From 9484d65b5bc0e29a0e09f48f7366dc200ecb2d67 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 12 Feb 2014 16:37:15 +0100 Subject: [PATCH] Add reboot reasons to reboot view --- res/layout/reboot.xml | 21 ++++++++++++++++++++ src/biz/bokhorst/xprivacy/ActivityApp.java | 4 +--- src/biz/bokhorst/xprivacy/ActivityBase.java | 21 ++++++++++++++++++++ src/biz/bokhorst/xprivacy/ActivityMain.java | 7 ++----- src/biz/bokhorst/xprivacy/ActivityShare.java | 4 ++++ src/biz/bokhorst/xprivacy/ActivityUsage.java | 4 ++++ 6 files changed, 53 insertions(+), 8 deletions(-) diff --git a/res/layout/reboot.xml b/res/layout/reboot.xml index 03b232708..5d8cfbe67 100644 --- a/res/layout/reboot.xml +++ b/res/layout/reboot.xml @@ -1,5 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/biz/bokhorst/xprivacy/ActivityApp.java b/src/biz/bokhorst/xprivacy/ActivityApp.java index a4442d9a2..99ef282d0 100644 --- a/src/biz/bokhorst/xprivacy/ActivityApp.java +++ b/src/biz/bokhorst/xprivacy/ActivityApp.java @@ -107,10 +107,8 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check privacy service client - if (!PrivacyService.checkClient()) { - setContentView(R.layout.reboot); + if (!PrivacyService.checkClient()) return; - } // Set theme String themeName = PrivacyManager.getSetting(0, PrivacyManager.cSettingTheme, "", false); diff --git a/src/biz/bokhorst/xprivacy/ActivityBase.java b/src/biz/bokhorst/xprivacy/ActivityBase.java index 57bd731cd..e3c39d66d 100644 --- a/src/biz/bokhorst/xprivacy/ActivityBase.java +++ b/src/biz/bokhorst/xprivacy/ActivityBase.java @@ -9,11 +9,32 @@ import android.graphics.Bitmap.Config; import android.graphics.PorterDuff.Mode; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.util.TypedValue; +import android.view.View; +import android.widget.TextView; @SuppressLint("Registered") public class ActivityBase extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Check privacy service client + if (!PrivacyService.checkClient()) { + setContentView(R.layout.reboot); + if (PrivacyService.getClient() == null) { + TextView tvRebootClient = (TextView) findViewById(R.id.tvRebootClient); + tvRebootClient.setVisibility(View.VISIBLE); + } else { + TextView tvRebootClient = (TextView) findViewById(R.id.tvRebootVersion); + tvRebootClient.setVisibility(View.VISIBLE); + Requirements.check(this); + } + } + } + protected Bitmap[] getTriStateCheckBox() { Bitmap[] bitmap = new Bitmap[4]; diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index 995e7b293..08bb49554 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -157,12 +157,8 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check privacy service client - if (!PrivacyService.checkClient()) { - setContentView(R.layout.reboot); - if (PrivacyService.getClient() != null) - Requirements.check(this); + if (!PrivacyService.checkClient()) return; - } // Salt should be the same when exporting/importing String salt = PrivacyManager.getSetting(0, PrivacyManager.cSettingSalt, null, false); @@ -174,6 +170,7 @@ protected void onCreate(Bundle savedInstanceState) { } // Set theme + // TODO: move to activity base String themeName = PrivacyManager.getSetting(0, PrivacyManager.cSettingTheme, "", false); mThemeId = (themeName.equals("Dark") ? R.style.CustomTheme : R.style.CustomTheme_Light); setTheme(mThemeId); diff --git a/src/biz/bokhorst/xprivacy/ActivityShare.java b/src/biz/bokhorst/xprivacy/ActivityShare.java index d38a134d6..d91be18ef 100644 --- a/src/biz/bokhorst/xprivacy/ActivityShare.java +++ b/src/biz/bokhorst/xprivacy/ActivityShare.java @@ -128,6 +128,10 @@ public Thread newThread(Runnable r) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // Check privacy service client + if (!PrivacyService.checkClient()) + return; + // Get data final Bundle extras = getIntent().getExtras(); final String action = getIntent().getAction(); diff --git a/src/biz/bokhorst/xprivacy/ActivityUsage.java b/src/biz/bokhorst/xprivacy/ActivityUsage.java index 0d6b39d9d..8e7c8efc1 100644 --- a/src/biz/bokhorst/xprivacy/ActivityUsage.java +++ b/src/biz/bokhorst/xprivacy/ActivityUsage.java @@ -56,6 +56,10 @@ public Thread newThread(Runnable r) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // Check privacy service client + if (!PrivacyService.checkClient()) + return; + // Set theme String themeName = PrivacyManager.getSetting(0, PrivacyManager.cSettingTheme, "", false); mThemeId = (themeName.equals("Dark") ? R.style.CustomTheme : R.style.CustomTheme_Light);