diff --git a/Source/Android/app/src/main/AndroidManifest.xml b/Source/Android/app/src/main/AndroidManifest.xml index c70716affe..6c49619945 100644 --- a/Source/Android/app/src/main/AndroidManifest.xml +++ b/Source/Android/app/src/main/AndroidManifest.xml @@ -74,7 +74,7 @@ android:exported="false" android:configChanges="orientation|screenSize" android:theme="@style/DolphinSettingsBase" - android:label="@string/preferences_settings"/> + android:label="@string/settings"/> { FragmentActivity activity = (FragmentActivity) view.getContext(); - String gameId = gameFile.getGameId(); - - if (gameId.isEmpty()) - { - AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.DolphinDialogBase); - builder.setTitle("Game Settings"); - builder.setMessage("Files without game IDs don't support game-specific settings."); - - builder.show(); - return true; - } - GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile); - ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction() + activity.getSupportFragmentManager().beginTransaction() .add(fragment, GamePropertiesDialog.TAG).commit(); return true; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java index a6c0148032..bad0bc28da 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java @@ -90,7 +90,8 @@ public final class GameDetailsDialog extends DialogFragment long blockSize = gameFile.getBlockSize(); String compression = gameFile.getCompressionMethod(); - textFileFormat.setText(String.format("%1$s (%2$s)", gameFile.getFileFormatName(), fileSize)); + textFileFormat.setText(getResources().getString(R.string.game_details_size_and_format, + gameFile.getFileFormatName(), fileSize)); if (compression.isEmpty()) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java index 8ef63c3d6a..91f6076d6a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GamePropertiesDialog.java @@ -96,7 +96,7 @@ public class GamePropertiesDialog extends DialogFragment R.style.DolphinDialogBase); itemsBuilder.applyToBuilder(builder); builder.setTitle(requireContext() - .getString(R.string.preferences_game_properties) + ": " + gameId); + .getString(R.string.preferences_game_properties_with_game_id, gameId)); return builder.create(); } @@ -113,18 +113,20 @@ public class GamePropertiesDialog extends DialogFragment { if (gameSettingsFile.delete() || hadGameProfiles) { - Toast.makeText(getContext(), "Cleared settings for " + gameId, Toast.LENGTH_SHORT) - .show(); + Toast.makeText(getContext(), + getResources().getString(R.string.properties_clear_success, gameId), + Toast.LENGTH_SHORT).show(); } else { - Toast.makeText(getContext(), "Unable to clear settings for " + gameId, + Toast.makeText(getContext(), + getResources().getString(R.string.properties_clear_failure, gameId), Toast.LENGTH_SHORT).show(); } } else { - Toast.makeText(getContext(), "No game settings to delete", Toast.LENGTH_SHORT).show(); + Toast.makeText(getContext(), R.string.properties_clear_missing, Toast.LENGTH_SHORT).show(); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java index aac533562d..b2a8e89389 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java @@ -5,6 +5,7 @@ import android.text.TextUtils; import android.widget.Toast; import org.dolphinemu.dolphinemu.NativeLibrary; +import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivityView; import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile; import org.dolphinemu.dolphinemu.services.GameFileCacheService; @@ -207,7 +208,7 @@ public class Settings implements Closeable if (!isGameSpecific()) { if (context != null) - Toast.makeText(context, "Saved settings to INI files", Toast.LENGTH_SHORT).show(); + Toast.makeText(context, R.string.settings_saved, Toast.LENGTH_SHORT).show(); for (Map.Entry entry : mIniFiles.entrySet()) { @@ -238,7 +239,10 @@ public class Settings implements Closeable // custom game settings if (context != null) - Toast.makeText(context, "Saved settings for " + mGameId, Toast.LENGTH_SHORT).show(); + { + Toast.makeText(context, context.getString(R.string.settings_saved_game_specific, mGameId), + Toast.LENGTH_SHORT).show(); + } SettingsFile.saveCustomGameSettings(mGameId, getGameSpecificFile()); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java index 12b842c009..066f0322c3 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java @@ -170,7 +170,7 @@ public final class SettingsActivityPresenter break; case 2: - mView.showToastMessage("Please make sure Continuous Scanning is enabled in Core Settings."); + mView.showToastMessage(mContext.getString(R.string.make_sure_continuous_scan_enabled)); break; } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java index f0d6ffe2ea..f09a172c88 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java @@ -35,7 +35,7 @@ public final class SettingsFragment extends Fragment implements SettingsFragment static { - titles.put(MenuTag.SETTINGS, R.string.preferences_settings); + titles.put(MenuTag.SETTINGS, R.string.settings); titles.put(MenuTag.CONFIG, R.string.config); titles.put(MenuTag.CONFIG_GENERAL, R.string.general_submenu); titles.put(MenuTag.CONFIG_INTERFACE, R.string.interface_submenu); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java index 75c0faaa09..af16420b7f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java @@ -121,7 +121,7 @@ public final class SettingsFragmentPresenter { if (!TextUtils.isEmpty(mGameID)) { - mView.getActivity().setTitle("Game Settings: " + mGameID); + mView.getActivity().setTitle(mContext.getString(R.string.game_settings, mGameID)); } ArrayList sl = new ArrayList<>(); @@ -217,8 +217,7 @@ public final class SettingsFragmentPresenter break; default: - mView.showToastMessage("Unimplemented menu"); - return; + throw new UnsupportedOperationException("Unimplemented menu"); } mSettingsList = sl; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/HomeScreenChannel.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/HomeScreenChannel.java index ab6a7bb71e..1a38bfbc5e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/HomeScreenChannel.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/HomeScreenChannel.java @@ -1,21 +1,18 @@ package org.dolphinemu.dolphinemu.model; +import android.net.Uri; + /** * Represents a home screen channel for Android TV api 26+ */ public class HomeScreenChannel { - private long channelId; private String name; private String description; - private String appLinkIntentUri; + private Uri appLinkIntentUri; - public HomeScreenChannel() - { - } - - public HomeScreenChannel(String name, String description, String appLinkIntentUri) + public HomeScreenChannel(String name, String description, Uri appLinkIntentUri) { this.name = name; this.description = description; @@ -52,12 +49,12 @@ public class HomeScreenChannel this.description = description; } - public String getAppLinkIntentUri() + public Uri getAppLinkIntentUri() { return appLinkIntentUri; } - public void setAppLinkIntentUri(String appLinkIntentUri) + public void setAppLinkIntentUri(Uri appLinkIntentUri) { this.appLinkIntentUri = appLinkIntentUri; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java index da4d885de0..7b15ea2490 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java @@ -85,7 +85,7 @@ public class SyncChannelJobService extends JobService } else { - subscriptions = TvUtil.createUniversalSubscriptions(); + subscriptions = TvUtil.createUniversalSubscriptions(context); for (HomeScreenChannel subscription : subscriptions) { long channelId = createChannel(subscription); @@ -111,7 +111,7 @@ public class SyncChannelJobService extends JobService } // Create the channel since it has not been added to the TV Provider. - Uri appLinkIntentUri = Uri.parse(subscription.getAppLinkIntentUri()); + Uri appLinkIntentUri = subscription.getAppLinkIntentUri(); Channel.Builder builder = new Channel.Builder(); builder.setType(TvContractCompat.Channels.TYPE_PREVIEW) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java index 9818c30a4e..340c3684c9 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java @@ -96,7 +96,8 @@ public class SyncProgramsJobService extends JobService Channel channel = TvUtil.getChannelById(context, channelId); for (Platform platform : Platform.values()) { - if (channel != null && channel.getDisplayName().equals(platform.getHeaderName())) + if (channel != null && + channel.getAppLinkIntentUri().equals(AppLinkHelper.buildBrowseUri(platform))) { getGamesByPlatform(platform); syncPrograms(channelId); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java index d35f440c0c..7207cb2d4f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java @@ -349,7 +349,7 @@ public final class TvMainActivity extends FragmentActivity mGameRows.add(row); // Create a header for this row. - HeaderItem header = new HeaderItem(platform.toInt(), platform.getHeaderName()); + HeaderItem header = new HeaderItem(platform.toInt(), getString(platform.getHeaderName())); // Create the row, passing it the filled adapter and the header, and give it to the master adapter. return new ListRow(header, row); @@ -388,8 +388,7 @@ public final class TvMainActivity extends FragmentActivity R.string.grid_menu_import_nand_backup)); // Create a header for this row. - HeaderItem header = - new HeaderItem(R.string.preferences_settings, getString(R.string.preferences_settings)); + HeaderItem header = new HeaderItem(R.string.settings, getString(R.string.settings)); return new ListRow(header, rowItems); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java index 914f13bb61..3ebf49c298 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java @@ -1,21 +1,25 @@ package org.dolphinemu.dolphinemu.ui.platform; +import org.dolphinemu.dolphinemu.R; + /** * Enum to represent platform (eg GameCube, Wii). */ public enum Platform { - GAMECUBE(0, "GameCube Games"), - WII(1, "Wii Games"), - WIIWARE(2, "WiiWare Games"); + GAMECUBE(0, R.string.platform_gamecube, "GameCube Games"), + WII(1, R.string.platform_wii, "Wii Games"), + WIIWARE(2, R.string.platform_wiiware, "WiiWare Games"); private final int value; - private final String headerName; + private final int headerName; + private final String idString; - Platform(int value, String headerName) + Platform(int value, int headerName, String idString) { this.value = value; this.headerName = headerName; + this.idString = idString; } public static Platform fromInt(int i) @@ -40,8 +44,13 @@ public enum Platform return value; } - public String getHeaderName() + public int getHeaderName() { return headerName; } + + public String getIdString() + { + return idString; + } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AppLinkHelper.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AppLinkHelper.java index efb70913f6..054ff7a187 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AppLinkHelper.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AppLinkHelper.java @@ -4,6 +4,8 @@ import android.net.Uri; import androidx.annotation.StringDef; +import org.dolphinemu.dolphinemu.ui.platform.Platform; + import java.util.List; /** @@ -29,9 +31,9 @@ public class AppLinkHelper .build(); } - public static Uri buildBrowseUri(String subscriptionName) + public static Uri buildBrowseUri(Platform platform) { - return Uri.parse(URI_VIEW).buildUpon().appendPath(subscriptionName).build(); + return Uri.parse(URI_VIEW).buildUpon().appendPath(platform.getIdString()).build(); } public static AppLinkAction extractAction(Uri uri) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java index da3b87c060..47a1d4943e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java @@ -251,20 +251,20 @@ public class TvUtil /** * Generates all subscriptions for homescreen channels. */ - public static List createUniversalSubscriptions() + public static List createUniversalSubscriptions(Context context) { - return new ArrayList<>(createPlatformSubscriptions()); + return new ArrayList<>(createPlatformSubscriptions(context)); } - private static List createPlatformSubscriptions() + private static List createPlatformSubscriptions(Context context) { List subs = new ArrayList<>(); for (Platform platform : Platform.values()) { subs.add(new HomeScreenChannel( - platform.getHeaderName(), - platform.getHeaderName(), - AppLinkHelper.buildBrowseUri(platform.getHeaderName()).toString())); + context.getString(platform.getHeaderName()), + context.getString(platform.getHeaderName()), + AppLinkHelper.buildBrowseUri(platform))); } return subs; } diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 93c9c0c030..7943ebbf8e 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -122,10 +122,14 @@ Crossfade + Settings + Game Settings: %1$s Config Graphics Settings GameCube Input Wii Input + Saved settings to INI files + Saved settings for %1$s General @@ -330,6 +334,9 @@ Continue Anyway + GameCube Games + Wii Games + WiiWare Games Add Folder to Library Settings Refresh Library @@ -354,9 +361,12 @@ Set as Default ISO Edit Game Settings Clear Game Settings + Cleared settings for %1$s + Unable to clear settings for %1$s + No game settings to delete Save and Exit - Settings Game Properties + Game Properties: %1$s Extension Bindings Junk Data Found The settings file for this game contains extraneous data added by an old version of Dolphin. This will likely prevent global settings from working as intended.\n\nWould you like to fix this by deleting the settings file for this game? All game-specific settings and cheats that you have added will be removed. This cannot be undone. @@ -369,6 +379,7 @@ Compression Block Size No Compression + %1$s (%2$s) Format @@ -468,5 +479,6 @@ It can efficiently compress both junk data and encrypted Wii data. Disc %1$d GameCube Controller 1 is set to \"None\" Ignore for this session + Please make sure Continuous Scanning is enabled in Core Settings.