From 04a4265ef342909014828f0836b0d0336b977d4e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 3 Sep 2017 00:17:42 +0800 Subject: [PATCH] Show correct message --- .../com/topjohnwu/magisk/MagiskFragment.java | 36 +++++++++---------- app/src/main/res/layout/fragment_magisk.xml | 1 + 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java b/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java index 72cd754e1..02d42e937 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java @@ -401,28 +401,18 @@ public class MagiskFragment extends Fragment rootStatusIcon.setImageResource(image); rootStatusIcon.setColorFilter(color); - if (!Shell.rootAccess()) { - installText.setText(R.string.install); + List items = new ArrayList<>(); + if (magiskManager.bootBlock != null) { + items.add(getString(R.string.auto_detect, magiskManager.bootBlock)); + spinner.setEnabled(false); } else { - if (magiskManager.remoteMagiskVersionCode > magiskManager.magiskVersionCode) { - installText.setText(R.string.update); - } else { - installText.setText(R.string.reinstall); - } - - List items = new ArrayList<>(); - if (magiskManager.bootBlock != null) { - items.add(getString(R.string.auto_detect, magiskManager.bootBlock)); - spinner.setEnabled(false); - } else { - items.add(getString(R.string.cannot_auto_detect)); - items.addAll(magiskManager.blockList); - } - ArrayAdapter adapter = new ArrayAdapter<>(getActivity(), - android.R.layout.simple_spinner_item, items); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - spinner.setAdapter(adapter); + items.add(getString(R.string.cannot_auto_detect)); + items.addAll(magiskManager.blockList); } + ArrayAdapter adapter = new ArrayAdapter<>(getActivity(), + android.R.layout.simple_spinner_item, items); + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + spinner.setAdapter(adapter); } private void updateCheckUI() { @@ -438,6 +428,12 @@ public class MagiskFragment extends Fragment magiskUpdateText.setText(getString(R.string.install_magisk_title, "v" + magiskManager.remoteMagiskVersionString)); } + if (magiskManager.remoteMagiskVersionCode > magiskManager.magiskVersionCode) { + installText.setText(R.string.update); + } else { + installText.setText(R.string.install); + } + magiskUpdateIcon.setImageResource(image); magiskUpdateIcon.setColorFilter(color); magiskUpdateIcon.setVisibility(View.VISIBLE); diff --git a/app/src/main/res/layout/fragment_magisk.xml b/app/src/main/res/layout/fragment_magisk.xml index fe8dbc999..aade9985e 100644 --- a/app/src/main/res/layout/fragment_magisk.xml +++ b/app/src/main/res/layout/fragment_magisk.xml @@ -411,6 +411,7 @@ android:ems="10" android:fontFamily="sans-serif" android:gravity="center" + android:text="@string/install" android:textAllCaps="false" android:textSize="20sp" android:textStyle="bold" />