diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-08-12 21:41:35 +0200 |
---|---|---|
committer | Charles Lombardo <clombardo169@gmail.com> | 2023-08-12 21:42:55 +0200 |
commit | 798a439eb1970c0d89b5274c8f0e702aa41daea7 (patch) | |
tree | bdd8b26082a135c8f9e6b3aafe73343b08c928c5 /src/android | |
parent | android: Use string resource for slider value/units (diff) | |
download | yuzu-798a439eb1970c0d89b5274c8f0e702aa41daea7.tar yuzu-798a439eb1970c0d89b5274c8f0e702aa41daea7.tar.gz yuzu-798a439eb1970c0d89b5274c8f0e702aa41daea7.tar.bz2 yuzu-798a439eb1970c0d89b5274c8f0e702aa41daea7.tar.lz yuzu-798a439eb1970c0d89b5274c8f0e702aa41daea7.tar.xz yuzu-798a439eb1970c0d89b5274c8f0e702aa41daea7.tar.zst yuzu-798a439eb1970c0d89b5274c8f0e702aa41daea7.zip |
Diffstat (limited to 'src/android')
7 files changed, 28 insertions, 3 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/LicenseAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/LicenseAdapter.kt index 7006651d0..bc6ff1364 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/LicenseAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/LicenseAdapter.kt @@ -49,6 +49,7 @@ class LicenseAdapter(private val activity: AppCompatActivity, var licenses: List val context = YuzuApplication.appContext binding.textSettingName.text = context.getString(license.titleId) binding.textSettingDescription.text = context.getString(license.descriptionId) + binding.textSettingValue.visibility = View.GONE } } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.kt index 3003768a3..79572fc06 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/DateTimeViewHolder.kt @@ -34,6 +34,8 @@ class DateTimeViewHolder(val binding: ListItemSettingBinding, adapter: SettingsA val zonedTime = ZonedDateTime.ofInstant(instant, ZoneId.of("UTC")) val dateFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM) binding.textSettingValue.text = dateFormatter.format(zonedTime) + + setStyle(setting.isEditable, binding) } override fun onClick(clicked: View) { diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt index e6c5165aa..83a2e94f1 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt @@ -24,6 +24,8 @@ class RunnableViewHolder(val binding: ListItemSettingBinding, adapter: SettingsA binding.textSettingDescription.visibility = View.GONE } binding.textSettingValue.visibility = View.GONE + + setStyle(setting.isEditable, binding) } override fun onClick(clicked: View) { diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SettingViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SettingViewHolder.kt index f56460893..0fd1d2eaa 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SettingViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SettingViewHolder.kt @@ -5,6 +5,8 @@ package org.yuzu.yuzu_emu.features.settings.ui.viewholder import android.view.View import androidx.recyclerview.widget.RecyclerView +import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding +import org.yuzu.yuzu_emu.databinding.ListItemSettingSwitchBinding import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem import org.yuzu.yuzu_emu.features.settings.ui.SettingsAdapter @@ -33,4 +35,18 @@ abstract class SettingViewHolder(itemView: View, protected val adapter: Settings abstract override fun onClick(clicked: View) abstract override fun onLongClick(clicked: View): Boolean + + fun setStyle(isEditable: Boolean, binding: ListItemSettingBinding) { + val opacity = if (isEditable) 1.0f else 0.5f + binding.textSettingName.alpha = opacity + binding.textSettingDescription.alpha = opacity + binding.textSettingValue.alpha = opacity + } + + fun setStyle(isEditable: Boolean, binding: ListItemSettingSwitchBinding) { + binding.switchWidget.isEnabled = isEditable + val opacity = if (isEditable) 1.0f else 0.5f + binding.textSettingName.alpha = opacity + binding.textSettingDescription.alpha = opacity + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt index 8ec769654..b42d955aa 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SingleChoiceViewHolder.kt @@ -31,17 +31,19 @@ class SingleChoiceViewHolder(val binding: ListItemSettingBinding, adapter: Setti for (i in values.indices) { if (values[i] == item.selectedValue) { binding.textSettingValue.text = resMgr.getStringArray(item.choicesId)[i] - return + break } } } else if (item is StringSingleChoiceSetting) { for (i in item.values!!.indices) { if (item.values[i] == item.selectedValue) { binding.textSettingValue.text = item.choices[i] - return + break } } } + + setStyle(setting.isEditable, binding) } override fun onClick(clicked: View) { diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.kt index f81ccde0d..a23b5d109 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SliderViewHolder.kt @@ -29,6 +29,8 @@ class SliderViewHolder(val binding: ListItemSettingBinding, adapter: SettingsAda setting.selectedValue, setting.units ) + + setStyle(setting.isEditable, binding) } override fun onClick(clicked: View) { diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt index f09f3e859..ef34bf5f4 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt @@ -30,7 +30,7 @@ class SwitchSettingViewHolder(val binding: ListItemSettingSwitchBinding, adapter } binding.switchWidget.isChecked = setting.isChecked - binding.switchWidget.isEnabled = setting.isEditable + setStyle(setting.isEditable, binding) } override fun onClick(clicked: View) { |