1
0
Fork 0

Add better loading screen (#4)

* Add loading, including a spinner, and the default discord background color.

* Add light mode support.
This commit is contained in:
Henry Hiles 2022-12-18 16:00:56 -05:00 committed by GitHub
parent 2ebc0fecc4
commit 48e84f8e93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 7 deletions

View file

@ -25,6 +25,10 @@ android {
}
buildTypes {
debug {
applicationIdSuffix ".dbg"
}
release {
minifyEnabled false
signingConfig signingConfigs.release

View file

@ -10,13 +10,15 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="true"
android:supportsRtl="true"
android:theme="@style/LoadingTheme"
tools:targetApi="31"
>
<activity
android:name=".MainActivity"
android:exported="true"
android:configChanges="orientation|keyboardHidden|screenSize|layoutDirection"
android:launchMode="singleTask">
android:launchMode="singleTask"
android:theme="@style/LoadingTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

View file

@ -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);

View file

@ -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) {

View file

@ -1,13 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<android.widget.LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.widget.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ProgressBar android:indeterminate="true" android:layout_width="40dp"
android:layout_height="40dp" android:layout_centerInParent="true" />
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</android.widget.LinearLayout>
android:visibility="invisible" />
</android.widget.RelativeLayout>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources><color name="background">#363942</color></resources>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources><color name="background">#FFFFFF</color></resources>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LoadingTheme" parent="@android:style/Theme.Material.Light.NoActionBar">
<item name="android:windowBackground">@color/background</item>
</style>
</resources>