diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-04-28 04:59:01 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:55 +0200 |
commit | c070a588b9ee286d2b5844b615e53026e8e5bd5a (patch) | |
tree | 69dbd2c04789f374db7e71f1f2e201901cda80af | |
parent | android: Properly pop setup fragment from the back stack (diff) | |
download | yuzu-c070a588b9ee286d2b5844b615e53026e8e5bd5a.tar yuzu-c070a588b9ee286d2b5844b615e53026e8e5bd5a.tar.gz yuzu-c070a588b9ee286d2b5844b615e53026e8e5bd5a.tar.bz2 yuzu-c070a588b9ee286d2b5844b615e53026e8e5bd5a.tar.lz yuzu-c070a588b9ee286d2b5844b615e53026e8e5bd5a.tar.xz yuzu-c070a588b9ee286d2b5844b615e53026e8e5bd5a.tar.zst yuzu-c070a588b9ee286d2b5844b615e53026e8e5bd5a.zip |
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeSettingAdapter.kt (renamed from src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeOptionAdapter.kt) | 10 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt (renamed from src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt) | 56 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeSetting.kt (renamed from src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeOption.kt) | 2 | ||||
-rw-r--r-- | src/android/app/src/main/res/layout/fragment_home_settings.xml (renamed from src/android/app/src/main/res/layout/fragment_options.xml) | 4 | ||||
-rw-r--r-- | src/android/app/src/main/res/menu/menu_navigation.xml | 6 | ||||
-rw-r--r-- | src/android/app/src/main/res/navigation/home_navigation.xml | 6 | ||||
-rw-r--r-- | src/android/app/src/main/res/values/strings.xml | 4 |
7 files changed, 44 insertions, 44 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeOptionAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeSettingAdapter.kt index 2bec2de87..2b3956e6d 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeOptionAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/HomeSettingAdapter.kt @@ -7,10 +7,10 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.content.res.ResourcesCompat import androidx.recyclerview.widget.RecyclerView import org.yuzu.yuzu_emu.databinding.CardHomeOptionBinding -import org.yuzu.yuzu_emu.model.HomeOption +import org.yuzu.yuzu_emu.model.HomeSetting -class HomeOptionAdapter(private val activity: AppCompatActivity, var options: List<HomeOption>) : - RecyclerView.Adapter<HomeOptionAdapter.HomeOptionViewHolder>(), +class HomeSettingAdapter(private val activity: AppCompatActivity, var options: List<HomeSetting>) : + RecyclerView.Adapter<HomeSettingAdapter.HomeOptionViewHolder>(), View.OnClickListener { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeOptionViewHolder { val binding = CardHomeOptionBinding.inflate(LayoutInflater.from(parent.context), parent, false) @@ -33,13 +33,13 @@ class HomeOptionAdapter(private val activity: AppCompatActivity, var options: Li inner class HomeOptionViewHolder(val binding: CardHomeOptionBinding) : RecyclerView.ViewHolder(binding.root) { - lateinit var option: HomeOption + lateinit var option: HomeSetting init { itemView.tag = this } - fun bind(option: HomeOption) { + fun bind(option: HomeSetting) { this.option = option binding.optionTitle.text = activity.resources.getString(option.titleId) binding.optionDescription.text = activity.resources.getString(option.descriptionId) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt index 1cf0d0f52..aba2a188e 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt @@ -17,16 +17,16 @@ import androidx.fragment.app.Fragment import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.dialog.MaterialAlertDialogBuilder import org.yuzu.yuzu_emu.R -import org.yuzu.yuzu_emu.adapters.HomeOptionAdapter -import org.yuzu.yuzu_emu.databinding.FragmentOptionsBinding +import org.yuzu.yuzu_emu.adapters.HomeSettingAdapter +import org.yuzu.yuzu_emu.databinding.FragmentHomeSettingsBinding import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile -import org.yuzu.yuzu_emu.model.HomeOption +import org.yuzu.yuzu_emu.model.HomeSetting import org.yuzu.yuzu_emu.ui.main.MainActivity import org.yuzu.yuzu_emu.utils.GpuDriverHelper -class OptionsFragment : Fragment() { - private var _binding: FragmentOptionsBinding? = null +class HomeSettingsFragment : Fragment() { + private var _binding: FragmentHomeSettingsBinding? = null private val binding get() = _binding!! private lateinit var mainActivity: MainActivity @@ -36,44 +36,44 @@ class OptionsFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { - _binding = FragmentOptionsBinding.inflate(layoutInflater) + _binding = FragmentHomeSettingsBinding.inflate(layoutInflater) return binding.root } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { mainActivity = requireActivity() as MainActivity - val optionsList: List<HomeOption> = listOf( - HomeOption( + val optionsList: List<HomeSetting> = listOf( + HomeSetting( + R.string.advanced_settings, + R.string.settings_description, + R.drawable.ic_settings + ) { SettingsActivity.launch(requireContext(), SettingsFile.FILE_NAME_CONFIG, "") }, + HomeSetting( + R.string.install_gpu_driver, + R.string.install_gpu_driver_description, + R.drawable.ic_input + ) { driverInstaller() }, + HomeSetting( + R.string.install_amiibo_keys, + R.string.install_amiibo_keys_description, + R.drawable.ic_nfc + ) { mainActivity.getAmiiboKey.launch(arrayOf("*/*")) }, + HomeSetting( R.string.add_games, R.string.add_games_description, R.drawable.ic_add ) { mainActivity.getGamesDirectory.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).data) }, - HomeOption( + HomeSetting( R.string.install_prod_keys, R.string.install_prod_keys_description, R.drawable.ic_unlock - ) { mainActivity.getProdKey.launch(arrayOf("*/*")) }, - HomeOption( - R.string.install_amiibo_keys, - R.string.install_amiibo_keys_description, - R.drawable.ic_nfc - ) { mainActivity.getAmiiboKey.launch(arrayOf("*/*")) }, - HomeOption( - R.string.install_gpu_driver, - R.string.install_gpu_driver_description, - R.drawable.ic_input - ) { driverInstaller() }, - HomeOption( - R.string.settings, - R.string.settings_description, - R.drawable.ic_settings - ) { SettingsActivity.launch(requireContext(), SettingsFile.FILE_NAME_CONFIG, "") } + ) { mainActivity.getProdKey.launch(arrayOf("*/*")) } ) - binding.optionsList.apply { + binding.homeSettingsList.apply { layoutManager = LinearLayoutManager(requireContext()) - adapter = HomeOptionAdapter(requireActivity() as AppCompatActivity, optionsList) + adapter = HomeSettingAdapter(requireActivity() as AppCompatActivity, optionsList) } setInsets() @@ -110,7 +110,7 @@ class OptionsFragment : Fragment() { } private fun setInsets() = - ViewCompat.setOnApplyWindowInsetsListener(binding.scrollViewOptions) { view: View, windowInsets: WindowInsetsCompat -> + ViewCompat.setOnApplyWindowInsetsListener(binding.scrollViewSettings) { view: View, windowInsets: WindowInsetsCompat -> val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) view.setPadding( insets.left, diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeOption.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeSetting.kt index c995ff12c..7049f2fa5 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeOption.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeSetting.kt @@ -3,7 +3,7 @@ package org.yuzu.yuzu_emu.model -data class HomeOption( +data class HomeSetting( val titleId: Int, val descriptionId: Int, val iconId: Int, diff --git a/src/android/app/src/main/res/layout/fragment_options.xml b/src/android/app/src/main/res/layout/fragment_home_settings.xml index 3bae8b0c4..e0c609309 100644 --- a/src/android/app/src/main/res/layout/fragment_options.xml +++ b/src/android/app/src/main/res/layout/fragment_home_settings.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/scroll_view_options" + android:id="@+id/scroll_view_settings" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?attr/colorSurface" @@ -21,7 +21,7 @@ android:src="@drawable/ic_yuzu_full" /> <androidx.recyclerview.widget.RecyclerView - android:id="@+id/options_list" + android:id="@+id/home_settings_list" android:layout_width="match_parent" android:layout_height="match_parent" /> diff --git a/src/android/app/src/main/res/menu/menu_navigation.xml b/src/android/app/src/main/res/menu/menu_navigation.xml index ca5a656a6..e46133604 100644 --- a/src/android/app/src/main/res/menu/menu_navigation.xml +++ b/src/android/app/src/main/res/menu/menu_navigation.xml @@ -7,8 +7,8 @@ android:title="@string/home_games" /> <item - android:id="@+id/optionsFragment" - android:icon="@drawable/ic_options" - android:title="@string/home_options" /> + android:id="@+id/homeSettingsFragment" + android:icon="@drawable/ic_settings" + android:title="@string/home_settings" /> </menu> diff --git a/src/android/app/src/main/res/navigation/home_navigation.xml b/src/android/app/src/main/res/navigation/home_navigation.xml index d0077bbea..d500d165b 100644 --- a/src/android/app/src/main/res/navigation/home_navigation.xml +++ b/src/android/app/src/main/res/navigation/home_navigation.xml @@ -10,9 +10,9 @@ android:label="PlatformGamesFragment" /> <fragment - android:id="@+id/optionsFragment" - android:name="org.yuzu.yuzu_emu.fragments.OptionsFragment" - android:label="OptionsFragment" /> + android:id="@+id/homeSettingsFragment" + android:name="org.yuzu.yuzu_emu.fragments.HomeSettingsFragment" + android:label="HomeSettingsFragment" /> <fragment android:id="@+id/firstTimeSetupFragment" diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index d37ffba0d..b0d766e07 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -26,7 +26,7 @@ <!-- Home strings --> <string name="home_games">Games</string> - <string name="home_options">Options</string> + <string name="home_settings">Settings</string> <string name="add_games">Add Games</string> <string name="add_games_description">Select your games folder</string> <string name="home_search_games">Search Games</string> @@ -41,7 +41,7 @@ <string name="install_amiibo_keys_failure">Keys file (key_retail.bin) is invalid</string> <string name="install_gpu_driver">Install GPU Driver</string> <string name="install_gpu_driver_description">Use a different driver for potentially better performance or accuracy</string> - <string name="settings">Settings</string> + <string name="advanced_settings">Advanced Settings</string> <string name="settings_description">Configure emulator settings</string> <!-- General settings strings --> |