From 47e62a568157ccb48e0b8855e301351d9be0c44a Mon Sep 17 00:00:00 2001 From: dvdandroid Date: Wed, 24 May 2017 21:21:15 +0200 Subject: [PATCH 01/16] Small code cleanup --- .../com/topjohnwu/magisk/AboutActivity.java | 15 --------------- .../com/topjohnwu/magisk/SettingsActivity.java | 15 --------------- .../topjohnwu/magisk/components/Activity.java | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java b/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java index 20680e37..44d3298e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java @@ -13,7 +13,6 @@ import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.view.View; -import android.view.WindowManager; import android.widget.TextView; import com.topjohnwu.magisk.components.AboutCardRow; @@ -135,18 +134,4 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { setFloating(); } - public void setFloating() { - boolean isTablet = getResources().getBoolean(R.bool.isTablet); - if (isTablet) { - WindowManager.LayoutParams params = getWindow().getAttributes(); - params.height = getResources().getDimensionPixelSize(R.dimen.floating_height); - params.width = getResources().getDimensionPixelSize(R.dimen.floating_width); - params.alpha = 1.0f; - params.dimAmount = 0.6f; - params.flags |= 2; - getWindow().setAttributes(params); - setFinishOnTouchOutside(true); - } - } - } diff --git a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java index de50b880..bc6fbe2b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java @@ -9,7 +9,6 @@ import android.preference.PreferenceScreen; import android.support.v7.app.ActionBar; import android.support.v7.widget.Toolbar; -import android.view.WindowManager; import android.widget.Toast; import com.topjohnwu.magisk.asyncs.MagiskHide; @@ -55,20 +54,6 @@ protected void onCreate(Bundle savedInstanceState) { } - public void setFloating() { - boolean isTablet = getResources().getBoolean(R.bool.isTablet); - if (isTablet) { - WindowManager.LayoutParams params = getWindow().getAttributes(); - params.height = getResources().getDimensionPixelSize(R.dimen.floating_height); - params.width = getResources().getDimensionPixelSize(R.dimen.floating_width); - params.alpha = 1.0f; - params.dimAmount = 0.6f; - params.flags |= 2; - getWindow().setAttributes(params); - setFinishOnTouchOutside(true); - } - } - public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { diff --git a/app/src/main/java/com/topjohnwu/magisk/components/Activity.java b/app/src/main/java/com/topjohnwu/magisk/components/Activity.java index 87bcd6b0..055d2b19 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/Activity.java +++ b/app/src/main/java/com/topjohnwu/magisk/components/Activity.java @@ -1,8 +1,10 @@ package com.topjohnwu.magisk.components; import android.support.v7.app.AppCompatActivity; +import android.view.WindowManager; import com.topjohnwu.magisk.MagiskManager; +import com.topjohnwu.magisk.R; public class Activity extends AppCompatActivity { @@ -10,4 +12,19 @@ public class Activity extends AppCompatActivity { public MagiskManager getApplicationContext() { return (MagiskManager) super.getApplicationContext(); } + + protected void setFloating() { + boolean isTablet = getResources().getBoolean(R.bool.isTablet); + if (isTablet) { + WindowManager.LayoutParams params = getWindow().getAttributes(); + params.height = getResources().getDimensionPixelSize(R.dimen.floating_height); + params.width = getResources().getDimensionPixelSize(R.dimen.floating_width); + params.alpha = 1.0f; + params.dimAmount = 0.6f; + params.flags |= 2; + getWindow().setAttributes(params); + setFinishOnTouchOutside(true); + } + } + } From 738f943a686de0026db79cd41b362e0cf8aa70dc Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 26 May 2017 18:20:53 +0800 Subject: [PATCH 02/16] Several UI tweaks --- app/src/main/java/com/topjohnwu/magisk/AboutActivity.java | 6 ++---- .../main/java/com/topjohnwu/magisk/SettingsActivity.java | 4 ++-- .../{activity_container.xml => activity_settings.xml} | 0 app/src/main/res/layout/fragment_magisk.xml | 3 ++- app/src/main/res/values-sw600dp/styles.xml | 8 ++++++++ app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/styles.xml | 6 ++++++ 8 files changed, 22 insertions(+), 8 deletions(-) rename app/src/main/res/layout/{activity_container.xml => activity_settings.xml} (100%) diff --git a/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java b/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java index 44d3298e..10462811 100644 --- a/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java @@ -28,7 +28,7 @@ public class AboutActivity extends Activity { - private static final String DONATION_URL = "http://topjohnwu.github.io/donate"; + private static final String DONATION_URL = "https://www.paypal.me/topjohnwu"; private static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382"; private static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/MagiskManager"; @@ -44,10 +44,8 @@ public class AboutActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - String theme = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("theme", ""); - Logger.dev("AboutActivity: Theme is " + theme); if (getApplicationContext().isDarkTheme) { - setTheme(R.style.AppTheme_Dark); + setTheme(R.style.AppTheme_Transparent_Dark); } setContentView(R.layout.activity_about); ButterKnife.bind(this); diff --git a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java index bc6fbe2b..79581dce 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java @@ -30,10 +30,10 @@ public class SettingsActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getApplicationContext().isDarkTheme) { - setTheme(R.style.AppTheme_Dark); + setTheme(R.style.AppTheme_Transparent_Dark); } - setContentView(R.layout.activity_container); + setContentView(R.layout.activity_settings); ButterKnife.bind(this); setSupportActionBar(toolbar); diff --git a/app/src/main/res/layout/activity_container.xml b/app/src/main/res/layout/activity_settings.xml similarity index 100% rename from app/src/main/res/layout/activity_container.xml rename to app/src/main/res/layout/activity_settings.xml diff --git a/app/src/main/res/layout/fragment_magisk.xml b/app/src/main/res/layout/fragment_magisk.xml index 9592aa94..fe8dbc99 100644 --- a/app/src/main/res/layout/fragment_magisk.xml +++ b/app/src/main/res/layout/fragment_magisk.xml @@ -178,7 +178,8 @@ android:layout_centerVertical="true" android:layout_margin="15dp" android:layout_toStartOf="@+id/safetyNet_status" - android:src="@drawable/ic_refresh" /> + android:src="@drawable/ic_refresh" + android:tint="?attr/imageColorTint" /> true + + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 7327dc4c..4b67ac85 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -30,5 +30,6 @@ + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 68f9a017..3aaf0ba5 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -10,7 +10,7 @@ #F44336 #4CAF50 #9E9E9E - #2196F3 + #2196f3 #FFC107 #dedede diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 0fb273ef..bb15ff54 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -12,6 +12,7 @@ false true @android:color/transparent + @android:color/background_dark + +