summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2013-10-01 21:43:27 -0400
committerLioncash <mathew1800@gmail.com>2013-10-01 21:43:27 -0400
commitcd6a863eec108ecc011be472109e62c9b9a77860 (patch)
tree315c8f3d69bc77b39db1359633501d723b024b1d /Source/Android
parent16fb0b04d8261628be8004fa74e2b268e19c67e0 (diff)
[Android] Make the GameListFragment extend a ListFragment instead of a Fragment. This allows us to simplify behavior a little by eliminating the need for an AdapterView. Now we just override "onListClick" and achieve the same result.
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java30
1 files changed, 12 insertions, 18 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
index e499ef593e..4be6c180bc 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
@@ -7,13 +7,12 @@
package org.dolphinemu.dolphinemu.gamelist;
import android.app.Activity;
-import android.app.Fragment;
+import android.app.ListFragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
@@ -31,9 +30,9 @@ import org.dolphinemu.dolphinemu.emulation.EmulationActivity;
/**
- * The {@link Fragment} responsible for displaying the game list.
+ * The {@link ListFragment} responsible for displaying the game list.
*/
-public final class GameListFragment extends Fragment
+public final class GameListFragment extends ListFragment
{
private ListView mMainList;
private GameListAdapter mGameAdapter;
@@ -60,7 +59,7 @@ public final class GameListFragment extends Fragment
*/
public GameListAdapter getAdapter()
{
- return mGameAdapter;
+ return mGameAdapter;
}
private void Fill()
@@ -110,28 +109,23 @@ public final class GameListFragment extends Fragment
{
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
mMainList = (ListView) rootView.findViewById(R.id.gamelist);
- mMainList.setOnItemClickListener(mGameItemClickListener);
Fill();
return mMainList;
}
-
- private final AdapterView.OnItemClickListener mGameItemClickListener = new AdapterView.OnItemClickListener()
+
+ @Override
+ public void onListItemClick(ListView listView, View view, int position, long id)
{
- public void onItemClick(AdapterView<?> parent, View view, int position, long id)
- {
- GameListItem item = mGameAdapter.getItem(position);
- onFileClick(item.getPath());
- }
- };
+ GameListItem item = mGameAdapter.getItem(position);
- private void onFileClick(String o)
- {
- Toast.makeText(mMe, String.format(getString(R.string.file_clicked), o), Toast.LENGTH_SHORT).show();
+ // Show a toast indicating which game was clicked.
+ Toast.makeText(mMe, String.format(getString(R.string.file_clicked), item.getPath()), Toast.LENGTH_SHORT).show();
+ // Start the emulation activity and send the path of the clicked ROM to it.
Intent intent = new Intent(mMe, EmulationActivity.class);
- intent.putExtra("SelectedGame", o);
+ intent.putExtra("SelectedGame", item.getPath());
mMe.startActivity(intent);
}