Skip to content

Commit

Permalink
Merge pull request #10653 from t895/tv-card
Browse files Browse the repository at this point in the history
Android: Consistent TV card colors
  • Loading branch information
phire authored Aug 10, 2022
2 parents 1dbe2a4 + e926946 commit 2747ab7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) ->
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -21,7 +25,6 @@ public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent)
settingsCard.setMainImageAdjustViewBounds(true);
settingsCard.setMainImageDimensions(192, 160);


settingsCard.setFocusable(true);
settingsCard.setFocusableInTouchMode(true);

Expand All @@ -32,14 +35,19 @@ 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();

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)
Expand Down

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions Source/Android/app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<color name="dolphin_blue_secondary">#2196f3</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="invalid_setting_overlay">#36ff0000</color>
Expand Down
3 changes: 0 additions & 3 deletions Source/Android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<color name="dolphin_blue_secondary">#21b0f3</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="invalid_setting_overlay">#36ff0000</color>
Expand Down

0 comments on commit 2747ab7

Please sign in to comment.