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:
parent
2ebc0fecc4
commit
48e84f8e93
8 changed files with 29 additions and 7 deletions
|
@ -25,6 +25,10 @@ android {
|
|||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".dbg"
|
||||
}
|
||||
|
||||
release {
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.release
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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>
|
2
app/src/main/res/values-night/colors.xml
Normal file
2
app/src/main/res/values-night/colors.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><color name="background">#363942</color></resources>
|
2
app/src/main/res/values/colors.xml
Normal file
2
app/src/main/res/values/colors.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><color name="background">#FFFFFF</color></resources>
|
6
app/src/main/res/values/styles.xml
Normal file
6
app/src/main/res/values/styles.xml
Normal 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>
|
Loading…
Reference in a new issue