Android: Add option to manually inject a path into the game list
This commit is contained in:
parent
8647423fe9
commit
2029702eda
|
@ -1,6 +1,8 @@
|
|||
package com.github.stenzek.duckstation;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
|
@ -209,6 +211,13 @@ public class GameDirectoriesActivity extends AppCompatActivity {
|
|||
findViewById(R.id.fab).setOnClickListener((v) -> startAddGameDirectory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_edit_game_directories, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
|
@ -216,6 +225,14 @@ public class GameDirectoriesActivity extends AppCompatActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (item.getItemId() == R.id.add_directory) {
|
||||
startAddGameDirectory();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.add_path) {
|
||||
startAddPath();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
@ -273,6 +290,25 @@ public class GameDirectoriesActivity extends AppCompatActivity {
|
|||
REQUEST_ADD_DIRECTORY_TO_GAME_LIST);
|
||||
}
|
||||
|
||||
private void startAddPath() {
|
||||
final EditText text = new EditText(this);
|
||||
text.setSingleLine();
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.edit_game_directories_add_path)
|
||||
.setMessage(R.string.edit_game_directories_add_path_summary)
|
||||
.setView(text)
|
||||
.setPositiveButton("Add", (dialog, which) -> {
|
||||
final String path = text.getText().toString();
|
||||
if (!path.isEmpty()) {
|
||||
addSearchDirectory(GameDirectoriesActivity.this, path, true);
|
||||
mDirectoryListAdapter.reload();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss())
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
|
|
@ -202,4 +202,8 @@
|
|||
<string name="game_directories_not_scanning_subdirectories">Not scanning subdirectories.</string>
|
||||
<string name="settings_display_all_frames">Optimal Frame Pacing</string>
|
||||
<string name="settings_summary_display_all_frames">Enable this option will ensure every frame the console renders is displayed to the screen, for optimal frame pacing. If you are having difficulties maintaining full speed, or are getting audio glitches, try disabling this option.</string>
|
||||
<string name="menu_edit_game_directories_add_directory">Add Directory</string>
|
||||
<string name="menu_edit_game_directories_add_path">Add Path</string>
|
||||
<string name="edit_game_directories_add_path">Add Path</string>
|
||||
<string name="edit_game_directories_add_path_summary">Enter the full path to the directory with games.\n\nYou can get this from a file manager app.\n\nExample: /storage/emulated/0/games</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue