Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Android] Make the file browser look much more nice and user friendly…
… to use. This is what it now looks like: http://i.imgur.com/KOZgA1i.png As usual, if any bugs arise from this rather large change. Please report it so I can fix it.
- Loading branch information
Showing
16 changed files
with
346 additions
and
97 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="fill_parent" | ||
| android:layout_height="fill_parent" | ||
| android:orientation="vertical" > | ||
| <LinearLayout | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="match_parent" | ||
| android:orientation="vertical" > | ||
|
|
||
| <TextView | ||
| android:id="@+id/FolderTitle" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginLeft="5dip" | ||
| android:layout_marginTop="5dip" | ||
| android:singleLine="true" | ||
| android:text="Title" | ||
| android:textStyle="bold" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/FolderSubTitle" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginLeft="10dip" | ||
| android:text="Subtitle" /> | ||
|
|
||
| </LinearLayout> | ||
| </LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,43 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="fill_parent" | ||
| android:layout_height="fill_parent" | ||
| android:orientation="vertical" > | ||
| <LinearLayout | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="match_parent" | ||
| android:orientation="vertical" > | ||
| android:layout_height="?android:attr/listPreferredItemHeight" | ||
| android:padding="3dip"> | ||
|
|
||
| <ImageView | ||
| android:id="@+id/ImageIcon" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="fill_parent" | ||
|
|
||
| android:layout_alignParentTop="true" | ||
| android:layout_alignParentBottom="true" | ||
| android:layout_marginRight="6dip"/> | ||
|
|
||
| <TextView | ||
| android:id="@+id/FolderTitle" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginLeft="5dip" | ||
| android:layout_marginTop="5dip" | ||
| android:singleLine="true" | ||
| android:text="Title" | ||
| android:textStyle="bold" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/FolderSubTitle" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginLeft="10dip" | ||
| android:text="Subtitle" /> | ||
|
|
||
| </LinearLayout> | ||
| </LinearLayout> | ||
| <TextView | ||
| android:id="@+id/FolderSubTitle" | ||
| android:layout_width="fill_parent" | ||
| android:layout_height="26dip" | ||
|
|
||
| android:layout_toRightOf="@id/ImageIcon" | ||
| android:layout_alignParentBottom="true" | ||
| android:layout_alignParentRight="true" | ||
|
|
||
| android:singleLine="true" | ||
| android:ellipsize="marquee" | ||
| android:text="Subtitle" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/FolderTitle" | ||
| android:layout_width="fill_parent" | ||
| android:layout_height="wrap_content" | ||
|
|
||
| android:layout_toRightOf="@id/ImageIcon" | ||
| android:layout_alignParentRight="true" | ||
| android:layout_alignParentTop="true" | ||
| android:layout_above="@id/FolderSubTitle" | ||
| android:layout_alignWithParentIfMissing="true" | ||
|
|
||
| android:gravity="center_vertical" | ||
| android:text="Title" /> | ||
|
|
||
| </RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 44 additions & 23 deletions
67
Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,58 +1,79 @@ | ||
| package org.dolphinemu.dolphinemu; | ||
|
|
||
| import android.content.Context; | ||
| import android.util.Log; | ||
| import android.view.LayoutInflater; | ||
| import android.view.View; | ||
| import android.view.ViewGroup; | ||
| import android.widget.ArrayAdapter; | ||
| import android.widget.ImageView; | ||
| import android.widget.TextView; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class FolderBrowserAdapter extends ArrayAdapter<GameListItem>{ | ||
| public class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>{ | ||
|
|
||
| private Context c; | ||
| private int id; | ||
| private List<GameListItem>items; | ||
| private List<FolderBrowserItem> items; | ||
|
|
||
| public FolderBrowserAdapter(Context context, int textViewResourceId, | ||
| List<GameListItem> objects) { | ||
| public FolderBrowserAdapter(Context context, int textViewResourceId, List<FolderBrowserItem> objects) { | ||
| super(context, textViewResourceId, objects); | ||
| c = context; | ||
| id = textViewResourceId; | ||
| items = objects; | ||
| } | ||
|
|
||
| public GameListItem getItem(int i) | ||
| public FolderBrowserItem getItem(int i) | ||
| { | ||
| return items.get(i); | ||
| } | ||
|
|
||
| @Override | ||
| public View getView(int position, View convertView, ViewGroup parent) { | ||
| public View getView(int position, View convertView, ViewGroup parent) | ||
| { | ||
| View v = convertView; | ||
| if (v == null) { | ||
| LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||
| v = vi.inflate(id, null); | ||
| if (v == null) | ||
| { | ||
| LayoutInflater vi = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||
| v = vi.inflate(id, parent, false); | ||
| } | ||
| final GameListItem o = items.get(position); | ||
| if (o != null) { | ||
| TextView t1 = (TextView) v.findViewById(R.id.FolderTitle); | ||
| TextView t2 = (TextView) v.findViewById(R.id.FolderSubTitle); | ||
|
|
||
| final FolderBrowserItem item = items.get(position); | ||
| if (item != null) | ||
| { | ||
| ImageView iconView = (ImageView) v.findViewById(R.id.ImageIcon); | ||
| TextView mainText = (TextView) v.findViewById(R.id.FolderTitle); | ||
| TextView subtitleText = (TextView) v.findViewById(R.id.FolderSubTitle); | ||
|
|
||
| if(t1!=null) | ||
| if(mainText != null) | ||
| { | ||
| mainText.setText(item.getName()); | ||
|
|
||
| if (!item.isValidItem()) | ||
| { | ||
| mainText.setTextColor(0xFFFF0000); | ||
| } | ||
| } | ||
|
|
||
| if(subtitleText != null) | ||
| { | ||
| subtitleText.setText(item.getSubtitle()); | ||
| } | ||
|
|
||
| if (iconView != null) | ||
| { | ||
| t1.setText(o.getName()); | ||
| if (!o.isValid()) | ||
| t1.setTextColor(0xFFFF0000); | ||
| if (item.isDirectory()) | ||
| { | ||
| iconView.setImageResource(R.drawable.ic_menu_folder); | ||
| } | ||
| else | ||
| { | ||
| iconView.setImageResource(R.drawable.ic_menu_file); | ||
| } | ||
| } | ||
| if(t2!=null) | ||
| t2.setText(o.getData()); | ||
|
|
||
| } | ||
| return v; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
Oops, something went wrong.