1
0
Fork 0

added more splashscreens (shiggy, oneko)

This commit is contained in:
nin0dev 2024-08-28 12:56:39 -04:00
parent a9ec66d1a6
commit d2c750175f
10 changed files with 181 additions and 17 deletions

View file

@ -9,7 +9,7 @@ android {
defaultConfig { defaultConfig {
applicationId "com.nin0dev.vendroid" applicationId "com.nin0dev.vendroid"
minSdk 21 minSdk 25
targetSdk 34 targetSdk 34
versionCode 6 versionCode 6
versionName "1.3" versionName "1.3"

View file

@ -0,0 +1,13 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="recovery"
android:enabled="true"
android:icon="@drawable/reset"
android:shortcutShortLabel="@string/recovery_shortcut_name"
android:shortcutLongLabel="@string/recovery_shortcut_name">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.nin0dev.vendroid.debug"
android:targetClass="com.nin0dev.vendroid.RecoveryActivity" />
</shortcut>
</shortcuts>

View file

@ -14,6 +14,11 @@
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:targetApi="34"> tools:targetApi="34">
<activity
android:name=".RecoveryActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/AppTheme" />
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"
android:exported="false" /> android:exported="false" />
@ -27,6 +32,10 @@
android:exported="true" android:exported="true"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -50,4 +59,4 @@
</activity> </activity>
</application> </application>
</manifest> </manifest>

View file

@ -25,7 +25,7 @@ object HttpClient {
val res = activity.resources val res = activity.resources
res.openRawResource(R.raw.vencord_mobile).use { `is` -> VencordMobileRuntime = readAsText(`is`) } res.openRawResource(R.raw.vencord_mobile).use { `is` -> VencordMobileRuntime = readAsText(`is`) }
if (VencordRuntime != null) return if (VencordRuntime != null) return
if (sPrefs.getString("vencordLocation", Constants.JS_BUNDLE_URL) == Constants.JS_BUNDLE_URL || BuildConfig.DEBUG) { // user is debugging vencord or app, always redownload if (sPrefs.getString("vencordLocation", Constants.JS_BUNDLE_URL) != Constants.JS_BUNDLE_URL || BuildConfig.DEBUG) { // user is debugging vencord or app, always redownload
Toast.makeText(activity, "Debugging app or Vencord, bundle will be redownloaded. Avoid using on limited networks", Toast.LENGTH_LONG).show() Toast.makeText(activity, "Debugging app or Vencord, bundle will be redownloaded. Avoid using on limited networks", Toast.LENGTH_LONG).show()
vendroidFile.delete() vendroidFile.delete()
} }

View file

@ -11,7 +11,6 @@ import android.os.Bundle
import android.os.StrictMode import android.os.StrictMode
import android.os.StrictMode.ThreadPolicy import android.os.StrictMode.ThreadPolicy
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View.VISIBLE
import android.view.WindowManager import android.view.WindowManager
import android.webkit.ValueCallback import android.webkit.ValueCallback
import android.webkit.WebView import android.webkit.WebView
@ -22,7 +21,6 @@ import com.android.volley.toolbox.Volley
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.nin0dev.vendroid.HttpClient.fetchVencord import com.nin0dev.vendroid.HttpClient.fetchVencord
import com.nin0dev.vendroid.Logger.e import com.nin0dev.vendroid.Logger.e
import pl.droidsonroids.gif.GifImageView
import java.io.IOException import java.io.IOException
class MainActivity : Activity() { class MainActivity : Activity() {
@ -56,13 +54,7 @@ class MainActivity : Activity() {
showDiscordToast("No updates available", "MESSAGE") showDiscordToast("No updates available", "MESSAGE")
} }
}, },
{ error -> { })
if (BuildConfig.DEBUG) {
e("Network error during update check", error)
}
Toast.makeText(this, "Failed to check for updates", Toast.LENGTH_SHORT).show()
}
)
stringRequest.setShouldCache(false); stringRequest.setShouldCache(false);
queue.add(stringRequest) queue.add(stringRequest)
} }
@ -80,9 +72,6 @@ class MainActivity : Activity() {
// https://developer.chrome.com/docs/devtools/remote-debugging/webviews/ // https://developer.chrome.com/docs/devtools/remote-debugging/webviews/
WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG) WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
if (sPrefs.getString("splash", "viggy") == "viggy") findViewById<GifImageView>(R.id.viggy_gif).visibility = VISIBLE
else if (sPrefs.getString("splash", "viggy") == "shiggy") findViewById<GifImageView>(R.id.shiggy_gif).visibility = VISIBLE
else if (sPrefs.getString("splash", "viggy") == "oneko") findViewById<GifImageView>(R.id.oneko_gif).visibility = VISIBLE
wv = findViewById(R.id.webview)!! wv = findViewById(R.id.webview)!!
explodeAndroid() explodeAndroid()
wv!!.setWebViewClient(VWebviewClient()) wv!!.setWebViewClient(VWebviewClient())

