Consistent tv card colors
Item selected color is now dolphin-blue for all cards in the TV activity.
This commit is contained in:
parent
1dbe2a4ea2
commit
e926946f64
|
@ -16,7 +16,6 @@ import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog;
|
import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog;
|
||||||
import org.dolphinemu.dolphinemu.model.GameFile;
|
import org.dolphinemu.dolphinemu.model.GameFile;
|
||||||
import org.dolphinemu.dolphinemu.services.GameFileCacheManager;
|
import org.dolphinemu.dolphinemu.services.GameFileCacheManager;
|
||||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
|
||||||
import org.dolphinemu.dolphinemu.utils.PicassoUtils;
|
import org.dolphinemu.dolphinemu.utils.PicassoUtils;
|
||||||
import org.dolphinemu.dolphinemu.viewholders.TvGameViewHolder;
|
import org.dolphinemu.dolphinemu.viewholders.TvGameViewHolder;
|
||||||
|
|
||||||
|
@ -68,23 +67,8 @@ public final class GameRowPresenter extends Presenter
|
||||||
|
|
||||||
holder.gameFile = gameFile;
|
holder.gameFile = gameFile;
|
||||||
|
|
||||||
// Set the platform-dependent background color of the card
|
// Set the background color of the card
|
||||||
int backgroundId;
|
Drawable background = ContextCompat.getDrawable(context, R.drawable.tv_card_background);
|
||||||
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);
|
|
||||||
holder.cardParent.setInfoAreaBackground(background);
|
holder.cardParent.setInfoAreaBackground(background);
|
||||||
holder.cardParent.setOnLongClickListener((view) ->
|
holder.cardParent.setOnLongClickListener((view) ->
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.adapters;
|
package org.dolphinemu.dolphinemu.adapters;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.leanback.widget.ImageCardView;
|
import androidx.leanback.widget.ImageCardView;
|
||||||
import androidx.leanback.widget.Presenter;
|
import androidx.leanback.widget.Presenter;
|
||||||
|
|
||||||
|
import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.model.TvSettingsItem;
|
import org.dolphinemu.dolphinemu.model.TvSettingsItem;
|
||||||
import org.dolphinemu.dolphinemu.viewholders.TvSettingsViewHolder;
|
import org.dolphinemu.dolphinemu.viewholders.TvSettingsViewHolder;
|
||||||
|
|
||||||
|
@ -21,7 +25,6 @@ public final class SettingsRowPresenter extends Presenter
|
||||||
settingsCard.setMainImageAdjustViewBounds(true);
|
settingsCard.setMainImageAdjustViewBounds(true);
|
||||||
settingsCard.setMainImageDimensions(192, 160);
|
settingsCard.setMainImageDimensions(192, 160);
|
||||||
|
|
||||||
|
|
||||||
settingsCard.setFocusable(true);
|
settingsCard.setFocusable(true);
|
||||||
settingsCard.setFocusableInTouchMode(true);
|
settingsCard.setFocusableInTouchMode(true);
|
||||||
|
|
||||||
|
@ -32,6 +35,7 @@ public final class SettingsRowPresenter extends Presenter
|
||||||
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item)
|
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item)
|
||||||
{
|
{
|
||||||
TvSettingsViewHolder holder = (TvSettingsViewHolder) viewHolder;
|
TvSettingsViewHolder holder = (TvSettingsViewHolder) viewHolder;
|
||||||
|
Context context = holder.cardParent.getContext();
|
||||||
TvSettingsItem settingsItem = (TvSettingsItem) item;
|
TvSettingsItem settingsItem = (TvSettingsItem) item;
|
||||||
|
|
||||||
Resources resources = holder.cardParent.getResources();
|
Resources resources = holder.cardParent.getResources();
|
||||||
|
@ -39,7 +43,11 @@ public final class SettingsRowPresenter extends Presenter
|
||||||
holder.itemId = settingsItem.getItemId();
|
holder.itemId = settingsItem.getItemId();
|
||||||
|
|
||||||
holder.cardParent.setTitleText(resources.getString(settingsItem.getLabelId()));
|
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)
|
public void onUnbindViewHolder(Presenter.ViewHolder viewHolder)
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:state_selected="true"
|
|
||||||
android:drawable="@color/dolphin_accent_wii"/>
|
|
||||||
<item
|
|
||||||
android:drawable="@color/tv_card_unselected"/>
|
|
||||||
</selector>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:state_selected="true"
|
|
||||||
android:drawable="@color/dolphin_accent_wiiware"/>
|
|
||||||
<item
|
|
||||||
android:drawable="@color/tv_card_unselected"/>
|
|
||||||
</selector>
|
|
|
@ -4,9 +4,6 @@
|
||||||
<color name="dolphin_blue_secondary">#2196f3</color>
|
<color name="dolphin_blue_secondary">#2196f3</color>
|
||||||
<color name="dolphin_white">#FFFFFF</color>
|
<color name="dolphin_white">#FFFFFF</color>
|
||||||
|
|
||||||
<color name="dolphin_accent_wii">#9e9e9e</color>
|
|
||||||
<color name="dolphin_accent_wiiware">#2979ff</color>
|
|
||||||
|
|
||||||
<color name="tv_card_unselected">#444444</color>
|
<color name="tv_card_unselected">#444444</color>
|
||||||
|
|
||||||
<color name="invalid_setting_overlay">#36ff0000</color>
|
<color name="invalid_setting_overlay">#36ff0000</color>
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
<color name="dolphin_blue_secondary">#21b0f3</color>
|
<color name="dolphin_blue_secondary">#21b0f3</color>
|
||||||
<color name="dolphin_white">#ffffff</color>
|
<color name="dolphin_white">#ffffff</color>
|
||||||
|
|
||||||
<color name="dolphin_accent_wii">#9e9e9e</color>
|
|
||||||
<color name="dolphin_accent_wiiware">#2979ff</color>
|
|
||||||
|
|
||||||
<color name="tv_card_unselected">#444444</color>
|
<color name="tv_card_unselected">#444444</color>
|
||||||
|
|
||||||
<color name="invalid_setting_overlay">#36ff0000</color>
|
<color name="invalid_setting_overlay">#36ff0000</color>
|
||||||
|
|
Loading…
Reference in New Issue