Update UI component

This commit is contained in:
topjohnwu 2016-12-26 17:15:46 +08:00
parent c78209604c
commit f521bce9e6
3 changed files with 66 additions and 5 deletions

View File

@ -153,7 +153,7 @@ public class Async {
protected void preProcessing() throws Throwable {} protected void preProcessing() throws Throwable {}
protected void copyToCache() throws Throwable { private void copyToCache() throws Throwable {
try { try {
InputStream in = mContext.getContentResolver().openInputStream(mUri); InputStream in = mContext.getContentResolver().openInputStream(mUri);
mCachedFile = new File(mContext.getCacheDir().getAbsolutePath() + "/install.zip"); mCachedFile = new File(mContext.getCacheDir().getAbsolutePath() + "/install.zip");
@ -250,14 +250,15 @@ public class Async {
Toast.makeText(mContext, mContext.getString(R.string.invalid_zip), Toast.LENGTH_LONG).show(); Toast.makeText(mContext, mContext.getString(R.string.invalid_zip), Toast.LENGTH_LONG).show();
break; break;
case 1: case 1:
done(); onSuccess();
break; break;
} }
} }
protected void done() { protected void onSuccess() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
prefs.edit().putBoolean("module_done", false).putBoolean("update_check_done", true).apply();
StatusFragment.updateCheckDone.trigger();
new LoadModules().exec(); new LoadModules().exec();
AlertDialog.Builder builder; AlertDialog.Builder builder;

View File

@ -137,6 +137,66 @@
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/flash_button"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="6dp"
style="?attr/cardStyle"
app:cardUseCompatPadding="true"
android:layout_width="match_parent"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginEnd="25dp"
android:layout_marginStart="25dp">
<ImageView
android:layout_width="50dp"
android:layout_height="wrap_content"
app:srcCompat="@mipmap/ic_launcher"
android:id="@+id/imageView"
android:layout_weight="0"
android:layout_marginEnd="20dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Magiskify"
android:ems="10"
android:gravity="center"
android:id="@+id/editText"
android:layout_weight="1"
android:textStyle="bold"
android:textColor="@android:color/black"
android:textAllCaps="false"
android:textSize="20sp"
android:fontFamily="sans-serif" />
<FrameLayout
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_weight="0"
android:layout_marginStart="20dp">
</FrameLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -118,7 +118,7 @@
<string name="settings_reboot_toast">Reboot to apply settings</string> <string name="settings_reboot_toast">Reboot to apply settings</string>
<string name="auto_detect">"(Auto Detect) %1$s"</string> <string name="auto_detect">"(Auto) %1$s"</string>
<string name="boot_image_title">Boot Image Location</string> <string name="boot_image_title">Boot Image Location</string>
<string name="detect_button">Detect</string> <string name="detect_button">Detect</string>
<string name="advanced_settings_title">Advanced Settings</string> <string name="advanced_settings_title">Advanced Settings</string>