Merge pull request #1374 from reicast/ac/android
Android: Complete conversion to API 26 standards
This commit is contained in:
commit
93affdd747
|
@ -92,7 +92,7 @@ public class FileBrowser extends Fragment {
|
|||
}
|
||||
|
||||
public static HashSet<String> getExternalMounts() {
|
||||
final HashSet<String> out = new HashSet<String>();
|
||||
final HashSet<String> out = new HashSet<>();
|
||||
String reg = "(?i).*vold.*(vfat|ntfs|exfat|fat32|ext3|ext4|fuse|sdfat).*rw.*";
|
||||
StringBuilder s = new StringBuilder();
|
||||
try {
|
||||
|
@ -133,7 +133,7 @@ public class FileBrowser extends Fragment {
|
|||
void onFolderSelected(Uri uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("deprecation")
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
|
@ -176,9 +176,9 @@ public class FileBrowser extends Fragment {
|
|||
}
|
||||
installButtons();
|
||||
if (!games) {
|
||||
new LocateGames(R.array.flash).execute(home_directory);
|
||||
new LocateGames(this, R.array.flash).execute(home_directory);
|
||||
} else {
|
||||
new LocateGames(R.array.images).execute(game_directory);
|
||||
new LocateGames(this, R.array.images).execute(game_directory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,11 +216,13 @@ public class FileBrowser extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private final class LocateGames extends AsyncTask<String, Integer, List<File>> {
|
||||
|
||||
private static final class LocateGames extends AsyncTask<String, Integer, List<File>> {
|
||||
|
||||
private WeakReference<FileBrowser> browser;
|
||||
private int array;
|
||||
|
||||
public LocateGames(int arrayType) {
|
||||
LocateGames(FileBrowser context, int arrayType) {
|
||||
browser = new WeakReference<>(context);
|
||||
this.array = arrayType;
|
||||
}
|
||||
|
||||
|
@ -229,7 +231,7 @@ public class FileBrowser extends Fragment {
|
|||
File storage = new File(paths[0]);
|
||||
|
||||
// array of valid image file extensions
|
||||
String[] mediaTypes = getActivity().getResources().getStringArray(array);
|
||||
String[] mediaTypes = browser.get().getActivity().getResources().getStringArray(array);
|
||||
FilenameFilter[] filter = new FilenameFilter[mediaTypes.length];
|
||||
|
||||
int i = 0;
|
||||
|
@ -237,18 +239,14 @@ public class FileBrowser extends Fragment {
|
|||
filter[i] = new FilenameFilter() {
|
||||
|
||||
public boolean accept(File dir, String name) {
|
||||
if (dir.getName().equals("obb") || dir.getName().equals("cache")
|
||||
|| dir.getName().startsWith(".") || name.startsWith(".")) {
|
||||
return false;
|
||||
} else if (array == R.array.flash && !name.startsWith("dc_")) {
|
||||
return false;
|
||||
} else if (searchQuery == null || name.toLowerCase(Locale.getDefault())
|
||||
.contains(searchQuery.toLowerCase(Locale.getDefault())))
|
||||
return StringUtils.endsWithIgnoreCase(name, "." + type);
|
||||
else
|
||||
return false;
|
||||
return (!dir.getName().equals("obb") && !dir.getName().equals("cache")
|
||||
&& !dir.getName().startsWith(".") && !name.startsWith("."))
|
||||
&& (array != R.array.flash && name.startsWith("dc_"))
|
||||
&& (browser.get().searchQuery == null
|
||||
|| name.toLowerCase(Locale.getDefault()).contains(
|
||||
browser.get().searchQuery.toLowerCase(Locale.getDefault())))
|
||||
&& StringUtils.endsWithIgnoreCase(name, "." + type);
|
||||
}
|
||||
|
||||
};
|
||||
i++;
|
||||
}
|
||||
|
@ -265,19 +263,19 @@ public class FileBrowser extends Fragment {
|
|||
@Override
|
||||
protected void onPostExecute(List<File> items) {
|
||||
if (items != null && !items.isEmpty()) {
|
||||
LinearLayout list = (LinearLayout) getActivity().findViewById(R.id.game_list);
|
||||
LinearLayout list = (LinearLayout) browser.get().getActivity().findViewById(R.id.game_list);
|
||||
if (list.getChildCount() > 0) {
|
||||
list.removeAllViews();
|
||||
}
|
||||
|
||||
String heading = getActivity().getString(R.string.games_listing);
|
||||
createListHeader(heading, list, array == R.array.images);
|
||||
String heading = browser.get().getActivity().getString(R.string.games_listing);
|
||||
browser.get().createListHeader(heading, list, array == R.array.images);
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
createListItem(list, items.get(i), i, array == R.array.images);
|
||||
browser.get().createListItem(list, items.get(i), i, array == R.array.images);
|
||||
}
|
||||
list.invalidate();
|
||||
} else {
|
||||
browseStorage(array == R.array.images);
|
||||
browser.get().browseStorage(array == R.array.images);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -290,15 +288,15 @@ public class FileBrowser extends Fragment {
|
|||
if (game_directory.equals(sdcard.getAbsolutePath())) {
|
||||
HashSet<String> extStorage = FileBrowser.getExternalMounts();
|
||||
if (extStorage != null && !extStorage.isEmpty()) {
|
||||
for (Iterator<String> sd = extStorage.iterator(); sd.hasNext();) {
|
||||
String sdCardPath = sd.next().replace("mnt/media_rw", "storage");
|
||||
if (!sdCardPath.equals(sdcard.getAbsolutePath())) {
|
||||
if (new File(sdCardPath).canRead()) {
|
||||
(new navigate(this)).execute(new File(sdCardPath));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String sd : extStorage) {
|
||||
String sdCardPath = sd.replace("mnt/media_rw", "storage");
|
||||
if (!sdCardPath.equals(sdcard.getAbsolutePath())) {
|
||||
if (new File(sdCardPath).canRead()) {
|
||||
(new navigate(this)).execute(new File(sdCardPath));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(new navigate(this)).executeOnExecutor(
|
||||
|
@ -320,9 +318,8 @@ public class FileBrowser extends Fragment {
|
|||
childview.findViewById(R.id.childview).setOnClickListener(
|
||||
new OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
File f = (File) view.getTag();
|
||||
vib.vibrate(50);
|
||||
mCallback.onGameSelected(f != null ? Uri.fromFile(f) : Uri.EMPTY);
|
||||
mCallback.onGameSelected(Uri.EMPTY);
|
||||
vib.vibrate(250);
|
||||
}
|
||||
});
|
||||
|
@ -377,7 +374,7 @@ public class FileBrowser extends Fragment {
|
|||
home_directory = game.getAbsolutePath().substring(0,
|
||||
game.getAbsolutePath().lastIndexOf(File.separator))
|
||||
.replace("/data", "");
|
||||
if (!DataDirectoryBIOS()) {
|
||||
if (requireDataBIOS()) {
|
||||
showToastMessage(getActivity().getString(R.string.config_data,
|
||||
home_directory), Snackbar.LENGTH_LONG);
|
||||
}
|
||||
|
@ -438,7 +435,7 @@ public class FileBrowser extends Fragment {
|
|||
protected List<File> doInBackground(File... paths) {
|
||||
heading = paths[0].getAbsolutePath();
|
||||
|
||||
ArrayList<File> list = new ArrayList<File>();
|
||||
ArrayList<File> list = new ArrayList<>();
|
||||
|
||||
File flist[] = paths[0].listFiles();
|
||||
parent = paths[0].getParentFile();
|
||||
|
@ -477,7 +474,7 @@ public class FileBrowser extends Fragment {
|
|||
|
||||
((ImageView) childview.findViewById(R.id.item_icon)).setImageResource(file == null
|
||||
? R.drawable.ic_settings: file.isDirectory()
|
||||
? R.drawable.ic_folder_black_24dp : R.drawable.disk_unknown);;
|
||||
? R.drawable.ic_folder_black_24dp : R.drawable.disk_unknown);
|
||||
|
||||
childview.setTag(file);
|
||||
|
||||
|
@ -509,7 +506,7 @@ public class FileBrowser extends Fragment {
|
|||
.replace("/data", "");
|
||||
browser.get().mPrefs.edit().putString(
|
||||
Config.pref_home, browser.get().home_directory).apply();
|
||||
if (!browser.get().DataDirectoryBIOS()) {
|
||||
if (browser.get().requireDataBIOS()) {
|
||||
browser.get().showToastMessage(browser.get()
|
||||
.getActivity().getString(R.string.config_data,
|
||||
browser.get().home_directory),
|
||||
|
@ -545,23 +542,24 @@ public class FileBrowser extends Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean DataDirectoryBIOS() {
|
||||
File data_directory = new File(home_directory, "data");
|
||||
if (!data_directory.exists() || !data_directory.isDirectory()) {
|
||||
data_directory.mkdirs();
|
||||
File bios = new File(home_directory, "dc_boot.bin");
|
||||
if (bios.renameTo(new File(home_directory, "data/dc_boot.bin"))) {
|
||||
File flash = new File(home_directory, "dc_flash.bin");
|
||||
return flash.renameTo(new File(home_directory, "data/dc_flash.bin"));
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
File bios = new File(home_directory, "data/dc_boot.bin");
|
||||
File flash = new File(home_directory, "data/dc_flash.bin");
|
||||
return (bios.exists() && flash.exists());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean requireDataBIOS() {
|
||||
File data_directory = new File(home_directory, "data");
|
||||
if (data_directory.exists() && data_directory.isDirectory()) {
|
||||
File bios = new File(home_directory, "data/dc_boot.bin");
|
||||
File flash = new File(home_directory, "data/dc_flash.bin");
|
||||
return !(bios.exists() && flash.exists());
|
||||
} else {
|
||||
if (data_directory.mkdirs()) {
|
||||
File bios = new File(home_directory, "dc_boot.bin");
|
||||
if (bios.renameTo(new File(home_directory, "data/dc_boot.bin"))) {
|
||||
return !new File(home_directory, "dc_flash.bin").renameTo(
|
||||
new File(home_directory, "data/dc_flash.bin"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void showToastMessage(String message, int duration) {
|
||||
ConstraintLayout layout = (ConstraintLayout) getActivity().findViewById(R.id.mainui_layout);
|
||||
|
|
|
@ -49,7 +49,6 @@ public class InputFragment extends Fragment {
|
|||
private AlertDialog alertDialogSelectController;
|
||||
private SharedPreferences mPrefs;
|
||||
private CompoundButton switchTouchVibrationEnabled;
|
||||
private CompoundButton micPluggedIntoController;
|
||||
|
||||
Vibrator vib;
|
||||
|
||||
|
@ -58,7 +57,7 @@ public class InputFragment extends Fragment {
|
|||
void onEditorSelected(Uri uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("deprecation")
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
|
@ -100,21 +99,24 @@ public class InputFragment extends Fragment {
|
|||
Config.vibrationDuration = mPrefs.getInt(Config.pref_vibrationDuration, 20);
|
||||
vib = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
|
||||
ImageView icon_a = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_a);
|
||||
icon_a.setAlpha(0.8f);
|
||||
ImageView icon_b = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_b);
|
||||
icon_b.setAlpha(0.8f);
|
||||
ImageView icon_c = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_c);
|
||||
icon_c.setAlpha(0.8f);
|
||||
ImageView icon_d = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_d);
|
||||
icon_d.setAlpha(0.8f);
|
||||
try {
|
||||
ImageView icon_a = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_a);
|
||||
icon_a.setAlpha(0.8f);
|
||||
ImageView icon_b = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_b);
|
||||
icon_b.setAlpha(0.8f);
|
||||
ImageView icon_c = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_c);
|
||||
icon_c.setAlpha(0.8f);
|
||||
ImageView icon_d = (ImageView) getView().findViewById(
|
||||
R.id.controller_icon_d);
|
||||
icon_d.setAlpha(0.8f);
|
||||
} catch (NullPointerException ex) {
|
||||
// Couldn't find images, so leave them opaque
|
||||
}
|
||||
|
||||
Button buttonLaunchEditor = (Button) getView().findViewById(
|
||||
R.id.buttonLaunchEditor);
|
||||
Button buttonLaunchEditor = (Button) getView().findViewById(R.id.buttonLaunchEditor);
|
||||
buttonLaunchEditor.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mCallback.onEditorSelected(Uri.EMPTY);
|
||||
|
@ -142,7 +144,7 @@ public class InputFragment extends Fragment {
|
|||
}
|
||||
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
|
@ -170,7 +172,7 @@ public class InputFragment extends Fragment {
|
|||
}
|
||||
switchTouchVibrationEnabled.setOnCheckedChangeListener(touch_vibration);
|
||||
|
||||
micPluggedIntoController = (CompoundButton) getView().findViewById(R.id.micEnabled);
|
||||
CompoundButton micPluggedIntoController = (CompoundButton) getView().findViewById(R.id.micEnabled);
|
||||
boolean micPluggedIn = mPrefs.getBoolean(Gamepad.pref_mic, false);
|
||||
micPluggedIntoController.setChecked(micPluggedIn);
|
||||
if (getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE)) {
|
||||
|
@ -323,9 +325,8 @@ public class InputFragment extends Fragment {
|
|||
buttonRemoveControllerPlayer1.setEnabled(true);
|
||||
} else {
|
||||
if (deviceDescriptorPlayer1 != null) {
|
||||
textViewDeviceDescriptorPlayer1
|
||||
.setText(getString(R.string.controller_not_connected)
|
||||
+ " (" + deviceDescriptorPlayer1 + ")");
|
||||
textViewDeviceDescriptorPlayer1.setText(getString(R.string.controller_not_connected,
|
||||
"(" + deviceDescriptorPlayer1 + ")"));
|
||||
buttonRemoveControllerPlayer1.setEnabled(true);
|
||||
} else {
|
||||
textViewDeviceDescriptorPlayer1
|
||||
|
@ -343,9 +344,8 @@ public class InputFragment extends Fragment {
|
|||
buttonRemoveControllerPlayer2.setEnabled(true);
|
||||
} else {
|
||||
if (deviceDescriptorPlayer2 != null) {
|
||||
textViewDeviceDescriptorPlayer2
|
||||
.setText(getString(R.string.controller_not_connected)
|
||||
+ " (" + deviceDescriptorPlayer2 + ")");
|
||||
textViewDeviceDescriptorPlayer2.setText(getString(R.string.controller_not_connected,
|
||||
"(" + deviceDescriptorPlayer2 + ")"));
|
||||
buttonRemoveControllerPlayer2.setEnabled(true);
|
||||
} else {
|
||||
textViewDeviceDescriptorPlayer2
|
||||
|
@ -357,7 +357,7 @@ public class InputFragment extends Fragment {
|
|||
String[] periphs = getResources().getStringArray(R.array.peripherals);
|
||||
|
||||
Spinner p2periph1spnr = (Spinner) getView().findViewById(R.id.spnr_player2_periph1);
|
||||
ArrayAdapter<String> p2periph1Adapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> p2periph1Adapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, periphs);
|
||||
p2periph1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
p2periph1spnr.setAdapter(p2periph1Adapter);
|
||||
|
@ -377,7 +377,7 @@ public class InputFragment extends Fragment {
|
|||
});
|
||||
|
||||
Spinner p2periph2spnr = (Spinner) getView().findViewById(R.id.spnr_player2_periph2);
|
||||
ArrayAdapter<String> p2periph2Adapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> p2periph2Adapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, periphs);
|
||||
p2periph2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
p2periph2spnr.setAdapter(p2periph2Adapter);
|
||||
|
@ -405,9 +405,8 @@ public class InputFragment extends Fragment {
|
|||
buttonRemoveControllerPlayer3.setEnabled(true);
|
||||
} else {
|
||||
if (deviceDescriptorPlayer3 != null) {
|
||||
textViewDeviceDescriptorPlayer3
|
||||
.setText(getString(R.string.controller_not_connected)
|
||||
+ " (" + deviceDescriptorPlayer3 + ")");
|
||||
textViewDeviceDescriptorPlayer3.setText(getString(R.string.controller_not_connected,
|
||||
"(" + deviceDescriptorPlayer3 + ")"));
|
||||
buttonRemoveControllerPlayer3.setEnabled(true);
|
||||
} else {
|
||||
textViewDeviceDescriptorPlayer3
|
||||
|
@ -417,7 +416,7 @@ public class InputFragment extends Fragment {
|
|||
}
|
||||
|
||||
Spinner p3periph1spnr = (Spinner) getView().findViewById(R.id.spnr_player3_periph1);
|
||||
ArrayAdapter<String> p3periph1Adapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> p3periph1Adapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, periphs);
|
||||
p3periph1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
p3periph1spnr.setAdapter(p3periph1Adapter);
|
||||
|
@ -437,7 +436,7 @@ public class InputFragment extends Fragment {
|
|||
});
|
||||
|
||||
Spinner p3periph2spnr = (Spinner) getView().findViewById(R.id.spnr_player3_periph2);
|
||||
ArrayAdapter<String> p3periph2Adapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> p3periph2Adapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, periphs);
|
||||
p3periph2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
p3periph2spnr.setAdapter(p3periph2Adapter);
|
||||
|
@ -465,9 +464,8 @@ public class InputFragment extends Fragment {
|
|||
buttonRemoveControllerPlayer4.setEnabled(true);
|
||||
} else {
|
||||
if (deviceDescriptorPlayer4 != null) {
|
||||
textViewDeviceDescriptorPlayer4
|
||||
.setText(getString(R.string.controller_not_connected)
|
||||
+ " (" + deviceDescriptorPlayer4 + ")");
|
||||
textViewDeviceDescriptorPlayer4.setText(getString(R.string.controller_not_connected,
|
||||
"(" + deviceDescriptorPlayer4 + ")"));
|
||||
buttonRemoveControllerPlayer4.setEnabled(true);
|
||||
} else {
|
||||
textViewDeviceDescriptorPlayer4
|
||||
|
@ -477,7 +475,7 @@ public class InputFragment extends Fragment {
|
|||
}
|
||||
|
||||
Spinner p4periph1spnr = (Spinner) getView().findViewById(R.id.spnr_player4_periph1);
|
||||
ArrayAdapter<String> p4periph1Adapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> p4periph1Adapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, periphs);
|
||||
p4periph1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
p4periph1spnr.setAdapter(p4periph1Adapter);
|
||||
|
@ -497,7 +495,7 @@ public class InputFragment extends Fragment {
|
|||
});
|
||||
|
||||
Spinner p4periph2spnr = (Spinner) getView().findViewById(R.id.spnr_player4_periph2);
|
||||
ArrayAdapter<String> p4periph2Adapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> p4periph2Adapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, periphs);
|
||||
p4periph2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
p4periph2spnr.setAdapter(p4periph2Adapter);
|
||||
|
|
|
@ -106,7 +106,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
String[] rstick = getResources().getStringArray(R.array.right_stick);
|
||||
right_stick_spinner = (Spinner) getView().findViewById(R.id.rstick_spinner);
|
||||
ArrayAdapter<String> rstickAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> rstickAdapter = new ArrayAdapter<>(
|
||||
getActivity(), android.R.layout.simple_spinner_item, rstick);
|
||||
rstickAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
right_stick_spinner.setAdapter(rstickAdapter);
|
||||
|
@ -385,7 +385,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
Spinner player_spnr = (Spinner) getView().findViewById(
|
||||
R.id.player_spinner);
|
||||
ArrayAdapter<String> playerAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> playerAdapter = new ArrayAdapter<>(
|
||||
getActivity(), android.R.layout.simple_spinner_item,
|
||||
controllers);
|
||||
playerAdapter
|
||||
|
@ -426,7 +426,7 @@ public class InputModFragment extends Fragment {
|
|||
Bitmap image = null;
|
||||
try {
|
||||
File buttons = null;
|
||||
InputStream bitmap = null;
|
||||
InputStream bitmap;
|
||||
String theme = mPrefs.getString(Config.pref_theme, null);
|
||||
if (theme != null) {
|
||||
buttons = new File(theme);
|
||||
|
@ -440,7 +440,6 @@ public class InputModFragment extends Fragment {
|
|||
options.inSampleSize = sS;
|
||||
image = BitmapFactory.decodeStream(bitmap, null, options);
|
||||
bitmap.close();
|
||||
bitmap = null;
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(32, 32);
|
||||
Bitmap resizedBitmap = Bitmap.createBitmap(image, x, y, 64 / sS,
|
||||
|
@ -456,7 +455,6 @@ public class InputModFragment extends Fragment {
|
|||
if (sS == 2) {
|
||||
if (image != null) {
|
||||
image.recycle();
|
||||
image = null;
|
||||
}
|
||||
sS = 4;
|
||||
return getButtonImage(x, y);
|
||||
|
@ -494,7 +492,7 @@ public class InputModFragment extends Fragment {
|
|||
|
||||
private class mapKeyCode extends AlertDialog.Builder {
|
||||
|
||||
public mapKeyCode(Context c) {
|
||||
mapKeyCode(Context c) {
|
||||
super(c);
|
||||
}
|
||||
|
||||
|
@ -535,18 +533,15 @@ public class InputModFragment extends Fragment {
|
|||
* @param button
|
||||
* The label of the button being assigned
|
||||
*/
|
||||
private int mapButton(int keyCode, String button) {
|
||||
private void mapButton(int keyCode, String button) {
|
||||
if (Build.MODEL.startsWith("R800")) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU)
|
||||
return -1;
|
||||
return;
|
||||
} else {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
mPrefs.edit().putInt(button + player, keyCode).apply();
|
||||
|
||||
return keyCode;
|
||||
}
|
||||
|
||||
private void mapAxis(final String button, final TextView output) {
|
||||
|
@ -638,7 +633,8 @@ public class InputModFragment extends Fragment {
|
|||
if (label.contains(":")) {
|
||||
label = label.substring(0, label.indexOf(":"));
|
||||
}
|
||||
output.setText(label + ": " + keyCode);
|
||||
label += ": " + keyCode;
|
||||
output.setText(label);
|
||||
return true;
|
||||
} else {
|
||||
String label = output.getText().toString();
|
||||
|
|
|
@ -74,7 +74,7 @@ public class OptionsFragment extends Fragment {
|
|||
void launchBIOSdetection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @SuppressWarnings("deprecation")
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
|
@ -117,8 +117,8 @@ public class OptionsFragment extends Fragment {
|
|||
// Specialized handler for devices with an extSdCard mount for external
|
||||
HashSet<String> extStorage = FileBrowser.getExternalMounts();
|
||||
if (extStorage != null && !extStorage.isEmpty()) {
|
||||
for (Iterator<String> sd = extStorage.iterator(); sd.hasNext();) {
|
||||
String sdCardPath = sd.next().replace("mnt/media_rw", "storage");
|
||||
for (String sd : extStorage) {
|
||||
String sdCardPath = sd.replace("mnt/media_rw", "storage");
|
||||
if (!sdCardPath.equals(sdcard.getAbsolutePath())) {
|
||||
game_directory = sdCardPath;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public class OptionsFragment extends Fragment {
|
|||
String[] bios = getResources().getStringArray(R.array.bios);
|
||||
codes = getResources().getStringArray(R.array.bioscode);
|
||||
Spinner bios_spnr = (Spinner) getView().findViewById(R.id.bios_spinner);
|
||||
ArrayAdapter<String> biosAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> biosAdapter = new ArrayAdapter<>(
|
||||
getActivity(), android.R.layout.simple_spinner_item, bios);
|
||||
biosAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
bios_spnr.setAdapter(biosAdapter);
|
||||
|
@ -292,7 +292,7 @@ public class OptionsFragment extends Fragment {
|
|||
|
||||
String[] cables = getResources().getStringArray(R.array.cable);
|
||||
Spinner cable_spnr = (Spinner) getView().findViewById(R.id.cable_spinner);
|
||||
ArrayAdapter<String> cableAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> cableAdapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, cables);
|
||||
cableAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
cable_spnr.setAdapter(cableAdapter);
|
||||
|
@ -315,7 +315,7 @@ public class OptionsFragment extends Fragment {
|
|||
|
||||
String[] regions = getResources().getStringArray(R.array.region);
|
||||
Spinner region_spnr = (Spinner) getView().findViewById(R.id.region_spinner);
|
||||
ArrayAdapter<String> regionAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> regionAdapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, regions);
|
||||
regionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
region_spnr.setAdapter(regionAdapter);
|
||||
|
@ -333,7 +333,7 @@ public class OptionsFragment extends Fragment {
|
|||
|
||||
String[] broadcasts = getResources().getStringArray(R.array.broadcast);
|
||||
Spinner broadcast_spnr = (Spinner) getView().findViewById(R.id.broadcast_spinner);
|
||||
ArrayAdapter<String> broadcastAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> broadcastAdapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, broadcasts);
|
||||
broadcastAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
broadcast_spnr.setAdapter(broadcastAdapter);
|
||||
|
@ -526,7 +526,7 @@ public class OptionsFragment extends Fragment {
|
|||
String[] depths = getResources().getStringArray(R.array.depth);
|
||||
|
||||
Spinner depth_spnr = (Spinner) getView().findViewById(R.id.depth_spinner);
|
||||
ArrayAdapter<String> depthAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> depthAdapter = new ArrayAdapter<>(
|
||||
getActivity(), R.layout.spinner_selected, depths);
|
||||
depthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
depth_spnr.setAdapter(depthAdapter);
|
||||
|
@ -580,11 +580,8 @@ public class OptionsFragment extends Fragment {
|
|||
for (final String type : mediaTypes) {
|
||||
filter[i] = new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
if (dir.getName().startsWith(".") || name.startsWith(".")) {
|
||||
return false;
|
||||
} else {
|
||||
return StringUtils.endsWithIgnoreCase(name, "." + type);
|
||||
}
|
||||
return !dir.getName().startsWith(".") && !name.startsWith(".")
|
||||
&& StringUtils.endsWithIgnoreCase(name, "." + type);
|
||||
}
|
||||
};
|
||||
i++;
|
||||
|
@ -602,7 +599,7 @@ public class OptionsFragment extends Fragment {
|
|||
themes[i] = items.get(i).getName();
|
||||
}
|
||||
themes[items.size()] = "None";
|
||||
ArrayAdapter<String> themeAdapter = new ArrayAdapter<String>(
|
||||
ArrayAdapter<String> themeAdapter = new ArrayAdapter<>(
|
||||
options.get().getActivity(), android.R.layout.simple_spinner_item, themes);
|
||||
themeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
options.get().mSpnrThemes.setAdapter(themeAdapter);
|
||||
|
@ -629,10 +626,14 @@ public class OptionsFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void hideSoftKeyBoard() {
|
||||
InputMethodManager iMm = (InputMethodManager) getActivity()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (iMm != null && iMm.isAcceptingText()) {
|
||||
iMm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
|
||||
try {
|
||||
InputMethodManager iMm = (InputMethodManager) getActivity()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (iMm != null && iMm.isAcceptingText()) {
|
||||
iMm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
// Keyboard may still be visible
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<string name="controller_b">Controller B</string>
|
||||
<string name="controller_c">Controller C</string>
|
||||
<string name="controller_d">Controller D</string>
|
||||
<string name="controller_not_connected">Controller ikke forbundet</string>
|
||||
<string name="controller_not_connected">Controller ikke forbundet %1$s</string>
|
||||
<string name="controller_none_selected">Ingen controller valgt</string>
|
||||
<string name="select">Vælg</string>
|
||||
<string name="remove">Fjern</string>
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<string name="controller_c">Controller C</string>
|
||||
<string name="controller_d">Controller D</string>
|
||||
<string name="controller_not_connected">Controller nicht verbunden</string>
|
||||
<string name="controller_none_selected">Kein Controller ausgewählt</string>
|
||||
<string name="controller_none_selected">Kein Controller ausgewählt %1$s</string>
|
||||
<string name="select">Auswählen</string>
|
||||
<string name="remove">Entfernen</string>
|
||||
<string name="select_controller_title">Controller auswählen</string>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<string name="controller_b">Controlador B</string>
|
||||
<string name="controller_c">Controlador C</string>
|
||||
<string name="controller_d">Controlador D</string>
|
||||
<string name="controller_not_connected">Controller No conectado</string>
|
||||
<string name="controller_not_connected">Controller No conectado %1$s</string>
|
||||
<string name="controller_none_selected">No Controlador seleccionado</string>
|
||||
<string name="select">Seleccionar</string>
|
||||
<string name="remove">Eliminar</string>
|
||||
|
|
|
@ -61,7 +61,7 @@ Last Edit: 21 May 2014
|
|||
<string name="controller_b">Manette B</string>
|
||||
<string name="controller_c">Manette C</string>
|
||||
<string name="controller_d">Manette D</string>
|
||||
<string name="controller_not_connected">Manette non connectée</string>
|
||||
<string name="controller_not_connected">Manette non connectée %1$s</string>
|
||||
<string name="controller_none_selected">Aucune manette selectionnée</string>
|
||||
<string name="select">Choisir</string>
|
||||
<string name="remove">Supprimer</string>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<string name="controller_b">コントローラB</string>
|
||||
<string name="controller_c">コントローラC</string>
|
||||
<string name="controller_d">コントローラD</string>
|
||||
<string name="controller_not_connected">コントローラが接続されていません</string>
|
||||
<string name="controller_not_connected">コントローラが接続されていません %1$s</string>
|
||||
<string name="controller_none_selected">コントローラが選択されていない。</string>
|
||||
<string name="select">選択する</string>
|
||||
<string name="remove">削除する</string>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<string name="controller_b">Controle B</string>
|
||||
<string name="controller_c">Controle C</string>
|
||||
<string name="controller_d">Controle D</string>
|
||||
<string name="controller_not_connected">Controle não está Conectado</string>
|
||||
<string name="controller_not_connected">Controle não está Conectado %1$s</string>
|
||||
<string name="controller_none_selected">Nenhum controle selecionado</string>
|
||||
<string name="select">Selecionar</string>
|
||||
<string name="remove">Remover</string>
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<string name="controller_b">Контроллер B</string>
|
||||
<string name="controller_c">Контроллер C</string>
|
||||
<string name="controller_d">Контроллер D</string>
|
||||
<string name="controller_not_connected">Контроллер не подключен</string>
|
||||
<string name="controller_not_connected">Контроллер не подключен %1$s</string>
|
||||
<string name="controller_none_selected">Контроллер не выбран</string>
|
||||
<string name="select">Назначить</string>
|
||||
<string name="remove">Удалить</string>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<string name="controller_b">控制器B</string>
|
||||
<string name="controller_c">控制器C</string>
|
||||
<string name="controller_d">控制器D</string>
|
||||
<string name="controller_not_connected">控制器未连接</string>
|
||||
<string name="controller_not_connected">控制器未连接 %1$s</string>
|
||||
<string name="controller_none_selected">未选择任何控制器</string>
|
||||
<string name="select">选择</string>
|
||||
<string name="remove">移除</string>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<string name="controller_b">控制器B</string>
|
||||
<string name="controller_c">控制器C</string>
|
||||
<string name="controller_d">控制器D</string>
|
||||
<string name="controller_not_connected">控制器未連接</string>
|
||||
<string name="controller_not_connected">控制器未連接 %1$s</string>
|
||||
<string name="controller_none_selected">未選擇任何控制器</string>
|
||||
<string name="select">選擇</string>
|
||||
<string name="remove">移除</string>
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<string name="controller_b">Controller B</string>
|
||||
<string name="controller_c">Controller C</string>
|
||||
<string name="controller_d">Controller D</string>
|
||||
<string name="controller_not_connected">Controller Not Connected</string>
|
||||
<string name="controller_not_connected">Controller Not Connected %1$s</string>
|
||||
<string name="controller_none_selected">No Controller Selected</string>
|
||||
<string name="select">Select</string>
|
||||
<string name="remove">Remove</string>
|
||||
|
|
Loading…
Reference in New Issue