View file

@ -0,0 +1,38 @@
package com.nin0dev.vendroid
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.view.WindowManager
import android.widget.Button
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.google.android.material.snackbar.Snackbar
class RecoveryActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window.statusBarColor = Color.TRANSPARENT
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
window.navigationBarColor = Color.TRANSPARENT
setContentView(R.layout.activity_recovery)
findViewById<Button>(R.id.reset_vencord_location).setOnClickListener {
val sPrefs = getSharedPreferences("settings", Context.MODE_PRIVATE)
val e = sPrefs.edit()
e.putString("vencordLocation", Constants.JS_BUNDLE_URL)
e.putBoolean("pendingReset", true)
e.apply()
Snackbar.make(findViewById(R.id.main_layout), "Successfully reset Vencord location", Snackbar.LENGTH_LONG).show()
}
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
}
}

View file

@ -8,9 +8,12 @@ import android.webkit.WebResourceRequest
import android.webkit.WebResourceResponse import android.webkit.WebResourceResponse
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
import android.widget.Toast
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import com.nin0dev.vendroid.Logger.e import com.nin0dev.vendroid.Logger.e
import java.io.File
import java.io.IOException import java.io.IOException
import java.lang.Exception
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.URL import java.net.URL
@ -26,8 +29,13 @@ class VWebviewClient : WebViewClient() {
} }
override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) { override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) {
view.evaluateJavascript(HttpClient.VencordRuntime!!, null) try {
view.evaluateJavascript(HttpClient.VencordMobileRuntime!!, null) HttpClient.VencordRuntime?.let { view.evaluateJavascript(it, null) }
HttpClient.VencordMobileRuntime?.let { view.evaluateJavascript(it, null) }
}
catch (e: Exception) {
Toast.makeText(view.context, "Couldn't load Vencord, try restarting the app.", Toast.LENGTH_LONG).show()
}
} }
override fun onPageFinished(view: WebView, url: String) { override fun onPageFinished(view: WebView, url: String) {

View file

@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M12,5V2L8,6l4,4V7c3.31,0 6,2.69 6,6c0,2.97 -2.17,5.43 -5,5.91v2.02c3.95,-0.49 7,-3.85 7,-7.93C20,8.58 16.42,5 12,5z"/>
<path android:fillColor="@android:color/white" android:pathData="M6,13c0,-1.65 0.67,-3.15 1.76,-4.24L6.34,7.34C4.9,8.79 4,10.79 4,13c0,4.08 3.05,7.44 7,7.93v-2.02C8.17,18.43 6,15.97 6,13z"/>
</vector>

View file

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/reset_vencord_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/reset_vencord_location" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="@string/reset_vencord_location_desc" />
<Button
android:id="@+id/update_vencord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/update_vencord" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="@string/update_vencord_desc" />
<Button
android:id="@+id/clear_cookies"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/clear_cookies" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/clear_cookies_desc" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
style="?attr/collapsingToolbarLayoutLargeStyle"
android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
app:contentScrim="?attr/colorSurfaceContainer"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="0dp"
app:layout_collapseMode="pin"
app:title="@string/recovery_shortcut_name"
app:titleTextColor="@color/text" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -0,0 +1,13 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="recovery"
android:enabled="true"
android:icon="@drawable/reset"
android:shortcutShortLabel="@string/recovery_shortcut_name"
android:shortcutLongLabel="@string/recovery_shortcut_name">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.nin0dev.vendroid"
android:targetClass="com.nin0dev.vendroid.RecoveryActivity" />
</shortcut>
</shortcuts>