Skip to content

Commit 4866875

Browse files
committed
make build-aab.sh fix warning about xiso
1 parent 5439068 commit 4866875

File tree

5 files changed

+83
-28
lines changed

5 files changed

+83
-28
lines changed

android/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ android {
3030
minSdk = 26
3131
targetSdk = 36
3232

33-
versionCode = 20
34-
versionName = "1.1.9"
33+
versionCode = 21
34+
versionName = "1.2.0"
3535

3636
ndk {
3737
abiFilters += listOf("arm64-v8a")

android/app/src/main/java/com/izzy2lost/x1box/GameLibraryActivity.kt

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ package com.izzy2lost.x1box
33
import android.content.Intent
44
import android.content.res.Configuration
55
import android.graphics.Bitmap
6-
import android.graphics.Typeface
76
import android.net.Uri
87
import android.os.Bundle
98
import android.os.ParcelFileDescriptor
109
import android.text.SpannableStringBuilder
1110
import android.text.Spanned
1211
import android.text.method.LinkMovementMethod
1312
import android.text.style.ClickableSpan
14-
import android.text.style.ForegroundColorSpan
15-
import android.text.style.StyleSpan
1613
import android.view.LayoutInflater
1714
import android.view.View
1815
import 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

android/app/src/main/res/layout/item_game_cover.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,25 @@
4242
android:maxLines="2"
4343
android:textAlignment="center"
4444
android:textAppearance="@style/TextAppearance.Material3.TitleSmall"
45-
app:layout_constraintBottom_toBottomOf="parent"
4645
app:layout_constraintEnd_toEndOf="parent"
4746
app:layout_constraintStart_toStartOf="parent"
4847
app:layout_constraintTop_toBottomOf="@id/game_cover_art_card" />
48+
49+
<TextView
50+
android:id="@+id/game_cover_convert_warning_text"
51+
android:layout_width="0dp"
52+
android:layout_height="wrap_content"
53+
android:layout_marginTop="4dp"
54+
android:gravity="center_horizontal"
55+
android:maxLines="1"
56+
android:text="@string/library_regular_iso_badge"
57+
android:textAlignment="center"
58+
android:textAppearance="@style/TextAppearance.Material3.LabelSmall"
59+
android:textColor="@color/xemu_warning"
60+
android:textStyle="bold"
61+
android:visibility="gone"
62+
app:layout_constraintBottom_toBottomOf="parent"
63+
app:layout_constraintEnd_toEndOf="parent"
64+
app:layout_constraintStart_toStartOf="parent"
65+
app:layout_constraintTop_toBottomOf="@id/game_cover_name_text" />
4966
</androidx.constraintlayout.widget.ConstraintLayout>

android/app/src/main/res/layout/item_game_entry.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@
5353
android:maxLines="2"
5454
android:textAppearance="@style/TextAppearance.Material3.TitleSmall" />
5555

56+
<TextView
57+
android:id="@+id/game_convert_warning_text"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content"
60+
android:layout_marginTop="4dp"
61+
android:maxLines="1"
62+
android:text="@string/library_regular_iso_badge"
63+
android:textAppearance="@style/TextAppearance.Material3.LabelSmall"
64+
android:textColor="@color/xemu_warning"
65+
android:textStyle="bold"
66+
android:visibility="gone" />
67+
5668
<TextView
5769
android:id="@+id/game_size_text"
5870
android:layout_width="match_parent"

build-aab.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
project_source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
6+
android_dir="${project_source_dir}/android"
7+
key_props="${android_dir}/key.properties"
8+
release_aab="${android_dir}/app/build/outputs/bundle/release/app-release.aab"
9+
10+
if [[ ! -f "${key_props}" ]]; then
11+
printf 'Creating "%s" with placeholders...\n' "${key_props}"
12+
cat >"${key_props}" <<'EOF'
13+
storeFile=/path/to/your-release-key.jks
14+
storePassword=REPLACE_ME
15+
keyAlias=REPLACE_ME
16+
keyPassword=REPLACE_ME
17+
EOF
18+
printf '\nEdit %s with your real values, then rerun this script.\n' "${key_props}"
19+
exit 1
20+
fi
21+
22+
if grep -Fq 'REPLACE_ME' "${key_props}"; then
23+
printf '\nPlease replace the placeholders in %s before building.\n' "${key_props}"
24+
exit 1
25+
fi
26+
27+
if grep -Fq '/path/to/your-release-key.jks' "${key_props}" || \
28+
grep -Fq 'C:/path/to/your-release-key.jks' "${key_props}"; then
29+
printf '\nPlease replace the storeFile placeholder in %s before building.\n' "${key_props}"
30+
exit 1
31+
fi
32+
33+
cd "${android_dir}"
34+
bash ./gradlew bundleRelease
35+
36+
printf '\nBuild complete.\n'
37+
printf 'Release AAB:\n'
38+
printf ' %s\n' "${release_aab}"

0 commit comments

Comments
 (0)