From e926946f64d3802ba0cbe22a3d532802614faae7 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Wed, 11 May 2022 21:14:02 -0400 Subject: [PATCH] Consistent tv card colors Item selected color is now dolphin-blue for all cards in the TV activity. --- .../dolphinemu/adapters/GameRowPresenter.java | 20 ++----------------- .../adapters/SettingsRowPresenter.java | 12 +++++++++-- ...nd_gamecube.xml => tv_card_background.xml} | 0 .../res/drawable/tv_card_background_wii.xml | 8 -------- .../drawable/tv_card_background_wiiware.xml | 8 -------- .../app/src/main/res/values-night/colors.xml | 3 --- .../app/src/main/res/values/colors.xml | 3 --- 7 files changed, 12 insertions(+), 42 deletions(-) rename Source/Android/app/src/main/res/drawable/{tv_card_background_gamecube.xml => tv_card_background.xml} (100%) delete mode 100644 Source/Android/app/src/main/res/drawable/tv_card_background_wii.xml delete mode 100644 Source/Android/app/src/main/res/drawable/tv_card_background_wiiware.xml diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.java index 2414f4666916..b961104e1468 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.java @@ -16,7 +16,6 @@ import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog; import org.dolphinemu.dolphinemu.model.GameFile; import org.dolphinemu.dolphinemu.services.GameFileCacheManager; -import org.dolphinemu.dolphinemu.ui.platform.Platform; import org.dolphinemu.dolphinemu.utils.PicassoUtils; import org.dolphinemu.dolphinemu.viewholders.TvGameViewHolder; @@ -68,23 +67,8 @@ public void onBindViewHolder(ViewHolder viewHolder, Object item) holder.gameFile = gameFile; - // Set the platform-dependent background color of the card - int backgroundId; - switch (Platform.fromNativeInt(gameFile.getPlatform())) - { - case GAMECUBE: - backgroundId = R.drawable.tv_card_background_gamecube; - break; - case WII: - backgroundId = R.drawable.tv_card_background_wii; - break; - case WIIWARE: - backgroundId = R.drawable.tv_card_background_wiiware; - break; - default: - throw new AssertionError("Not reachable."); - } - Drawable background = ContextCompat.getDrawable(context, backgroundId); + // Set the background color of the card + Drawable background = ContextCompat.getDrawable(context, R.drawable.tv_card_background); holder.cardParent.setInfoAreaBackground(background); holder.cardParent.setOnLongClickListener((view) -> { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/SettingsRowPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/SettingsRowPresenter.java index 286e36539e81..f05cffb9835f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/SettingsRowPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/SettingsRowPresenter.java @@ -2,12 +2,16 @@ package org.dolphinemu.dolphinemu.adapters; +import android.content.Context; import android.content.res.Resources; +import android.graphics.drawable.Drawable; import android.view.ViewGroup; +import androidx.core.content.ContextCompat; import androidx.leanback.widget.ImageCardView; import androidx.leanback.widget.Presenter; +import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.model.TvSettingsItem; import org.dolphinemu.dolphinemu.viewholders.TvSettingsViewHolder; @@ -21,7 +25,6 @@ public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) settingsCard.setMainImageAdjustViewBounds(true); settingsCard.setMainImageDimensions(192, 160); - settingsCard.setFocusable(true); settingsCard.setFocusableInTouchMode(true); @@ -32,6 +35,7 @@ public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { TvSettingsViewHolder holder = (TvSettingsViewHolder) viewHolder; + Context context = holder.cardParent.getContext(); TvSettingsItem settingsItem = (TvSettingsItem) item; Resources resources = holder.cardParent.getResources(); @@ -39,7 +43,11 @@ public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) holder.itemId = settingsItem.getItemId(); holder.cardParent.setTitleText(resources.getString(settingsItem.getLabelId())); - holder.cardParent.setMainImage(resources.getDrawable(settingsItem.getIconId(), null)); + holder.cardParent.setMainImage(resources.getDrawable(settingsItem.getIconId())); + + // Set the background color of the card + Drawable background = ContextCompat.getDrawable(context, R.drawable.tv_card_background); + holder.cardParent.setInfoAreaBackground(background); } public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) diff --git a/Source/Android/app/src/main/res/drawable/tv_card_background_gamecube.xml b/Source/Android/app/src/main/res/drawable/tv_card_background.xml similarity index 100% rename from Source/Android/app/src/main/res/drawable/tv_card_background_gamecube.xml rename to Source/Android/app/src/main/res/drawable/tv_card_background.xml diff --git a/Source/Android/app/src/main/res/drawable/tv_card_background_wii.xml b/Source/Android/app/src/main/res/drawable/tv_card_background_wii.xml deleted file mode 100644 index d4a04a92036a..000000000000 --- a/Source/Android/app/src/main/res/drawable/tv_card_background_wii.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/Source/Android/app/src/main/res/drawable/tv_card_background_wiiware.xml b/Source/Android/app/src/main/res/drawable/tv_card_background_wiiware.xml deleted file mode 100644 index 837d59cb39b3..000000000000 --- a/Source/Android/app/src/main/res/drawable/tv_card_background_wiiware.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/Source/Android/app/src/main/res/values-night/colors.xml b/Source/Android/app/src/main/res/values-night/colors.xml index b2c5676f35f3..8db7ef7bc5c8 100644 --- a/Source/Android/app/src/main/res/values-night/colors.xml +++ b/Source/Android/app/src/main/res/values-night/colors.xml @@ -4,9 +4,6 @@ #2196f3 #FFFFFF - #9e9e9e - #2979ff - #444444 #36ff0000 diff --git a/Source/Android/app/src/main/res/values/colors.xml b/Source/Android/app/src/main/res/values/colors.xml index 4a70ae74f5fb..46bb372e2cfc 100644 --- a/Source/Android/app/src/main/res/values/colors.xml +++ b/Source/Android/app/src/main/res/values/colors.xml @@ -4,9 +4,6 @@ #21b0f3 #ffffff - #9e9e9e - #2979ff - #444444 #36ff0000