first commit
34
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Log/OS Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio generated files and folders
|
||||||
|
captures/
|
||||||
|
.externalNativeBuild/
|
||||||
|
.cxx/
|
||||||
|
*.aab
|
||||||
|
*.apk
|
||||||
|
output-metadata.json
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
misc.xml
|
||||||
|
deploymentTargetDropDown.xml
|
||||||
|
render.experimental.xml
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
google-services.json
|
||||||
|
|
||||||
|
# Android Profiling
|
||||||
|
*.hprof
|
||||||
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 sad.ovh
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
1
app/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
||||||
60
app/build.gradle.kts
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "ovh.sad.bleh"
|
||||||
|
compileSdk {
|
||||||
|
version = release(36)
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "ovh.sad.bleh"
|
||||||
|
minSdk = 34
|
||||||
|
targetSdk = 36
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.androidx.core.ktx)
|
||||||
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
|
implementation(libs.androidx.activity.compose)
|
||||||
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
|
implementation(libs.androidx.compose.ui)
|
||||||
|
implementation(libs.androidx.compose.ui.graphics)
|
||||||
|
implementation(libs.androidx.compose.ui.tooling.preview)
|
||||||
|
implementation(libs.androidx.compose.material3)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.androidx.junit)
|
||||||
|
androidTestImplementation(libs.androidx.espresso.core)
|
||||||
|
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||||
|
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
|
||||||
|
debugImplementation(libs.androidx.compose.ui.tooling)
|
||||||
|
debugImplementation(libs.androidx.compose.ui.test.manifest)
|
||||||
|
}
|
||||||
21
app/proguard-rules.pro
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
BIN
app/release/baselineProfiles/0/app-release.dm
Normal file
BIN
app/release/baselineProfiles/1/app-release.dm
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("ovh.sad.bleh", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
29
app/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.Bleh">
|
||||||
|
<activity android:name=".SecretActivity" />
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@style/Theme.Bleh">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
81
app/src/main/java/ovh/sad/bleh/Caching.kt
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Context.MODE_PRIVATE
|
||||||
|
import android.os.Handler
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
|
class Caching {
|
||||||
|
companion object {
|
||||||
|
// The logger function, defaults to Android Log
|
||||||
|
var defaultLogger: (String) -> Unit = { msg -> Log.d("Caching", msg) }
|
||||||
|
private var logger: (String) -> Unit = defaultLogger
|
||||||
|
|
||||||
|
// Set a custom logger
|
||||||
|
fun setLog(customLog: (String) -> Unit) {
|
||||||
|
logger = customLog
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to call logger
|
||||||
|
private fun log(message: String) {
|
||||||
|
logger(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBranch(context: Context): String? {
|
||||||
|
val sharedPreferences = context.getSharedPreferences("UserPreferences", MODE_PRIVATE)
|
||||||
|
return if (sharedPreferences.getString("blehBranch", null) != null) {
|
||||||
|
sharedPreferences.getString("blehBranch", "");
|
||||||
|
} else {
|
||||||
|
"stable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCachedJsFile(context: Context): java.io.File {
|
||||||
|
return java.io.File(context.cacheDir, "bleh.user.js")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCachedVersionFile(context: Context): java.io.File {
|
||||||
|
return java.io.File(context.cacheDir, "bleh.user.js.version")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBlehJs(context: Context): String? {
|
||||||
|
val cachedFile = getCachedJsFile(context)
|
||||||
|
val text = if (cachedFile.exists()) cachedFile.readText() else return null
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkBlehJsUpdate(handler: Handler, context: Context) {
|
||||||
|
log("Checking bleh updates..")
|
||||||
|
val branch = getBranch(context)
|
||||||
|
val buildUrl =
|
||||||
|
"https://raw.githubusercontent.com/katelyynn/bleh/refs/heads/${if(branch == "stable") "uwu" else branch}/fm/src/build/build.json?${System.currentTimeMillis()}"
|
||||||
|
val jsUrl =
|
||||||
|
"https://raw.githubusercontent.com/katelyynn/bleh/refs/heads/${if(branch == "stable") "uwu" else branch}/fm/bleh.user.js?${System.currentTimeMillis()}"
|
||||||
|
|
||||||
|
val cachedFile = getCachedJsFile(context)
|
||||||
|
val versionFile = getCachedVersionFile(context)
|
||||||
|
|
||||||
|
try {
|
||||||
|
val buildResult = Utils.fetchHtml(handler, buildUrl)
|
||||||
|
|
||||||
|
val latestVersion = buildResult.html?.let {
|
||||||
|
Regex("\"build\"\\s*:\\s*\"([^\"]+)\"").find(it)?.groupValues?.get(1)
|
||||||
|
} + "-" + branch
|
||||||
|
|
||||||
|
var cachedVersion = if (versionFile.exists()) versionFile.readText() else null
|
||||||
|
log("Cached version: $cachedVersion, latest version: $latestVersion");
|
||||||
|
|
||||||
|
if (latestVersion != null && latestVersion != cachedVersion) {
|
||||||
|
val jsResult = Utils.fetchHtml(handler, jsUrl)
|
||||||
|
if (jsResult.error == null) {
|
||||||
|
cachedFile.writeText(jsResult.html.orEmpty())
|
||||||
|
versionFile.writeText(latestVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
153
app/src/main/java/ovh/sad/bleh/InterceptingWebViewClient.kt
Normal file
|
|
@ -0,0 +1,153 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.util.Log
|
||||||
|
import android.webkit.WebResourceRequest
|
||||||
|
import android.webkit.WebResourceResponse
|
||||||
|
import android.webkit.WebView
|
||||||
|
import android.webkit.WebViewClient
|
||||||
|
import android.widget.Toast
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
|
data class FetchResult(
|
||||||
|
val html: String?,
|
||||||
|
val error: String? = null,
|
||||||
|
val statusCode: Int? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
open class InterceptingWebViewClient(private val context: Context) : WebViewClient() {
|
||||||
|
open fun log(message: String) {
|
||||||
|
Log.d("IWVC", message)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val blockedDomains = arrayOf<String>(
|
||||||
|
"demdex.net",
|
||||||
|
"ssa.last.fm",
|
||||||
|
"googletagmanager.com",
|
||||||
|
"everestjs.net",
|
||||||
|
"newrelic.com",
|
||||||
|
"at.cbsi.com",
|
||||||
|
"tiqcdn.com",
|
||||||
|
"siteintercept.qualtrics.com",
|
||||||
|
"secure-us.imrworldwide.com",
|
||||||
|
"scorecardresearch.com",
|
||||||
|
"cookielaw.org",
|
||||||
|
"cdn.privacy.paramount.com",
|
||||||
|
"twochihuahuas.com",
|
||||||
|
"doubleclick.net",
|
||||||
|
"liadm.com",
|
||||||
|
"amazon-adsystem.com",
|
||||||
|
"confiant-integrations.net",
|
||||||
|
"criteo.com",
|
||||||
|
"adsrvr.org",
|
||||||
|
"contextual.media.net",
|
||||||
|
"adsafeprotected.com",
|
||||||
|
"merequartz.com",
|
||||||
|
"googlesyndication.com",
|
||||||
|
"strangeclocks.com"
|
||||||
|
)
|
||||||
|
|
||||||
|
val mainHandler = Handler(Looper.getMainLooper())
|
||||||
|
// onPageStarted here exists for one big reason
|
||||||
|
//
|
||||||
|
// When logging in for the first time, the client sends a POST request, which we can't really get the response of (cause it's a POST rqeuest, duh!)
|
||||||
|
// so I set this flag (interceptNextPost), which intercepts the next page load after a POST (which is always the page POST'ed)
|
||||||
|
private var interceptNextPost = false;
|
||||||
|
|
||||||
|
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
||||||
|
if(interceptNextPost) {
|
||||||
|
val injectedJs = Caching.getBlehJs(context)
|
||||||
|
if(injectedJs == null) {
|
||||||
|
mainHandler.post {
|
||||||
|
Toast.makeText(context, "Something is fucked! injectedJs returned NULL", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
return super.onPageStarted(view, url, favicon)
|
||||||
|
}
|
||||||
|
|
||||||
|
mainHandler.post {
|
||||||
|
Toast.makeText(context, "This page load may be slow.", Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
|
view?.evaluateJavascript("window.unsafeWindow = window;$injectedJs") { e ->
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interceptNextPost = false;
|
||||||
|
}
|
||||||
|
super.onPageStarted(view, url, favicon)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun shouldInterceptRequest(
|
||||||
|
view: WebView?,
|
||||||
|
request: WebResourceRequest?
|
||||||
|
): WebResourceResponse? {
|
||||||
|
val req = request ?: return null
|
||||||
|
val url = req.url.toString()
|
||||||
|
try {
|
||||||
|
val host = req.url.host ?: "no host wtf"
|
||||||
|
|
||||||
|
if (blockedDomains.any { host.contains(it, ignoreCase = true) }) {
|
||||||
|
log("Blocked $host.")
|
||||||
|
return WebResourceResponse(
|
||||||
|
"application/javascript",
|
||||||
|
StandardCharsets.UTF_8.name(),
|
||||||
|
ByteArrayInputStream.nullInputStream()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
log("Letting past: $host")
|
||||||
|
}
|
||||||
|
|
||||||
|
if(req.method == "POST" && req.isForMainFrame && (req.url.host == "www.last.fm" || req.url.host == "last.fm")) {
|
||||||
|
interceptNextPost = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.method == "GET" && req.isForMainFrame && (req.url.host == "www.last.fm" || req.url.host == "last.fm")) {
|
||||||
|
log("Intercepting mainframe..")
|
||||||
|
|
||||||
|
var fetched = Utils.fetchHtml(mainHandler, url, 3, true);
|
||||||
|
val code = fetched.statusCode
|
||||||
|
if ((code != 200 && code != 404) || fetched.html == null) {
|
||||||
|
mainHandler.post {
|
||||||
|
Toast.makeText(context, "Could not modify HTML. Status code: " + code + ", error: " + fetched.error, Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
return super.shouldInterceptRequest(view, request)
|
||||||
|
}
|
||||||
|
|
||||||
|
val injectedJs = Caching.getBlehJs(context);
|
||||||
|
if(injectedJs == null) {
|
||||||
|
mainHandler.post {
|
||||||
|
Toast.makeText(context, "Something is fucked! injectedJs returned NULL", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
return super.shouldInterceptRequest(view, request)
|
||||||
|
}
|
||||||
|
val injectedTag = "<script defer>window.unsafeWindow = window;$injectedJs</script>"
|
||||||
|
val modifiedHtml = try {
|
||||||
|
val pattern = Regex("(?i)</html[^>]*>")
|
||||||
|
|
||||||
|
if (pattern.containsMatchIn(fetched.html)) {
|
||||||
|
fetched.html.replaceFirst(pattern, "$0$injectedTag")
|
||||||
|
} else {
|
||||||
|
injectedTag + fetched.html
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
injectedTag + fetched.html
|
||||||
|
}
|
||||||
|
|
||||||
|
val bytes = modifiedHtml.toByteArray(StandardCharsets.UTF_8)
|
||||||
|
return WebResourceResponse(
|
||||||
|
"text/html",
|
||||||
|
StandardCharsets.UTF_8.name(),
|
||||||
|
ByteArrayInputStream(bytes)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.shouldInterceptRequest(view, request)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
61
app/src/main/java/ovh/sad/bleh/MainActivity.kt
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import androidx.activity.ComponentActivity
|
||||||
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.input.pointer.pointerInteropFilter
|
||||||
|
import ovh.sad.bleh.ui.theme.BlehTheme
|
||||||
|
|
||||||
|
class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
|
@OptIn(ExperimentalComposeUiApi::class)
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
var tapCount = 0
|
||||||
|
var lastTapTime = 0L
|
||||||
|
val multiTapThresholdMs = 200L
|
||||||
|
val requiredTaps = 30
|
||||||
|
|
||||||
|
setContent {
|
||||||
|
BlehTheme {
|
||||||
|
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
|
||||||
|
LastFmWebView(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(innerPadding)
|
||||||
|
.pointerInteropFilter { event ->
|
||||||
|
when (event.action) {
|
||||||
|
MotionEvent.ACTION_DOWN -> {
|
||||||
|
val now = System.currentTimeMillis()
|
||||||
|
if (now - lastTapTime < multiTapThresholdMs) {
|
||||||
|
tapCount++
|
||||||
|
} else {
|
||||||
|
tapCount = 1
|
||||||
|
}
|
||||||
|
lastTapTime = now
|
||||||
|
|
||||||
|
Log.d("Secret", "Tap #$tapCount")
|
||||||
|
|
||||||
|
if (tapCount >= requiredTaps) {
|
||||||
|
startActivity(Intent(this@MainActivity, SecretActivity::class.java))
|
||||||
|
tapCount = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
124
app/src/main/java/ovh/sad/bleh/SecretActivity.kt
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import android.content.Context.MODE_PRIVATE
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.util.Log
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.activity.ComponentActivity
|
||||||
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import ovh.sad.bleh.ui.theme.BlehTheme
|
||||||
|
import androidx.core.content.edit
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
class SecretActivity : ComponentActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContent {
|
||||||
|
BlehTheme {
|
||||||
|
SecretScreen(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SecretScreen(activity: SecretActivity) {
|
||||||
|
val sharedPreferences = activity.getSharedPreferences("UserPreferences", MODE_PRIVATE)
|
||||||
|
val tempBranch = sharedPreferences.getString("blehBranch", null);
|
||||||
|
|
||||||
|
var selectedOption by remember { mutableStateOf(if(tempBranch != null) "custom" else "stable") }
|
||||||
|
var customBranch by remember { mutableStateOf(tempBranch ?: "") }
|
||||||
|
var errorText by remember { mutableStateOf("") }
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
|
) {
|
||||||
|
Text("Select branch", style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.primary)
|
||||||
|
|
||||||
|
RadioButtonRow("Latest stable", MaterialTheme.colorScheme.secondary, "stable", selectedOption) { selectedOption = it }
|
||||||
|
RadioButtonRow("Custom branch", MaterialTheme.colorScheme.secondary, "custom", selectedOption) { selectedOption = it }
|
||||||
|
|
||||||
|
if (selectedOption == "custom") {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = customBranch,
|
||||||
|
onValueChange = { customBranch = it },
|
||||||
|
label = { Text("Input a Custom Branch here", color = MaterialTheme.colorScheme.secondary) },
|
||||||
|
singleLine = true,
|
||||||
|
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(onClick = {
|
||||||
|
if (selectedOption == "custom" && customBranch.isBlank()) {
|
||||||
|
errorText = "Custom branch cannot be empty!"
|
||||||
|
} else if (selectedOption == "custom" && !isValidBranch(customBranch)) {
|
||||||
|
errorText = "Custom branch is incorrect!"
|
||||||
|
} else {
|
||||||
|
errorText = ""
|
||||||
|
|
||||||
|
val previousState = sharedPreferences.getString("blehBranch", "") + "";
|
||||||
|
|
||||||
|
sharedPreferences.edit(commit = true) {
|
||||||
|
if (selectedOption == "custom") {
|
||||||
|
putString("blehBranch", customBranch)
|
||||||
|
} else {
|
||||||
|
if (previousState.isNotEmpty()) {
|
||||||
|
remove("blehBranch");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (previousState != sharedPreferences.getString("blehBranch", "")) {
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
Caching.checkBlehJsUpdate(
|
||||||
|
Handler(Looper.getMainLooper()),
|
||||||
|
activity
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}) {
|
||||||
|
Text("Submit")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorText.isNotEmpty()) {
|
||||||
|
Text(errorText, color = MaterialTheme.colorScheme.error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun RadioButtonRow(text: String, textColor: Color, value: String, selected: String, onSelected: (String) -> Unit) {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
RadioButton(
|
||||||
|
selected = selected == value,
|
||||||
|
onClick = { onSelected(value) }
|
||||||
|
)
|
||||||
|
Text(text, color = textColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simple branch validation
|
||||||
|
fun isValidBranch(branch: String) = branch.matches(Regex("^[a-zA-Z0-9_-]+$"))
|
||||||
131
app/src/main/java/ovh/sad/bleh/Utils.kt
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.util.Log
|
||||||
|
import android.webkit.CookieManager
|
||||||
|
import java.io.BufferedInputStream
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.InputStream
|
||||||
|
import java.net.HttpURLConnection
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
|
|
||||||
|
open class Utils {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
// The logger function, defaults to Android Log
|
||||||
|
var defaultLogger: (String) -> Unit = { msg -> Log.d("Utils", msg) }
|
||||||
|
private var logger: (String) -> Unit = defaultLogger
|
||||||
|
|
||||||
|
// Set a custom logger
|
||||||
|
fun setLog(customLog: (String) -> Unit) {
|
||||||
|
logger = customLog
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to call logger
|
||||||
|
private fun log(message: String) {
|
||||||
|
logger(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fetchHtml(
|
||||||
|
handler: Handler,
|
||||||
|
urlString: String,
|
||||||
|
retries: Int = 3,
|
||||||
|
cookies: Boolean = false
|
||||||
|
): FetchResult {
|
||||||
|
var conn: HttpURLConnection? = null
|
||||||
|
var input: InputStream? = null
|
||||||
|
|
||||||
|
val retryableCodes = setOf(429, 500, 502, 503, 504, 406)
|
||||||
|
val cookieHeader = CookieManager.getInstance().getCookie(urlString) ?: ""
|
||||||
|
|
||||||
|
return try {
|
||||||
|
val url = URL(urlString)
|
||||||
|
log("URL: $urlString (retries left: $retries)")
|
||||||
|
|
||||||
|
conn = (url.openConnection() as HttpURLConnection).apply {
|
||||||
|
requestMethod = "GET"
|
||||||
|
connectTimeout = 25_000
|
||||||
|
readTimeout = 25_000
|
||||||
|
instanceFollowRedirects = true
|
||||||
|
setRequestProperty(
|
||||||
|
"User-Agent",
|
||||||
|
"Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36"
|
||||||
|
)
|
||||||
|
setRequestProperty(
|
||||||
|
"Accept",
|
||||||
|
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
|
||||||
|
)
|
||||||
|
setRequestProperty("Accept-Language", "en-US,en;q=0.9")
|
||||||
|
setRequestProperty("Connection", "keep-alive")
|
||||||
|
setRequestProperty("DNT", "1")
|
||||||
|
setRequestProperty("Upgrade-Insecure-Requests", "1")
|
||||||
|
setRequestProperty("X-UA-Device-Type", "mobile")
|
||||||
|
setRequestProperty("X-UA-Country-Code", "LV")
|
||||||
|
if (cookies && cookieHeader.isNotEmpty()) {
|
||||||
|
setRequestProperty("Cookie", cookieHeader)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val code = conn.responseCode
|
||||||
|
|
||||||
|
if (cookies) {
|
||||||
|
conn.headerFields["Set-Cookie"]?.forEach { header ->
|
||||||
|
handler.post {
|
||||||
|
CookieManager.getInstance().setCookie(urlString, header) {
|
||||||
|
CookieManager.getInstance().flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code in retryableCodes) {
|
||||||
|
log("Got $code, retrying... ($retries left)")
|
||||||
|
if (retries > 0) {
|
||||||
|
Thread.sleep(500)
|
||||||
|
return fetchHtml(handler, urlString, retries - 1, cookies)
|
||||||
|
} else {
|
||||||
|
log("$code persisted after retries.")
|
||||||
|
return FetchResult(html = null, error = "HTTP $code", statusCode = code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input = if (code in 200..299) {
|
||||||
|
BufferedInputStream(conn.inputStream)
|
||||||
|
} else {
|
||||||
|
BufferedInputStream(conn.errorStream ?: ByteArrayInputStream(ByteArray(0)))
|
||||||
|
}
|
||||||
|
|
||||||
|
val html = readStreamToString(input)
|
||||||
|
|
||||||
|
if (code !in 200..299) {
|
||||||
|
log("Code $code")
|
||||||
|
return FetchResult(html = html, error = "HTTP $code", statusCode = code)
|
||||||
|
}
|
||||||
|
|
||||||
|
log("Downloaded $urlString.")
|
||||||
|
FetchResult(html = html, statusCode = code)
|
||||||
|
|
||||||
|
} catch (e: Exception) {
|
||||||
|
log("Exception: ${e.message}")
|
||||||
|
FetchResult(html = null, error = e.message)
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
input?.close()
|
||||||
|
} catch (_: Exception) {}
|
||||||
|
conn?.disconnect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun readStreamToString(input: InputStream): String {
|
||||||
|
val baos = ByteArrayOutputStream()
|
||||||
|
val buffer = ByteArray(4096)
|
||||||
|
var read: Int
|
||||||
|
while (input.read(buffer).also { read = it } != -1) {
|
||||||
|
baos.write(buffer, 0, read)
|
||||||
|
}
|
||||||
|
return baos.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
194
app/src/main/java/ovh/sad/bleh/WebViewScreen.kt
Normal file
|
|
@ -0,0 +1,194 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.util.Log
|
||||||
|
import android.webkit.CookieManager as AndroidCookieManager
|
||||||
|
import android.webkit.WebChromeClient
|
||||||
|
import android.webkit.WebResourceRequest
|
||||||
|
import android.webkit.WebResourceResponse
|
||||||
|
import android.webkit.WebSettings
|
||||||
|
import android.webkit.WebView
|
||||||
|
import android.webkit.WebViewClient
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.compose.animation.core.LinearEasing
|
||||||
|
import androidx.compose.animation.core.RepeatMode
|
||||||
|
import androidx.compose.animation.core.animateFloat
|
||||||
|
import androidx.compose.animation.core.infiniteRepeatable
|
||||||
|
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||||
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.widthIn
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.draw.rotate
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.io.BufferedInputStream
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.InputStream
|
||||||
|
import java.net.HttpCookie
|
||||||
|
import java.net.HttpURLConnection
|
||||||
|
import java.net.URL
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
|
@Composable
|
||||||
|
fun LastFmWebView(modifier: Modifier = Modifier) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
var isLoading by remember { mutableStateOf(true) }
|
||||||
|
var currentLog by remember { mutableStateOf("Loading.. ") }
|
||||||
|
|
||||||
|
val rotation by rememberInfiniteTransition().animateFloat(
|
||||||
|
initialValue = 0f,
|
||||||
|
targetValue = 360f,
|
||||||
|
animationSpec = infiniteRepeatable(
|
||||||
|
animation = tween(durationMillis = 1500, easing = LinearEasing),
|
||||||
|
repeatMode = RepeatMode.Restart
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
Box(modifier = modifier.fillMaxSize()) {
|
||||||
|
AndroidView(
|
||||||
|
factory = { ctx ->
|
||||||
|
WebView(ctx).apply {
|
||||||
|
layoutParams = android.view.ViewGroup.LayoutParams(
|
||||||
|
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
|
||||||
|
AndroidCookieManager.getInstance().setAcceptCookie(true)
|
||||||
|
AndroidCookieManager.getInstance().setAcceptThirdPartyCookies(this, true)
|
||||||
|
|
||||||
|
settings.javaScriptEnabled = true
|
||||||
|
settings.domStorageEnabled = true
|
||||||
|
settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
||||||
|
fitsSystemWindows = true
|
||||||
|
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(this) { v, insets ->
|
||||||
|
val sys = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||||
|
v.updatePadding(
|
||||||
|
left = sys.left,
|
||||||
|
top = sys.top,
|
||||||
|
right = sys.right,
|
||||||
|
bottom = sys.bottom
|
||||||
|
)
|
||||||
|
insets
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewCompat.requestApplyInsets(this)
|
||||||
|
|
||||||
|
var iwvc = object : InterceptingWebViewClient(context) {
|
||||||
|
override fun log(message: String) {
|
||||||
|
currentLog = "Loading.. (iwvc)\n$message";
|
||||||
|
super.log(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
webViewClient = iwvc;
|
||||||
|
|
||||||
|
webChromeClient = object : WebChromeClient() {
|
||||||
|
override fun onProgressChanged(view: WebView?, newProgress: Int) {
|
||||||
|
if (newProgress < 100) isLoading = true
|
||||||
|
if(newProgress == 100) {
|
||||||
|
isLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Caching.setLog { e ->
|
||||||
|
Caching.defaultLogger(e);
|
||||||
|
currentLog = "Loading.. (caching)\n$e";
|
||||||
|
}
|
||||||
|
|
||||||
|
Utils.setLog { e ->
|
||||||
|
Utils.defaultLogger(e);
|
||||||
|
currentLog = "Loading.. (utils)\n$e";
|
||||||
|
}
|
||||||
|
|
||||||
|
WebView.setWebContentsDebuggingEnabled(true)
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
Caching.checkBlehJsUpdate(iwvc.mainHandler, ctx);
|
||||||
|
ctx.mainExecutor.execute {
|
||||||
|
loadUrl("https://www.last.fm/login")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
update = { }
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.hsl(0f, 0f, 0.13f)),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(96.dp)
|
||||||
|
.rotate(rotation)
|
||||||
|
.clip(CircleShape)
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.ic_launcher_background),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.matchParentSize()
|
||||||
|
)
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.ic_launcher_foreground),
|
||||||
|
contentDescription = "Loading",
|
||||||
|
modifier = Modifier.matchParentSize()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.widthIn(max = 200.dp),
|
||||||
|
softWrap = true,
|
||||||
|
text = currentLog,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/src/main/java/ovh/sad/bleh/ui/theme/Color.kt
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
package ovh.sad.bleh.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val Purple80 = Color(0xFFD0BCFF)
|
||||||
|
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||||
|
val Pink80 = Color(0xFFEFB8C8)
|
||||||
|
|
||||||
|
val Purple40 = Color(0xFF6650A4)
|
||||||
|
val PurpleGrey40 = Color(0xFF625B71)
|
||||||
|
val Pink40 = Color(0xFF7D5260)
|
||||||
95
app/src/main/java/ovh/sad/bleh/ui/theme/Theme.kt
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
package ovh.sad.bleh.ui.theme
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.darkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicDarkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicLightColorScheme
|
||||||
|
import androidx.compose.material3.lightColorScheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
|
// Light theme colors
|
||||||
|
val LightColors = lightColorScheme(
|
||||||
|
primary = Purple40,
|
||||||
|
onPrimary = Color.White,
|
||||||
|
primaryContainer = Purple80,
|
||||||
|
onPrimaryContainer = Color.Black,
|
||||||
|
secondary = PurpleGrey40,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
secondaryContainer = PurpleGrey80,
|
||||||
|
onSecondaryContainer = Color.Black,
|
||||||
|
tertiary = Pink40,
|
||||||
|
onTertiary = Color.White,
|
||||||
|
tertiaryContainer = Pink80,
|
||||||
|
onTertiaryContainer = Color.Black,
|
||||||
|
background = Color(0xFFF5F5F5),
|
||||||
|
onBackground = Color(0xFF1C1B1F),
|
||||||
|
surface = Color.White,
|
||||||
|
onSurface = Color(0xFF1C1B1F),
|
||||||
|
error = Color(0xFFB00020),
|
||||||
|
onError = Color.White,
|
||||||
|
surfaceVariant = Color(0xFFE7E0EC),
|
||||||
|
onSurfaceVariant = Color(0xFF49454F),
|
||||||
|
outline = Color(0xFF79747E),
|
||||||
|
inverseOnSurface = Color.White,
|
||||||
|
inverseSurface = Color(0xFF313033),
|
||||||
|
inversePrimary = Purple80,
|
||||||
|
scrim = Color.Black
|
||||||
|
)
|
||||||
|
|
||||||
|
// Dark theme colors
|
||||||
|
val DarkColors = darkColorScheme(
|
||||||
|
primary = Purple80,
|
||||||
|
onPrimary = Color.Black,
|
||||||
|
primaryContainer = Purple40,
|
||||||
|
onPrimaryContainer = Color.White,
|
||||||
|
secondary = PurpleGrey80,
|
||||||
|
onSecondary = Color.Black,
|
||||||
|
secondaryContainer = PurpleGrey40,
|
||||||
|
onSecondaryContainer = Color.White,
|
||||||
|
tertiary = Pink80,
|
||||||
|
onTertiary = Color.Black,
|
||||||
|
tertiaryContainer = Pink40,
|
||||||
|
onTertiaryContainer = Color.White,
|
||||||
|
background = Color(0xFF1C1B1F),
|
||||||
|
onBackground = Color(0xFFE6E1E5),
|
||||||
|
surface = Color(0xFF1C1B1F),
|
||||||
|
onSurface = Color(0xFFE6E1E5),
|
||||||
|
error = Color(0xFFCF6679),
|
||||||
|
onError = Color.Black,
|
||||||
|
surfaceVariant = Color(0xFF49454F),
|
||||||
|
onSurfaceVariant = Color(0xFFCAC4D0),
|
||||||
|
outline = Color(0xFF938F99),
|
||||||
|
inverseOnSurface = Color(0xFF1C1B1F),
|
||||||
|
inverseSurface = Color(0xFFE6E1E5),
|
||||||
|
inversePrimary = Purple40,
|
||||||
|
scrim = Color.Black
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BlehTheme(
|
||||||
|
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||||
|
// Dynamic color is available on Android 12+
|
||||||
|
dynamicColor: Boolean = true,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val colorScheme = when {
|
||||||
|
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||||
|
val context = LocalContext.current
|
||||||
|
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
darkTheme -> DarkColors
|
||||||
|
else -> LightColors
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
54
app/src/main/java/ovh/sad/bleh/ui/theme/Type.kt
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
package ovh.sad.bleh.ui.theme
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
val Typography = Typography(
|
||||||
|
displayLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 57.sp,
|
||||||
|
lineHeight = 64.sp,
|
||||||
|
letterSpacing = (-0.25).sp
|
||||||
|
),
|
||||||
|
displayMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 45.sp,
|
||||||
|
lineHeight = 52.sp
|
||||||
|
),
|
||||||
|
displaySmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 36.sp,
|
||||||
|
lineHeight = 44.sp
|
||||||
|
),
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
fontSize = 22.sp,
|
||||||
|
lineHeight = 28.sp
|
||||||
|
),
|
||||||
|
titleMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp
|
||||||
|
),
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp
|
||||||
|
),
|
||||||
|
labelLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp
|
||||||
|
)
|
||||||
|
)
|
||||||
21
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="200"
|
||||||
|
android:viewportHeight="200">
|
||||||
|
<path
|
||||||
|
android:pathData="M100,-112.13l212.13,212.13l-212.13,212.13l-212.13,-212.13z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:startX="-112.13"
|
||||||
|
android:startY="-112.13"
|
||||||
|
android:endX="-112.13"
|
||||||
|
android:endY="312.13"
|
||||||
|
android:type="linear">
|
||||||
|
<item android:offset="0" android:color="#FF7653E0"/>
|
||||||
|
<item android:offset="1" android:color="#FF9C85E0"/>
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
</vector>
|
||||||
16
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="200"
|
||||||
|
android:viewportHeight="200">
|
||||||
|
<group android:scaleX="0.65"
|
||||||
|
android:scaleY="0.65"
|
||||||
|
android:translateX="35"
|
||||||
|
android:translateY="35">
|
||||||
|
<path
|
||||||
|
android:pathData="M76.45,45.78C73.2,45.97 72.48,46.23 71.94,47.42C71.37,48.7 69.27,55.86 67.93,61.23C66.2,68.04 65.6,81.03 65.48,114.07C65.44,126.09 65.48,126.6 66.85,129.16C67.46,130.28 67.94,131.54 67.94,131.95C67.94,134.79 74.9,146.14 77.69,147.85C80.18,149.37 86.16,151.67 88.31,151.95C89.19,152.06 91.06,152.48 92.45,152.87C93.85,153.26 96.51,153.68 98.37,153.79C100.21,153.89 101.89,154.16 102.1,154.37C102.54,154.8 107.21,152.57 108.82,151.14C109.43,150.63 110.39,150.37 110.98,150.62C112.18,151.06 117.6,149.21 117.6,148.36C117.6,147.62 123.15,142.1 125.71,140.28C126.85,139.46 127.96,138.1 128.17,137.24C128.38,136.39 129.16,135.25 129.89,134.74C131.96,133.3 132.99,128.52 133.29,118.91C133.44,114.04 133.83,109.56 134.16,108.96C135.6,106.28 132.74,101.13 126.49,95.11C122,90.77 120.87,90.07 115.85,88.25C107.69,85.29 103.4,84.93 98.6,86.8C96.04,87.8 94.42,88.87 93.72,90.05C92.72,91.74 89.78,94.13 89.33,93.61C88.94,93.19 90.6,83.9 91.29,82.55C92.19,80.81 92.42,75.96 92.44,59.63L92.45,45.64L86.4,45.58C83.08,45.55 78.59,45.65 76.45,45.78M96.18,111.56C95.08,111.9 93.28,113.18 92.2,114.42C89.33,117.68 89.42,121.47 92.45,126.07C93.68,127.93 94.68,129.82 94.68,130.25C94.68,130.69 95.23,131.55 95.89,132.14C97.06,133.2 97.31,133.17 101.14,131.68C103.36,130.82 105.98,129.93 106.94,129.71C109.55,129.12 111.65,125.39 112.12,120.46C112.48,116.77 112.36,116.14 110.89,114.04C109.39,111.89 108.96,111.67 105.38,111.29C100.55,110.78 98.72,110.85 96.18,111.56Z"
|
||||||
|
android:fillColor="#fff"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 992 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
10
app/src/main/res/values/colors.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FF6200EE</color>
|
||||||
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
</resources>
|
||||||
3
app/src/main/res/values/strings.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">bleh</string>
|
||||||
|
</resources>
|
||||||
5
app/src/main/res/values/themes.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.Bleh" parent="android:Theme.Black.NoTitleBar" />
|
||||||
|
</resources>
|
||||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older than API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
||||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
||||||
17
app/src/test/java/ovh/sad/bleh/ExampleUnitTest.kt
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
package ovh.sad.bleh
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
6
build.gradle.kts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
|
}
|
||||||
23
gradle.properties
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. For more details, visit
|
||||||
|
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
|
kotlin.code.style=official
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
32
gradle/libs.versions.toml
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
[versions]
|
||||||
|
agp = "8.13.0"
|
||||||
|
kotlin = "2.0.21"
|
||||||
|
coreKtx = "1.10.1"
|
||||||
|
junit = "4.13.2"
|
||||||
|
junitVersion = "1.1.5"
|
||||||
|
espressoCore = "3.5.1"
|
||||||
|
lifecycleRuntimeKtx = "2.6.1"
|
||||||
|
activityCompose = "1.8.0"
|
||||||
|
composeBom = "2024.09.00"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
|
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
|
||||||
|
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
|
||||||
|
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
|
||||||
|
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||||
|
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||||
|
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
|
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
|
androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||||
|
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||||
|
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
|
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
8
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#Fri Oct 17 14:58:45 MSK 2025
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
251
gradlew
vendored
Executable file
|
|
@ -0,0 +1,251 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH="\\\"\\\""
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
94
gradlew.bat
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
23
settings.gradle.kts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "bleh"
|
||||||
|
include(":app")
|
||||||