mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-01 10:31:31 +02:00
[Android] Add an option to clear the game list.
This commit is contained in:
parent
c2aef25f4c
commit
1469342f83
@ -19,6 +19,8 @@
|
||||
<string name="file_size">ファイルサイズ: </string>
|
||||
|
||||
<!-- Game List Activity -->
|
||||
<string name="clear_game_list">クリア</string>
|
||||
<string name="clear_game_list_confirm">ゲームリストからすべての項目を削除しますか?</string>
|
||||
<string name="game_list">ゲームリスト</string>
|
||||
<string name="browse_folder">フォルダの参照</string>
|
||||
<string name="settings">設定</string>
|
||||
|
@ -19,6 +19,8 @@
|
||||
<string name="file_size">File Size: </string>
|
||||
|
||||
<!-- 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="browse_folder">Browse Folder</string>
|
||||
<string name="settings">Settings</string>
|
||||
|
@ -7,8 +7,10 @@
|
||||
package org.dolphinemu.dolphinemu.gamelist;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
@ -16,6 +18,7 @@ import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.view.*;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -248,6 +251,20 @@ public final class GameListActivity extends Activity
|
||||
{
|
||||
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
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
@ -259,6 +276,38 @@ public final class GameListActivity extends Activity
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,16 @@ public final class GameListFragment extends Fragment
|
||||
*/
|
||||
void onZeroFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the adapter for this fragment.
|
||||
*
|
||||
* @return the adapter for this fragment.
|
||||
*/
|
||||
public GameListAdapter getAdapter()
|
||||
{
|
||||
return mGameAdapter;
|
||||
}
|
||||
|
||||
private void Fill()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user