Merge pull request #330 from lioncash/master

More simplifications and API 'correctness' for Android.
This commit is contained in:
Squarepusher 2013-10-10 04:18:25 -07:00
commit 8a2364181e
4 changed files with 13 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fastScrollEnabled="true" >

View File

@ -15,7 +15,7 @@ import android.view.*;
// JELLY_BEAN_MR1 = 17
public final class CoreSelection extends Activity implements AdapterView.OnItemClickListener {
public final class CoreSelection extends ListActivity {
private IconAdapter<ModuleWrapper> adapter;
private static final String TAG = "CoreSelection";
@ -37,9 +37,8 @@ public final class CoreSelection extends Activity implements AdapterView.OnItemC
// Setup the list
adapter = new IconAdapter<ModuleWrapper>(this, R.layout.line_list_item);
ListView list = (ListView) findViewById(R.id.list);
ListView list = getListView();
list.setAdapter(adapter);
list.setOnItemClickListener(this);
setTitle(R.string.select_libretro_core);
@ -49,7 +48,7 @@ public final class CoreSelection extends Activity implements AdapterView.OnItemC
for (final File lib : libs) {
String libName = lib.getName();
Log.i(TAG, "Libretro core: " + libName);
Log.i(TAG, "Libretro core: " + libName);
// Allow both libretro-core.so and libretro_core.so.
if (!libName.startsWith("libretroarch")) {
@ -65,7 +64,7 @@ public final class CoreSelection extends Activity implements AdapterView.OnItemC
}
@Override
public void onItemClick(AdapterView<?> listView, View view, int position, long id) {
public void onListItemClick(ListView listView, View view, int position, long id) {
final ModuleWrapper item = adapter.getItem(position);
MainMenuActivity.getInstance().setModule(item.file.getAbsolutePath(), item.getText());
UserPreferences.updateConfigFile(this);

View File

@ -9,16 +9,15 @@ import java.io.InputStreamReader;
import org.retroarch.R;
import org.retroarch.browser.preferences.UserPreferences;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
public final class HistorySelection extends Activity implements AdapterView.OnItemClickListener {
public final class HistorySelection extends ListActivity {
private IconAdapter<HistoryWrapper> adapter;
@ -30,9 +29,8 @@ public final class HistorySelection extends Activity implements AdapterView.OnIt
// Setup the list
adapter = new IconAdapter<HistoryWrapper>(this, R.layout.line_list_item);
ListView list = (ListView) findViewById(R.id.list);
ListView list = getListView();
list.setAdapter(adapter);
list.setOnItemClickListener(this);
setTitle(R.string.recently_played_games);
@ -57,7 +55,7 @@ public final class HistorySelection extends Activity implements AdapterView.OnIt
}
@Override
public void onItemClick(AdapterView<?> listView, View view, int position, long id) {
public void onListItemClick(ListView listView, View view, int position, long id) {
final HistoryWrapper item = adapter.getItem(position);
final String gamePath = item.getGamePath();
final String corePath = item.getCorePath();

View File

@ -16,7 +16,7 @@ import android.widget.*;
import android.view.*;
public class DirectoryActivity extends Activity implements AdapterView.OnItemClickListener {
public class DirectoryActivity extends ListActivity {
private IconAdapter<FileWrapper> adapter;
private File listedDirectory;
@ -80,9 +80,8 @@ public class DirectoryActivity extends Activity implements AdapterView.OnItemCli
// Setup the list
adapter = new IconAdapter<FileWrapper>(this, R.layout.line_list_item);
ListView list = (ListView) findViewById(R.id.list);
ListView list = getListView();
list.setAdapter(adapter);
list.setOnItemClickListener(this);
// Load Directory
if (savedInstanceState != null) {
@ -121,9 +120,8 @@ public class DirectoryActivity extends Activity implements AdapterView.OnItemCli
}
@Override
public void onItemClick(AdapterView<?> aListView, View aView,
int aPosition, long aID) {
final FileWrapper item = adapter.getItem(aPosition);
public void onListItemClick(ListView listView, View aView, int position, long id) {
final FileWrapper item = adapter.getItem(position);
if (item.parentItem && backStack.get(backStack.size() - 1).parentIsBack) {
backStack.remove(backStack.size() - 1);