Show correct message

This commit is contained in:
topjohnwu 2017-09-03 00:17:42 +08:00
parent 0ec473195d
commit 04a4265ef3
2 changed files with 17 additions and 20 deletions

View File

@ -401,28 +401,18 @@ public class MagiskFragment extends Fragment
rootStatusIcon.setImageResource(image); rootStatusIcon.setImageResource(image);
rootStatusIcon.setColorFilter(color); rootStatusIcon.setColorFilter(color);
if (!Shell.rootAccess()) { List<String> items = new ArrayList<>();
installText.setText(R.string.install); if (magiskManager.bootBlock != null) {
items.add(getString(R.string.auto_detect, magiskManager.bootBlock));
spinner.setEnabled(false);
} else { } else {
if (magiskManager.remoteMagiskVersionCode > magiskManager.magiskVersionCode) { items.add(getString(R.string.cannot_auto_detect));
installText.setText(R.string.update); items.addAll(magiskManager.blockList);
} else {
installText.setText(R.string.reinstall);
}
List<String> 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<String> adapter = new ArrayAdapter<>(getActivity(),
android.R.layout.simple_spinner_item, items);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
} }
ArrayAdapter<String> 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() { private void updateCheckUI() {
@ -438,6 +428,12 @@ public class MagiskFragment extends Fragment
magiskUpdateText.setText(getString(R.string.install_magisk_title, "v" + magiskManager.remoteMagiskVersionString)); 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.setImageResource(image);
magiskUpdateIcon.setColorFilter(color); magiskUpdateIcon.setColorFilter(color);
magiskUpdateIcon.setVisibility(View.VISIBLE); magiskUpdateIcon.setVisibility(View.VISIBLE);

View File

@ -411,6 +411,7 @@
android:ems="10" android:ems="10"
android:fontFamily="sans-serif" android:fontFamily="sans-serif"
android:gravity="center" android:gravity="center"
android:text="@string/install"
android:textAllCaps="false" android:textAllCaps="false"
android:textSize="20sp" android:textSize="20sp"
android:textStyle="bold" /> android:textStyle="bold" />