Add NoUIActivity
This commit is contained in:
parent
5dab580cfc
commit
79c71509f6
@ -26,15 +26,18 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".AboutActivity"
|
||||
android:theme="@style/AppTheme.Transparent" />
|
||||
android:theme="@style/AppTheme.StatusBar" />
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:theme="@style/AppTheme.Transparent" />
|
||||
android:theme="@style/AppTheme.StatusBar" />
|
||||
<activity
|
||||
android:name=".FlashActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="nosensor"
|
||||
android:theme="@style/AppTheme.Transparent" />
|
||||
android:theme="@style/AppTheme.StatusBar" />
|
||||
<activity
|
||||
android:name=".NoUIActivity"
|
||||
android:theme="@style/AppTheme.Translucent" />
|
||||
<activity
|
||||
android:name=".superuser.RequestActivity"
|
||||
android:excludeFromRecents="true"
|
||||
|
@ -31,7 +31,7 @@ public class AboutActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public int getDarkTheme() {
|
||||
return R.style.AppTheme_Transparent_Dark;
|
||||
return R.style.AppTheme_StatusBar_Dark;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +77,7 @@ public class FlashActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public int getDarkTheme() {
|
||||
return R.style.AppTheme_Transparent_Dark;
|
||||
return R.style.AppTheme_StatusBar_Dark;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
26
src/full/java/com/topjohnwu/magisk/NoUIActivity.java
Normal file
26
src/full/java/com/topjohnwu/magisk/NoUIActivity.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.topjohnwu.magisk;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
|
||||
import com.topjohnwu.magisk.components.Activity;
|
||||
import com.topjohnwu.magisk.utils.Const;
|
||||
|
||||
public class NoUIActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
String[] perms = getIntent().getStringArrayExtra(Const.Key.INTENT_PERM);
|
||||
if (perms != null) {
|
||||
ActivityCompat.requestPermissions(this, perms, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
finish();
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
|
||||
|
||||
@Override
|
||||
public int getDarkTheme() {
|
||||
return R.style.AppTheme_Transparent_Dark;
|
||||
return R.style.AppTheme_StatusBar_Dark;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
android:id="@+id/drawer_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme.Transparent" parent="AppTheme">
|
||||
<style name="AppTheme.StatusBar" parent="AppTheme">
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
@ -9,7 +9,7 @@
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Transparent.Dark" parent="AppTheme.Dark">
|
||||
<style name="AppTheme.StatusBar.Dark" parent="AppTheme.Dark">
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
@ -30,6 +30,14 @@
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Translucent" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
||||
</style>
|
||||
|
||||
<style name="CardViewStyle.Dark" parent="CardView">
|
||||
<item name="cardBackgroundColor">@android:color/background_dark</item>
|
||||
</style>
|
||||
@ -38,11 +46,11 @@
|
||||
<item name="cardBackgroundColor">@android:color/background_light</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Transparent" parent="AppTheme">
|
||||
<style name="AppTheme.StatusBar" parent="AppTheme">
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Transparent.Dark" parent="AppTheme.Dark">
|
||||
<style name="AppTheme.StatusBar.Dark" parent="AppTheme.Dark">
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
|
||||
</style>
|
||||
|
||||
|
@ -9,21 +9,20 @@ import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.topjohnwu.magisk.MagiskManager;
|
||||
import com.topjohnwu.magisk.NoUIActivity;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.SplashActivity;
|
||||
import com.topjohnwu.magisk.utils.Const;
|
||||
|
||||
public abstract class Activity extends FlavorActivity {
|
||||
|
||||
private static Runnable permissionGrantCallback;
|
||||
protected static Runnable permissionGrantCallback;
|
||||
|
||||
private ActivityResultListener activityResultListener;
|
||||
|
||||
public Activity() {
|
||||
super();
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.setLocale(MagiskManager.locale);
|
||||
configuration.setLocale(Application.locale);
|
||||
applyOverrideConfiguration(configuration);
|
||||
}
|
||||
|
||||
@ -40,12 +39,12 @@ public abstract class Activity extends FlavorActivity {
|
||||
permissionGrantCallback = callback;
|
||||
if (!(context instanceof Activity)) {
|
||||
// Start activity to show dialog
|
||||
Intent intent = new Intent(context, SplashActivity.class);
|
||||
Intent intent = new Intent(context, NoUIActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Const.Key.INTENT_PERM, permissions);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
ActivityCompat.requestPermissions((android.app.Activity) context, permissions, 0);
|
||||
ActivityCompat.requestPermissions((Activity) context, permissions, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,7 +70,7 @@ public abstract class Activity extends FlavorActivity {
|
||||
permissionGrantCallback.run();
|
||||
}
|
||||
} else {
|
||||
MagiskManager.toast(R.string.no_rw_storage, Toast.LENGTH_LONG);
|
||||
Application.toast(R.string.no_rw_storage, Toast.LENGTH_LONG);
|
||||
}
|
||||
permissionGrantCallback = null;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".SplashActivity"
|
||||
android:name=".NoUIActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -15,7 +15,7 @@ import com.topjohnwu.magisk.utils.WebService;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class SplashActivity extends Activity {
|
||||
public class NoUIActivity extends Activity {
|
||||
|
||||
private String apkLink;
|
||||
private String version;
|
||||
@ -44,16 +44,14 @@ public class SplashActivity extends Activity {
|
||||
.setCancelable(false)
|
||||
.setTitle(R.string.app_name)
|
||||
.setMessage(R.string.upgrade_msg)
|
||||
.setPositiveButton(R.string.yes, (d, w) -> {
|
||||
runWithPermission(new String[]
|
||||
.setPositiveButton(R.string.yes, (d, w) -> runWithPermission(new String[]
|
||||
{ Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
|
||||
Intent intent = new Intent(this, ManagerUpdate.class);
|
||||
intent.putExtra(Const.Key.INTENT_SET_LINK, apkLink);
|
||||
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
|
||||
sendBroadcast(intent);
|
||||
finish();
|
||||
});
|
||||
})
|
||||
}))
|
||||
.setNegativeButton(R.string.no_thanks, (d, w) -> finish())
|
||||
.show();
|
||||
});
|
Loading…
Reference in New Issue
Block a user