Skip to content

Commit 8dc7a97

Browse files
committed
android: update usages for toggle
1 parent d9795c4 commit 8dc7a97

19 files changed

+717
-1374
lines changed

android/app/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@ dependencies {
6262
implementation(libs.haze)
6363
implementation(libs.haze.materials)
6464
implementation(libs.androidx.dynamicanimation)
65-
implementation(libs.androidx.compose.foundation.layout)
66-
compileOnly(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))
67-
implementation(fileTree(mapOf("dir" to "lib", "include" to listOf("*.aar"))))
6865
debugImplementation(libs.androidx.compose.ui.tooling)
66+
implementation(libs.androidx.compose.foundation.layout)
67+
// compileOnly(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))
68+
// implementation(fileTree(mapOf("dir" to "lib", "include" to listOf("*.aar"))))
69+
compileOnly(files("libs/libxposed-api-100.aar"))
70+
debugImplementation(files("libs/backdrop-debug.aar"))
71+
releaseImplementation(files("libs/backdrop-release.aar"))
6972
}
107 KB
Binary file not shown.
101 KB
Binary file not shown.

android/app/src/main/java/me/kavishdevar/librepods/composables/AudioSettings.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import androidx.navigation.NavController
4242
import androidx.navigation.compose.rememberNavController
4343
import me.kavishdevar.librepods.R
4444
import me.kavishdevar.librepods.utils.AACPManager
45+
import me.kavishdevar.librepods.utils.ATTHandles
4546
import kotlin.io.encoding.ExperimentalEncodingApi
4647

4748
@Composable
@@ -95,7 +96,12 @@ fun AudioSettings(navController: NavController) {
9596
.padding(start = 12.dp, end = 0.dp)
9697
)
9798

98-
LoudSoundReductionSwitch()
99+
StyledToggle(
100+
label = stringResource(R.string.loud_sound_reduction),
101+
description = stringResource(R.string.loud_sound_reduction_description),
102+
attHandle = ATTHandles.LOUD_SOUND_REDUCTION,
103+
independent = false
104+
)
99105
HorizontalDivider(
100106
thickness = 1.5.dp,
101107
color = Color(0x40888888),

android/app/src/main/java/me/kavishdevar/librepods/composables/AutomaticConnectionSwitch.kt

Lines changed: 0 additions & 182 deletions
This file was deleted.

android/app/src/main/java/me/kavishdevar/librepods/composables/ConnectionSettings.kt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ import androidx.compose.material3.HorizontalDivider
3030
import androidx.compose.runtime.Composable
3131
import androidx.compose.ui.Modifier
3232
import androidx.compose.ui.graphics.Color
33+
import androidx.compose.ui.platform.LocalContext
34+
import androidx.compose.ui.res.stringResource
3335
import androidx.compose.ui.tooling.preview.Preview
3436
import androidx.compose.ui.unit.dp
3537
import kotlin.io.encoding.ExperimentalEncodingApi
38+
import android.content.Context.MODE_PRIVATE
39+
import me.kavishdevar.librepods.composables.StyledToggle
40+
import me.kavishdevar.librepods.utils.AACPManager
41+
import me.kavishdevar.librepods.R
3642

3743
@Composable
3844
fun ConnectionSettings() {
@@ -45,15 +51,28 @@ fun ConnectionSettings() {
4551
.background(backgroundColor, RoundedCornerShape(14.dp))
4652
.padding(top = 2.dp)
4753
) {
48-
EarDetectionSwitch()
54+
StyledToggle(
55+
label = stringResource(R.string.ear_detection),
56+
controlCommandIdentifier = AACPManager.Companion.ControlCommandIdentifiers.EAR_DETECTION_CONFIG,
57+
sharedPreferenceKey = "automatic_ear_detection",
58+
sharedPreferences = LocalContext.current.getSharedPreferences("settings", MODE_PRIVATE),
59+
independent = false
60+
)
4961
HorizontalDivider(
5062
thickness = 1.5.dp,
5163
color = Color(0x40888888),
5264
modifier = Modifier
5365
.padding(start = 12.dp, end = 0.dp)
5466
)
5567

56-
AutomaticConnectionSwitch()
68+
StyledToggle(
69+
label = stringResource(R.string.automatically_connect),
70+
description = stringResource(R.string.automatically_connect_description),
71+
controlCommandIdentifier = AACPManager.Companion.ControlCommandIdentifiers.AUTOMATIC_CONNECTION_CONFIG,
72+
sharedPreferenceKey = "automatic_connection_ctrl_cmd",
73+
sharedPreferences = LocalContext.current.getSharedPreferences("settings", MODE_PRIVATE),
74+
independent = false
75+
)
5776
}
5877
}
5978

0 commit comments

Comments
 (0)