Navigate to GitHub when versions are not consistent (#60)
This commit is contained in:
parent
68bb2d3db7
commit
49b80387ee
|
|
@ -1,7 +1,6 @@
|
||||||
package io.github.lsposed.manager.ui.activity;
|
package io.github.lsposed.manager.ui.activity;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
|
@ -25,9 +24,13 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import io.github.lsposed.manager.App;
|
import io.github.lsposed.manager.App;
|
||||||
|
import io.github.lsposed.manager.BuildConfig;
|
||||||
|
import io.github.lsposed.manager.Constants;
|
||||||
import io.github.lsposed.manager.R;
|
import io.github.lsposed.manager.R;
|
||||||
import io.github.lsposed.manager.util.CustomThemeColor;
|
import io.github.lsposed.manager.util.CustomThemeColor;
|
||||||
import io.github.lsposed.manager.util.CustomThemeColors;
|
import io.github.lsposed.manager.util.CustomThemeColors;
|
||||||
|
import io.github.lsposed.manager.util.NavUtil;
|
||||||
|
import io.github.lsposed.manager.util.Version;
|
||||||
|
|
||||||
public class BaseActivity extends AppCompatActivity {
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
@ -98,6 +101,23 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
AppCompatDelegate.setDefaultNightMode(preferences.getInt("theme", -1));
|
AppCompatDelegate.setDefaultNightMode(preferences.getInt("theme", -1));
|
||||||
theme = getTheme(this) + getCustomTheme() + preferences.getBoolean("md2", true);
|
theme = getTheme(this) + getCustomTheme() + preferences.getBoolean("md2", true);
|
||||||
|
|
||||||
|
// make sure the versions are consistent
|
||||||
|
String coreVersionStr = Constants.getXposedVersion();
|
||||||
|
if (coreVersionStr != null) {
|
||||||
|
Version managerVersion = new Version(BuildConfig.VERSION_NAME);
|
||||||
|
Version coreVersion = new Version(coreVersionStr);
|
||||||
|
if (managerVersion.equals(coreVersion)) {
|
||||||
|
new MaterialAlertDialogBuilder(this)
|
||||||
|
.setMessage(R.string.outdated_manager)
|
||||||
|
.setPositiveButton(R.string.ok, (dialog, id) -> {
|
||||||
|
NavUtil.startURL(this, getString(R.string.about_source));
|
||||||
|
finish();
|
||||||
|
})
|
||||||
|
.setCancelable(false)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupRecyclerViewInsets(View recyclerView, View root) {
|
protected void setupRecyclerViewInsets(View recyclerView, View root) {
|
||||||
|
|
@ -160,12 +180,4 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
// only pass theme style to super, so styled theme will not be overwritten
|
// only pass theme style to super, so styled theme will not be overwritten
|
||||||
super.onApplyThemeResource(theme, R.style.ThemeOverlay, first);
|
super.onApplyThemeResource(theme, R.style.ThemeOverlay, first);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void areYouSure(int contentTextId, DialogInterface.OnClickListener listener) {
|
|
||||||
new MaterialAlertDialogBuilder(this).setTitle(R.string.areyousure)
|
|
||||||
.setMessage(contentTextId)
|
|
||||||
.setPositiveButton(android.R.string.ok, listener)
|
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package io.github.lsposed.manager.ui.activity;
|
package io.github.lsposed.manager.ui.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
|
@ -13,7 +10,6 @@ import com.bumptech.glide.Glide;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import io.github.lsposed.manager.BuildConfig;
|
|
||||||
import io.github.lsposed.manager.Constants;
|
import io.github.lsposed.manager.Constants;
|
||||||
import io.github.lsposed.manager.R;
|
import io.github.lsposed.manager.R;
|
||||||
import io.github.lsposed.manager.databinding.ActivityMainBinding;
|
import io.github.lsposed.manager.databinding.ActivityMainBinding;
|
||||||
|
|
@ -21,7 +17,6 @@ import io.github.lsposed.manager.ui.fragment.StatusDialogBuilder;
|
||||||
import io.github.lsposed.manager.util.GlideHelper;
|
import io.github.lsposed.manager.util.GlideHelper;
|
||||||
import io.github.lsposed.manager.util.ModuleUtil;
|
import io.github.lsposed.manager.util.ModuleUtil;
|
||||||
import io.github.lsposed.manager.util.NavUtil;
|
import io.github.lsposed.manager.util.NavUtil;
|
||||||
import io.github.lsposed.manager.util.Version;
|
|
||||||
import io.github.lsposed.manager.util.light.Light;
|
import io.github.lsposed.manager.util.light.Light;
|
||||||
|
|
||||||
public class MainActivity extends BaseActivity {
|
public class MainActivity extends BaseActivity {
|
||||||
|
|
@ -31,27 +26,6 @@ public class MainActivity extends BaseActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// make sure the versions are consistent
|
|
||||||
String coreVersionStr = Constants.getXposedVersion();
|
|
||||||
|
|
||||||
if (coreVersionStr != null) {
|
|
||||||
Version managerVersion = new Version(BuildConfig.VERSION_NAME);
|
|
||||||
Version coreVersion = new Version(coreVersionStr);
|
|
||||||
if (!managerVersion.equals(coreVersion)) {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
||||||
builder.setMessage(R.string.outdated_manager)
|
|
||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setCancelable(false);
|
|
||||||
Dialog dlg = builder.create();
|
|
||||||
dlg.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
binding.modules.setOnClickListener(v -> {
|
binding.modules.setOnClickListener(v -> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue