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