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 {
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
applicationIdSuffix ".dbg"
|
||||||
|
}
|
||||||
|
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
|
|
@ -10,13 +10,15 @@
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/LoadingTheme"
|
||||||
tools:targetApi="31"
|
tools:targetApi="31"
|
||||||
>
|
>
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize|layoutDirection"
|
android:configChanges="orientation|keyboardHidden|screenSize|layoutDirection"
|
||||||
android:launchMode="singleTask">
|
android:launchMode="singleTask"
|
||||||
|
android:theme="@style/LoadingTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|
|
@ -25,9 +25,6 @@ public class MainActivity extends Activity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
var bar = this.getActionBar();
|
|
||||||
if (bar != null) bar.hide();
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
wv = findViewById(R.id.webview);
|
wv = findViewById(R.id.webview);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package dev.vendicated.vencord;
|
package dev.vendicated.vencord;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.view.View;
|
||||||
import android.webkit.*;
|
import android.webkit.*;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
@ -22,6 +23,12 @@ public class VWebviewClient extends WebViewClient {
|
||||||
view.evaluateJavascript(HttpClient.VencordMobileRuntime, null);
|
view.evaluateJavascript(HttpClient.VencordMobileRuntime, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
view.setVisibility(View.VISIBLE);
|
||||||
|
super.onPageFinished(view, url);
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest req) {
|
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest req) {
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
<ProgressBar android:indeterminate="true" android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp" android:layout_centerInParent="true" />
|
||||||
|
|
||||||
<WebView
|
<WebView
|
||||||
android:id="@+id/webview"
|
android:id="@+id/webview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
/>
|
android:visibility="invisible" />
|
||||||
</android.widget.LinearLayout>
|
</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…
Add table
Add a link
Reference in a new issue