@@ -3,16 +3,13 @@ package com.izzy2lost.x1box
33import android.content.Intent
44import android.content.res.Configuration
55import android.graphics.Bitmap
6- import android.graphics.Typeface
76import android.net.Uri
87import android.os.Bundle
98import android.os.ParcelFileDescriptor
109import android.text.SpannableStringBuilder
1110import android.text.Spanned
1211import android.text.method.LinkMovementMethod
1312import android.text.style.ClickableSpan
14- import android.text.style.ForegroundColorSpan
15- import android.text.style.StyleSpan
1613import android.view.LayoutInflater
1714import android.view.View
1815import android.view.ViewGroup
@@ -609,11 +606,13 @@ class GameLibraryActivity : AppCompatActivity() {
609606 for (game in games) {
610607 val item = inflater.inflate(R .layout.item_game_entry, gamesListContainer, false )
611608 val nameText = item.findViewById<TextView >(R .id.game_name_text)
609+ val convertWarningText = item.findViewById<TextView >(R .id.game_convert_warning_text)
612610 val sizeText = item.findViewById<TextView >(R .id.game_size_text)
613611 val pathText = item.findViewById<TextView >(R .id.game_path_text)
614612 val coverImage = item.findViewById<ImageView >(R .id.game_list_cover_image)
615613
616614 nameText.text = game.title
615+ bindConvertibleWarning(convertWarningText, game)
617616 sizeText.text = buildGameSizeText(game)
618617 pathText.text = game.relativePath
619618
@@ -654,9 +653,11 @@ class GameLibraryActivity : AppCompatActivity() {
654653 row!! .addView(item, itemLp)
655654
656655 val nameText = item.findViewById<TextView >(R .id.game_cover_name_text)
656+ val convertWarningText = item.findViewById<TextView >(R .id.game_cover_convert_warning_text)
657657 val coverImage = item.findViewById<ImageView >(R .id.game_cover_image)
658658
659659 nameText.text = game.title
660+ bindConvertibleWarning(convertWarningText, game)
660661 item.setOnClickListener { launchGame(game) }
661662 item.setOnLongClickListener { showGameContextMenu(game); true }
662663 bindCoverArt(coverImage, game)
@@ -1199,31 +1200,18 @@ class GameLibraryActivity : AppCompatActivity() {
11991200 }
12001201 }
12011202
1202- private fun buildGameSizeText (game : GameEntry ): CharSequence {
1203- val sizeLabel = getString(R .string.library_game_size, formatSize(game.sizeBytes))
1204- if (game.discImageFormat != DiscImageFormat .REGULAR_ISO ) {
1205- return sizeLabel
1206- }
1207-
1208- return SpannableStringBuilder (sizeLabel).apply {
1209- append(" " )
1210- val badgeStart = length
1211- append(getString(R .string.library_regular_iso_badge))
1212- setSpan(
1213- ForegroundColorSpan (getColor(R .color.xemu_warning)),
1214- badgeStart,
1215- length,
1216- Spanned .SPAN_EXCLUSIVE_EXCLUSIVE
1217- )
1218- setSpan(
1219- StyleSpan (Typeface .BOLD ),
1220- badgeStart,
1221- length,
1222- Spanned .SPAN_EXCLUSIVE_EXCLUSIVE
1223- )
1203+ private fun bindConvertibleWarning (view : TextView , game : GameEntry ) {
1204+ view.visibility = if (game.discImageFormat == DiscImageFormat .REGULAR_ISO ) {
1205+ View .VISIBLE
1206+ } else {
1207+ View .GONE
12241208 }
12251209 }
12261210
1211+ private fun buildGameSizeText (game : GameEntry ): CharSequence {
1212+ return getString(R .string.library_game_size, formatSize(game.sizeBytes))
1213+ }
1214+
12271215 private fun isConvertibleIso (game : GameEntry ): Boolean {
12281216 return when (game.discImageFormat) {
12291217 DiscImageFormat .REGULAR_ISO -> true
0 commit comments