mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
[Android] Add an option to clear the game list.
This commit is contained in:
@ -19,6 +19,8 @@
|
|||||||
<string name="file_size">ファイルサイズ: </string>
|
<string name="file_size">ファイルサイズ: </string>
|
||||||
|
|
||||||
<!-- Game List Activity -->
|
<!-- Game List Activity -->
|
||||||
|
<string name="clear_game_list">クリア</string>
|
||||||
|
<string name="clear_game_list_confirm">ゲームリストからすべての項目を削除しますか?</string>
|
||||||
<string name="game_list">ゲームリスト</string>
|
<string name="game_list">ゲームリスト</string>
|
||||||
<string name="browse_folder">フォルダの参照</string>
|
<string name="browse_folder">フォルダの参照</string>
|
||||||
<string name="settings">設定</string>
|
<string name="settings">設定</string>
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
<string name="file_size">File Size: </string>
|
<string name="file_size">File Size: </string>
|
||||||
|
|
||||||
<!-- Game List Activity -->
|
<!-- Game List Activity -->
|
||||||
|
<string name="clear_game_list">Clear game list</string>
|
||||||
|
<string name="clear_game_list_confirm">Do you want to clear the game list?</string>
|
||||||
<string name="game_list">Game List</string>
|
<string name="game_list">Game List</string>
|
||||||
<string name="browse_folder">Browse Folder</string>
|
<string name="browse_folder">Browse Folder</string>
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
|
@ -7,8 +7,10 @@
|
|||||||
package org.dolphinemu.dolphinemu.gamelist;
|
package org.dolphinemu.dolphinemu.gamelist;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -16,6 +18,7 @@ import android.support.v4.app.ActionBarDrawerToggle;
|
|||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -249,6 +252,20 @@ public final class GameListActivity extends Activity
|
|||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
// Only show this in the game list.
|
||||||
|
if (this.mCurFragmentNum == 0)
|
||||||
|
{
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.gamelist_menu, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item)
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
{
|
{
|
||||||
@ -259,6 +276,38 @@ public final class GameListActivity extends Activity
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If clear game list is pressed.
|
||||||
|
if (item.getItemId() == R.id.clearGameList)
|
||||||
|
{
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(R.string.clear_game_list);
|
||||||
|
builder.setMessage(getString(R.string.clear_game_list_confirm));
|
||||||
|
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener(){
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
String directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0");
|
||||||
|
int intDirs = Integer.parseInt(directories);
|
||||||
|
|
||||||
|
for (int i = 0; i < intDirs; i++)
|
||||||
|
{
|
||||||
|
NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPath" + i, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayAdapter<GameListItem> adapter = ((GameListFragment)GameListActivity.this.mCurFragment).getAdapter();
|
||||||
|
adapter.clear();
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which)
|
||||||
|
{
|
||||||
|
// Do nothing. This just make "No" appear.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,16 @@ public final class GameListFragment extends Fragment
|
|||||||
void onZeroFiles();
|
void onZeroFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the adapter for this fragment.
|
||||||
|
*
|
||||||
|
* @return the adapter for this fragment.
|
||||||
|
*/
|
||||||
|
public GameListAdapter getAdapter()
|
||||||
|
{
|
||||||
|
return mGameAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
private void Fill()
|
private void Fill()
|
||||||
{
|
{
|
||||||
List<GameListItem> fls = new ArrayList<GameListItem>();
|
List<GameListItem> fls = new ArrayList<GameListItem>();
|
||||||
|
Reference in New Issue
Block a user