From 5e198d1421372f7673f181666df76acc8ff1607d Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 30 Dec 2022 18:09:03 -0800 Subject: [PATCH] android: Minimize frontend & convert to yuzu. --- src/android/app/build.gradle | 2 +- .../yuzu_emu}/ExampleInstrumentedTest.java | 2 +- src/android/app/src/main/AndroidManifest.xml | 34 +- .../citra/citra_emu/applets/MiiSelector.java | 122 ----- .../camera/StillImageCameraHelper.java | 65 --- .../DiskShaderCacheProgress.java | 138 ------ .../features/cheats/model/Cheat.java | 57 --- .../features/cheats/model/CheatEngine.java | 13 - .../cheats/model/CheatsViewModel.java | 177 ------- .../cheats/ui/CheatDetailsFragment.java | 174 ------- .../features/cheats/ui/CheatListFragment.java | 46 -- .../features/cheats/ui/CheatViewHolder.java | 56 --- .../features/cheats/ui/CheatsActivity.java | 161 ------- .../features/cheats/ui/CheatsAdapter.java | 72 --- .../yuzu_emu}/NativeLibrary.java | 14 +- .../yuzu_emu/YuzuApplication.java} | 12 +- .../activities/CustomFilePickerActivity.java | 4 +- .../activities/EmulationActivity.java | 450 +++++------------- .../yuzu_emu}/adapters/GameAdapter.java | 18 +- .../yuzu_emu}/applets/SoftwareKeyboard.java | 18 +- .../yuzu_emu}/dialogs/MotionAlertDialog.java | 6 +- .../settings/model/BooleanSetting.java | 2 +- .../features/settings/model/FloatSetting.java | 2 +- .../features/settings/model/IntSetting.java | 2 +- .../features/settings/model/Setting.java | 4 +- .../settings/model/SettingSection.java | 2 +- .../features/settings/model/Settings.java | 17 +- .../settings/model/StringSetting.java | 2 +- .../settings/model/view/CheckBoxSetting.java | 16 +- .../settings/model/view/DateTimeSetting.java | 6 +- .../settings/model/view/HeaderSetting.java | 4 +- .../model/view/InputBindingSetting.java | 32 +- .../settings/model/view/PremiumHeader.java | 2 +- .../view/PremiumSingleChoiceSetting.java | 14 +- .../settings/model/view/SettingsItem.java | 8 +- .../model/view/SingleChoiceSetting.java | 6 +- .../settings/model/view/SliderSetting.java | 10 +- .../model/view/StringSingleChoiceSetting.java | 6 +- .../settings/model/view/SubmenuSetting.java | 4 +- .../settings/ui/SettingsActivity.java | 18 +- .../ui/SettingsActivityPresenter.java | 29 +- .../settings/ui/SettingsActivityView.java | 6 +- .../features/settings/ui/SettingsAdapter.java | 52 +- .../settings/ui/SettingsFragment.java | 12 +- .../ui/SettingsFragmentPresenter.java | 134 +----- .../settings/ui/SettingsFragmentView.java | 8 +- .../settings/ui/SettingsFrameLayout.java | 2 +- .../viewholder/CheckBoxSettingViewHolder.java | 10 +- .../ui/viewholder/DateTimeViewHolder.java | 12 +- .../ui/viewholder/HeaderViewHolder.java | 8 +- .../InputBindingSettingViewHolder.java | 10 +- .../ui/viewholder/PremiumViewHolder.java | 12 +- .../ui/viewholder/SettingViewHolder.java | 6 +- .../ui/viewholder/SingleChoiceViewHolder.java | 14 +- .../ui/viewholder/SliderViewHolder.java | 10 +- .../ui/viewholder/SubmenuViewHolder.java | 10 +- .../features/settings/utils/SettingsFile.java | 36 +- .../fragments/CustomFilePickerFragment.java | 4 +- .../fragments/EmulationFragment.java | 28 +- .../yuzu/yuzu_emu/fragments/MenuFragment.java | 129 +++++ .../yuzu_emu}/model/Game.java | 2 +- .../yuzu_emu}/model/GameDatabase.java | 6 +- .../yuzu_emu}/model/GameProvider.java | 6 +- .../yuzu_emu}/overlay/InputOverlay.java | 14 +- .../overlay/InputOverlayDrawableButton.java | 2 +- .../overlay/InputOverlayDrawableDpad.java | 2 +- .../overlay/InputOverlayDrawableJoystick.java | 6 +- .../yuzu_emu}/ui/DividerItemDecoration.java | 2 +- .../ui/TwoPaneOnBackPressedCallback.java | 2 +- .../yuzu_emu}/ui/main/MainActivity.java | 28 +- .../yuzu_emu}/ui/main/MainPresenter.java | 18 +- .../yuzu_emu}/ui/main/MainView.java | 2 +- .../ui/platform/PlatformGamesFragment.java | 12 +- .../ui/platform/PlatformGamesPresenter.java | 10 +- .../ui/platform/PlatformGamesView.java | 2 +- .../yuzu_emu}/utils/Action1.java | 2 +- .../yuzu_emu}/utils/AddDirectoryHelper.java | 6 +- .../yuzu_emu}/utils/BiMap.java | 2 +- .../yuzu_emu}/utils/BillingManager.java | 14 +- .../utils/ControllerMappingHelper.java | 2 +- .../utils/DirectoryInitialization.java | 34 +- .../utils/DirectoryStateReceiver.java | 4 +- .../utils/EmulationMenuSettings.java | 6 +- .../yuzu_emu}/utils/FileBrowserHelper.java | 4 +- .../yuzu_emu}/utils/FileUtil.java | 2 +- .../yuzu_emu}/utils/ForegroundService.java | 6 +- .../utils/GameIconRequestHandler.java | 4 +- .../yuzu_emu}/utils/Log.java | 6 +- .../yuzu_emu}/utils/PermissionsHandler.java | 2 +- .../PicassoRoundedCornersTransformation.java | 2 +- .../yuzu_emu}/utils/PicassoUtils.java | 8 +- .../yuzu_emu}/utils/StartupHandler.java | 6 +- .../yuzu_emu}/utils/ThemeUtil.java | 8 +- .../yuzu_emu}/viewholders/GameViewHolder.java | 4 +- src/android/app/src/main/jni/native.cpp | 64 +-- src/android/app/src/main/jni/native.h | 68 +-- .../res/animator/menu_slide_in_from_end.xml | 20 + .../res/animator/menu_slide_in_from_start.xml | 20 + .../res/animator/menu_slide_out_to_end.xml | 21 + .../res/animator/menu_slide_out_to_start.xml | 21 + .../main/res/layout-ldrtl/list_item_cheat.xml | 38 -- .../src/main/res/layout/activity_cheats.xml | 22 - .../main/res/layout/activity_emulation.xml | 31 +- .../res/layout/fragment_cheat_details.xml | 163 ------- .../main/res/layout/fragment_cheat_list.xml | 27 -- .../main/res/layout/fragment_emulation.xml | 5 +- .../main/res/layout/fragment_ingame_menu.xml | 56 +++ .../src/main/res/layout/fragment_settings.xml | 6 +- .../src/main/res/layout/list_item_cheat.xml | 38 -- .../app/src/main/res/menu/menu_emulation.xml | 118 ----- .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 5899 -> 17950 bytes .../mipmap-hdpi/ic_launcher_foreground.png | Bin 7416 -> 48880 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 3377 -> 15249 bytes .../mipmap-mdpi/ic_launcher_foreground.png | Bin 4413 -> 47388 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 8742 -> 17663 bytes .../mipmap-xhdpi/ic_launcher_foreground.png | Bin 10530 -> 49903 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 14300 -> 20413 bytes .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin 17511 -> 57817 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 20804 -> 23487 bytes .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin 24886 -> 58695 bytes .../app/src/main/res/values-night/colors.xml | 7 +- .../app/src/main/res/values/colors.xml | 7 +- .../app/src/main/res/values/dimens.xml | 9 +- .../app/src/main/res/values/integers.xml | 1 + .../app/src/main/res/values/strings.xml | 74 +-- .../app/src/main/res/values/styles.xml | 39 +- .../org/citra/citra_emu/ExampleUnitTest.java | 17 - src/android/code-style-java.xml | 3 +- 128 files changed, 933 insertions(+), 2508 deletions(-) rename src/android/app/src/androidTest/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ExampleInstrumentedTest.java (53%) delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/applets/MiiSelector.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/camera/StillImageCameraHelper.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/Cheat.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatEngine.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatsViewModel.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatDetailsFragment.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatListFragment.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatViewHolder.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsActivity.java delete mode 100644 src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsAdapter.java rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/NativeLibrary.java (97%) rename src/android/app/src/main/java/org/{citra/citra_emu/CitraApplication.java => yuzu/yuzu_emu/YuzuApplication.java} (86%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/activities/CustomFilePickerActivity.java (93%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/activities/EmulationActivity.java (54%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/adapters/GameAdapter.java (95%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/applets/SoftwareKeyboard.java (94%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/dialogs/MotionAlertDialog.java (97%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/BooleanSetting.java (89%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/FloatSetting.java (89%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/IntSetting.java (88%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/Setting.java (88%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/SettingSection.java (96%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/Settings.java (86%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/StringSetting.java (88%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/CheckBoxSetting.java (82%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/DateTimeSetting.java (85%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/HeaderSetting.java (71%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/InputBindingSetting.java (92%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/PremiumHeader.java (79%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/PremiumSingleChoiceSetting.java (78%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/SettingsItem.java (93%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/SingleChoiceSetting.java (90%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/SliderSetting.java (90%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/StringSingleChoiceSetting.java (92%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/model/view/SubmenuSetting.java (78%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsActivity.java (91%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsActivityPresenter.java (80%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsActivityView.java (94%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsAdapter.java (90%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsFragment.java (92%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsFragmentPresenter.java (69%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsFragmentView.java (90%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/SettingsFrameLayout.java (96%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java (82%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/DateTimeViewHolder.java (78%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/HeaderViewHolder.java (73%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/InputBindingSettingViewHolder.java (83%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/PremiumViewHolder.java (82%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/SettingViewHolder.java (86%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/SingleChoiceViewHolder.java (85%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/SliderViewHolder.java (79%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/ui/viewholder/SubmenuViewHolder.java (78%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/features/settings/utils/SettingsFile.java (92%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/fragments/CustomFilePickerFragment.java (98%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/fragments/EmulationFragment.java (94%) create mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/MenuFragment.java rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/model/Game.java (98%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/model/GameDatabase.java (98%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/model/GameProvider.java (97%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/overlay/InputOverlay.java (99%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/overlay/InputOverlayDrawableButton.java (99%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/overlay/InputOverlayDrawableDpad.java (99%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/overlay/InputOverlayDrawableJoystick.java (98%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/DividerItemDecoration.java (99%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/TwoPaneOnBackPressedCallback.java (96%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/main/MainActivity.java (92%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/main/MainPresenter.java (81%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/main/MainView.java (94%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/platform/PlatformGamesFragment.java (90%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/platform/PlatformGamesPresenter.java (78%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/ui/platform/PlatformGamesView.java (92%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/Action1.java (60%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/AddDirectoryHelper.java (90%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/BiMap.java (93%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/BillingManager.java (95%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/ControllerMappingHelper.java (98%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/DirectoryInitialization.java (84%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/DirectoryStateReceiver.java (83%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/EmulationMenuSettings.java (95%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/FileBrowserHelper.java (96%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/FileUtil.java (96%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/ForegroundService.java (94%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/GameIconRequestHandler.java (90%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/Log.java (86%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/PermissionsHandler.java (97%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/PicassoRoundedCornersTransformation.java (97%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/PicassoUtils.java (88%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/StartupHandler.java (93%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/utils/ThemeUtil.java (82%) rename src/android/app/src/main/java/org/{citra/citra_emu => yuzu/yuzu_emu}/viewholders/GameViewHolder.java (94%) create mode 100644 src/android/app/src/main/res/animator/menu_slide_in_from_end.xml create mode 100644 src/android/app/src/main/res/animator/menu_slide_in_from_start.xml create mode 100644 src/android/app/src/main/res/animator/menu_slide_out_to_end.xml create mode 100644 src/android/app/src/main/res/animator/menu_slide_out_to_start.xml delete mode 100644 src/android/app/src/main/res/layout-ldrtl/list_item_cheat.xml delete mode 100644 src/android/app/src/main/res/layout/activity_cheats.xml delete mode 100644 src/android/app/src/main/res/layout/fragment_cheat_details.xml delete mode 100644 src/android/app/src/main/res/layout/fragment_cheat_list.xml create mode 100644 src/android/app/src/main/res/layout/fragment_ingame_menu.xml delete mode 100644 src/android/app/src/main/res/layout/list_item_cheat.xml delete mode 100644 src/android/app/src/main/res/menu/menu_emulation.xml delete mode 100644 src/android/app/src/test/java/org/citra/citra_emu/ExampleUnitTest.java diff --git a/src/android/app/build.gradle b/src/android/app/build.gradle index 5a108743b..ffbadce14 100644 --- a/src/android/app/build.gradle +++ b/src/android/app/build.gradle @@ -30,7 +30,7 @@ android { defaultConfig { // TODO If this is ever modified, change application_id in strings.xml - applicationId "org.citra.citra_emu" + applicationId "org.yuzu.yuzu_emu" minSdkVersion 28 targetSdkVersion 29 versionCode autoVersion diff --git a/src/android/app/src/androidTest/java/org/citra/citra_emu/ExampleInstrumentedTest.java b/src/android/app/src/androidTest/java/org/yuzu/yuzu_emu/ExampleInstrumentedTest.java similarity index 53% rename from src/android/app/src/androidTest/java/org/citra/citra_emu/ExampleInstrumentedTest.java rename to src/android/app/src/androidTest/java/org/yuzu/yuzu_emu/ExampleInstrumentedTest.java index 6a25f2ce6..0cea19827 100644 --- a/src/android/app/src/androidTest/java/org/citra/citra_emu/ExampleInstrumentedTest.java +++ b/src/android/app/src/androidTest/java/org/yuzu/yuzu_emu/ExampleInstrumentedTest.java @@ -1,3 +1,3 @@ -package org.citra.citra_emu; +package org.yuzu.yuzu_emu; import android.content.Context; diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index c2463e079..0d7e3f7ad 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="org.yuzu.yuzu_emu"> @@ -11,9 +11,6 @@ - @@ -23,7 +20,7 @@ @@ -46,22 +43,22 @@ - + @@ -70,16 +67,10 @@ - - - + @@ -97,3 +88,4 @@ + diff --git a/src/android/app/src/main/java/org/citra/citra_emu/applets/MiiSelector.java b/src/android/app/src/main/java/org/citra/citra_emu/applets/MiiSelector.java deleted file mode 100644 index 3586a9b34..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/applets/MiiSelector.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2020 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -package org.citra.citra_emu.applets; - -import android.app.Activity; -import android.app.Dialog; -import android.os.Bundle; - -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.activities.EmulationActivity; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Objects; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.fragment.app.DialogFragment; - -public final class MiiSelector { - public static class MiiSelectorConfig implements java.io.Serializable { - public boolean enable_cancel_button; - public String title; - public long initially_selected_mii_index; - // List of Miis to display - public String[] mii_names; - } - - public static class MiiSelectorData { - public long return_code; - public int index; - - private MiiSelectorData(long return_code, int index) { - this.return_code = return_code; - this.index = index; - } - } - - public static class MiiSelectorDialogFragment extends DialogFragment { - static MiiSelectorDialogFragment newInstance(MiiSelectorConfig config) { - MiiSelectorDialogFragment frag = new MiiSelectorDialogFragment(); - Bundle args = new Bundle(); - args.putSerializable("config", config); - frag.setArguments(args); - return frag; - } - - @NonNull - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - final Activity emulationActivity = Objects.requireNonNull(getActivity()); - - MiiSelectorConfig config = - Objects.requireNonNull((MiiSelectorConfig) Objects.requireNonNull(getArguments()) - .getSerializable("config")); - - // Note: we intentionally leave out the Standard Mii in the native code so that - // the string can get translated - ArrayList list = new ArrayList<>(); - list.add(emulationActivity.getString(R.string.standard_mii)); - list.addAll(Arrays.asList(config.mii_names)); - - final int initialIndex = config.initially_selected_mii_index < list.size() - ? (int) config.initially_selected_mii_index - : 0; - data.index = initialIndex; - AlertDialog.Builder builder = - new AlertDialog.Builder(emulationActivity) - .setTitle(config.title.isEmpty() - ? emulationActivity.getString(R.string.mii_selector) - : config.title) - .setSingleChoiceItems(list.toArray(new String[]{}), initialIndex, - (dialog, which) -> { - data.index = which; - }) - .setPositiveButton(android.R.string.ok, (dialog, which) -> { - data.return_code = 0; - synchronized (finishLock) { - finishLock.notifyAll(); - } - }); - if (config.enable_cancel_button) { - builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> { - data.return_code = 1; - synchronized (finishLock) { - finishLock.notifyAll(); - } - }); - } - setCancelable(false); - return builder.create(); - } - } - - private static MiiSelectorData data; - private static final Object finishLock = new Object(); - - private static void ExecuteImpl(MiiSelectorConfig config) { - final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get(); - - data = new MiiSelectorData(0, 0); - - MiiSelectorDialogFragment fragment = MiiSelectorDialogFragment.newInstance(config); - fragment.show(emulationActivity.getSupportFragmentManager(), "mii_selector"); - } - - public static MiiSelectorData Execute(MiiSelectorConfig config) { - NativeLibrary.sEmulationActivity.get().runOnUiThread(() -> ExecuteImpl(config)); - - synchronized (finishLock) { - try { - finishLock.wait(); - } catch (Exception ignored) { - } - } - - return data; - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/camera/StillImageCameraHelper.java b/src/android/app/src/main/java/org/citra/citra_emu/camera/StillImageCameraHelper.java deleted file mode 100644 index 701cb0710..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/camera/StillImageCameraHelper.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2020 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -package org.citra.citra_emu.camera; - -import android.content.Intent; -import android.graphics.Bitmap; -import android.provider.MediaStore; - -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.activities.EmulationActivity; -import org.citra.citra_emu.utils.PicassoUtils; - -import androidx.annotation.Nullable; - -// Used in native code. -public final class StillImageCameraHelper { - public static final int REQUEST_CAMERA_FILE_PICKER = 1; - private static final Object filePickerLock = new Object(); - private static @Nullable - String filePickerPath; - - // Opens file picker for camera. - public static @Nullable - String OpenFilePicker() { - final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get(); - - // At this point, we are assuming that we already have permissions as they are - // needed to launch a game - emulationActivity.runOnUiThread(() -> { - Intent intent = new Intent(Intent.ACTION_PICK); - intent.setDataAndType(MediaStore.Images.Media.INTERNAL_CONTENT_URI, "image/*"); - emulationActivity.startActivityForResult( - Intent.createChooser(intent, - emulationActivity.getString(R.string.camera_select_image)), - REQUEST_CAMERA_FILE_PICKER); - }); - - synchronized (filePickerLock) { - try { - filePickerLock.wait(); - } catch (InterruptedException ignored) { - } - } - - return filePickerPath; - } - - // Called from EmulationActivity. - public static void OnFilePickerResult(Intent result) { - filePickerPath = result == null ? null : result.getDataString(); - - synchronized (filePickerLock) { - filePickerLock.notifyAll(); - } - } - - // Blocking call. Load image from file and crop/resize it to fit in width x height. - @Nullable - public static Bitmap LoadImageFromFile(String uri, int width, int height) { - return PicassoUtils.LoadBitmapFromFile(uri, width, height); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java b/src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java deleted file mode 100644 index d6d14cc5f..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2021 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -package org.citra.citra_emu.disk_shader_cache; - -import android.app.Activity; -import android.app.Dialog; -import android.content.DialogInterface; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.fragment.app.DialogFragment; - -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.activities.EmulationActivity; -import org.citra.citra_emu.utils.Log; - -import java.util.Objects; - -public class DiskShaderCacheProgress { - - // Equivalent to VideoCore::LoadCallbackStage - public enum LoadCallbackStage { - Prepare, - Decompile, - Build, - Complete, - } - - private static final Object finishLock = new Object(); - private static ProgressDialogFragment fragment; - - public static class ProgressDialogFragment extends DialogFragment { - ProgressBar progressBar; - TextView progressText; - AlertDialog dialog; - - static ProgressDialogFragment newInstance(String title, String message) { - ProgressDialogFragment frag = new ProgressDialogFragment(); - Bundle args = new Bundle(); - args.putString("title", title); - args.putString("message", message); - frag.setArguments(args); - return frag; - } - - @NonNull - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - final Activity emulationActivity = Objects.requireNonNull(getActivity()); - - final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title")); - final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message")); - - LayoutInflater inflater = LayoutInflater.from(emulationActivity); - View view = inflater.inflate(R.layout.dialog_progress_bar, null); - - progressBar = view.findViewById(R.id.progress_bar); - progressText = view.findViewById(R.id.progress_text); - progressText.setText(""); - - setCancelable(false); - setRetainInstance(true); - - AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity); - builder.setTitle(title); - builder.setMessage(message); - builder.setView(view); - builder.setNegativeButton(android.R.string.cancel, null); - - dialog = builder.create(); - dialog.create(); - - dialog.getButton(DialogInterface.BUTTON_NEGATIVE).setOnClickListener((v) -> emulationActivity.onBackPressed()); - - synchronized (finishLock) { - finishLock.notifyAll(); - } - - return dialog; - } - - private void onUpdateProgress(String msg, int progress, int max) { - Objects.requireNonNull(getActivity()).runOnUiThread(() -> { - progressBar.setProgress(progress); - progressBar.setMax(max); - progressText.setText(String.format("%d/%d", progress, max)); - dialog.setMessage(msg); - }); - } - } - - private static void prepareDialog() { - NativeLibrary.sEmulationActivity.get().runOnUiThread(() -> { - final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get(); - fragment = ProgressDialogFragment.newInstance(emulationActivity.getString(R.string.loading), emulationActivity.getString(R.string.preparing_shaders)); - fragment.show(emulationActivity.getSupportFragmentManager(), "diskShaders"); - }); - - synchronized (finishLock) { - try { - finishLock.wait(); - } catch (Exception ignored) { - } - } - } - - public static void loadProgress(LoadCallbackStage stage, int progress, int max) { - final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get(); - if (emulationActivity == null) { - Log.error("[DiskShaderCacheProgress] EmulationActivity not present"); - return; - } - - switch (stage) { - case Prepare: - prepareDialog(); - break; - case Decompile: - fragment.onUpdateProgress(emulationActivity.getString(R.string.preparing_shaders), progress, max); - break; - case Build: - fragment.onUpdateProgress(emulationActivity.getString(R.string.building_shaders), progress, max); - break; - case Complete: - // Workaround for when dialog is dismissed when the app is in the background - fragment.dismissAllowingStateLoss(); - break; - } - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/Cheat.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/Cheat.java deleted file mode 100644 index 93b026364..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/Cheat.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.citra.citra_emu.features.cheats.model; - -import androidx.annotation.Keep; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -public class Cheat { - @Keep - private final long mPointer; - - private Runnable mEnabledChangedCallback = null; - - @Keep - private Cheat(long pointer) { - mPointer = pointer; - } - - @Override - protected native void finalize(); - - @NonNull - public native String getName(); - - @NonNull - public native String getNotes(); - - @NonNull - public native String getCode(); - - public native boolean getEnabled(); - - public void setEnabled(boolean enabled) { - setEnabledImpl(enabled); - onEnabledChanged(); - } - - private native void setEnabledImpl(boolean enabled); - - public void setEnabledChangedCallback(@Nullable Runnable callback) { - mEnabledChangedCallback = callback; - } - - private void onEnabledChanged() { - if (mEnabledChangedCallback != null) { - mEnabledChangedCallback.run(); - } - } - - /** - * If the code is valid, returns 0. Otherwise, returns the 1-based index - * for the line containing the error. - */ - public static native int isValidGatewayCode(@NonNull String code); - - public static native Cheat createGatewayCode(@NonNull String name, @NonNull String notes, - @NonNull String code); -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatEngine.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatEngine.java deleted file mode 100644 index 5748162bb..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatEngine.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.citra.citra_emu.features.cheats.model; - -public class CheatEngine { - public static native Cheat[] getCheats(); - - public static native void addCheat(Cheat cheat); - - public static native void removeCheat(int index); - - public static native void updateCheat(int index, Cheat newCheat); - - public static native void saveCheatFile(); -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatsViewModel.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatsViewModel.java deleted file mode 100644 index 66f4202d8..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/model/CheatsViewModel.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.citra.citra_emu.features.cheats.model; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class CheatsViewModel extends ViewModel { - private int mSelectedCheatPosition = -1; - private final MutableLiveData mSelectedCheat = new MutableLiveData<>(null); - private final MutableLiveData mIsAdding = new MutableLiveData<>(false); - private final MutableLiveData mIsEditing = new MutableLiveData<>(false); - - private final MutableLiveData mCheatAddedEvent = new MutableLiveData<>(null); - private final MutableLiveData mCheatChangedEvent = new MutableLiveData<>(null); - private final MutableLiveData mCheatDeletedEvent = new MutableLiveData<>(null); - private final MutableLiveData mOpenDetailsViewEvent = new MutableLiveData<>(false); - - private Cheat[] mCheats; - private boolean mCheatsNeedSaving = false; - - public void load() { - mCheats = CheatEngine.getCheats(); - - for (int i = 0; i < mCheats.length; i++) { - int position = i; - mCheats[i].setEnabledChangedCallback(() -> { - mCheatsNeedSaving = true; - notifyCheatUpdated(position); - }); - } - } - - public void saveIfNeeded() { - if (mCheatsNeedSaving) { - CheatEngine.saveCheatFile(); - mCheatsNeedSaving = false; - } - } - - public Cheat[] getCheats() { - return mCheats; - } - - public LiveData getSelectedCheat() { - return mSelectedCheat; - } - - public void setSelectedCheat(Cheat cheat, int position) { - if (mIsEditing.getValue()) { - setIsEditing(false); - } - - mSelectedCheat.setValue(cheat); - mSelectedCheatPosition = position; - } - - public LiveData getIsAdding() { - return mIsAdding; - } - - public LiveData getIsEditing() { - return mIsEditing; - } - - public void setIsEditing(boolean isEditing) { - mIsEditing.setValue(isEditing); - - if (mIsAdding.getValue() && !isEditing) { - mIsAdding.setValue(false); - setSelectedCheat(null, -1); - } - } - - /** - * When a cheat is added, the integer stored in the returned LiveData - * changes to the position of that cheat, then changes back to null. - */ - public LiveData getCheatAddedEvent() { - return mCheatAddedEvent; - } - - private void notifyCheatAdded(int position) { - mCheatAddedEvent.setValue(position); - mCheatAddedEvent.setValue(null); - } - - public void startAddingCheat() { - mSelectedCheat.setValue(null); - mSelectedCheatPosition = -1; - - mIsAdding.setValue(true); - mIsEditing.setValue(true); - } - - public void finishAddingCheat(Cheat cheat) { - if (!mIsAdding.getValue()) { - throw new IllegalStateException(); - } - - mIsAdding.setValue(false); - mIsEditing.setValue(false); - - int position = mCheats.length; - - CheatEngine.addCheat(cheat); - - mCheatsNeedSaving = true; - load(); - - notifyCheatAdded(position); - setSelectedCheat(mCheats[position], position); - } - - /** - * When a cheat is edited, the integer stored in the returned LiveData - * changes to the position of that cheat, then changes back to null. - */ - public LiveData getCheatUpdatedEvent() { - return mCheatChangedEvent; - } - - /** - * Notifies that an edit has been made to the contents of the cheat at the given position. - */ - private void notifyCheatUpdated(int position) { - mCheatChangedEvent.setValue(position); - mCheatChangedEvent.setValue(null); - } - - public void updateSelectedCheat(Cheat newCheat) { - CheatEngine.updateCheat(mSelectedCheatPosition, newCheat); - - mCheatsNeedSaving = true; - load(); - - notifyCheatUpdated(mSelectedCheatPosition); - setSelectedCheat(mCheats[mSelectedCheatPosition], mSelectedCheatPosition); - } - - /** - * When a cheat is deleted, the integer stored in the returned LiveData - * changes to the position of that cheat, then changes back to null. - */ - public LiveData getCheatDeletedEvent() { - return mCheatDeletedEvent; - } - - /** - * Notifies that the cheat at the given position has been deleted. - */ - private void notifyCheatDeleted(int position) { - mCheatDeletedEvent.setValue(position); - mCheatDeletedEvent.setValue(null); - } - - public void deleteSelectedCheat() { - int position = mSelectedCheatPosition; - - setSelectedCheat(null, -1); - - CheatEngine.removeCheat(position); - - mCheatsNeedSaving = true; - load(); - - notifyCheatDeleted(position); - } - - public LiveData getOpenDetailsViewEvent() { - return mOpenDetailsViewEvent; - } - - public void openDetailsView() { - mOpenDetailsViewEvent.setValue(true); - mOpenDetailsViewEvent.setValue(false); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatDetailsFragment.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatDetailsFragment.java deleted file mode 100644 index 762cdb80e..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatDetailsFragment.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.citra.citra_emu.features.cheats.ui; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.EditText; -import android.widget.ScrollView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; -import androidx.fragment.app.Fragment; -import androidx.lifecycle.ViewModelProvider; - -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.cheats.model.Cheat; -import org.citra.citra_emu.features.cheats.model.CheatsViewModel; - -public class CheatDetailsFragment extends Fragment { - private View mRoot; - private ScrollView mScrollView; - private TextView mLabelName; - private EditText mEditName; - private EditText mEditNotes; - private EditText mEditCode; - private Button mButtonDelete; - private Button mButtonEdit; - private Button mButtonCancel; - private Button mButtonOk; - - private CheatsViewModel mViewModel; - - @Nullable - @Override - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { - return inflater.inflate(R.layout.fragment_cheat_details, container, false); - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - mRoot = view.findViewById(R.id.root); - mScrollView = view.findViewById(R.id.scroll_view); - mLabelName = view.findViewById(R.id.label_name); - mEditName = view.findViewById(R.id.edit_name); - mEditNotes = view.findViewById(R.id.edit_notes); - mEditCode = view.findViewById(R.id.edit_code); - mButtonDelete = view.findViewById(R.id.button_delete); - mButtonEdit = view.findViewById(R.id.button_edit); - mButtonCancel = view.findViewById(R.id.button_cancel); - mButtonOk = view.findViewById(R.id.button_ok); - - CheatsActivity activity = (CheatsActivity) requireActivity(); - mViewModel = new ViewModelProvider(activity).get(CheatsViewModel.class); - - mViewModel.getSelectedCheat().observe(getViewLifecycleOwner(), - this::onSelectedCheatUpdated); - mViewModel.getIsEditing().observe(getViewLifecycleOwner(), this::onIsEditingUpdated); - - mButtonDelete.setOnClickListener(this::onDeleteClicked); - mButtonEdit.setOnClickListener(this::onEditClicked); - mButtonCancel.setOnClickListener(this::onCancelClicked); - mButtonOk.setOnClickListener(this::onOkClicked); - - // On a portrait phone screen (or other narrow screen), only one of the two panes are shown - // at the same time. If the user is navigating using a d-pad and moves focus to an element - // in the currently hidden pane, we need to manually show that pane. - CheatsActivity.setOnFocusChangeListenerRecursively(view, - (v, hasFocus) -> activity.onDetailsViewFocusChange(hasFocus)); - } - - private void clearEditErrors() { - mEditName.setError(null); - mEditCode.setError(null); - } - - private void onDeleteClicked(View view) { - String name = mEditName.getText().toString(); - - AlertDialog.Builder builder = new AlertDialog.Builder(requireContext()); - builder.setMessage(getString(R.string.cheats_delete_confirmation, name)); - builder.setPositiveButton(android.R.string.yes, - (dialog, i) -> mViewModel.deleteSelectedCheat()); - builder.setNegativeButton(android.R.string.no, null); - builder.show(); - } - - private void onEditClicked(View view) { - mViewModel.setIsEditing(true); - mButtonOk.requestFocus(); - } - - private void onCancelClicked(View view) { - mViewModel.setIsEditing(false); - onSelectedCheatUpdated(mViewModel.getSelectedCheat().getValue()); - mButtonDelete.requestFocus(); - } - - private void onOkClicked(View view) { - clearEditErrors(); - - String name = mEditName.getText().toString(); - String notes = mEditNotes.getText().toString(); - String code = mEditCode.getText().toString(); - - if (name.isEmpty()) { - mEditName.setError(getString(R.string.cheats_error_no_name)); - mScrollView.smoothScrollTo(0, mLabelName.getTop()); - return; - } else if (code.isEmpty()) { - mEditCode.setError(getString(R.string.cheats_error_no_code_lines)); - mScrollView.smoothScrollTo(0, mEditCode.getBottom()); - return; - } - - int validityResult = Cheat.isValidGatewayCode(code); - - if (validityResult != 0) { - mEditCode.setError(getString(R.string.cheats_error_on_line, validityResult)); - mScrollView.smoothScrollTo(0, mEditCode.getBottom()); - return; - } - - Cheat newCheat = Cheat.createGatewayCode(name, notes, code); - - if (mViewModel.getIsAdding().getValue()) { - mViewModel.finishAddingCheat(newCheat); - } else { - mViewModel.updateSelectedCheat(newCheat); - } - - mButtonEdit.requestFocus(); - } - - private void onSelectedCheatUpdated(@Nullable Cheat cheat) { - clearEditErrors(); - - boolean isEditing = mViewModel.getIsEditing().getValue(); - - mRoot.setVisibility(isEditing || cheat != null ? View.VISIBLE : View.GONE); - - // If the fragment was recreated while editing a cheat, it's vital that we - // don't repopulate the fields, otherwise the user's changes will be lost - if (!isEditing) { - if (cheat == null) { - mEditName.setText(""); - mEditNotes.setText(""); - mEditCode.setText(""); - } else { - mEditName.setText(cheat.getName()); - mEditNotes.setText(cheat.getNotes()); - mEditCode.setText(cheat.getCode()); - } - } - } - - private void onIsEditingUpdated(boolean isEditing) { - if (isEditing) { - mRoot.setVisibility(View.VISIBLE); - } - - mEditName.setEnabled(isEditing); - mEditNotes.setEnabled(isEditing); - mEditCode.setEnabled(isEditing); - - mButtonDelete.setVisibility(isEditing ? View.GONE : View.VISIBLE); - mButtonEdit.setVisibility(isEditing ? View.GONE : View.VISIBLE); - mButtonCancel.setVisibility(isEditing ? View.VISIBLE : View.GONE); - mButtonOk.setVisibility(isEditing ? View.VISIBLE : View.GONE); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatListFragment.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatListFragment.java deleted file mode 100644 index 6c67a31d4..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatListFragment.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.citra.citra_emu.features.cheats.ui; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.lifecycle.ViewModelProvider; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.google.android.material.floatingactionbutton.FloatingActionButton; - -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.cheats.model.CheatsViewModel; -import org.citra.citra_emu.ui.DividerItemDecoration; - -public class CheatListFragment extends Fragment { - @Nullable - @Override - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { - return inflater.inflate(R.layout.fragment_cheat_list, container, false); - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - RecyclerView recyclerView = view.findViewById(R.id.cheat_list); - FloatingActionButton fab = view.findViewById(R.id.fab); - - CheatsActivity activity = (CheatsActivity) requireActivity(); - CheatsViewModel viewModel = new ViewModelProvider(activity).get(CheatsViewModel.class); - - recyclerView.setAdapter(new CheatsAdapter(activity, viewModel)); - recyclerView.setLayoutManager(new LinearLayoutManager(activity)); - recyclerView.addItemDecoration(new DividerItemDecoration(activity, null)); - - fab.setOnClickListener(v -> { - viewModel.startAddingCheat(); - viewModel.openDetailsView(); - }); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatViewHolder.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatViewHolder.java deleted file mode 100644 index 8ba8f86e7..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatViewHolder.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.citra.citra_emu.features.cheats.ui; - -import android.view.View; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.lifecycle.ViewModelProvider; -import androidx.recyclerview.widget.RecyclerView; - -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.cheats.model.Cheat; -import org.citra.citra_emu.features.cheats.model.CheatsViewModel; - -public class CheatViewHolder extends RecyclerView.ViewHolder - implements View.OnClickListener, CompoundButton.OnCheckedChangeListener { - private final View mRoot; - private final TextView mName; - private final CheckBox mCheckbox; - - private CheatsViewModel mViewModel; - private Cheat mCheat; - private int mPosition; - - public CheatViewHolder(@NonNull View itemView) { - super(itemView); - - mRoot = itemView.findViewById(R.id.root); - mName = itemView.findViewById(R.id.text_name); - mCheckbox = itemView.findViewById(R.id.checkbox); - } - - public void bind(CheatsActivity activity, Cheat cheat, int position) { - mCheckbox.setOnCheckedChangeListener(null); - - mViewModel = new ViewModelProvider(activity).get(CheatsViewModel.class); - mCheat = cheat; - mPosition = position; - - mName.setText(mCheat.getName()); - mCheckbox.setChecked(mCheat.getEnabled()); - - mRoot.setOnClickListener(this); - mCheckbox.setOnCheckedChangeListener(this); - } - - public void onClick(View root) { - mViewModel.setSelectedCheat(mCheat, mPosition); - mViewModel.openDetailsView(); - } - - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mCheat.setEnabled(isChecked); - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsActivity.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsActivity.java deleted file mode 100644 index a36bf427c..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsActivity.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.citra.citra_emu.features.cheats.ui; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.view.ViewCompat; -import androidx.lifecycle.ViewModelProvider; -import androidx.slidingpanelayout.widget.SlidingPaneLayout; - -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.cheats.model.Cheat; -import org.citra.citra_emu.features.cheats.model.CheatsViewModel; -import org.citra.citra_emu.ui.TwoPaneOnBackPressedCallback; - -public class CheatsActivity extends AppCompatActivity - implements SlidingPaneLayout.PanelSlideListener { - private CheatsViewModel mViewModel; - - private SlidingPaneLayout mSlidingPaneLayout; - private View mCheatList; - private View mCheatDetails; - - private View mCheatListLastFocus; - private View mCheatDetailsLastFocus; - - public static void launch(Context context) { - Intent intent = new Intent(context, CheatsActivity.class); - context.startActivity(intent); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mViewModel = new ViewModelProvider(this).get(CheatsViewModel.class); - mViewModel.load(); - - setContentView(R.layout.activity_cheats); - - mSlidingPaneLayout = findViewById(R.id.sliding_pane_layout); - mCheatList = findViewById(R.id.cheat_list); - mCheatDetails = findViewById(R.id.cheat_details); - - mCheatListLastFocus = mCheatList; - mCheatDetailsLastFocus = mCheatDetails; - - mSlidingPaneLayout.addPanelSlideListener(this); - - getOnBackPressedDispatcher().addCallback(this, - new TwoPaneOnBackPressedCallback(mSlidingPaneLayout)); - - mViewModel.getSelectedCheat().observe(this, this::onSelectedCheatChanged); - mViewModel.getIsEditing().observe(this, this::onIsEditingChanged); - onSelectedCheatChanged(mViewModel.getSelectedCheat().getValue()); - - mViewModel.getOpenDetailsViewEvent().observe(this, this::openDetailsView); - - // Show "Up" button in the action bar for navigation - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.menu_settings, menu); - - return true; - } - - @Override - protected void onStop() { - super.onStop(); - - mViewModel.saveIfNeeded(); - } - - @Override - public void onPanelSlide(@NonNull View panel, float slideOffset) { - } - - @Override - public void onPanelOpened(@NonNull View panel) { - boolean rtl = ViewCompat.getLayoutDirection(panel) == ViewCompat.LAYOUT_DIRECTION_RTL; - mCheatDetailsLastFocus.requestFocus(rtl ? View.FOCUS_LEFT : View.FOCUS_RIGHT); - } - - @Override - public void onPanelClosed(@NonNull View panel) { - boolean rtl = ViewCompat.getLayoutDirection(panel) == ViewCompat.LAYOUT_DIRECTION_RTL; - mCheatListLastFocus.requestFocus(rtl ? View.FOCUS_RIGHT : View.FOCUS_LEFT); - } - - private void onIsEditingChanged(boolean isEditing) { - if (isEditing) { - mSlidingPaneLayout.setLockMode(SlidingPaneLayout.LOCK_MODE_UNLOCKED); - } - } - - private void onSelectedCheatChanged(Cheat selectedCheat) { - boolean cheatSelected = selectedCheat != null || mViewModel.getIsEditing().getValue(); - - if (!cheatSelected && mSlidingPaneLayout.isOpen()) { - mSlidingPaneLayout.close(); - } - - mSlidingPaneLayout.setLockMode(cheatSelected ? - SlidingPaneLayout.LOCK_MODE_UNLOCKED : SlidingPaneLayout.LOCK_MODE_LOCKED_CLOSED); - } - - public void onListViewFocusChange(boolean hasFocus) { - if (hasFocus) { - mCheatListLastFocus = mCheatList.findFocus(); - if (mCheatListLastFocus == null) - throw new NullPointerException(); - - mSlidingPaneLayout.close(); - } - } - - public void onDetailsViewFocusChange(boolean hasFocus) { - if (hasFocus) { - mCheatDetailsLastFocus = mCheatDetails.findFocus(); - if (mCheatDetailsLastFocus == null) - throw new NullPointerException(); - - mSlidingPaneLayout.open(); - } - } - - @Override - public boolean onSupportNavigateUp() { - onBackPressed(); - return true; - } - - private void openDetailsView(boolean open) { - if (open) { - mSlidingPaneLayout.open(); - } - } - - public static void setOnFocusChangeListenerRecursively(@NonNull View view, - View.OnFocusChangeListener listener) { - view.setOnFocusChangeListener(listener); - - if (view instanceof ViewGroup) { - ViewGroup viewGroup = (ViewGroup) view; - for (int i = 0; i < viewGroup.getChildCount(); i++) { - View child = viewGroup.getChildAt(i); - setOnFocusChangeListenerRecursively(child, listener); - } - } - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsAdapter.java b/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsAdapter.java deleted file mode 100644 index 9cb2ce8d8..000000000 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/cheats/ui/CheatsAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.citra.citra_emu.features.cheats.ui; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.cheats.model.Cheat; -import org.citra.citra_emu.features.cheats.model.CheatsViewModel; - -public class CheatsAdapter extends RecyclerView.Adapter { - private final CheatsActivity mActivity; - private final CheatsViewModel mViewModel; - - public CheatsAdapter(CheatsActivity activity, CheatsViewModel viewModel) { - mActivity = activity; - mViewModel = viewModel; - - mViewModel.getCheatAddedEvent().observe(activity, (position) -> { - if (position != null) { - notifyItemInserted(position); - } - }); - - mViewModel.getCheatUpdatedEvent().observe(activity, (position) -> { - if (position != null) { - notifyItemChanged(position); - } - }); - - mViewModel.getCheatDeletedEvent().observe(activity, (position) -> { - if (position != null) { - notifyItemRemoved(position); - } - }); - } - - @NonNull - @Override - public CheatViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - LayoutInflater inflater = LayoutInflater.from(parent.getContext()); - - View cheatView = inflater.inflate(R.layout.list_item_cheat, parent, false); - addViewListeners(cheatView); - return new CheatViewHolder(cheatView); - } - - @Override - public void onBindViewHolder(@NonNull CheatViewHolder holder, int position) { - holder.bind(mActivity, getItemAt(position), position); - } - - @Override - public int getItemCount() { - return mViewModel.getCheats().length; - } - - private void addViewListeners(View view) { - // On a portrait phone screen (or other narrow screen), only one of the two panes are shown - // at the same time. If the user is navigating using a d-pad and moves focus to an element - // in the currently hidden pane, we need to manually show that pane. - CheatsActivity.setOnFocusChangeListenerRecursively(view, - (v, hasFocus) -> mActivity.onListViewFocusChange(hasFocus)); - } - - private Cheat getItemAt(int position) { - return mViewModel.getCheats()[position]; - } -} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/NativeLibrary.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java similarity index 97% rename from src/android/app/src/main/java/org/citra/citra_emu/NativeLibrary.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java index baff99dc8..e15612a36 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/NativeLibrary.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java @@ -4,7 +4,7 @@ * Refer to the license.txt file included. */ -package org.citra.citra_emu; +package org.yuzu.yuzu_emu; import android.app.Activity; import android.app.Dialog; @@ -24,9 +24,9 @@ import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; -import org.citra.citra_emu.activities.EmulationActivity; -import org.citra.citra_emu.utils.EmulationMenuSettings; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.activities.EmulationActivity; +import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; +import org.yuzu.yuzu_emu.utils.Log; import java.lang.ref.WeakReference; import java.util.Objects; @@ -314,7 +314,7 @@ public final class NativeLibrary { } public static boolean isPortraitMode() { - return CitraApplication.getAppContext().getResources().getConfiguration().orientation == + return YuzuApplication.getAppContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; } @@ -420,10 +420,10 @@ public final class NativeLibrary { alertPromptButton = 0; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - params.leftMargin = params.rightMargin = CitraApplication.getAppContext().getResources().getDimensionPixelSize(R.dimen.dialog_margin); + params.leftMargin = params.rightMargin = YuzuApplication.getAppContext().getResources().getDimensionPixelSize(R.dimen.dialog_margin); // Set up the input - alertPromptEditText = new EditText(CitraApplication.getAppContext()); + alertPromptEditText = new EditText(YuzuApplication.getAppContext()); alertPromptEditText.setText(text); alertPromptEditText.setSingleLine(); alertPromptEditText.setLayoutParams(params); diff --git a/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/YuzuApplication.java similarity index 86% rename from src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/YuzuApplication.java index 41ac7e27c..700916f87 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/YuzuApplication.java @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -package org.citra.citra_emu; +package org.yuzu.yuzu_emu; import android.app.Application; import android.app.NotificationChannel; @@ -10,13 +10,13 @@ import android.app.NotificationManager; import android.content.Context; import android.os.Build; -import org.citra.citra_emu.model.GameDatabase; -import org.citra.citra_emu.utils.DirectoryInitialization; -import org.citra.citra_emu.utils.PermissionsHandler; +import org.yuzu.yuzu_emu.model.GameDatabase; +import org.yuzu.yuzu_emu.utils.DirectoryInitialization; +import org.yuzu.yuzu_emu.utils.PermissionsHandler; -public class CitraApplication extends Application { +public class YuzuApplication extends Application { public static GameDatabase databaseHelper; - private static CitraApplication application; + private static YuzuApplication application; private void createNotificationChannel() { // Create the NotificationChannel, but only on API 26+ because diff --git a/src/android/app/src/main/java/org/citra/citra_emu/activities/CustomFilePickerActivity.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/CustomFilePickerActivity.java similarity index 93% rename from src/android/app/src/main/java/org/citra/citra_emu/activities/CustomFilePickerActivity.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/CustomFilePickerActivity.java index 3083286e2..a79780814 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/activities/CustomFilePickerActivity.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/CustomFilePickerActivity.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.activities; +package org.yuzu.yuzu_emu.activities; import android.content.Intent; import android.os.Environment; @@ -8,7 +8,7 @@ import androidx.annotation.Nullable; import com.nononsenseapps.filepicker.AbstractFilePickerFragment; import com.nononsenseapps.filepicker.FilePickerActivity; -import org.citra.citra_emu.fragments.CustomFilePickerFragment; +import org.yuzu.yuzu_emu.fragments.CustomFilePickerFragment; import java.io.File; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/activities/EmulationActivity.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.java similarity index 54% rename from src/android/app/src/main/java/org/citra/citra_emu/activities/EmulationActivity.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.java index 47ef0fd23..cd64a3298 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/activities/EmulationActivity.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.java @@ -1,9 +1,10 @@ -package org.citra.citra_emu.activities; +package org.yuzu.yuzu_emu.activities; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; @@ -15,37 +16,31 @@ import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; -import android.widget.CheckBox; import android.widget.SeekBar; import android.widget.TextView; import androidx.annotation.IntDef; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationManagerCompat; +import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; -import org.citra.citra_emu.CitraApplication; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.cheats.ui.CheatsActivity; -import org.citra.citra_emu.features.settings.model.view.InputBindingSetting; -import org.citra.citra_emu.features.settings.ui.SettingsActivity; -import org.citra.citra_emu.features.settings.utils.SettingsFile; -import org.citra.citra_emu.camera.StillImageCameraHelper; -import org.citra.citra_emu.fragments.EmulationFragment; -import org.citra.citra_emu.ui.main.MainActivity; -import org.citra.citra_emu.utils.ControllerMappingHelper; -import org.citra.citra_emu.utils.EmulationMenuSettings; -import org.citra.citra_emu.utils.FileBrowserHelper; -import org.citra.citra_emu.utils.FileUtil; -import org.citra.citra_emu.utils.ForegroundService; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity; +import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile; +import org.yuzu.yuzu_emu.fragments.EmulationFragment; +import org.yuzu.yuzu_emu.fragments.MenuFragment; +import org.yuzu.yuzu_emu.utils.ControllerMappingHelper; +import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; +import org.yuzu.yuzu_emu.utils.ForegroundService; -import java.io.File; -import java.io.IOException; import java.lang.annotation.Retention; -import java.util.Collections; import java.util.List; import static android.Manifest.permission.CAMERA; @@ -53,6 +48,10 @@ import static android.Manifest.permission.RECORD_AUDIO; import static java.lang.annotation.RetentionPolicy.SOURCE; public final class EmulationActivity extends AppCompatActivity { + private static final String BACKSTACK_NAME_MENU = "menu"; + + private static final String BACKSTACK_NAME_SUBMENU = "submenu"; + public static final String EXTRA_SELECTED_GAME = "SelectedGame"; public static final String EXTRA_SELECTED_TITLE = "SelectedTitle"; public static final int MENU_ACTION_EDIT_CONTROLS_PLACEMENT = 0; @@ -60,61 +59,10 @@ public final class EmulationActivity extends AppCompatActivity { public static final int MENU_ACTION_ADJUST_SCALE = 2; public static final int MENU_ACTION_EXIT = 3; public static final int MENU_ACTION_SHOW_FPS = 4; - public static final int MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE = 5; - public static final int MENU_ACTION_SCREEN_LAYOUT_PORTRAIT = 6; - public static final int MENU_ACTION_SCREEN_LAYOUT_SINGLE = 7; - public static final int MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE = 8; - public static final int MENU_ACTION_SWAP_SCREENS = 9; - public static final int MENU_ACTION_RESET_OVERLAY = 10; - public static final int MENU_ACTION_SHOW_OVERLAY = 11; - public static final int MENU_ACTION_OPEN_SETTINGS = 12; - public static final int MENU_ACTION_LOAD_AMIIBO = 13; - public static final int MENU_ACTION_REMOVE_AMIIBO = 14; - public static final int MENU_ACTION_JOYSTICK_REL_CENTER = 15; - public static final int MENU_ACTION_DPAD_SLIDE_ENABLE = 16; - public static final int MENU_ACTION_OPEN_CHEATS = 17; - - public static final int REQUEST_SELECT_AMIIBO = 2; + public static final int MENU_ACTION_RESET_OVERLAY = 6; + public static final int MENU_ACTION_SHOW_OVERLAY = 7; + public static final int MENU_ACTION_OPEN_SETTINGS = 8; private static final int EMULATION_RUNNING_NOTIFICATION = 0x1000; - private static SparseIntArray buttonsActionsMap = new SparseIntArray(); - - static { - buttonsActionsMap.append(R.id.menu_emulation_edit_layout, - EmulationActivity.MENU_ACTION_EDIT_CONTROLS_PLACEMENT); - buttonsActionsMap.append(R.id.menu_emulation_toggle_controls, - EmulationActivity.MENU_ACTION_TOGGLE_CONTROLS); - buttonsActionsMap - .append(R.id.menu_emulation_adjust_scale, EmulationActivity.MENU_ACTION_ADJUST_SCALE); - buttonsActionsMap.append(R.id.menu_emulation_show_fps, - EmulationActivity.MENU_ACTION_SHOW_FPS); - buttonsActionsMap.append(R.id.menu_screen_layout_landscape, - EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE); - buttonsActionsMap.append(R.id.menu_screen_layout_portrait, - EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_PORTRAIT); - buttonsActionsMap.append(R.id.menu_screen_layout_single, - EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_SINGLE); - buttonsActionsMap.append(R.id.menu_screen_layout_sidebyside, - EmulationActivity.MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE); - buttonsActionsMap.append(R.id.menu_emulation_swap_screens, - EmulationActivity.MENU_ACTION_SWAP_SCREENS); - buttonsActionsMap - .append(R.id.menu_emulation_reset_overlay, EmulationActivity.MENU_ACTION_RESET_OVERLAY); - buttonsActionsMap - .append(R.id.menu_emulation_show_overlay, EmulationActivity.MENU_ACTION_SHOW_OVERLAY); - buttonsActionsMap - .append(R.id.menu_emulation_open_settings, EmulationActivity.MENU_ACTION_OPEN_SETTINGS); - buttonsActionsMap - .append(R.id.menu_emulation_amiibo_load, EmulationActivity.MENU_ACTION_LOAD_AMIIBO); - buttonsActionsMap - .append(R.id.menu_emulation_amiibo_remove, EmulationActivity.MENU_ACTION_REMOVE_AMIIBO); - buttonsActionsMap.append(R.id.menu_emulation_joystick_rel_center, - EmulationActivity.MENU_ACTION_JOYSTICK_REL_CENTER); - buttonsActionsMap.append(R.id.menu_emulation_dpad_slide_enable, - EmulationActivity.MENU_ACTION_DPAD_SLIDE_ENABLE); - buttonsActionsMap - .append(R.id.menu_emulation_open_cheats, EmulationActivity.MENU_ACTION_OPEN_CHEATS); - } - private View mDecorView; private EmulationFragment mEmulationFragment; private SharedPreferences mPreferences; @@ -124,6 +72,8 @@ public final class EmulationActivity extends AppCompatActivity { private String mSelectedTitle; private String mPath; + private boolean mMenuVisible; + public static void launch(FragmentActivity activity, String path, String title) { Intent launcher = new Intent(activity, EmulationActivity.class); @@ -172,7 +122,7 @@ public final class EmulationActivity extends AppCompatActivity { // Set these options now so that the SurfaceView the game renders into is the right size. enableFullscreenImmersive(); - setTheme(R.style.CitraEmulationBase); + setTheme(R.style.YuzuEmulationBase); setContentView(R.layout.activity_emulation); @@ -217,52 +167,7 @@ public final class EmulationActivity extends AppCompatActivity { @Override public void onBackPressed() { - NativeLibrary.PauseEmulation(); - new AlertDialog.Builder(this) - .setTitle(R.string.emulation_close_game) - .setMessage(R.string.emulation_close_game_message) - .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> - { - mEmulationFragment.stopEmulation(); - finish(); - }) - .setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> - NativeLibrary.UnPauseEmulation()) - .setOnCancelListener(dialogInterface -> - NativeLibrary.UnPauseEmulation()) - .create() - .show(); - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - switch (requestCode) { - case NativeLibrary.REQUEST_CODE_NATIVE_CAMERA: - if (grantResults[0] != PackageManager.PERMISSION_GRANTED && - shouldShowRequestPermissionRationale(CAMERA)) { - new AlertDialog.Builder(this) - .setTitle(R.string.camera) - .setMessage(R.string.camera_permission_needed) - .setPositiveButton(android.R.string.ok, null) - .show(); - } - NativeLibrary.CameraPermissionResult(grantResults[0] == PackageManager.PERMISSION_GRANTED); - break; - case NativeLibrary.REQUEST_CODE_NATIVE_MIC: - if (grantResults[0] != PackageManager.PERMISSION_GRANTED && - shouldShowRequestPermissionRationale(RECORD_AUDIO)) { - new AlertDialog.Builder(this) - .setTitle(R.string.microphone) - .setMessage(R.string.microphone_permission_needed) - .setPositiveButton(android.R.string.ok, null) - .show(); - } - NativeLibrary.MicPermissionResult(grantResults[0] == PackageManager.PERMISSION_GRANTED); - break; - default: - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - break; - } + toggleMenu(); } private void enableFullscreenImmersive() { @@ -276,179 +181,13 @@ public final class EmulationActivity extends AppCompatActivity { View.SYSTEM_UI_FLAG_IMMERSIVE); } - @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_emulation, menu); - - int layoutOptionMenuItem = R.id.menu_screen_layout_landscape; - switch (EmulationMenuSettings.getLandscapeScreenLayout()) { - case EmulationMenuSettings.LayoutOption_SingleScreen: - layoutOptionMenuItem = R.id.menu_screen_layout_single; - break; - case EmulationMenuSettings.LayoutOption_SideScreen: - layoutOptionMenuItem = R.id.menu_screen_layout_sidebyside; - break; - case EmulationMenuSettings.LayoutOption_MobilePortrait: - layoutOptionMenuItem = R.id.menu_screen_layout_portrait; - break; - } - - menu.findItem(layoutOptionMenuItem).setChecked(true); - menu.findItem(R.id.menu_emulation_joystick_rel_center).setChecked(EmulationMenuSettings.getJoystickRelCenter()); - menu.findItem(R.id.menu_emulation_dpad_slide_enable).setChecked(EmulationMenuSettings.getDpadSlideEnable()); - menu.findItem(R.id.menu_emulation_show_fps).setChecked(EmulationMenuSettings.getShowFps()); - menu.findItem(R.id.menu_emulation_swap_screens).setChecked(EmulationMenuSettings.getSwapScreens()); - menu.findItem(R.id.menu_emulation_show_overlay).setChecked(EmulationMenuSettings.getShowOverlay()); - - return true; - } - - private void DisplaySavestateWarning() { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext()); - if (preferences.getBoolean("savestateWarningShown", false)) { - return; - } - - LayoutInflater inflater = mEmulationFragment.requireActivity().getLayoutInflater(); - View view = inflater.inflate(R.layout.dialog_checkbox, null); - CheckBox checkBox = view.findViewById(R.id.checkBox); - - new AlertDialog.Builder(this) - .setTitle(R.string.savestate_warning_title) - .setMessage(R.string.savestate_warning_message) - .setView(view) - .setPositiveButton(android.R.string.ok, (dialog, which) -> { - preferences.edit().putBoolean("savestateWarningShown", checkBox.isChecked()).apply(); - }) - .show(); - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - super.onPrepareOptionsMenu(menu); - menu.findItem(R.id.menu_emulation_save_state).setVisible(false); - menu.findItem(R.id.menu_emulation_load_state).setVisible(false); - return true; - } - - @SuppressWarnings("WrongConstant") - @Override - public boolean onOptionsItemSelected(MenuItem item) { - int action = buttonsActionsMap.get(item.getItemId(), -1); - + public void handleMenuAction(int action) { switch (action) { - // Edit the placement of the controls - case MENU_ACTION_EDIT_CONTROLS_PLACEMENT: - editControlsPlacement(); - break; - - // Enable/Disable specific buttons or the entire input overlay. - case MENU_ACTION_TOGGLE_CONTROLS: - toggleControls(); - break; - - // Adjust the scale of the overlay controls. - case MENU_ACTION_ADJUST_SCALE: - adjustScale(); - break; - - // Toggle the visibility of the Performance stats TextView - case MENU_ACTION_SHOW_FPS: { - final boolean isEnabled = !EmulationMenuSettings.getShowFps(); - EmulationMenuSettings.setShowFps(isEnabled); - item.setChecked(isEnabled); - - mEmulationFragment.updateShowFpsOverlay(); - break; - } - // Sets the screen layout to Landscape - case MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE: - changeScreenOrientation(EmulationMenuSettings.LayoutOption_MobileLandscape, item); - break; - - // Sets the screen layout to Portrait - case MENU_ACTION_SCREEN_LAYOUT_PORTRAIT: - changeScreenOrientation(EmulationMenuSettings.LayoutOption_MobilePortrait, item); - break; - - // Sets the screen layout to Single - case MENU_ACTION_SCREEN_LAYOUT_SINGLE: - changeScreenOrientation(EmulationMenuSettings.LayoutOption_SingleScreen, item); - break; - - // Sets the screen layout to Side by Side - case MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE: - changeScreenOrientation(EmulationMenuSettings.LayoutOption_SideScreen, item); - break; - - // Swap the top and bottom screen locations - case MENU_ACTION_SWAP_SCREENS: { - final boolean isEnabled = !EmulationMenuSettings.getSwapScreens(); - EmulationMenuSettings.setSwapScreens(isEnabled); - item.setChecked(isEnabled); - break; - } - - // Reset overlay placement - case MENU_ACTION_RESET_OVERLAY: - resetOverlay(); - break; - - // Show or hide overlay - case MENU_ACTION_SHOW_OVERLAY: { - final boolean isEnabled = !EmulationMenuSettings.getShowOverlay(); - EmulationMenuSettings.setShowOverlay(isEnabled); - item.setChecked(isEnabled); - - mEmulationFragment.refreshInputOverlay(); - break; - } - case MENU_ACTION_EXIT: mEmulationFragment.stopEmulation(); finish(); break; - - case MENU_ACTION_OPEN_SETTINGS: - SettingsActivity.launch(this, SettingsFile.FILE_NAME_CONFIG, ""); - break; - - case MENU_ACTION_LOAD_AMIIBO: - FileBrowserHelper.openFilePicker(this, REQUEST_SELECT_AMIIBO, - R.string.select_amiibo, - Collections.singletonList("bin"), false); - break; - - case MENU_ACTION_REMOVE_AMIIBO: - RemoveAmiibo(); - break; - - case MENU_ACTION_JOYSTICK_REL_CENTER: - final boolean isJoystickRelCenterEnabled = !EmulationMenuSettings.getJoystickRelCenter(); - EmulationMenuSettings.setJoystickRelCenter(isJoystickRelCenterEnabled); - item.setChecked(isJoystickRelCenterEnabled); - break; - - case MENU_ACTION_DPAD_SLIDE_ENABLE: - final boolean isDpadSlideEnabled = !EmulationMenuSettings.getDpadSlideEnable(); - EmulationMenuSettings.setDpadSlideEnable(isDpadSlideEnabled); - item.setChecked(isDpadSlideEnabled); - break; - - case MENU_ACTION_OPEN_CHEATS: - CheatsActivity.launch(this); - break; } - - return true; - } - - private void changeScreenOrientation(int layoutOption, MenuItem item) { - item.setChecked(true); - NativeLibrary.NotifyOrientationChange(layoutOption, getWindowManager().getDefaultDisplay() - .getRotation()); - EmulationMenuSettings.setLandscapeScreenLayout(layoutOption); } private void editControlsPlacement() { @@ -462,6 +201,11 @@ public final class EmulationActivity extends AppCompatActivity { // Gets button presses @Override public boolean dispatchKeyEvent(KeyEvent event) { + if (mMenuVisible || event.getKeyCode() == KeyEvent.KEYCODE_BACK) + { + return super.dispatchKeyEvent(event); + } + int action; int button = mPreferences.getInt(InputBindingSetting.getInputButtonKey(event.getKeyCode()), event.getKeyCode()); @@ -492,49 +236,6 @@ public final class EmulationActivity extends AppCompatActivity { return NativeLibrary.onGamePadEvent(input.getDescriptor(), button, action); } - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent result) { - super.onActivityResult(requestCode, resultCode, result); - switch (requestCode) { - case StillImageCameraHelper.REQUEST_CAMERA_FILE_PICKER: - StillImageCameraHelper.OnFilePickerResult(resultCode == RESULT_OK ? result : null); - break; - case REQUEST_SELECT_AMIIBO: - // If the user picked a file, as opposed to just backing out. - if (resultCode == MainActivity.RESULT_OK) { - String[] selectedFiles = FileBrowserHelper.getSelectedFiles(result); - if (selectedFiles == null) - return; - - onAmiiboSelected(selectedFiles[0]); - } - break; - } - } - - private void onAmiiboSelected(String selectedFile) { - File file = new File(selectedFile); - boolean success = false; - try { - byte[] bytes = FileUtil.getBytesFromFile(file); - } catch (IOException e) { - e.printStackTrace(); - } - - if (!success) { - new AlertDialog.Builder(this) - .setTitle(R.string.amiibo_load_error) - .setMessage(R.string.amiibo_load_error_message) - .setPositiveButton(android.R.string.ok, null) - .create() - .show(); - } - } - - private void RemoveAmiibo() { - - } - private void toggleControls() { final SharedPreferences.Editor editor = mPreferences.edit(); boolean[] enabledButtons = new boolean[14]; @@ -630,8 +331,59 @@ public final class EmulationActivity extends AppCompatActivity { .show(); } + private static boolean areCoordinatesOutside(@Nullable View view, float x, float y) + { + if (view == null) + { + return true; + } + + Rect viewBounds = new Rect(); + view.getGlobalVisibleRect(viewBounds); + return !viewBounds.contains(Math.round(x), Math.round(y)); + } + + @Override + public boolean dispatchTouchEvent(MotionEvent event) + { + if (event.getActionMasked() == MotionEvent.ACTION_DOWN) + { + boolean anyMenuClosed = false; + + Fragment submenu = getSupportFragmentManager().findFragmentById(R.id.frame_submenu); + if (submenu != null && areCoordinatesOutside(submenu.getView(), event.getX(), event.getY())) + { + closeSubmenu(); + submenu = null; + anyMenuClosed = true; + } + + if (submenu == null) + { + Fragment menu = getSupportFragmentManager().findFragmentById(R.id.frame_menu); + if (menu != null && areCoordinatesOutside(menu.getView(), event.getX(), event.getY())) + { + closeMenu(); + anyMenuClosed = true; + } + } + + if (anyMenuClosed) + { + return true; + } + } + + return super.dispatchTouchEvent(event); + } + @Override public boolean dispatchGenericMotionEvent(MotionEvent event) { + if (mMenuVisible) + { + return false; + } + if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0)) { return super.dispatchGenericMotionEvent(event); } @@ -747,9 +499,39 @@ public final class EmulationActivity extends AppCompatActivity { @Retention(SOURCE) @IntDef({MENU_ACTION_EDIT_CONTROLS_PLACEMENT, MENU_ACTION_TOGGLE_CONTROLS, MENU_ACTION_ADJUST_SCALE, - MENU_ACTION_EXIT, MENU_ACTION_SHOW_FPS, MENU_ACTION_SCREEN_LAYOUT_LANDSCAPE, - MENU_ACTION_SCREEN_LAYOUT_PORTRAIT, MENU_ACTION_SCREEN_LAYOUT_SINGLE, MENU_ACTION_SCREEN_LAYOUT_SIDEBYSIDE, - MENU_ACTION_SWAP_SCREENS, MENU_ACTION_RESET_OVERLAY, MENU_ACTION_SHOW_OVERLAY, MENU_ACTION_OPEN_SETTINGS}) + MENU_ACTION_EXIT, MENU_ACTION_SHOW_FPS, MENU_ACTION_RESET_OVERLAY, MENU_ACTION_SHOW_OVERLAY, MENU_ACTION_OPEN_SETTINGS}) public @interface MenuAction { } + + private boolean closeSubmenu() + { + return getSupportFragmentManager().popBackStackImmediate(BACKSTACK_NAME_SUBMENU, + FragmentManager.POP_BACK_STACK_INCLUSIVE); + } + + private boolean closeMenu() + { + mMenuVisible = false; + return getSupportFragmentManager().popBackStackImmediate(BACKSTACK_NAME_MENU, + FragmentManager.POP_BACK_STACK_INCLUSIVE); + } + + private void toggleMenu() + { + if (!closeMenu()) { + // Removing the menu failed, so that means it wasn't visible. Add it. + Fragment fragment = MenuFragment.newInstance(); + getSupportFragmentManager().beginTransaction() + .setCustomAnimations( + R.animator.menu_slide_in_from_start, + R.animator.menu_slide_out_to_start, + R.animator.menu_slide_in_from_start, + R.animator.menu_slide_out_to_start) + .add(R.id.frame_menu, fragment) + .addToBackStack(BACKSTACK_NAME_MENU) + .commit(); + mMenuVisible = true; + } + } + } diff --git a/src/android/app/src/main/java/org/citra/citra_emu/adapters/GameAdapter.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.java similarity index 95% rename from src/android/app/src/main/java/org/citra/citra_emu/adapters/GameAdapter.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.java index bc791638a..fa785741b 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/adapters/GameAdapter.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.adapters; +package org.yuzu.yuzu_emu.adapters; import android.database.Cursor; import android.database.DataSetObserver; @@ -16,13 +16,13 @@ import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentActivity; import androidx.recyclerview.widget.RecyclerView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.activities.EmulationActivity; -import org.citra.citra_emu.model.GameDatabase; -import org.citra.citra_emu.ui.DividerItemDecoration; -import org.citra.citra_emu.utils.Log; -import org.citra.citra_emu.utils.PicassoUtils; -import org.citra.citra_emu.viewholders.GameViewHolder; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.activities.EmulationActivity; +import org.yuzu.yuzu_emu.model.GameDatabase; +import org.yuzu.yuzu_emu.ui.DividerItemDecoration; +import org.yuzu.yuzu_emu.utils.Log; +import org.yuzu.yuzu_emu.utils.PicassoUtils; +import org.yuzu.yuzu_emu.viewholders.GameViewHolder; import java.nio.file.Path; import java.nio.file.Paths; @@ -99,7 +99,7 @@ public final class GameAdapter extends RecyclerView.Adapter impl holder.regions = mCursor.getString(GameDatabase.GAME_COLUMN_REGIONS); holder.company = mCursor.getString(GameDatabase.GAME_COLUMN_COMPANY); - final int backgroundColorId = isValidGame(holder.path) ? R.color.card_view_background : R.color.card_view_disabled; + final int backgroundColorId = isValidGame(holder.path) ? R.color.view_background : R.color.view_disabled; View itemView = holder.getItemView(); itemView.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), backgroundColorId)); } else { diff --git a/src/android/app/src/main/java/org/citra/citra_emu/applets/SoftwareKeyboard.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/SoftwareKeyboard.java similarity index 94% rename from src/android/app/src/main/java/org/citra/citra_emu/applets/SoftwareKeyboard.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/SoftwareKeyboard.java index 7be5f6d97..4aeb41472 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/applets/SoftwareKeyboard.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/applets/SoftwareKeyboard.java @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -package org.citra.citra_emu.applets; +package org.yuzu.yuzu_emu.applets; import android.app.Activity; import android.app.Dialog; @@ -19,11 +19,11 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; -import org.citra.citra_emu.CitraApplication; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.activities.EmulationActivity; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.YuzuApplication; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.activities.EmulationActivity; +import org.yuzu.yuzu_emu.utils.Log; import java.util.Objects; @@ -107,14 +107,14 @@ public final class SoftwareKeyboard { FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.leftMargin = params.rightMargin = - CitraApplication.getAppContext().getResources().getDimensionPixelSize( + YuzuApplication.getAppContext().getResources().getDimensionPixelSize( R.dimen.dialog_margin); KeyboardConfig config = Objects.requireNonNull( (KeyboardConfig) Objects.requireNonNull(getArguments()).getSerializable("config")); // Set up the input - EditText editText = new EditText(CitraApplication.getAppContext()); + EditText editText = new EditText(YuzuApplication.getAppContext()); editText.setHint(config.hint_text); editText.setSingleLine(!config.multiline_mode); editText.setLayoutParams(params); @@ -254,7 +254,7 @@ public final class SoftwareKeyboard { public static void ShowError(String error) { NativeLibrary.displayAlertMsg( - CitraApplication.getAppContext().getResources().getString(R.string.software_keyboard), + YuzuApplication.getAppContext().getResources().getString(R.string.software_keyboard), error, false); } diff --git a/src/android/app/src/main/java/org/citra/citra_emu/dialogs/MotionAlertDialog.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/MotionAlertDialog.java similarity index 97% rename from src/android/app/src/main/java/org/citra/citra_emu/dialogs/MotionAlertDialog.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/MotionAlertDialog.java index 0f10f1858..874c1acbc 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/dialogs/MotionAlertDialog.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/MotionAlertDialog.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.dialogs; +package org.yuzu.yuzu_emu.dialogs; import android.content.Context; import android.view.InputDevice; @@ -8,8 +8,8 @@ import android.view.MotionEvent; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; -import org.citra.citra_emu.features.settings.model.view.InputBindingSetting; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting; +import org.yuzu.yuzu_emu.utils.Log; import java.util.ArrayList; import java.util.List; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/BooleanSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.java similarity index 89% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/BooleanSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.java index 932dcf1d3..965f1b2a2 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/BooleanSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.model; +package org.yuzu.yuzu_emu.features.settings.model; public final class BooleanSetting extends Setting { private boolean mValue; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/FloatSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/FloatSetting.java similarity index 89% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/FloatSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/FloatSetting.java index 275f0ecea..9b9b60092 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/FloatSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/FloatSetting.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.model; +package org.yuzu.yuzu_emu.features.settings.model; public final class FloatSetting extends Setting { private float mValue; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/IntSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.java similarity index 88% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/IntSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.java index f712e5bfa..001f27579 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/IntSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.model; +package org.yuzu.yuzu_emu.features.settings.model; public final class IntSetting extends Setting { private int mValue; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/Setting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java similarity index 88% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/Setting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java index b762847c9..28003078a 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/Setting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java @@ -1,7 +1,7 @@ -package org.citra.citra_emu.features.settings.model; +package org.yuzu.yuzu_emu.features.settings.model; /** - * Abstraction for a setting item as read from / written to Citra's configuration ini files. + * Abstraction for a setting item as read from / written to yuzu's configuration ini files. * These files generally consist of a key/value pair, though the type of value is ambiguous and * must be inferred at read-time. The type of value determines which child of this class is used * to represent the Setting. diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/SettingSection.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.java similarity index 96% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/SettingSection.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.java index 0a291aa6b..da9d40c78 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/SettingSection.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.model; +package org.yuzu.yuzu_emu.features.settings.model; import java.util.HashMap; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/Settings.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.java similarity index 86% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/Settings.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.java index 9684966f2..efde45ee9 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/Settings.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.java @@ -1,11 +1,11 @@ -package org.citra.citra_emu.features.settings.model; +package org.yuzu.yuzu_emu.features.settings.model; import android.text.TextUtils; -import org.citra.citra_emu.CitraApplication; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.ui.SettingsActivityView; -import org.citra.citra_emu.features.settings.utils.SettingsFile; +import org.yuzu.yuzu_emu.YuzuApplication; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivityView; +import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile; import java.util.Arrays; import java.util.HashMap; @@ -17,7 +17,6 @@ public class Settings { public static final String SECTION_PREMIUM = "Premium"; public static final String SECTION_CORE = "Core"; public static final String SECTION_SYSTEM = "System"; - public static final String SECTION_CAMERA = "Camera"; public static final String SECTION_CONTROLS = "Controls"; public static final String SECTION_RENDERER = "Renderer"; public static final String SECTION_LAYOUT = "Layout"; @@ -30,7 +29,7 @@ public class Settings { private static final Map> configFileSectionsMap = new HashMap<>(); static { - configFileSectionsMap.put(SettingsFile.FILE_NAME_CONFIG, Arrays.asList(SECTION_PREMIUM, SECTION_CORE, SECTION_SYSTEM, SECTION_CAMERA, SECTION_CONTROLS, SECTION_RENDERER, SECTION_LAYOUT, SECTION_UTILITY, SECTION_AUDIO, SECTION_DEBUG)); + configFileSectionsMap.put(SettingsFile.FILE_NAME_CONFIG, Arrays.asList(SECTION_PREMIUM, SECTION_CORE, SECTION_SYSTEM, SECTION_CONTROLS, SECTION_RENDERER, SECTION_LAYOUT, SECTION_UTILITY, SECTION_AUDIO, SECTION_DEBUG)); } /** @@ -109,7 +108,7 @@ public class Settings { public void saveSettings(SettingsActivityView view) { if (TextUtils.isEmpty(gameId)) { - view.showToastMessage(CitraApplication.getAppContext().getString(R.string.ini_saved), false); + view.showToastMessage(YuzuApplication.getAppContext().getString(R.string.ini_saved), false); for (Map.Entry> entry : configFileSectionsMap.entrySet()) { String fileName = entry.getKey(); @@ -123,7 +122,7 @@ public class Settings { } } else { // custom game settings - view.showToastMessage(CitraApplication.getAppContext().getString(R.string.gameid_saved, gameId), false); + view.showToastMessage(YuzuApplication.getAppContext().getString(R.string.gameid_saved, gameId), false); SettingsFile.saveCustomGameSettings(gameId, sections); } diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/StringSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/StringSetting.java similarity index 88% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/StringSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/StringSetting.java index b906b7010..0b5128382 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/StringSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/StringSetting.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.model; +package org.yuzu.yuzu_emu.features.settings.model; public final class StringSetting extends Setting { private String mValue; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/CheckBoxSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/CheckBoxSetting.java similarity index 82% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/CheckBoxSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/CheckBoxSetting.java index baf40709f..c5c4e14f3 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/CheckBoxSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/CheckBoxSetting.java @@ -1,11 +1,11 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.CitraApplication; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.BooleanSetting; -import org.citra.citra_emu.features.settings.model.IntSetting; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.ui.SettingsFragmentView; +import org.yuzu.yuzu_emu.YuzuApplication; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.BooleanSetting; +import org.yuzu.yuzu_emu.features.settings.model.IntSetting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragmentView; public final class CheckBoxSetting extends SettingsItem { private boolean mDefaultValue; @@ -59,7 +59,7 @@ public final class CheckBoxSetting extends SettingsItem { public IntSetting setChecked(boolean checked) { // Show a performance warning if the setting has been disabled if (mShowPerformanceWarning && !checked) { - mView.showToastMessage(CitraApplication.getAppContext().getString(R.string.performance_warning), true); + mView.showToastMessage(YuzuApplication.getAppContext().getString(R.string.performance_warning), true); } if (getSetting() == null) { diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/DateTimeSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.java similarity index 85% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/DateTimeSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.java index afc3352cc..17b2f1188 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/DateTimeSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/DateTimeSetting.java @@ -1,7 +1,7 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.StringSetting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.StringSetting; public final class DateTimeSetting extends SettingsItem { private String mDefaultValue; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/HeaderSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/HeaderSetting.java similarity index 71% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/HeaderSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/HeaderSetting.java index bac8876cd..c41ac3d54 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/HeaderSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/HeaderSetting.java @@ -1,6 +1,6 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; public final class HeaderSetting extends SettingsItem { public HeaderSetting(String key, Setting setting, int titleId, int descriptionId) { diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/InputBindingSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputBindingSetting.java similarity index 92% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/InputBindingSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputBindingSetting.java index e9141a208..4ad54421e 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/InputBindingSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputBindingSetting.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; import android.content.SharedPreferences; import android.preference.PreferenceManager; @@ -6,12 +6,12 @@ import android.view.InputDevice; import android.view.KeyEvent; import android.widget.Toast; -import org.citra.citra_emu.CitraApplication; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.StringSetting; -import org.citra.citra_emu.features.settings.utils.SettingsFile; +import org.yuzu.yuzu_emu.YuzuApplication; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.StringSetting; +import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile; public final class InputBindingSetting extends SettingsItem { private static final String INPUT_MAPPING_PREFIX = "InputMapping"; @@ -108,7 +108,7 @@ public final class InputBindingSetting extends SettingsItem { } /** - * Returns the Citra button code for the settings key. + * Returns the yuzu button code for the settings key. */ private int getButtonCode() { switch (getKey()) { @@ -145,7 +145,7 @@ public final class InputBindingSetting extends SettingsItem { } /** - * Returns the settings key for the specified Citra button code. + * Returns the settings key for the specified yuzu button code. */ private static String getButtonKey(int buttonCode) { switch (buttonCode) { @@ -201,7 +201,7 @@ public final class InputBindingSetting extends SettingsItem { */ public void removeOldMapping() { // Get preferences editor - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext()); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext()); SharedPreferences.Editor editor = preferences.edit(); // Try remove all possible keys we wrote for this setting @@ -250,7 +250,7 @@ public final class InputBindingSetting extends SettingsItem { */ private void WriteButtonMapping(String key) { // Get preferences editor - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext()); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext()); SharedPreferences.Editor editor = preferences.edit(); // Remove mapping for another setting using this input @@ -278,7 +278,7 @@ public final class InputBindingSetting extends SettingsItem { */ private void WriteAxisMapping(int axis, int value) { // Get preferences editor - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext()); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext()); SharedPreferences.Editor editor = preferences.edit(); // Cleanup old mapping @@ -302,7 +302,7 @@ public final class InputBindingSetting extends SettingsItem { */ public void onKeyInput(KeyEvent keyEvent) { if (!IsButtonMappingSupported()) { - Toast.makeText(CitraApplication.getAppContext(), R.string.input_message_analog_only, Toast.LENGTH_LONG).show(); + Toast.makeText(YuzuApplication.getAppContext(), R.string.input_message_analog_only, Toast.LENGTH_LONG).show(); return; } @@ -324,11 +324,11 @@ public final class InputBindingSetting extends SettingsItem { public void onMotionInput(InputDevice device, InputDevice.MotionRange motionRange, char axisDir) { if (!IsAxisMappingSupported()) { - Toast.makeText(CitraApplication.getAppContext(), R.string.input_message_button_only, Toast.LENGTH_LONG).show(); + Toast.makeText(YuzuApplication.getAppContext(), R.string.input_message_button_only, Toast.LENGTH_LONG).show(); return; } - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext()); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext()); SharedPreferences.Editor editor = preferences.edit(); int button; @@ -354,7 +354,7 @@ public final class InputBindingSetting extends SettingsItem { * Sets the string to use in the configuration UI for the gamepad input. */ private StringSetting setUiString(String ui) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext()); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext()); SharedPreferences.Editor editor = preferences.edit(); if (getSetting() == null) { diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/PremiumHeader.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/PremiumHeader.java similarity index 79% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/PremiumHeader.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/PremiumHeader.java index 2b1793d3e..9bf95ce51 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/PremiumHeader.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/PremiumHeader.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; public final class PremiumHeader extends SettingsItem { public PremiumHeader() { diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/PremiumSingleChoiceSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/PremiumSingleChoiceSetting.java similarity index 78% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/PremiumSingleChoiceSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/PremiumSingleChoiceSetting.java index c0560d2dc..0c4570c8d 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/PremiumSingleChoiceSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/PremiumSingleChoiceSetting.java @@ -1,12 +1,12 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import org.citra.citra_emu.CitraApplication; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.ui.SettingsFragmentView; +import org.yuzu.yuzu_emu.YuzuApplication; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragmentView; public final class PremiumSingleChoiceSetting extends SettingsItem { private int mDefaultValue; @@ -15,7 +15,7 @@ public final class PremiumSingleChoiceSetting extends SettingsItem { private int mValuesId; private SettingsFragmentView mView; - private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.getAppContext()); + private static SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.getAppContext()); public PremiumSingleChoiceSetting(String key, String section, int titleId, int descriptionId, int choicesId, int valuesId, int defaultValue, Setting setting, SettingsFragmentView view) { @@ -49,7 +49,7 @@ public final class PremiumSingleChoiceSetting extends SettingsItem { final SharedPreferences.Editor editor = mPreferences.edit(); editor.putInt(getKey(), selection); editor.apply(); - mView.showToastMessage(CitraApplication.getAppContext().getString(R.string.design_updated), false); + mView.showToastMessage(YuzuApplication.getAppContext().getString(R.string.design_updated), false); } @Override diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SettingsItem.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.java similarity index 93% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SettingsItem.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.java index 305352022..db7fb791a 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SettingsItem.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.java @@ -1,8 +1,8 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.Settings; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.Settings; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; /** * ViewModel abstraction for an Item in the RecyclerView powering SettingsFragments. diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SingleChoiceSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.java similarity index 90% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SingleChoiceSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.java index ee9d225d6..619df6d52 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SingleChoiceSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.java @@ -1,7 +1,7 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.features.settings.model.IntSetting; -import org.citra.citra_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.IntSetting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; public final class SingleChoiceSetting extends SettingsItem { private int mDefaultValue; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SliderSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SliderSetting.java similarity index 90% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SliderSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SliderSetting.java index 551b13f99..8ac25b66e 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SliderSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SliderSetting.java @@ -1,9 +1,9 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.features.settings.model.FloatSetting; -import org.citra.citra_emu.features.settings.model.IntSetting; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.features.settings.model.FloatSetting; +import org.yuzu.yuzu_emu.features.settings.model.IntSetting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.utils.Log; public final class SliderSetting extends SettingsItem { private int mMin; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/StringSingleChoiceSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/StringSingleChoiceSetting.java similarity index 92% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/StringSingleChoiceSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/StringSingleChoiceSetting.java index 057145d9d..419abfd49 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/StringSingleChoiceSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/StringSingleChoiceSetting.java @@ -1,7 +1,7 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.StringSetting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.StringSetting; public class StringSingleChoiceSetting extends SettingsItem { private String mDefaultValue; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SubmenuSetting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SubmenuSetting.java similarity index 78% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SubmenuSetting.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SubmenuSetting.java index 9d44a923f..3f5b3c8d0 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/view/SubmenuSetting.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SubmenuSetting.java @@ -1,6 +1,6 @@ -package org.citra.citra_emu.features.settings.model.view; +package org.yuzu.yuzu_emu.features.settings.model.view; -import org.citra.citra_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; public final class SubmenuSetting extends SettingsItem { private String mMenuKey; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivity.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.java similarity index 91% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivity.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.java index 23c3c4c9e..916ced382 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivity.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import android.app.ProgressDialog; import android.content.Context; @@ -15,11 +15,11 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.FragmentTransaction; import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.utils.DirectoryInitialization; -import org.citra.citra_emu.utils.DirectoryStateReceiver; -import org.citra.citra_emu.utils.EmulationMenuSettings; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.utils.DirectoryInitialization; +import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver; +import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView { private static final String ARG_MENU_TAG = "menu_tag"; @@ -172,17 +172,17 @@ public final class SettingsActivity extends AppCompatActivity implements Setting } @Override - public org.citra.citra_emu.features.settings.model.Settings getSettings() { + public org.yuzu.yuzu_emu.features.settings.model.Settings getSettings() { return mPresenter.getSettings(); } @Override - public void setSettings(org.citra.citra_emu.features.settings.model.Settings settings) { + public void setSettings(org.yuzu.yuzu_emu.features.settings.model.Settings settings) { mPresenter.setSettings(settings); } @Override - public void onSettingsFileLoaded(org.citra.citra_emu.features.settings.model.Settings settings) { + public void onSettingsFileLoaded(org.yuzu.yuzu_emu.features.settings.model.Settings settings) { SettingsFragmentView fragment = getFragment(); if (fragment != null) { diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivityPresenter.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityPresenter.java similarity index 80% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivityPresenter.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityPresenter.java index 0d63873bb..ba6b6762b 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivityPresenter.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityPresenter.java @@ -1,17 +1,17 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import android.content.IntentFilter; import android.os.Bundle; import android.text.TextUtils; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.features.settings.model.Settings; -import org.citra.citra_emu.features.settings.utils.SettingsFile; -import org.citra.citra_emu.utils.DirectoryInitialization; -import org.citra.citra_emu.utils.DirectoryInitialization.DirectoryInitializationState; -import org.citra.citra_emu.utils.DirectoryStateReceiver; -import org.citra.citra_emu.utils.Log; -import org.citra.citra_emu.utils.ThemeUtil; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.features.settings.model.Settings; +import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile; +import org.yuzu.yuzu_emu.utils.DirectoryInitialization; +import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState; +import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver; +import org.yuzu.yuzu_emu.utils.Log; +import org.yuzu.yuzu_emu.utils.ThemeUtil; import java.io.File; @@ -43,7 +43,7 @@ public final class SettingsActivityPresenter { } public void onStart() { - prepareCitraDirectoriesIfNeeded(); + prepareDirectoriesIfNeeded(); } void loadSettingsUI() { @@ -59,12 +59,13 @@ public final class SettingsActivityPresenter { mView.onSettingsFileLoaded(mSettings); } - private void prepareCitraDirectoriesIfNeeded() { + private void prepareDirectoriesIfNeeded() { File configFile = new File(DirectoryInitialization.getUserDirectory() + "/config/" + SettingsFile.FILE_NAME_CONFIG + ".ini"); if (!configFile.exists()) { - Log.error("Citra config file could not be found!"); + Log.error(DirectoryInitialization.getUserDirectory() + "/config/" + SettingsFile.FILE_NAME_CONFIG + ".ini"); + Log.error("yuzu config file could not be found!"); } - if (DirectoryInitialization.areCitraDirectoriesReady()) { + if (DirectoryInitialization.areDirectoriesReady()) { loadSettingsUI(); } else { mView.showLoading(); @@ -74,7 +75,7 @@ public final class SettingsActivityPresenter { directoryStateReceiver = new DirectoryStateReceiver(directoryInitializationState -> { - if (directoryInitializationState == DirectoryInitializationState.CITRA_DIRECTORIES_INITIALIZED) { + if (directoryInitializationState == DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED) { mView.hideLoading(); loadSettingsUI(); } else if (directoryInitializationState == DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED) { diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivityView.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.java similarity index 94% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivityView.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.java index 0d26d48a7..5aff3bcf7 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsActivityView.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.java @@ -1,9 +1,9 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import android.content.IntentFilter; -import org.citra.citra_emu.features.settings.model.Settings; -import org.citra.citra_emu.utils.DirectoryStateReceiver; +import org.yuzu.yuzu_emu.features.settings.model.Settings; +import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver; /** * Abstraction for the Activity that manages SettingsFragments. diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsAdapter.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsAdapter.java similarity index 90% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsAdapter.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsAdapter.java index bfd7c71a9..1102d6af1 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsAdapter.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsAdapter.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import android.content.Context; import android.content.DialogInterface; @@ -13,31 +13,31 @@ import android.widget.TimePicker; import androidx.appcompat.app.AlertDialog; import androidx.recyclerview.widget.RecyclerView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.dialogs.MotionAlertDialog; -import org.citra.citra_emu.features.settings.model.FloatSetting; -import org.citra.citra_emu.features.settings.model.IntSetting; -import org.citra.citra_emu.features.settings.model.StringSetting; -import org.citra.citra_emu.features.settings.model.view.CheckBoxSetting; -import org.citra.citra_emu.features.settings.model.view.DateTimeSetting; -import org.citra.citra_emu.features.settings.model.view.InputBindingSetting; -import org.citra.citra_emu.features.settings.model.view.PremiumSingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.model.view.SingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.SliderSetting; -import org.citra.citra_emu.features.settings.model.view.StringSingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.SubmenuSetting; -import org.citra.citra_emu.features.settings.ui.viewholder.CheckBoxSettingViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.DateTimeViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.HeaderViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.InputBindingSettingViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.PremiumViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.SettingViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.SingleChoiceViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.SliderViewHolder; -import org.citra.citra_emu.features.settings.ui.viewholder.SubmenuViewHolder; -import org.citra.citra_emu.ui.main.MainActivity; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.dialogs.MotionAlertDialog; +import org.yuzu.yuzu_emu.features.settings.model.FloatSetting; +import org.yuzu.yuzu_emu.features.settings.model.IntSetting; +import org.yuzu.yuzu_emu.features.settings.model.StringSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.DateTimeSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.PremiumSingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.model.view.SingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.StringSingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.CheckBoxSettingViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.DateTimeViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.HeaderViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.InputBindingSettingViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.PremiumViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SettingViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SingleChoiceViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SliderViewHolder; +import org.yuzu.yuzu_emu.features.settings.ui.viewholder.SubmenuViewHolder; +import org.yuzu.yuzu_emu.ui.main.MainActivity; +import org.yuzu.yuzu_emu.utils.Log; import java.util.ArrayList; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragment.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.java similarity index 92% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragment.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.java index 5799dcb8d..845f6b7b4 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragment.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import android.content.Context; import android.os.Bundle; @@ -12,11 +12,11 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.Settings; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.ui.DividerItemDecoration; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.Settings; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.ui.DividerItemDecoration; import java.util.ArrayList; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentPresenter.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.java similarity index 69% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentPresenter.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.java index 31f3e68eb..27f0adf29 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentPresenter.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import android.app.Activity; import android.content.Context; @@ -7,24 +7,24 @@ import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraManager; import android.text.TextUtils; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.SettingSection; -import org.citra.citra_emu.features.settings.model.Settings; -import org.citra.citra_emu.features.settings.model.StringSetting; -import org.citra.citra_emu.features.settings.model.view.CheckBoxSetting; -import org.citra.citra_emu.features.settings.model.view.DateTimeSetting; -import org.citra.citra_emu.features.settings.model.view.HeaderSetting; -import org.citra.citra_emu.features.settings.model.view.InputBindingSetting; -import org.citra.citra_emu.features.settings.model.view.PremiumHeader; -import org.citra.citra_emu.features.settings.model.view.PremiumSingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.model.view.SingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.SliderSetting; -import org.citra.citra_emu.features.settings.model.view.StringSingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.SubmenuSetting; -import org.citra.citra_emu.features.settings.utils.SettingsFile; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.SettingSection; +import org.yuzu.yuzu_emu.features.settings.model.Settings; +import org.yuzu.yuzu_emu.features.settings.model.StringSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.DateTimeSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.HeaderSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.PremiumHeader; +import org.yuzu.yuzu_emu.features.settings.model.view.PremiumSingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.model.view.SingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.StringSingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting; +import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile; +import org.yuzu.yuzu_emu.utils.Log; import java.util.ArrayList; import java.util.Arrays; @@ -115,9 +115,6 @@ public final class SettingsFragmentPresenter { case Settings.SECTION_SYSTEM: addSystemSettings(sl); break; - case Settings.SECTION_CAMERA: - addCameraSettings(sl); - break; case Settings.SECTION_CONTROLS: addInputSettings(sl); break; @@ -145,7 +142,6 @@ public final class SettingsFragmentPresenter { sl.add(new SubmenuSetting(null, null, R.string.preferences_premium, 0, Settings.SECTION_PREMIUM)); sl.add(new SubmenuSetting(null, null, R.string.preferences_general, 0, Settings.SECTION_CORE)); sl.add(new SubmenuSetting(null, null, R.string.preferences_system, 0, Settings.SECTION_SYSTEM)); - sl.add(new SubmenuSetting(null, null, R.string.preferences_camera, 0, Settings.SECTION_CAMERA)); sl.add(new SubmenuSetting(null, null, R.string.preferences_controls, 0, Settings.SECTION_CONTROLS)); sl.add(new SubmenuSetting(null, null, R.string.preferences_graphics, 0, Settings.SECTION_RENDERER)); sl.add(new SubmenuSetting(null, null, R.string.preferences_audio, 0, Settings.SECTION_AUDIO)); @@ -197,96 +193,6 @@ public final class SettingsFragmentPresenter { sl.add(new DateTimeSetting(SettingsFile.KEY_INIT_TIME, Settings.SECTION_SYSTEM, R.string.init_time, R.string.init_time_description, "2000-01-01 00:00:01", dateTime)); } - private void addCameraSettings(ArrayList sl) { - final Activity activity = mView.getActivity(); - activity.setTitle(R.string.preferences_camera); - - // Get the camera IDs - CameraManager cameraManager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE); - ArrayList supportedCameraNameList = new ArrayList<>(); - ArrayList supportedCameraIdList = new ArrayList<>(); - if (cameraManager != null) { - try { - for (String id : cameraManager.getCameraIdList()) { - final CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id); - if (Objects.requireNonNull(characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)) == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) { - continue; // Legacy cameras cannot be used with the NDK - } - - supportedCameraIdList.add(id); - - final int facing = Objects.requireNonNull(characteristics.get(CameraCharacteristics.LENS_FACING)); - int stringId = R.string.camera_facing_external; - switch (facing) { - case CameraCharacteristics.LENS_FACING_FRONT: - stringId = R.string.camera_facing_front; - break; - case CameraCharacteristics.LENS_FACING_BACK: - stringId = R.string.camera_facing_back; - break; - case CameraCharacteristics.LENS_FACING_EXTERNAL: - stringId = R.string.camera_facing_external; - break; - } - supportedCameraNameList.add(String.format("%1$s (%2$s)", id, activity.getString(stringId))); - } - } catch (CameraAccessException e) { - Log.error("Couldn't retrieve camera list"); - e.printStackTrace(); - } - } - - // Create the names and values for display - ArrayList cameraDeviceNameList = new ArrayList<>(Arrays.asList(activity.getResources().getStringArray(R.array.cameraDeviceNames))); - cameraDeviceNameList.addAll(supportedCameraNameList); - ArrayList cameraDeviceValueList = new ArrayList<>(Arrays.asList(activity.getResources().getStringArray(R.array.cameraDeviceValues))); - cameraDeviceValueList.addAll(supportedCameraIdList); - - final String[] cameraDeviceNames = cameraDeviceNameList.toArray(new String[]{}); - final String[] cameraDeviceValues = cameraDeviceValueList.toArray(new String[]{}); - - final boolean haveCameraDevices = !supportedCameraIdList.isEmpty(); - - String[] imageSourceNames = activity.getResources().getStringArray(R.array.cameraImageSourceNames); - String[] imageSourceValues = activity.getResources().getStringArray(R.array.cameraImageSourceValues); - if (!haveCameraDevices) { - // Remove the last entry (ndk / Device Camera) - imageSourceNames = Arrays.copyOfRange(imageSourceNames, 0, imageSourceNames.length - 1); - imageSourceValues = Arrays.copyOfRange(imageSourceValues, 0, imageSourceValues.length - 1); - } - - final String defaultImageSource = haveCameraDevices ? "ndk" : "image"; - - SettingSection cameraSection = mSettings.getSection(Settings.SECTION_CAMERA); - - Setting innerCameraImageSource = cameraSection.getSetting(SettingsFile.KEY_CAMERA_INNER_NAME); - Setting innerCameraConfig = asStringSetting(cameraSection.getSetting(SettingsFile.KEY_CAMERA_INNER_CONFIG)); - Setting innerCameraFlip = cameraSection.getSetting(SettingsFile.KEY_CAMERA_INNER_FLIP); - sl.add(new HeaderSetting(null, null, R.string.inner_camera, 0)); - sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_INNER_NAME, Settings.SECTION_CAMERA, R.string.image_source, R.string.image_source_description, imageSourceNames, imageSourceValues, defaultImageSource, innerCameraImageSource)); - if (haveCameraDevices) - sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_INNER_CONFIG, Settings.SECTION_CAMERA, R.string.camera_device, R.string.camera_device_description, cameraDeviceNames, cameraDeviceValues, "_front", innerCameraConfig)); - sl.add(new SingleChoiceSetting(SettingsFile.KEY_CAMERA_INNER_FLIP, Settings.SECTION_CAMERA, R.string.image_flip, 0, R.array.cameraFlipNames, R.array.cameraFlipValues, 0, innerCameraFlip)); - - Setting outerLeftCameraImageSource = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_NAME); - Setting outerLeftCameraConfig = asStringSetting(cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_CONFIG)); - Setting outerLeftCameraFlip = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_FLIP); - sl.add(new HeaderSetting(null, null, R.string.outer_left_camera, 0)); - sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_NAME, Settings.SECTION_CAMERA, R.string.image_source, R.string.image_source_description, imageSourceNames, imageSourceValues, defaultImageSource, outerLeftCameraImageSource)); - if (haveCameraDevices) - sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_CONFIG, Settings.SECTION_CAMERA, R.string.camera_device, R.string.camera_device_description, cameraDeviceNames, cameraDeviceValues, "_back", outerLeftCameraConfig)); - sl.add(new SingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_LEFT_FLIP, Settings.SECTION_CAMERA, R.string.image_flip, 0, R.array.cameraFlipNames, R.array.cameraFlipValues, 0, outerLeftCameraFlip)); - - Setting outerRightCameraImageSource = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_NAME); - Setting outerRightCameraConfig = asStringSetting(cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_CONFIG)); - Setting outerRightCameraFlip = cameraSection.getSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_FLIP); - sl.add(new HeaderSetting(null, null, R.string.outer_right_camera, 0)); - sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_NAME, Settings.SECTION_CAMERA, R.string.image_source, R.string.image_source_description, imageSourceNames, imageSourceValues, defaultImageSource, outerRightCameraImageSource)); - if (haveCameraDevices) - sl.add(new StringSingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_CONFIG, Settings.SECTION_CAMERA, R.string.camera_device, R.string.camera_device_description, cameraDeviceNames, cameraDeviceValues, "_back", outerRightCameraConfig)); - sl.add(new SingleChoiceSetting(SettingsFile.KEY_CAMERA_OUTER_RIGHT_FLIP, Settings.SECTION_CAMERA, R.string.image_flip, 0, R.array.cameraFlipNames, R.array.cameraFlipValues, 0, outerRightCameraFlip)); - } - private void addInputSettings(ArrayList sl) { mView.getActivity().setTitle(R.string.preferences_controls); @@ -382,7 +288,7 @@ public final class SettingsFragmentPresenter { sl.add(new HeaderSetting(null, null, R.string.utility, 0)); sl.add(new CheckBoxSetting(SettingsFile.KEY_DUMP_TEXTURES, Settings.SECTION_UTILITY, R.string.dump_textures, R.string.dump_textures_description, false, dumpTextures)); sl.add(new CheckBoxSetting(SettingsFile.KEY_CUSTOM_TEXTURES, Settings.SECTION_UTILITY, R.string.custom_textures, R.string.custom_textures_description, false, customTextures)); - //Disabled until custom texture implementation gets rewrite, current one overloads RAM and crashes Citra. + //Disabled until custom texture implementation gets rewrite, current one overloads RAM and crashes yuzu. //sl.add(new CheckBoxSetting(SettingsFile.KEY_PRELOAD_TEXTURES, Settings.SECTION_UTILITY, R.string.preload_textures, R.string.preload_textures_description, false, preloadTextures)); } diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentView.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.java similarity index 90% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentView.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.java index c36eb55a7..3c1743fab 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentView.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.java @@ -1,10 +1,10 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import androidx.fragment.app.FragmentActivity; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.Settings; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.Settings; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; import java.util.ArrayList; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFrameLayout.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.java similarity index 96% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFrameLayout.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.java index 67bde5709..f753368a8 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFrameLayout.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFrameLayout.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.ui; +package org.yuzu.yuzu_emu.features.settings.ui; import android.content.Context; import android.util.AttributeSet; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java similarity index 82% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java index d914f7d0b..2b05739e7 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java @@ -1,13 +1,13 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.CheckBoxSetting; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; public final class CheckBoxSettingViewHolder extends SettingViewHolder { private CheckBoxSetting mItem; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/DateTimeViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.java similarity index 78% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/DateTimeViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.java index 09ea93010..60a65b71a 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/DateTimeViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.java @@ -1,13 +1,13 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.view.View; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.DateTimeSetting; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.DateTimeSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.utils.Log; public final class DateTimeViewHolder extends SettingViewHolder { private DateTimeSetting mItem; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/HeaderViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/HeaderViewHolder.java similarity index 73% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/HeaderViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/HeaderViewHolder.java index baf80ed76..afe021149 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/HeaderViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/HeaderViewHolder.java @@ -1,11 +1,11 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.view.View; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; public final class HeaderViewHolder extends SettingViewHolder { private TextView mHeaderName; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java similarity index 83% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java index 7d95c250a..6f8bef7d7 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.content.Context; import android.content.SharedPreferences; @@ -6,10 +6,10 @@ import android.preference.PreferenceManager; import android.view.View; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.InputBindingSetting; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.InputBindingSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; public final class InputBindingSettingViewHolder extends SettingViewHolder { private InputBindingSetting mItem; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/PremiumViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/PremiumViewHolder.java similarity index 82% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/PremiumViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/PremiumViewHolder.java index be0853ff0..1f862b281 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/PremiumViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/PremiumViewHolder.java @@ -1,13 +1,13 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.view.View; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; -import org.citra.citra_emu.features.settings.ui.SettingsFragmentView; -import org.citra.citra_emu.ui.main.MainActivity; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsFragmentView; +import org.yuzu.yuzu_emu.ui.main.MainActivity; public final class PremiumViewHolder extends SettingViewHolder { private TextView mHeaderName; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SettingViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SettingViewHolder.java similarity index 86% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SettingViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SettingViewHolder.java index 2643ea121..268b7c386 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SettingViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SettingViewHolder.java @@ -1,11 +1,11 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.view.View; import androidx.recyclerview.widget.RecyclerView; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; public abstract class SettingViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private SettingsAdapter mAdapter; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.java similarity index 85% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.java index a175af9f8..e3766f55e 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.java @@ -1,15 +1,15 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.content.res.Resources; import android.view.View; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.PremiumSingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.model.view.SingleChoiceSetting; -import org.citra.citra_emu.features.settings.model.view.StringSingleChoiceSetting; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.PremiumSingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.model.view.SingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.model.view.StringSingleChoiceSetting; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; public final class SingleChoiceViewHolder extends SettingViewHolder { private SettingsItem mItem; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SliderViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.java similarity index 79% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SliderViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.java index 3dd048a29..1f60a37ce 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SliderViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.java @@ -1,12 +1,12 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.view.View; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.model.view.SliderSetting; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; public final class SliderViewHolder extends SettingViewHolder { private SliderSetting mItem; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SubmenuViewHolder.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SubmenuViewHolder.java similarity index 78% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SubmenuViewHolder.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SubmenuViewHolder.java index cb8c3e92a..1aca4723d 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/viewholder/SubmenuViewHolder.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SubmenuViewHolder.java @@ -1,12 +1,12 @@ -package org.citra.citra_emu.features.settings.ui.viewholder; +package org.yuzu.yuzu_emu.features.settings.ui.viewholder; import android.view.View; import android.widget.TextView; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.view.SettingsItem; -import org.citra.citra_emu.features.settings.model.view.SubmenuSetting; -import org.citra.citra_emu.features.settings.ui.SettingsAdapter; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem; +import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter; public final class SubmenuViewHolder extends SettingViewHolder { private SubmenuSetting mItem; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/utils/SettingsFile.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/utils/SettingsFile.java similarity index 92% rename from src/android/app/src/main/java/org/citra/citra_emu/features/settings/utils/SettingsFile.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/utils/SettingsFile.java index 8ae6b70d7..9e58dedc2 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/utils/SettingsFile.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/utils/SettingsFile.java @@ -1,20 +1,20 @@ -package org.citra.citra_emu.features.settings.utils; +package org.yuzu.yuzu_emu.features.settings.utils; import androidx.annotation.NonNull; -import org.citra.citra_emu.CitraApplication; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.features.settings.model.FloatSetting; -import org.citra.citra_emu.features.settings.model.IntSetting; -import org.citra.citra_emu.features.settings.model.Setting; -import org.citra.citra_emu.features.settings.model.SettingSection; -import org.citra.citra_emu.features.settings.model.Settings; -import org.citra.citra_emu.features.settings.model.StringSetting; -import org.citra.citra_emu.features.settings.ui.SettingsActivityView; -import org.citra.citra_emu.utils.BiMap; -import org.citra.citra_emu.utils.DirectoryInitialization; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.YuzuApplication; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.features.settings.model.FloatSetting; +import org.yuzu.yuzu_emu.features.settings.model.IntSetting; +import org.yuzu.yuzu_emu.features.settings.model.Setting; +import org.yuzu.yuzu_emu.features.settings.model.SettingSection; +import org.yuzu.yuzu_emu.features.settings.model.Settings; +import org.yuzu.yuzu_emu.features.settings.model.StringSetting; +import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivityView; +import org.yuzu.yuzu_emu.utils.BiMap; +import org.yuzu.yuzu_emu.utils.DirectoryInitialization; +import org.yuzu.yuzu_emu.utils.Log; import org.ini4j.Wini; import java.io.BufferedReader; @@ -164,11 +164,11 @@ public final class SettingsFile { } } } catch (FileNotFoundException e) { - Log.error("[SettingsFile] File not found: " + ini.getAbsolutePath() + e.getMessage()); + Log.error("[SettingsFile] File not found: " + e.getMessage()); if (view != null) view.onSettingsFileNotFound(); } catch (IOException e) { - Log.error("[SettingsFile] Error reading from: " + ini.getAbsolutePath() + e.getMessage()); + Log.error("[SettingsFile] Error reading from: " + e.getMessage()); if (view != null) view.onSettingsFileNotFound(); } finally { @@ -176,7 +176,7 @@ public final class SettingsFile { try { reader.close(); } catch (IOException e) { - Log.error("[SettingsFile] Error closing: " + ini.getAbsolutePath() + e.getMessage()); + Log.error("[SettingsFile] Error closing: " + e.getMessage()); } } } @@ -223,7 +223,7 @@ public final class SettingsFile { writer.store(); } catch (IOException e) { Log.error("[SettingsFile] File not found: " + fileName + ".ini: " + e.getMessage()); - view.showToastMessage(CitraApplication.getAppContext().getString(R.string.error_saving, fileName, e.getMessage()), false); + view.showToastMessage(YuzuApplication.getAppContext().getString(R.string.error_saving, fileName, e.getMessage()), false); } } diff --git a/src/android/app/src/main/java/org/citra/citra_emu/fragments/CustomFilePickerFragment.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/CustomFilePickerFragment.java similarity index 98% rename from src/android/app/src/main/java/org/citra/citra_emu/fragments/CustomFilePickerFragment.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/CustomFilePickerFragment.java index c18ecd4c3..2658b1445 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/fragments/CustomFilePickerFragment.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/CustomFilePickerFragment.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.fragments; +package org.yuzu.yuzu_emu.fragments; import android.net.Uri; import android.os.Bundle; @@ -14,7 +14,7 @@ import androidx.core.content.FileProvider; import com.nononsenseapps.filepicker.FilePickerFragment; -import org.citra.citra_emu.R; +import org.yuzu.yuzu_emu.R; import java.io.File; import java.util.Arrays; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/fragments/EmulationFragment.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.java similarity index 94% rename from src/android/app/src/main/java/org/citra/citra_emu/fragments/EmulationFragment.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.java index cdb40d6f8..b2083f858 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/fragments/EmulationFragment.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.fragments; +package org.yuzu.yuzu_emu.fragments; import android.content.Context; import android.content.IntentFilter; @@ -22,15 +22,15 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.R; -import org.citra.citra_emu.activities.EmulationActivity; -import org.citra.citra_emu.overlay.InputOverlay; -import org.citra.citra_emu.utils.DirectoryInitialization; -import org.citra.citra_emu.utils.DirectoryInitialization.DirectoryInitializationState; -import org.citra.citra_emu.utils.DirectoryStateReceiver; -import org.citra.citra_emu.utils.EmulationMenuSettings; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.activities.EmulationActivity; +import org.yuzu.yuzu_emu.overlay.InputOverlay; +import org.yuzu.yuzu_emu.utils.DirectoryInitialization; +import org.yuzu.yuzu_emu.utils.DirectoryInitialization.DirectoryInitializationState; +import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver; +import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; +import org.yuzu.yuzu_emu.utils.Log; public final class EmulationFragment extends Fragment implements SurfaceHolder.Callback, Choreographer.FrameCallback { private static final String KEY_GAMEPATH = "gamepath"; @@ -118,10 +118,10 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C public void onResume() { super.onResume(); Choreographer.getInstance().postFrameCallback(this); - if (DirectoryInitialization.areCitraDirectoriesReady()) { + if (DirectoryInitialization.areDirectoriesReady()) { mEmulationState.run(activity.isActivityRecreated()); } else { - setupCitraDirectoriesThenStartEmulation(); + setupDirectoriesThenStartEmulation(); } } @@ -146,7 +146,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C super.onDetach(); } - private void setupCitraDirectoriesThenStartEmulation() { + private void setupDirectoriesThenStartEmulation() { IntentFilter statusIntentFilter = new IntentFilter( DirectoryInitialization.BROADCAST_ACTION); @@ -154,7 +154,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C new DirectoryStateReceiver(directoryInitializationState -> { if (directoryInitializationState == - DirectoryInitializationState.CITRA_DIRECTORIES_INITIALIZED) { + DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED) { mEmulationState.run(activity.isActivityRecreated()); } else if (directoryInitializationState == DirectoryInitializationState.EXTERNAL_STORAGE_PERMISSION_NEEDED) { diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/MenuFragment.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/MenuFragment.java new file mode 100644 index 000000000..5dc3f5545 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/MenuFragment.java @@ -0,0 +1,129 @@ +package org.yuzu.yuzu_emu.fragments; + +import android.content.pm.PackageManager; +import android.graphics.Rect; +import android.os.Bundle; +import android.util.SparseIntArray; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; + +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; +import androidx.fragment.app.Fragment; + +import com.google.android.material.color.MaterialColors; +import com.google.android.material.elevation.ElevationOverlayProvider; + +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.activities.EmulationActivity; + + +public final class MenuFragment extends Fragment implements View.OnClickListener +{ + private static final String KEY_TITLE = "title"; + private static final String KEY_WII = "wii"; + private static SparseIntArray buttonsActionsMap = new SparseIntArray(); + + private int mCutInset = 0; + + static + { + buttonsActionsMap.append(R.id.menu_exit, EmulationActivity.MENU_ACTION_EXIT); + } + + public static MenuFragment newInstance() + { + MenuFragment fragment = new MenuFragment(); + + Bundle arguments = new Bundle(); + fragment.setArguments(arguments); + + return fragment; + } + + // This is primarily intended to account for any navigation bar at the bottom of the screen + private int getBottomPaddingRequired() + { + Rect visibleFrame = new Rect(); + requireActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleFrame); + return visibleFrame.bottom - visibleFrame.top - getResources().getDisplayMetrics().heightPixels; + } + + @NonNull + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) + { + View rootView = inflater.inflate(R.layout.fragment_ingame_menu, container, false); + + LinearLayout options = rootView.findViewById(R.id.layout_options); + +// mPauseEmulation = options.findViewById(R.id.menu_pause_emulation); +// mUnpauseEmulation = options.findViewById(R.id.menu_unpause_emulation); +// +// updatePauseUnpauseVisibility(); +// +// if (!requireActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)) +// { +// options.findViewById(R.id.menu_overlay_controls).setVisibility(View.GONE); +// } +// +// if (!getArguments().getBoolean(KEY_WII, true)) +// { +// options.findViewById(R.id.menu_refresh_wiimotes).setVisibility(View.GONE); +// } + + int bottomPaddingRequired = getBottomPaddingRequired(); + + // Provide a safe zone between the navigation bar and Exit Emulation to avoid accidental touches + float density = getResources().getDisplayMetrics().density; + if (bottomPaddingRequired >= 32 * density) + { + bottomPaddingRequired += 32 * density; + } + + if (bottomPaddingRequired > rootView.getPaddingBottom()) + { + rootView.setPadding(rootView.getPaddingLeft(), rootView.getPaddingTop(), + rootView.getPaddingRight(), bottomPaddingRequired); + } + + for (int childIndex = 0; childIndex < options.getChildCount(); childIndex++) + { + Button button = (Button) options.getChildAt(childIndex); + + button.setOnClickListener(this); + } + + rootView.findViewById(R.id.menu_exit).setOnClickListener(this); + +// mTitleText = rootView.findViewById(R.id.text_game_title); +// String title = getArguments().getString(KEY_TITLE, null); +// if (title != null) +// { +// mTitleText.setText(title); +// } + + if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) + { +// rootView.post(() -> NativeLibrary.SetObscuredPixelsLeft(rootView.getWidth())); + } + + return rootView; + } + + @Override + public void onClick(View button) + { + int action = buttonsActionsMap.get(button.getId()); + EmulationActivity activity = (EmulationActivity) requireActivity(); + activity.handleMenuAction(action); + } +} diff --git a/src/android/app/src/main/java/org/citra/citra_emu/model/Game.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.java similarity index 98% rename from src/android/app/src/main/java/org/citra/citra_emu/model/Game.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.java index a4ffc59c7..bc1b19bd1 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/model/Game.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/Game.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.model; +package org.yuzu.yuzu_emu.model; import android.content.ContentValues; import android.database.Cursor; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/model/GameDatabase.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameDatabase.java similarity index 98% rename from src/android/app/src/main/java/org/citra/citra_emu/model/GameDatabase.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameDatabase.java index 8232d0489..ac5db1c36 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/model/GameDatabase.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameDatabase.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.model; +package org.yuzu.yuzu_emu.model; import android.content.ContentValues; import android.content.Context; @@ -6,8 +6,8 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.utils.Log; import java.io.File; import java.util.Arrays; diff --git a/src/android/app/src/main/java/org/citra/citra_emu/model/GameProvider.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameProvider.java similarity index 97% rename from src/android/app/src/main/java/org/citra/citra_emu/model/GameProvider.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameProvider.java index 33b289fc4..eff4b1e2d 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/model/GameProvider.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GameProvider.java @@ -1,4 +1,4 @@ -package org.citra.citra_emu.model; +package org.yuzu.yuzu_emu.model; import android.content.ContentProvider; import android.content.ContentValues; @@ -8,8 +8,8 @@ import android.net.Uri; import androidx.annotation.NonNull; -import org.citra.citra_emu.BuildConfig; -import org.citra.citra_emu.utils.Log; +import org.yuzu.yuzu_emu.BuildConfig; +import org.yuzu.yuzu_emu.utils.Log; /** * Provides an interface allowing Activities to interact with the SQLite database. diff --git a/src/android/app/src/main/java/org/citra/citra_emu/overlay/InputOverlay.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.java similarity index 99% rename from src/android/app/src/main/java/org/citra/citra_emu/overlay/InputOverlay.java rename to src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.java index cdb2f7666..043a164ce 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/overlay/InputOverlay.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.java @@ -4,7 +4,7 @@ * Refer to the license.txt file included. */ -package org.citra.citra_emu.overlay; +package org.yuzu.yuzu_emu.overlay; import android.app.Activity; import android.content.Context; @@ -25,11 +25,11 @@ import android.view.SurfaceView; import android.view.View; import android.view.View.OnTouchListener; -import org.citra.citra_emu.NativeLibrary; -import org.citra.citra_emu.NativeLibrary.ButtonState; -import org.citra.citra_emu.NativeLibrary.ButtonType; -import org.citra.citra_emu.R; -import org.citra.citra_emu.utils.EmulationMenuSettings; +import org.yuzu.yuzu_emu.NativeLibrary; +import org.yuzu.yuzu_emu.NativeLibrary.ButtonState; +import org.yuzu.yuzu_emu.NativeLibrary.ButtonType; +import org.yuzu.yuzu_emu.R; +import org.yuzu.yuzu_emu.utils.EmulationMenuSettings; import java.util.HashSet; import java.util.Set; @@ -117,7 +117,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { * within a SharedPreferences instance so that those values can be retrieved here. *

* This has a few benefits over the conventional way of storing the values - * (ie. within the Citra ini file). + * (ie. within the yuzu ini file). *