Magisk Version isn't async

This commit is contained in:
topjohnwu 2016-09-26 11:46:13 +08:00
parent 91d3d2ad1f
commit 7511df61b3
2 changed files with 16 additions and 25 deletions

View File

@ -29,9 +29,6 @@ import butterknife.BindView;
import butterknife.ButterKnife;
public class MagiskFragment extends Fragment {
@BindView(R.id.progressBarVersion) ProgressBar progressBar;
@BindView(R.id.magiskStatusView) View magiskStatusView;
@BindView(R.id.magisk_status_container) View magiskStatusContainer;
@BindView(R.id.magisk_status_icon) ImageView magiskStatusIcon;
@ -73,6 +70,21 @@ public class MagiskFragment extends Fragment {
ta0.recycle();
ta1.recycle();
ta2.recycle();
if (Utils.magiskVersion == -1) {
magiskStatusContainer.setBackgroundColor(grey500);
magiskStatusIcon.setImageResource(statusUnknown);
magiskVersion.setTextColor(grey500);
magiskVersion.setText(R.string.magisk_version_error);
} else {
magiskStatusContainer.setBackgroundColor(colorOK);
magiskStatusIcon.setImageResource(statusOK);
magiskVersion.setText(getString(R.string.magisk_version, String.valueOf(Utils.magiskVersion)));
magiskVersion.setTextColor(colorOK);
}
new updateUI().executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
return v;
@ -101,21 +113,6 @@ public class MagiskFragment extends Fragment {
builder = new AlertDialog.Builder(getActivity());
}
if (Utils.magiskVersion == -1) {
magiskStatusContainer.setBackgroundColor(grey500);
magiskStatusIcon.setImageResource(statusUnknown);
magiskVersion.setTextColor(grey500);
magiskVersion.setText(R.string.magisk_version_error);
} else {
magiskStatusContainer.setBackgroundColor(colorOK);
magiskStatusIcon.setImageResource(statusOK);
magiskVersion.setText(getString(R.string.magisk_version, String.valueOf(Utils.magiskVersion)));
magiskVersion.setTextColor(colorOK);
}
if (Utils.remoteMagiskVersion == -1) {
appCheckUpdatesContainer.setBackgroundColor(colorWarn);
magiskCheckUpdatesContainer.setBackgroundColor(colorWarn);
@ -124,6 +121,7 @@ public class MagiskFragment extends Fragment {
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_warning);
appCheckUpdatesStatus.setText(R.string.cannot_check_updates);
appCheckUpdatesStatus.setTextColor(colorWarn);
magiskCheckUpdatesStatus.setText(R.string.cannot_check_updates);
magiskCheckUpdatesStatus.setTextColor(colorWarn);
} else {
@ -186,7 +184,6 @@ public class MagiskFragment extends Fragment {
}
}
progressBar.setVisibility(View.GONE);
appCheckUpdatesProgress.setVisibility(View.GONE);
magiskCheckUpdatesProgress.setVisibility(View.GONE);
}

View File

@ -43,12 +43,6 @@
android:layout_height="84dp"
android:layout_gravity="center"/>
<ProgressBar
android:id="@+id/progressBarVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</FrameLayout>
<TextView