Skip to content

Commit

Permalink
add preview mode for creating themes for Themer plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Juby210 committed Jul 16, 2021
1 parent 5327fe1 commit 177259a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
18 changes: 14 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/settings_layout"
android:layout_weight="1"
android:orientation="vertical" />
<TextView
android:id="@+id/error_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:gravity="bottom"
android:textAlignment="center"
android:text="@string/xposed_not_detected"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone" />
android:visibility="gone"
android:background="@android:color/holo_orange_light"
android:padding="8dp"
android:textColor="@color/white"
tools:ignore="RtlCompat" />
</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<string name="statusbar_color">Status bar color</string>
<string name="support_server">Support Server</string>
<string name="tested_on">Tested on: 84.1 - Alpha</string>
<string name="xposed_not_detected">Xposed module isn\'t enabled or resource hooks in xposed settings, if you enabled them, try to reboot your device</string>
<string name="xposed_not_detected">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.</string>

<string-array name="scope">
<item>com.aliucord</item>
Expand Down

0 comments on commit 177259a

Please sign in to comment.