From 177259a30c30e6bd9da4973bc2a6a23b233146b6 Mon Sep 17 00:00:00 2001
From: Juby210 <31005896+Juby210@users.noreply.github.com>
Date: Fri, 16 Jul 2021 23:51:34 +0200
Subject: [PATCH] add preview mode for creating themes for Themer plugin
---
app/build.gradle.kts | 4 ++--
.../themer/activities/MainActivity.java | 10 ++++++----
app/src/main/res/layout/activity_main.xml | 18 ++++++++++++++----
app/src/main/res/values/strings.xml | 2 +-
4 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index c5247dd..e044491 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -9,8 +9,8 @@ android {
applicationId = "com.aliucord.themer"
minSdk = 21
targetSdk = 30
- versionCode = 3
- versionName = "0.0.3-rc2"
+ versionCode = 4
+ versionName = "0.0.3"
}
buildTypes {
diff --git a/app/src/main/java/com/aliucord/themer/activities/MainActivity.java b/app/src/main/java/com/aliucord/themer/activities/MainActivity.java
index 34ea110..a802df7 100644
--- a/app/src/main/java/com/aliucord/themer/activities/MainActivity.java
+++ b/app/src/main/java/com/aliucord/themer/activities/MainActivity.java
@@ -52,15 +52,17 @@ protected void onCreate(Bundle savedInstanceState) {
boolean xposedEnabled = isXposedModuleEnabled();
boolean discordInstalled = isPackageInstalled(pm, "com.discord") || isPackageInstalled(pm, "com.aliucord");
if (!xposedEnabled || !discordInstalled) {
- error = true;
TextView errorView = findViewById(R.id.error_view);
- if (xposedEnabled) errorView.setText(R.string.install_discord);
errorView.setVisibility(View.VISIBLE);
- return;
+ if (xposedEnabled) {
+ error = true;
+ errorView.setText(R.string.install_discord);
+ return;
+ }
}
if (shouldAskForStorage()) checkPermissions();
- prefs = getSharedPreferences(BuildConfig.APPLICATION_ID + "_preferences", Context.MODE_WORLD_READABLE);
+ prefs = getSharedPreferences(BuildConfig.APPLICATION_ID + "_preferences", xposedEnabled ? Context.MODE_WORLD_READABLE : Context.MODE_PRIVATE);
getSupportFragmentManager().beginTransaction().add(R.id.settings_layout, settingsFragment).commit();
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index c0a37b1..dbd90dc 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -4,16 +4,26 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:id="@+id/settings_layout"
tools:context=".activities.MainActivity">
+
+ android:visibility="gone"
+ android:background="@android:color/holo_orange_light"
+ android:padding="8dp"
+ android:textColor="@color/white"
+ tools:ignore="RtlCompat" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ed35571..9c52778 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -26,7 +26,7 @@
Status bar color
Support Server
Tested on: 84.1 - Alpha
- Xposed module isn\'t enabled or resource hooks in xposed settings, if you enabled them, try to reboot your device
+ PREVIEW MODE: Xposed module isn\'t enabled or resource hooks in xposed settings, if you enabled them, try to reboot your device.\n\nYou can use this app to create themes for Themer plugin only in this state.
- com.aliucord