mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-26 05:17:42 +00:00
Magisk Version now double, also support custom version names
This commit is contained in:
parent
aababe1a87
commit
e76dba0f84
@ -33,8 +33,9 @@ import butterknife.ButterKnife;
|
||||
|
||||
public class MagiskFragment extends Fragment {
|
||||
|
||||
public static int magiskVersion, remoteMagiskVersion = -1, remoteAppVersionCode = -1;
|
||||
public static String magiskLink, magiskChangelog, appLink, appChangelog, remoteAppVersion;
|
||||
public static int remoteAppVersionCode = -1;
|
||||
public static double magiskVersion, remoteMagiskVersion = -1;
|
||||
public static String magiskVersionString, magiskLink, magiskChangelog, appLink, appChangelog, remoteAppVersion;
|
||||
|
||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
|
||||
@ -174,10 +175,14 @@ public class MagiskFragment extends Fragment {
|
||||
|
||||
private void updateMagiskVersion() {
|
||||
List<String> ret = Shell.sh("getprop magisk.version");
|
||||
try {
|
||||
magiskVersion = Integer.parseInt(ret.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
if (ret.get(0).length() == 0) {
|
||||
magiskVersion = -1;
|
||||
} else try {
|
||||
magiskVersionString = ret.get(0);
|
||||
magiskVersion = Double.parseDouble(ret.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
// Custom version don't need to receive updates
|
||||
magiskVersion = Double.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
if (magiskVersion == -1) {
|
||||
@ -190,7 +195,7 @@ public class MagiskFragment extends Fragment {
|
||||
magiskStatusContainer.setBackgroundColor(colorOK);
|
||||
magiskStatusIcon.setImageResource(statusOK);
|
||||
|
||||
magiskVersionText.setText(getString(R.string.magisk_version, String.valueOf(magiskVersion)));
|
||||
magiskVersionText.setText(getString(R.string.magisk_version, magiskVersionString));
|
||||
magiskVersionText.setTextColor(colorOK);
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class Async {
|
||||
JSONObject magisk = json.getJSONObject("magisk");
|
||||
JSONObject app = json.getJSONObject("app");
|
||||
|
||||
MagiskFragment.remoteMagiskVersion = magisk.getInt("versionCode");
|
||||
MagiskFragment.remoteMagiskVersion = magisk.getDouble("versionCode");
|
||||
MagiskFragment.magiskLink = magisk.getString("link");
|
||||
MagiskFragment.magiskChangelog = magisk.getString("changelog");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user