(misc) minor UI tweaks

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/300/head
androidacy-user 1 year ago
parent 61117ed065
commit af1c06985e

@ -346,6 +346,17 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
RepoManager.getINSTANCE().runAfterUpdate(moduleViewListBuilderOnline::appendRemoteModules); RepoManager.getINSTANCE().runAfterUpdate(moduleViewListBuilderOnline::appendRemoteModules);
moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline); moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline);
// logic to handle updateable modules
moduleViewListBuilder.applyTo(moduleListOnline, moduleViewAdapterOnline);
// if moduleViewListBuilderOnline has the upgradeable notification, show a badge on the online repo nav item
if (MainApplication.getINSTANCE().modulesHaveUpdates) {
runOnUiThread(() -> {
final var badge = bottomNavigationView.getOrCreateBadge(1);
badge.setVisible(true);
badge.setNumber(MainApplication.getINSTANCE().updateModuleCount);
bottomNavigationView.setSelectedItemId(R.id.installed_menu_item);
});
}
Timber.i("Finished app opening state!"); Timber.i("Finished app opening state!");
} }
}, true); }, true);

@ -90,7 +90,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
// Use FoxProcess wrapper helper. // Use FoxProcess wrapper helper.
private static final boolean wrapped = !FoxProcessExt.isRootLoader(); private static final boolean wrapped = !FoxProcessExt.isRootLoader();
private static boolean SHOWCASE_MODE_TRUE = false; private static String SHOWCASE_MODE_TRUE = null;
public static boolean isOfficial = false; public static boolean isOfficial = false;
private static long secret; private static long secret;
private static Locale timeFormatLocale = Resources.getSystem().getConfiguration().getLocales().get(0); private static Locale timeFormatLocale = Resources.getSystem().getConfiguration().getLocales().get(0);
@ -101,6 +101,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
private static boolean firstBoot; private static boolean firstBoot;
private static HashMap<Object, Object> mSharedPrefs; private static HashMap<Object, Object> mSharedPrefs;
private static final ArrayList<String> callers = new ArrayList<>(); private static final ArrayList<String> callers = new ArrayList<>();
public boolean modulesHaveUpdates = false;
static { static {
Shell.setDefaultBuilder(shellBuilder = Shell.Builder.create().setFlags(Shell.FLAG_REDIRECT_STDERR).setTimeout(10).setInitializers(InstallerInitializer.class)); Shell.setDefaultBuilder(shellBuilder = Shell.Builder.create().setFlags(Shell.FLAG_REDIRECT_STDERR).setTimeout(10).setInitializers(InstallerInitializer.class));
@ -110,6 +111,8 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
} while (secret == 0); } while (secret == 0);
} }
public int updateModuleCount = 0;
@StyleRes @StyleRes
private int managerThemeResId = R.style.Theme_MagiskModuleManager; private int managerThemeResId = R.style.Theme_MagiskModuleManager;
private FoxThemeWrapper markwonThemeContext; private FoxThemeWrapper markwonThemeContext;
@ -188,9 +191,12 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
} }
public static boolean isShowcaseMode() { public static boolean isShowcaseMode() {
if (SHOWCASE_MODE_TRUE) return true; if (SHOWCASE_MODE_TRUE != null) {
// convert from String to boolean
return Boolean.parseBoolean(SHOWCASE_MODE_TRUE);
}
boolean showcaseMode = getPreferences("mmm").getBoolean("pref_showcase_mode", false); boolean showcaseMode = getPreferences("mmm").getBoolean("pref_showcase_mode", false);
SHOWCASE_MODE_TRUE = showcaseMode; SHOWCASE_MODE_TRUE = String.valueOf(showcaseMode);
return showcaseMode; return showcaseMode;
} }

@ -15,8 +15,8 @@ import com.fox2code.mmm.manager.LocalModuleInfo;
import com.fox2code.mmm.manager.ModuleInfo; import com.fox2code.mmm.manager.ModuleInfo;
import com.fox2code.mmm.repo.RepoModule; import com.fox2code.mmm.repo.RepoModule;
import com.fox2code.mmm.utils.IntentHelper; import com.fox2code.mmm.utils.IntentHelper;
import com.fox2code.mmm.utils.io.net.Http;
import com.fox2code.mmm.utils.io.PropUtils; import com.fox2code.mmm.utils.io.PropUtils;
import com.fox2code.mmm.utils.io.net.Http;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@ -145,6 +145,10 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
} else if (this.moduleInfo.versionCode < this.moduleInfo.updateVersionCode || } else if (this.moduleInfo.versionCode < this.moduleInfo.updateVersionCode ||
(this.repoModule != null && this.moduleInfo.versionCode < (this.repoModule != null && this.moduleInfo.versionCode <
this.repoModule.moduleInfo.versionCode)) { this.repoModule.moduleInfo.versionCode)) {
Timber.d("Module %s has update", this.moduleId);
MainApplication.getINSTANCE().modulesHaveUpdates = true;
MainApplication.getINSTANCE().updateModuleCount++;
Timber.d("modulesHaveUpdates = %s, updateModuleCount = %s", MainApplication.getINSTANCE().modulesHaveUpdates, MainApplication.getINSTANCE().updateModuleCount);
return Type.UPDATABLE; return Type.UPDATABLE;
} else { } else {
return Type.INSTALLED; return Type.INSTALLED;

@ -192,6 +192,7 @@ public enum Http {
// for debug builds, add a logging interceptor // for debug builds, add a logging interceptor
// this spams the logcat, so it's disabled by default and hidden behind a build config flag // this spams the logcat, so it's disabled by default and hidden behind a build config flag
if (BuildConfig.DEBUG && BuildConfig.DEBUG_HTTP) { if (BuildConfig.DEBUG && BuildConfig.DEBUG_HTTP) {
Timber.w("HTTP logging is enabled. Performance may be impacted.");
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
httpclientBuilder.addInterceptor(loggingInterceptor); httpclientBuilder.addInterceptor(loggingInterceptor);
@ -460,8 +461,6 @@ public enum Http {
public static boolean hasConnectivity() { public static boolean hasConnectivity() {
// Check if we have internet connection // Check if we have internet connection
// Attempt to contact connectivitycheck.gstatic.com/generate_204
// If we can't, we don't have internet connection
Timber.d("Checking internet connection..."); Timber.d("Checking internet connection...");
// this url is actually hosted by Cloudflare and is not dependent on Androidacy servers being up // this url is actually hosted by Cloudflare and is not dependent on Androidacy servers being up
byte[] resp; byte[] resp;

Loading…
Cancel
Save