[app] Open URL when need to update (#934)
This commit is contained in:
parent
9dddd13eb0
commit
6b3c9c361b
|
|
@ -60,7 +60,7 @@ public class ConfigManager {
|
|||
return LSPManagerServiceHolder.getService().getXposedVersionName();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(App.TAG, Log.getStackTraceString(e));
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class MainActivity extends BaseActivity {
|
|||
}
|
||||
if (intent.getAction() != null && intent.getAction().equals("android.intent.action.APPLICATION_PREFERENCES")) {
|
||||
navController.navigate(R.id.action_settings_fragment);
|
||||
} else if (intent.hasExtra("modulePackageName")) {
|
||||
} else if (intent.hasExtra("modulePackageName") && ConfigManager.isBinderAlive()) {
|
||||
navController.navigate(NavGraphDirections.actionAppListFragment(intent.getStringExtra("modulePackageName"), intent.getIntExtra("moduleUserId", -1)));
|
||||
} else if (!TextUtils.isEmpty(intent.getDataString())) {
|
||||
switch (intent.getDataString()) {
|
||||
|
|
|
|||
|
|
@ -55,10 +55,11 @@ public class BaseActivity extends MaterialActivity {
|
|||
// make sure the versions are consistent
|
||||
if (BuildConfig.DEBUG) return;
|
||||
if (!ConfigManager.isBinderAlive()) return;
|
||||
if (BuildConfig.VERSION_NAME.equals(ConfigManager.getXposedVersionName())) return;
|
||||
var version = ConfigManager.getXposedVersionName();
|
||||
if (BuildConfig.VERSION_NAME.equals(version)) return;
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(BuildConfig.VERSION_NAME.compareTo(ConfigManager.getXposedVersionName()) > 0 ?
|
||||
R.string.outdated_core : R.string.outdated_manager)
|
||||
.setMessage(BuildConfig.VERSION_NAME.compareTo(version) > 0 ?
|
||||
R.string.outdated_core : R.string.outdated_manager)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, id) -> {
|
||||
NavUtil.startURL(this, getString(R.string.about_source));
|
||||
finish();
|
||||
|
|
|
|||
|
|
@ -80,8 +80,10 @@ public class HomeFragment extends BaseFragment {
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
BaseActivity activity = (BaseActivity) requireActivity();
|
||||
boolean isBinderAlive = ConfigManager.isBinderAlive();
|
||||
boolean needUpdate = App.needUpdate();
|
||||
binding.status.setOnClickListener(v -> {
|
||||
if (ConfigManager.isBinderAlive()) {
|
||||
if (isBinderAlive && !needUpdate) {
|
||||
new InfoDialogBuilder(activity).setTitle(R.string.info).show();
|
||||
} else {
|
||||
NavUtil.startURL(activity, getString(R.string.about_source));
|
||||
|
|
@ -111,7 +113,7 @@ public class HomeFragment extends BaseFragment {
|
|||
.load(wrap(activity.getApplicationInfo(), getResources().getConfiguration().hashCode()))
|
||||
.into(binding.appIcon);
|
||||
int cardBackgroundColor;
|
||||
if (ConfigManager.isBinderAlive()) {
|
||||
if (isBinderAlive) {
|
||||
if (!ConfigManager.isSepolicyLoaded()) {
|
||||
binding.statusTitle.setText(R.string.partial_activated);
|
||||
cardBackgroundColor = ResourcesKt.resolveColor(activity.getTheme(), R.attr.colorWarning);
|
||||
|
|
@ -127,7 +129,7 @@ public class HomeFragment extends BaseFragment {
|
|||
cardBackgroundColor = ResourcesKt.resolveColor(activity.getTheme(), R.attr.colorWarning);
|
||||
binding.statusIcon.setImageResource(R.drawable.ic_warning);
|
||||
binding.statusSummary.setText(R.string.system_prop_incorrect_summary);
|
||||
} else if (App.needUpdate()) {
|
||||
} else if (needUpdate) {
|
||||
binding.statusTitle.setText(R.string.need_update);
|
||||
cardBackgroundColor = ResourcesKt.resolveColor(activity.getTheme(), R.attr.colorWarning);
|
||||
binding.statusIcon.setImageResource(R.drawable.ic_warning);
|
||||
|
|
|
|||
|
|
@ -244,15 +244,6 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
|
|||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (ConfigManager.getXposedVersionName() == null) {
|
||||
Toast.makeText(requireContext(), R.string.lsposed_not_active, Toast.LENGTH_LONG).show();
|
||||
getNavController().navigateUp();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
|
||||
|
|
|
|||
Loading…
Reference in New Issue