Change version string when there is an update (Fix #24)

This commit is contained in:
Fox2Code 2022-01-10 21:08:27 +01:00
parent 0affbe7aee
commit 0ecc413041
3 changed files with 10 additions and 5 deletions

View File

@ -10,7 +10,7 @@ android {
applicationId "com.fox2code.mmm" applicationId "com.fox2code.mmm"
minSdk 21 minSdk 21
targetSdk 31 targetSdk 31
versionCode 15 versionCode 16
versionName "0.2.5" versionName "0.2.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@ -177,8 +177,11 @@ public final class ModuleViewAdapter extends RecyclerView.Adapter<ModuleViewAdap
ModuleInfo moduleInfo = moduleHolder.getMainModuleInfo(); ModuleInfo moduleInfo = moduleHolder.getMainModuleInfo();
this.titleText.setText(moduleInfo.name); this.titleText.setText(moduleInfo.name);
this.creditText.setText(moduleInfo.version + " " + this.creditText.setText((localModuleInfo == null ||
this.getString(R.string.module_by) + " " + moduleInfo.author); moduleInfo.version.equals(localModuleInfo.version) ? moduleInfo.version :
localModuleInfo.version + " (" + this.getString(
R.string.module_last_update) + moduleInfo.version + ")") +
" " + this.getString(R.string.module_by) + " " + moduleInfo.author);
this.descriptionText.setText(moduleInfo.description); this.descriptionText.setText(moduleInfo.description);
String updateText = moduleHolder.getUpdateTimeText(); String updateText = moduleHolder.getUpdateTimeText();
if (!updateText.isEmpty()) { if (!updateText.isEmpty()) {

View File

@ -129,7 +129,8 @@ public class PropUtils {
} }
break; break;
case "author": case "author":
moduleInfo.author = value; moduleInfo.author = value.endsWith(" development team") ?
value.substring(0, value.length() - 17) : value;
break; break;
case "description": case "description":
moduleInfo.description = value; moduleInfo.description = value;
@ -200,7 +201,8 @@ public class PropUtils {
if (moduleInfo.name == null || !readName) { if (moduleInfo.name == null || !readName) {
moduleInfo.name = makeNameFromId(moduleInfo.id); moduleInfo.name = makeNameFromId(moduleInfo.id);
} }
if (moduleInfo.version == null || !readVersion) { // We can't accept too long version names for usability reason.
if (moduleInfo.version == null || !readVersion || moduleInfo.version.length() > 16) {
moduleInfo.version = "v" + moduleInfo.versionCode; moduleInfo.version = "v" + moduleInfo.versionCode;
} }
if (moduleInfo.minApi == 0) { if (moduleInfo.minApi == 0) {