fix more crashing

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 2 years ago
parent eb2645075a
commit 5cc2bee50f

@ -146,11 +146,15 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
// now, we just had to make it more fucking complicated, didn't we?
// we now have pref_background_update_check_excludes_version, which is a id:version stringset of versions the user may want to "skip"
// 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
Set<String> stringSet = MainApplication.getSharedPreferences("mmm").getStringSet("pref_background_update_check_excludes_version", new HashSet<>());
Set<String> stringSetT = MainApplication.getSharedPreferences("mmm").getStringSet("pref_background_update_check_excludes_version", new HashSet<>());
String version = "";
if (stringSet.contains(moduleInfo.id)) {
Set<String> stringSet = stringSetT;
Timber.d(stringSet.toString());
if (stringSet.contains(this.moduleInfo.id)) {
// get the one matching
version = stringSet.stream().filter(s -> s.startsWith(moduleInfo.id)).findFirst().orElse("");
Timber.d("found mod in ig ver");
version = stringSet.stream().filter(s -> s.startsWith(this.moduleInfo.id)).findFirst().orElse("");
Timber.d("igV:%s", version);
}
String remoteVersionCode = String.valueOf(moduleInfo.updateVersionCode);
if (repoModule != null) {
@ -164,19 +168,24 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
// now find out if user wants up to and including this version, or this version and newer
// if it starts with ^, it's this version and newer, if it ends with $, it's this version and older
if (version.startsWith("^")) {
Timber.d("igV start with");
// this version and newer
if (wantsVersion <= remoteVersionCodeInt || wantsVersion <= localVersionCode) {
// if it is, we skip it
Timber.d("igu true");
ignoreUpdate = true;
}
} else if (version.endsWith("$")) {
Timber.d("igV end with");
// this version and older
if (wantsVersion >= remoteVersionCodeInt || wantsVersion >= localVersionCode) {
// if it is, we skip it
Timber.d("igu true");
ignoreUpdate = true;
}
} else if (wantsVersion == remoteVersionCodeInt || wantsVersion == localVersionCode) {
// if it is, we skip it
Timber.d("igu true");
ignoreUpdate = true;
}
}

@ -667,7 +667,13 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
Timber.d("ok clicked");
// for every module, get the text field and save it to the stringset
Set<String> stringSetTemp = new HashSet<>();
String prevMod = "";
for (int i = 0; i < layout.getChildCount(); i++) {
if (layout.getChildAt(i) instanceof MaterialTextView) {
MaterialTextView mv = (MaterialTextView) layout.getChildAt(i);
prevMod = mv.getText().toString();
continue;
};
EditText editText = (EditText) layout.getChildAt(i);
String text = editText.getText().toString();
if (!text.isEmpty()) {
@ -675,7 +681,8 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
// so we remove all non-numbers and non ^ and $
text = text.replaceAll("[^0-9^$]", "");
// we have to use module id even though we show name
stringSetTemp.add(localModuleInfos.stream().filter(localModuleInfo -> localModuleInfo.name.equals(editText.getHint().toString())).findFirst().orElse(null).id + ":" + text);
String finalprevMod = prevMod;
stringSetTemp.add(localModuleInfos.stream().filter(localModuleInfo -> localModuleInfo.name.equals(finalprevMod)).findFirst().orElse(null).id + ":" + text);
Timber.d("text is %s for %s", text, editText.getHint().toString());
} else {
Timber.d("text is empty for %s", editText.getHint().toString());

Loading…
Cancel
Save