Merge pull request #525 from lioncash/android-xml-cleanup
Separate the XML view handling of the folder browser and the game list from one another.
This commit is contained in:
commit
1439e45940
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:padding="3dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/BrowserItemIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
|
||||
tools:src="@drawable/ic_launcher"
|
||||
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginRight="6dip"/>
|
||||
|
||||
<!-- Properties in the 'tools' namespace are only visible in the UI editor, not at runtime. -->
|
||||
<TextView tools:text="@string/file_size"
|
||||
android:id="@+id/BrowserItemSubTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="26dip"
|
||||
|
||||
android:textColor="#bbbbbb"
|
||||
|
||||
android:layout_toRightOf="@id/BrowserItemIcon"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
/>
|
||||
|
||||
<!-- Properties in the 'tools' namespace are only visible in the UI editor, not at runtime. -->
|
||||
<TextView tools:text="Name of Game"
|
||||
android:id="@+id/BrowserItemTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:textSize="22sp"
|
||||
android:textColor="#555555"
|
||||
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
|
||||
android:layout_toRightOf="@id/BrowserItemIcon"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_above="@id/BrowserItemSubTitle"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,8 @@
|
|||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/gamelist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:choiceMode="singleChoice"
|
||||
android:dividerHeight="1dp"
|
||||
tools:listitem="@layout/folderbrowser_list_item"/>
|
|
@ -6,7 +6,7 @@
|
|||
android:padding="3dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ListItemIcon"
|
||||
android:id="@+id/GameListItemIcon"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
|
@ -18,13 +18,13 @@
|
|||
|
||||
<!-- Properties in the 'tools' namespace are only visible in the UI editor, not at runtime. -->
|
||||
<TextView tools:text="@string/file_size"
|
||||
android:id="@+id/ListItemSubTitle"
|
||||
android:id="@+id/GameListItemSubTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="26dip"
|
||||
|
||||
android:textColor="#bbbbbb"
|
||||
|
||||
android:layout_toRightOf="@id/ListItemIcon"
|
||||
android:layout_toRightOf="@id/GameListItemIcon"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
<!-- Properties in the 'tools' namespace are only visible in the UI editor, not at runtime. -->
|
||||
<TextView tools:text="Name of Game"
|
||||
android:id="@+id/ListItemTitle"
|
||||
android:id="@+id/GameListItemTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
|
@ -45,10 +45,10 @@
|
|||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
|
||||
android:layout_toRightOf="@id/ListItemIcon"
|
||||
android:layout_toRightOf="@id/GameListItemIcon"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_above="@id/ListItemSubTitle"
|
||||
android:layout_above="@id/GameListItemSubTitle"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
|
||||
android:gravity="center_vertical"
|
|
@ -5,4 +5,4 @@
|
|||
android:layout_height="match_parent"
|
||||
android:choiceMode="singleChoice"
|
||||
android:dividerHeight="1dp"
|
||||
tools:listitem="@layout/gamelist_folderbrowser_list_item"/>
|
||||
tools:listitem="@layout/gamelist_list_item"/>
|
|
@ -123,8 +123,8 @@ public final class FolderBrowser extends ListFragment
|
|||
if(currentDir == null)
|
||||
currentDir = new File(Environment.getExternalStorageDirectory().getPath());
|
||||
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
adapter = new FolderBrowserAdapter(getActivity(), R.layout.gamelist_folderbrowser_list_item);
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.folderbrowser_listview, container, false);
|
||||
adapter = new FolderBrowserAdapter(getActivity(), R.layout.folderbrowser_list_item);
|
||||
rootView.setAdapter(adapter);
|
||||
|
||||
Fill(currentDir);
|
||||
|
|
|
@ -63,9 +63,9 @@ public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>
|
|||
|
||||
// Initialize the ViewHolder and store it.
|
||||
viewHolder = new ViewHolder();
|
||||
viewHolder.title = (TextView) convertView.findViewById(R.id.ListItemTitle);
|
||||
viewHolder.subtitle = (TextView) convertView.findViewById(R.id.ListItemSubTitle);
|
||||
viewHolder.icon = (ImageView) convertView.findViewById(R.id.ListItemIcon);
|
||||
viewHolder.title = (TextView) convertView.findViewById(R.id.BrowserItemTitle);
|
||||
viewHolder.subtitle = (TextView) convertView.findViewById(R.id.BrowserItemSubTitle);
|
||||
viewHolder.icon = (ImageView) convertView.findViewById(R.id.BrowserItemIcon);
|
||||
convertView.setTag(viewHolder);
|
||||
}
|
||||
else // Can recover the holder.
|
||||
|
|
|
@ -52,9 +52,9 @@ public final class GameListAdapter extends ArrayAdapter<GameListItem>
|
|||
final GameListItem item = getItem(position);
|
||||
if (item != null)
|
||||
{
|
||||
TextView title = (TextView) convertView.findViewById(R.id.ListItemTitle);
|
||||
TextView subtitle = (TextView) convertView.findViewById(R.id.ListItemSubTitle);
|
||||
ImageView icon = (ImageView) convertView.findViewById(R.id.ListItemIcon);
|
||||
TextView title = (TextView) convertView.findViewById(R.id.GameListItemTitle);
|
||||
TextView subtitle = (TextView) convertView.findViewById(R.id.GameListItemSubTitle);
|
||||
ImageView icon = (ImageView) convertView.findViewById(R.id.GameListItemIcon);
|
||||
|
||||
if (title != null)
|
||||
title.setText(item.getName());
|
||||
|
|
|
@ -107,7 +107,7 @@ public final class GameListFragment extends ListFragment
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
mGameAdapter = new GameListAdapter(getActivity(), R.layout.gamelist_folderbrowser_list_item);
|
||||
mGameAdapter = new GameListAdapter(getActivity(), R.layout.gamelist_list_item);
|
||||
rootView.setAdapter(mGameAdapter);
|
||||
|
||||
Fill();
|
||||
|
|
Loading…
Reference in New Issue