Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 0ecc413

Browse files
committed
Change version string when there is an update (Fix #24)
1 parent 0affbe7 commit 0ecc413

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
applicationId "com.fox2code.mmm"
1111
minSdk 21
1212
targetSdk 31
13-
versionCode 15
13+
versionCode 16
1414
versionName "0.2.5"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

app/src/main/java/com/fox2code/mmm/ModuleViewAdapter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,11 @@ public boolean update(ModuleHolder moduleHolder) {
177177

178178
ModuleInfo moduleInfo = moduleHolder.getMainModuleInfo();
179179
this.titleText.setText(moduleInfo.name);
180-
this.creditText.setText(moduleInfo.version + " " +
181-
this.getString(R.string.module_by) + " " + moduleInfo.author);
180+
this.creditText.setText((localModuleInfo == null ||
181+
moduleInfo.version.equals(localModuleInfo.version) ? moduleInfo.version :
182+
localModuleInfo.version + " (" + this.getString(
183+
R.string.module_last_update) + moduleInfo.version + ")") +
184+
" " + this.getString(R.string.module_by) + " " + moduleInfo.author);
182185
this.descriptionText.setText(moduleInfo.description);
183186
String updateText = moduleHolder.getUpdateTimeText();
184187
if (!updateText.isEmpty()) {

app/src/main/java/com/fox2code/mmm/utils/PropUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ public static void readProperties(ModuleInfo moduleInfo, String file,boolean loc
129129
}
130130
break;
131131
case "author":
132-
moduleInfo.author = value;
132+
moduleInfo.author = value.endsWith(" development team") ?
133+
value.substring(0, value.length() - 17) : value;
133134
break;
134135
case "description":
135136
moduleInfo.description = value;
@@ -200,7 +201,8 @@ public static void readProperties(ModuleInfo moduleInfo, String file,boolean loc
200201
if (moduleInfo.name == null || !readName) {
201202
moduleInfo.name = makeNameFromId(moduleInfo.id);
202203
}
203-
if (moduleInfo.version == null || !readVersion) {
204+
// We can't accept too long version names for usability reason.
205+
if (moduleInfo.version == null || !readVersion || moduleInfo.version.length() > 16) {
204206
moduleInfo.version = "v" + moduleInfo.versionCode;
205207
}
206208
if (moduleInfo.minApi == 0) {

0 commit comments

Comments
 (0)