Skip to content

Commit 5cc2bee

Browse files
fix more crashing
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent eb26450 commit 5cc2bee

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

app/src/main/java/com/fox2code/mmm/module/ModuleHolder.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,15 @@ public Type getType() {
146146
// now, we just had to make it more fucking complicated, didn't we?
147147
// we now have pref_background_update_check_excludes_version, which is a id:version stringset of versions the user may want to "skip"
148148
// oh, and because i hate myself, i made ^ at the beginning match that version and newer, and $ at the end match that version and older
149-
Set<String> stringSet = MainApplication.getSharedPreferences("mmm").getStringSet("pref_background_update_check_excludes_version", new HashSet<>());
149+
Set<String> stringSetT = MainApplication.getSharedPreferences("mmm").getStringSet("pref_background_update_check_excludes_version", new HashSet<>());
150150
String version = "";
151-
if (stringSet.contains(moduleInfo.id)) {
151+
Set<String> stringSet = stringSetT;
152+
Timber.d(stringSet.toString());
153+
if (stringSet.contains(this.moduleInfo.id)) {
152154
// get the one matching
153-
version = stringSet.stream().filter(s -> s.startsWith(moduleInfo.id)).findFirst().orElse("");
155+
Timber.d("found mod in ig ver");
156+
version = stringSet.stream().filter(s -> s.startsWith(this.moduleInfo.id)).findFirst().orElse("");
157+
Timber.d("igV:%s", version);
154158
}
155159
String remoteVersionCode = String.valueOf(moduleInfo.updateVersionCode);
156160
if (repoModule != null) {
@@ -164,19 +168,24 @@ public Type getType() {
164168
// now find out if user wants up to and including this version, or this version and newer
165169
// if it starts with ^, it's this version and newer, if it ends with $, it's this version and older
166170
if (version.startsWith("^")) {
171+
Timber.d("igV start with");
167172
// this version and newer
168173
if (wantsVersion <= remoteVersionCodeInt || wantsVersion <= localVersionCode) {
169174
// if it is, we skip it
175+
Timber.d("igu true");
170176
ignoreUpdate = true;
171177
}
172178
} else if (version.endsWith("$")) {
179+
Timber.d("igV end with");
173180
// this version and older
174181
if (wantsVersion >= remoteVersionCodeInt || wantsVersion >= localVersionCode) {
175182
// if it is, we skip it
183+
Timber.d("igu true");
176184
ignoreUpdate = true;
177185
}
178186
} else if (wantsVersion == remoteVersionCodeInt || wantsVersion == localVersionCode) {
179187
// if it is, we skip it
188+
Timber.d("igu true");
180189
ignoreUpdate = true;
181190
}
182191
}

app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,22 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
667667
Timber.d("ok clicked");
668668
// for every module, get the text field and save it to the stringset
669669
Set<String> stringSetTemp = new HashSet<>();
670+
String prevMod = "";
670671
for (int i = 0; i < layout.getChildCount(); i++) {
672+
if (layout.getChildAt(i) instanceof MaterialTextView) {
673+
MaterialTextView mv = (MaterialTextView) layout.getChildAt(i);
674+
prevMod = mv.getText().toString();
675+
continue;
676+
};
671677
EditText editText = (EditText) layout.getChildAt(i);
672678
String text = editText.getText().toString();
673679
if (!text.isEmpty()) {
674680
// text can only contain numbers and the characters ^ and $
675681
// so we remove all non-numbers and non ^ and $
676682
text = text.replaceAll("[^0-9^$]", "");
677683
// we have to use module id even though we show name
678-
stringSetTemp.add(localModuleInfos.stream().filter(localModuleInfo -> localModuleInfo.name.equals(editText.getHint().toString())).findFirst().orElse(null).id + ":" + text);
684+
String finalprevMod = prevMod;
685+
stringSetTemp.add(localModuleInfos.stream().filter(localModuleInfo -> localModuleInfo.name.equals(finalprevMod)).findFirst().orElse(null).id + ":" + text);
679686
Timber.d("text is %s for %s", text, editText.getHint().toString());
680687
} else {
681688
Timber.d("text is empty for %s", editText.getHint().toString());

0 commit comments

Comments
 (0)