Fix manager crash

This commit is contained in:
NekoInverter 2021-01-26 17:37:02 +08:00 committed by tehcneko
parent dc788d852c
commit aca1038700
8 changed files with 8 additions and 36 deletions

View File

@ -27,7 +27,6 @@ public class AboutActivity extends BaseActivity {
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
}
setupWindowInsets(binding.snackbar, null);
binding.appVersion.setText(BuildConfig.VERSION_NAME);
@ -44,7 +43,7 @@ public class AboutActivity extends BaseActivity {
v.setOnClickListener(v1 -> NavUtil.startURL(this, getString(url)));
}
public void openLink(View view) {
NavUtil.startURL(this, view.getTag().toString());
}
//public void openLink(View view) {
// NavUtil.startURL(this, view.getTag().toString());
//}
}

View File

@ -47,6 +47,10 @@ public class BaseActivity extends AppCompatActivity {
protected static SharedPreferences preferences;
private String theme;
static {
preferences = App.getPreferences();
}
public static boolean isBlackNightTheme() {
return preferences.getBoolean("black_dark_theme", false) || preferences.getBoolean("md2", false);
}
@ -110,14 +114,9 @@ public class BaseActivity extends AppCompatActivity {
return getResources().getIdentifier(customThemeName, "style", getPackageName());
}
protected void setupWindowInsets(View rootView, View secondView) {
// TODO:
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
preferences = App.getPreferences();
AppCompatDelegate.setDefaultNightMode(preferences.getInt("theme", -1));
theme = getTheme(this) + getCustomTheme() + preferences.getBoolean("md2", false);
}

View File

@ -48,7 +48,6 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
}
setupWindowInsets(binding.snackbar, binding.recyclerView);
final boolean isWhiteListMode = isWhiteListMode();
appAdapter = new BlackListAdapter(this, isWhiteListMode);
appAdapter.setHasStableIds(true);

View File

@ -67,7 +67,6 @@ public class LogsActivity extends BaseActivity {
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
}
setupWindowInsets(binding.snackbar, binding.recyclerView);
if (!preferences.getBoolean("hide_logcat_warning", false)) {
DialogInstallWarningBinding binding = DialogInstallWarningBinding.inflate(getLayoutInflater());

View File

@ -34,7 +34,6 @@ public class MainActivity extends BaseActivity implements ModuleUtil.ModuleListe
binding.modules.setElevation(12);
}
});
setupWindowInsets(binding.snackbar, null);
ModuleUtil.getInstance().addListener(this);
binding.modules.setOnClickListener(v -> {
Intent intent = new Intent();

View File

@ -51,7 +51,6 @@ public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Call
bar.setDisplayHomeAsUpEnabled(true);
bar.setSubtitle(moduleName);
}
setupWindowInsets(binding.snackbar, binding.recyclerView);
appAdapter = new ScopeAdapter(this, modulePackageName, binding.masterSwitch);
appAdapter.setHasStableIds(true);
binding.recyclerView.setAdapter(appAdapter);

View File

@ -177,7 +177,6 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
}
setupWindowInsets(binding.snackbar, binding.recyclerView);
filter = new ApplicationFilter();
moduleUtil = ModuleUtil.getInstance();
pm = getPackageManager();
@ -507,27 +506,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
return false;
});
holder.itemView.setOnCreateContextMenuListener((menu, v, menuInfo) -> {
getMenuInflater().inflate(R.menu.context_menu_modules, menu);
/*ModuleUtil.InstalledModule installedModule = ModuleUtil.getInstance().getModule(item.packageName);
if (installedModule == null) {
return;
}
try {
String support = RepoDb.getModuleSupport(installedModule.packageName);
if (NavUtil.parseURL(support) == null) {
menu.removeItem(R.id.menu_support);
}
} catch (RepoDb.RowNotFoundException e) {
menu.removeItem(R.id.menu_download_updates);
menu.removeItem(R.id.menu_support);
}
if (installedModule.packageName.equals(BuildConfig.APPLICATION_ID)) {
menu.removeItem(R.id.menu_launch);
menu.removeItem(R.id.menu_scope);
menu.removeItem(R.id.menu_uninstall);
}*/
});
holder.itemView.setOnCreateContextMenuListener((menu, v, menuInfo) -> getMenuInflater().inflate(R.menu.context_menu_modules, menu));
holder.appName.setText(item.getAppName());
TextView version = holder.appVersion;

View File

@ -58,7 +58,6 @@ public class SettingsActivity extends BaseActivity {
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
}
setupWindowInsets(binding.snackbar, null);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new SettingsFragment()).commit();