Fix Lyrics Fade Region

This commit is contained in:
2026-05-24 22:55:00 +10:00
parent 324a6eb6c8
commit e105a3eb35
8 changed files with 31 additions and 189 deletions
@@ -12,7 +12,6 @@ class PreferencesManager(preferences: SharedPreferences) : BasePreferenceManager
var devMode by booleanPreference("dev_mode", false)
var installer by enumPreference<InstallerSetting>("installer", InstallerSetting.PackageInstaller)
var keepPatchedApks by booleanPreference("keep_patched_apks", false)
var showNetworkWarning by booleanPreference("show_network_warning", true)
var showPlayProtectWarning by booleanPreference("show_play_protect_warning", true)
var autoUpdateCheck by booleanPreference("auto_update_check", true)
@@ -1,96 +0,0 @@
package com.meowarex.rlmobile.ui.components.dialogs
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import com.meowarex.rlmobile.R
@Composable
fun NetworkWarningDialog(
onConfirm: (neverShow: Boolean) -> Unit,
onDismiss: (neverShow: Boolean) -> Unit,
) {
val interactionSource = remember(::MutableInteractionSource)
var neverShow by rememberSaveable { mutableStateOf(false) }
val rememberedNeverShow by rememberUpdatedState(neverShow)
AlertDialog(
onDismissRequest = { onDismiss(rememberedNeverShow) },
properties = DialogProperties(
dismissOnClickOutside = false,
),
confirmButton = {
FilledTonalButton(
onClick = { onConfirm(rememberedNeverShow) },
colors = ButtonDefaults.filledTonalButtonColors(
containerColor = MaterialTheme.colorScheme.error,
contentColor = MaterialTheme.colorScheme.onError,
),
) {
Text(stringResource(R.string.action_continue))
}
},
dismissButton = {
TextButton(
onClick = { onDismiss(rememberedNeverShow) },
colors = ButtonDefaults.textButtonColors(
contentColor = MaterialTheme.colorScheme.onErrorContainer
),
) {
Text(stringResource(R.string.navigation_back))
}
},
title = { Text(stringResource(R.string.network_warning_title)) },
text = {
Column(
verticalArrangement = Arrangement.spacedBy(12.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = stringResource(R.string.network_warning_body),
textAlign = TextAlign.Center,
)
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.clickable(
interactionSource = interactionSource,
indication = null,
onClick = { neverShow = !rememberedNeverShow },
)
.padding(end = 16.dp)
) {
Checkbox(
checked = neverShow,
onCheckedChange = { neverShow = it },
interactionSource = interactionSource,
)
Text(stringResource(R.string.network_warning_disable))
}
}
},
icon = {
Icon(
painter = painterResource(R.drawable.ic_warning),
contentDescription = null,
modifier = Modifier.size(32.dp),
)
},
containerColor = MaterialTheme.colorScheme.errorContainer,
iconContentColor = MaterialTheme.colorScheme.onErrorContainer,
titleContentColor = MaterialTheme.colorScheme.onErrorContainer,
textContentColor = MaterialTheme.colorScheme.onErrorContainer,
)
}
@@ -1,19 +0,0 @@
package com.meowarex.rlmobile.ui.previews.dialogs
import android.content.res.Configuration
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.meowarex.rlmobile.ui.components.dialogs.NetworkWarningDialog
import com.meowarex.rlmobile.ui.theme.ManagerTheme
@Composable
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
private fun NetworkWarningDialogPreview() {
ManagerTheme {
NetworkWarningDialog(
onConfirm = {},
onDismiss = {},
)
}
}
@@ -28,7 +28,6 @@ import com.meowarex.rlmobile.patcher.steps.StepGroup
import com.meowarex.rlmobile.ui.components.MainActionButton
import com.meowarex.rlmobile.ui.components.Wakelock
import com.meowarex.rlmobile.ui.components.dialogs.InstallerAbortDialog
import com.meowarex.rlmobile.ui.components.dialogs.NetworkWarningDialog
import com.meowarex.rlmobile.ui.screens.log.LogScreen
import com.meowarex.rlmobile.ui.screens.patching.components.*
import com.meowarex.rlmobile.ui.screens.patchopts.PatchOptions
@@ -111,19 +110,6 @@ class PatchingScreen(
listState.animateScrollToItem(0)
}
if (model.showNetworkWarningDialog) {
NetworkWarningDialog(
onConfirm = { neverShow ->
model.hideNetworkWarning(neverShow)
model.install()
},
onDismiss = { neverShow ->
model.hideNetworkWarning(neverShow)
navigator.pop()
},
)
}
if (showAbortWarning) {
InstallerAbortDialog(
onDismiss = { showAbortWarning = false },
@@ -41,9 +41,6 @@ class PatchingScreenModel(
val devMode get() = prefs.devMode
var showNetworkWarningDialog by mutableStateOf(!alreadyShownNetworkWarning && application.isNetworkDangerous())
private set
var steps by mutableStateOf<ImmutableMap<StepGroup, ImmutableList<Step>>?>(null)
private set
@@ -52,10 +49,6 @@ class PatchingScreenModel(
private set
init {
if (!prefs.showNetworkWarning)
showNetworkWarningDialog = false
if (!showNetworkWarningDialog)
install()
// Rotate fun facts every so often
@@ -67,12 +60,6 @@ class PatchingScreenModel(
}
}
fun hideNetworkWarning(neverShow: Boolean) {
showNetworkWarningDialog = false
alreadyShownNetworkWarning = true
prefs.showNetworkWarning = !neverShow
}
fun launchApp() {
if (state.value !is PatchingScreenState.Success)
return
@@ -194,9 +181,6 @@ class PatchingScreenModel(
}
companion object {
// Global state to avoid showing the warning more than once per launch
private var alreadyShownNetworkWarning = false
/**
* Random fun facts to show on the installation screen.
*/
@@ -5,11 +5,9 @@ import android.app.Activity
import android.content.*
import android.content.pm.PackageManager
import android.content.res.Resources
import android.net.ConnectivityManager
import android.net.Uri
import android.os.*
import android.provider.Settings
import android.telephony.TelephonyManager
import android.util.Log
import android.util.TypedValue
import android.widget.Toast
@@ -152,37 +150,6 @@ suspend fun Context.isPlayProtectEnabled(): Boolean? {
}
}
/**
* Check whether the device is connected on a metered WIFI connection or through any type of mobile data,
* to avoid unknowingly downloading a lot of stuff through a potentially metered network.
*/
@Suppress("DEPRECATION")
fun Context.isNetworkDangerous(): Boolean {
val connectivity = this.getSystemService<ConnectivityManager>()
?: error("Unable to get system connectivity service")
if (connectivity.isActiveNetworkMetered) return true
when (val info = connectivity.activeNetworkInfo) {
null -> return false
else -> {
if (info.isRoaming) return true
if (info.type == ConnectivityManager.TYPE_WIFI) return false
}
}
val telephony = this.getSystemService<TelephonyManager>()
?: error("Unable to get system telephony service")
val dangerousMobileDataStates = arrayOf(
/* TelephonyManager.DATA_DISCONNECTING */ 4,
TelephonyManager.DATA_CONNECTED,
TelephonyManager.DATA_CONNECTING,
)
return dangerousMobileDataStates.contains(telephony.dataState)
}
/**
* Gets the user associated with this context.
*/
@@ -138,11 +138,6 @@
<string name="contributors_contributions">%s contributions</string>
<string name="network_load_fail">Failed to load</string>
<string name="network_warning_title">Metered network</string>
<string
name="network_warning_body"
>It appears you are connected to mobile data or a potentially metered network. Continuing with the installation may result in several hundred megabytes being downloaded. Are you sure you want to continue?</string>
<string name="network_warning_disable">Don\'t show this again</string>
<string name="version_none">None</string>
<string name="version_stable">Stable</string>
+28 -2
View File
@@ -1,11 +1,37 @@
--- a/com/tidal/android/feature/playerscreen/ui/composables/k1.smali
+++ b/com/tidal/android/feature/playerscreen/ui/composables/k1.smali
@@ -64,7 +64,7 @@
@@ -64,26 +64,29 @@
.line 16
.line 17
- iget v2, p0, Lcom/tidal/android/feature/playerscreen/ui/composables/k1;->a:F
+ const/high16 v2, 0x43480000 # hardcode top fade region to 200dp (decouple from contentPadding)
+ const/high16 v2, 0x43200000 # 160f startDp — alpha clamps to 0 above this, hiding lyrics under the pill
.line 18
.line 19
invoke-interface {p1, v2}, Landroidx/compose/ui/unit/Density;->toPx-0680j_4(F)F
.line 20
.line 21
.line 22
- move-result v3
+ move-result v2 # startY in px
+
+ const/high16 v3, 0x435c0000 # 220f endDp — 60dp transition, alpha clamps to 1 below this
+
+ invoke-interface {p1, v3}, Landroidx/compose/ui/unit/Density;->toPx-0680j_4(F)F
+
+ move-result v3 # endY in px
.line 23
const/16 v5, 0x8
.line 24
.line 25
const/4 v6, 0x0
- .line 26
- const/4 v2, 0x0
-
.line 27
const/4 v4, 0x0