From 48e84f8e93ca055da9f114800706947280f49abb Mon Sep 17 00:00:00 2001 From: Henry Hiles Date: Sun, 18 Dec 2022 16:00:56 -0500 Subject: [PATCH] Add better loading screen (#4) * Add loading, including a spinner, and the default discord background color. * Add light mode support. --- app/build.gradle | 4 ++++ app/src/main/AndroidManifest.xml | 4 +++- .../main/java/dev/vendicated/vencord/MainActivity.java | 3 --- .../main/java/dev/vendicated/vencord/VWebviewClient.java | 7 +++++++ app/src/main/res/layout/activity_main.xml | 8 +++++--- app/src/main/res/values-night/colors.xml | 2 ++ app/src/main/res/values/colors.xml | 2 ++ app/src/main/res/values/styles.xml | 6 ++++++ 8 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 app/src/main/res/values-night/colors.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/styles.xml diff --git a/app/build.gradle b/app/build.gradle index 257f49d..f9684cd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,6 +25,10 @@ android { } buildTypes { + debug { + applicationIdSuffix ".dbg" + } + release { minifyEnabled false signingConfig signingConfigs.release diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eaf0b26..2b5ee31 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,13 +10,15 @@ android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:supportsRtl="true" + android:theme="@style/LoadingTheme" tools:targetApi="31" > + android:launchMode="singleTask" + android:theme="@style/LoadingTheme"> diff --git a/app/src/main/java/dev/vendicated/vencord/MainActivity.java b/app/src/main/java/dev/vendicated/vencord/MainActivity.java index 480e838..e946351 100644 --- a/app/src/main/java/dev/vendicated/vencord/MainActivity.java +++ b/app/src/main/java/dev/vendicated/vencord/MainActivity.java @@ -25,9 +25,6 @@ public class MainActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - var bar = this.getActionBar(); - if (bar != null) bar.hide(); - setContentView(R.layout.activity_main); wv = findViewById(R.id.webview); diff --git a/app/src/main/java/dev/vendicated/vencord/VWebviewClient.java b/app/src/main/java/dev/vendicated/vencord/VWebviewClient.java index 1cd46c9..f526e61 100644 --- a/app/src/main/java/dev/vendicated/vencord/VWebviewClient.java +++ b/app/src/main/java/dev/vendicated/vencord/VWebviewClient.java @@ -1,6 +1,7 @@ package dev.vendicated.vencord; import android.graphics.Bitmap; +import android.view.View; import android.webkit.*; import androidx.annotation.Nullable; @@ -22,6 +23,12 @@ public class VWebviewClient extends WebViewClient { view.evaluateJavascript(HttpClient.VencordMobileRuntime, null); } + @Override + public void onPageFinished(WebView view, String url) { + view.setVisibility(View.VISIBLE); + super.onPageFinished(view, url); + } + @Nullable @Override public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest req) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 1ed6451..f3e56e0 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,13 +1,15 @@ - + - \ No newline at end of file + android:visibility="invisible" /> + \ No newline at end of file diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml new file mode 100644 index 0000000..e2137f5 --- /dev/null +++ b/app/src/main/res/values-night/colors.xml @@ -0,0 +1,2 @@ + +#363942 \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..e0ad4d2 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,2 @@ + +#FFFFFF \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..e2786ea --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file