summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2022-08-22 08:19:43 -0400
committerCharles Lombardo <clombardo169@gmail.com>2022-08-22 13:50:39 -0400
commit2caa1f3b437ecd5ba7e9124cb2e6cf67a570f84c (patch)
tree4625d8fb24aae0dc215f98d0dc0e8a4713f5f9ee /Source/Android/app/src/main/java
parentcc3e6a11ac07bd7ac242d6f18fb8273aa0c11724 (diff)
Android: Add option to disable game cover text
Diffstat (limited to 'Source/Android/app/src/main/java')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java4
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.java7
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java2
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java2
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java78
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java2
6 files changed, 84 insertions, 11 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java
index d481640c9b..e35645ee60 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java
@@ -72,9 +72,7 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
{
Context context = holder.itemView.getContext();
GameFile gameFile = mGameFiles.get(position);
- PicassoUtils.loadGameCover(holder.imageScreenshot, gameFile);
-
- holder.textGameTitle.setText(gameFile.getTitle());
+ PicassoUtils.loadGameCover(holder, holder.imageScreenshot, gameFile);
if (GameFileCacheManager.findSecondDisc(gameFile) != null)
{
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 b961104e14..6261ea6827 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
@@ -50,15 +50,14 @@ public final class GameRowPresenter extends Presenter
GameFile gameFile = (GameFile) item;
holder.imageScreenshot.setImageDrawable(null);
- PicassoUtils.loadGameCover(holder.imageScreenshot, gameFile);
+ PicassoUtils.loadGameCover(null, holder.imageScreenshot, gameFile);
holder.cardParent.setTitleText(gameFile.getTitle());
if (GameFileCacheManager.findSecondDisc(gameFile) != null)
{
- holder.cardParent
- .setContentText(
- context.getString(R.string.disc_number, gameFile.getDiscNumber() + 1));
+ holder.cardParent.setContentText(
+ context.getString(R.string.disc_number, gameFile.getDiscNumber() + 1));
}
else
{
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java
index d09aaa75b1..0c02f1b9a0 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java
@@ -79,6 +79,8 @@ public enum BooleanSetting implements AbstractBooleanSetting
MAIN_DEBUG_JIT_REGISTER_CACHE_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG,
"JitRegisterCacheOff", false),
+ MAIN_SHOW_GAME_TITLES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
+ "ShowGameTitles", true),
MAIN_JOYSTICK_REL_CENTER(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
"JoystickRelCenter", true),
MAIN_PHONE_RUMBLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
index 137d2e3dc5..38976684d6 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
@@ -321,6 +321,8 @@ public final class SettingsFragmentPresenter
R.string.osd_messages_description));
sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_USE_GAME_COVERS,
R.string.download_game_covers, 0));
+ sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_SHOW_GAME_TITLES,
+ R.string.show_titles_in_game_list, R.string.show_titles_in_game_list_description));
}
private void addAudioSettings(ArrayList<SettingsItem> sl)
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java
index 876f022480..69aabffa7f 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java
@@ -6,6 +6,7 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
+import android.view.View;
import android.widget.ImageView;
import com.squareup.picasso.Callback;
@@ -14,6 +15,7 @@ import com.squareup.picasso.Picasso;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
import org.dolphinemu.dolphinemu.model.GameFile;
+import org.dolphinemu.dolphinemu.viewholders.GameViewHolder;
import java.io.File;
@@ -35,8 +37,23 @@ public class PicassoUtils
.into(imageView);
}
- public static void loadGameCover(ImageView imageView, GameFile gameFile)
+ public static void loadGameCover(GameViewHolder gameViewHolder, ImageView imageView,
+ GameFile gameFile)
{
+ if (BooleanSetting.MAIN_SHOW_GAME_TITLES.getBooleanGlobal() && gameViewHolder != null)
+ {
+ gameViewHolder.textGameTitle.setText(gameFile.getTitle());
+ gameViewHolder.textGameTitle.setVisibility(View.VISIBLE);
+ gameViewHolder.textGameTitleInner.setVisibility(View.GONE);
+ gameViewHolder.textGameCaption.setVisibility(View.VISIBLE);
+ }
+ else if (gameViewHolder != null)
+ {
+ gameViewHolder.textGameTitleInner.setText(gameFile.getTitle());
+ gameViewHolder.textGameTitle.setVisibility(View.GONE);
+ gameViewHolder.textGameCaption.setVisibility(View.GONE);
+ }
+
Context context = imageView.getContext();
File cover = new File(gameFile.getCustomCoverPath());
if (cover.exists())
@@ -49,7 +66,18 @@ public class PicassoUtils
.centerInside()
.config(Bitmap.Config.ARGB_8888)
.error(R.drawable.no_banner)
- .into(imageView);
+ .into(imageView, new Callback()
+ {
+ @Override public void onSuccess()
+ {
+ PicassoUtils.disableInnerTitle(gameViewHolder);
+ }
+
+ @Override public void onError(Exception e)
+ {
+ PicassoUtils.enableInnerTitle(gameViewHolder, gameFile);
+ }
+ });
}
else if ((cover = new File(gameFile.getCoverPath(context))).exists())
{
@@ -61,7 +89,18 @@ public class PicassoUtils
.centerInside()
.config(Bitmap.Config.ARGB_8888)
.error(R.drawable.no_banner)
- .into(imageView);
+ .into(imageView, new Callback()
+ {
+ @Override public void onSuccess()
+ {
+ PicassoUtils.disableInnerTitle(gameViewHolder);
+ }
+
+ @Override public void onError(Exception e)
+ {
+ PicassoUtils.enableInnerTitle(gameViewHolder, gameFile);
+ }
+ });
}
// GameTDB has a pretty close to complete collection for US/EN covers. First pass at getting
// the cover will be by the disk's region, second will be the US cover, and third EN.
@@ -82,6 +121,7 @@ public class PicassoUtils
{
CoverHelper.saveCover(((BitmapDrawable) imageView.getDrawable()).getBitmap(),
gameFile.getCoverPath(context));
+ PicassoUtils.disableInnerTitle(gameViewHolder);
}
@Override
@@ -104,6 +144,7 @@ public class PicassoUtils
CoverHelper.saveCover(
((BitmapDrawable) imageView.getDrawable()).getBitmap(),
gameFile.getCoverPath(context));
+ PicassoUtils.disableInnerTitle(gameViewHolder);
}
@Override
@@ -127,11 +168,13 @@ public class PicassoUtils
((BitmapDrawable) imageView.getDrawable())
.getBitmap(),
gameFile.getCoverPath(context));
+ PicassoUtils.disableInnerTitle(gameViewHolder);
}
@Override
public void onError(Exception ex)
{
+ PicassoUtils.enableInnerTitle(gameViewHolder, gameFile);
}
});
}
@@ -148,7 +191,34 @@ public class PicassoUtils
.fit()
.centerInside()
.config(Bitmap.Config.ARGB_8888)
- .into(imageView);
+ .into(imageView, new Callback()
+ {
+ @Override public void onSuccess()
+ {
+ PicassoUtils.disableInnerTitle(gameViewHolder);
+ }
+
+ @Override public void onError(Exception e)
+ {
+ PicassoUtils.enableInnerTitle(gameViewHolder, gameFile);
+ }
+ });
+ }
+ }
+
+ private static void enableInnerTitle(GameViewHolder gameViewHolder, GameFile gameFile)
+ {
+ if (gameViewHolder != null && !BooleanSetting.MAIN_SHOW_GAME_TITLES.getBooleanGlobal())
+ {
+ gameViewHolder.textGameTitleInner.setVisibility(View.VISIBLE);
+ }
+ }
+
+ private static void disableInnerTitle(GameViewHolder gameViewHolder)
+ {
+ if (gameViewHolder != null && !BooleanSetting.MAIN_SHOW_GAME_TITLES.getBooleanGlobal())
+ {
+ gameViewHolder.textGameTitleInner.setVisibility(View.GONE);
}
}
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java
index cdcf4a03c0..b829847488 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java
@@ -19,6 +19,7 @@ public class GameViewHolder extends RecyclerView.ViewHolder
{
public ImageView imageScreenshot;
public TextView textGameTitle;
+ public TextView textGameTitleInner;
public TextView textGameCaption;
public GameFile gameFile;
@@ -31,6 +32,7 @@ public class GameViewHolder extends RecyclerView.ViewHolder
imageScreenshot = itemView.findViewById(R.id.image_game_screen);
textGameTitle = itemView.findViewById(R.id.text_game_title);
+ textGameTitleInner = itemView.findViewById(R.id.text_game_title_inner);
textGameCaption = itemView.findViewById(R.id.text_game_caption);
}
}