Fix top inset bug, try to workaround no root/magisk issues.

pull/85/head
Fox2Code 2 years ago
parent 2a97cbafa3
commit 63224b76fd

@ -154,6 +154,8 @@ public class MainActivity extends CompatActivity implements SwipeRefreshLayout.O
runOnUiThread(() -> {
progressIndicator.setIndeterminate(false);
progressIndicator.setMax(PRECISION);
// Fix insets not being accounted for correctly
updateScreenInsets(getResources().getConfiguration());
});
Log.i(TAG, "Scanning for modules!");
final int max = ModuleManager.getINSTANCE().getUpdatableModuleCount();

@ -120,7 +120,7 @@ public class ModuleViewListBuilder {
moduleHolders.add(new ModuleHolder(notificationType));
}
}
newNotificationsLen = this.notifications.size() - special;
newNotificationsLen = this.notifications.size() + 1 - special;
EnumSet<ModuleHolder.Type> headerTypes = EnumSet.of(ModuleHolder.Type.SEPARATOR,
ModuleHolder.Type.NOTIFICATION, ModuleHolder.Type.FOOTER);
Iterator<ModuleHolder> moduleHolderIterator = this.mappedModuleHolders.values().iterator();
@ -170,7 +170,9 @@ public class ModuleViewListBuilder {
this.updateInsets = RUNNABLE;
final EnumSet<NotificationType> oldNotifications =
EnumSet.noneOf(NotificationType.class);
boolean isTop = !moduleList.canScrollVertically(-1);
boolean isTop = // Force isTop if empty
moduleViewAdapter.moduleHolders.isEmpty() ||
!moduleList.canScrollVertically(-1);
boolean isBottom = !isTop && !moduleList.canScrollVertically(1);
int oldNotificationsLen = 0;
int oldOfflineModulesLen = 0;
@ -199,10 +201,16 @@ public class ModuleViewListBuilder {
int oldLen = moduleViewAdapter.moduleHolders.size();
moduleViewAdapter.moduleHolders.clear();
moduleViewAdapter.moduleHolders.addAll(moduleHolders);
synchronized (this.updateLock) {
headerFooter[0].footerPx = this.headerPx;
headerFooter[1].footerPx = this.footerPx;
}
if (oldNotificationsLen != newNotificationsLen ||
!oldNotifications.equals(this.notifications)) {
notifySizeChanged(moduleViewAdapter, 0,
oldNotificationsLen, newNotificationsLen);
} else {
notifySizeChanged(moduleViewAdapter, 0, 1, 1);
}
if (newLen - newNotificationsLen == 0) {
notifySizeChanged(moduleViewAdapter, newNotificationsLen,

@ -15,6 +15,8 @@ import java.util.ArrayList;
public class InstallerInitializer extends Shell.Initializer {
private static final String TAG = "InstallerInitializer";
private static final File MAGISK_SYSTEM =
new File("/system/bin/magisk");
private static String MAGISK_PATH;
private static int MAGISK_VERSION_CODE;
@ -64,6 +66,9 @@ public class InstallerInitializer extends Shell.Initializer {
}
if (forceCheck) {
InstallerInitializer.MAGISK_PATH = MAGISK_PATH;
if (MAGISK_PATH == null) {
InstallerInitializer.MAGISK_VERSION_CODE = 0;
}
}
if (MAGISK_PATH != null) {
MainApplication.setHasGottenRootAccess(true);
@ -112,9 +117,15 @@ public class InstallerInitializer extends Shell.Initializer {
Log.w(TAG, "Unable to detect magisk path!");
} else {
newJob.add("export ASH_STANDALONE=1");
newJob.add("export PATH=\"" + MAGISK_PATH + "/.magisk/busybox;$PATH\"");
if (!MAGISK_PATH.equals("/sbin") && !MAGISK_SYSTEM.exists()) {
newJob.add("export PATH=" + MAGISK_PATH + ";$PATH;" +
MAGISK_PATH + "/.magisk/busybox");
} else {
newJob.add("export PATH=$PATH;" +
MAGISK_PATH + "/.magisk/busybox");
}
newJob.add("export MAGISKTMP=\"" + MAGISK_PATH + "/.magisk\"");
newJob.add("busybox sh");
newJob.add("$(which busybox 2> /dev/null) sh");
}
return true;
}

Loading…
Cancel
Save