-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to choose the audio provider and bumped up yt-dlp
- Loading branch information
Showing
11 changed files
with
182 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
app/src/main/java/com/bobbyesp/spowlo/ui/pages/settings/format/AudioProviderDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.bobbyesp.spowlo.ui.pages.settings.format | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.MusicNote | ||
import androidx.compose.material3.AlertDialog | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.bobbyesp.spowlo.R | ||
import com.bobbyesp.spowlo.ui.components.ConfirmButton | ||
import com.bobbyesp.spowlo.ui.components.SingleChoiceItemWithIcon | ||
import com.bobbyesp.spowlo.utils.AUDIO_PROVIDER | ||
import com.bobbyesp.spowlo.utils.PreferencesUtil | ||
|
||
@Composable | ||
fun AudioProviderDialog( | ||
onDismissRequest: () -> Unit | ||
) { | ||
var audioProvider by remember { mutableStateOf(PreferencesUtil.getAudioProvider()) } | ||
AlertDialog( | ||
onDismissRequest = onDismissRequest, | ||
title = { Text(stringResource(id = R.string.audio_provider)) }, | ||
icon = { Icon(Icons.Outlined.MusicNote, null) }, | ||
text = { | ||
Column() { | ||
Text( | ||
stringResource(id = R.string.audio_provider_desc), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(bottom = 12.dp) | ||
.padding(horizontal = 24.dp), | ||
style = MaterialTheme.typography.bodyLarge | ||
) | ||
LazyColumn { | ||
for (i in 0..1) { | ||
item { | ||
SingleChoiceItemWithIcon( | ||
text = PreferencesUtil.getAudioProviderDesc(i), | ||
selected = audioProvider == i, | ||
icon = PreferencesUtil.getAudioProviderIcon(i), | ||
onClick = { | ||
audioProvider = i | ||
} | ||
) | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
confirmButton = { | ||
ConfirmButton( | ||
onClick = { | ||
PreferencesUtil.encodeInt(AUDIO_PROVIDER, audioProvider) | ||
onDismissRequest() | ||
} | ||
) | ||
}, | ||
dismissButton = { TextButton(onClick = { onDismissRequest() }) { | ||
Text(text = stringResource(id = R.string.dismiss)) | ||
} }, | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<vector android:autoMirrored="true" android:height="144dp" | ||
android:viewportHeight="48" android:viewportWidth="48" | ||
android:width="144dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="#FF3D00" android:pathData="M43.2,33.9c-0.4,2.1 -2.1,3.7 -4.2,4c-3.3,0.5 -8.8,1.1 -15,1.1c-6.1,0 -11.6,-0.6 -15,-1.1c-2.1,-0.3 -3.8,-1.9 -4.2,-4C4.4,31.6 4,28.2 4,24c0,-4.2 0.4,-7.6 0.8,-9.9c0.4,-2.1 2.1,-3.7 4.2,-4C12.3,9.6 17.8,9 24,9c6.2,0 11.6,0.6 15,1.1c2.1,0.3 3.8,1.9 4.2,4c0.4,2.3 0.9,5.7 0.9,9.9C44,28.2 43.6,31.6 43.2,33.9z"/> | ||
<path android:fillColor="#FFF" android:pathData="M20,31L20,17 32,24z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector android:autoMirrored="true" android:height="144dp" | ||
android:viewportHeight="48" android:viewportWidth="48" | ||
android:width="144dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="#f44336" android:pathData="M24,24m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0"/> | ||
<path android:fillColor="#fff" android:pathData="M21,29l8,-5l-8,-5z"/> | ||
<path android:fillColor="#00000000" | ||
android:pathData="M24,14c5.5,0 10,4.476 10,10s-4.476,10 -10,10s-10,-4.476 -10,-10S18.5,14 24,14" | ||
android:strokeColor="#fff" android:strokeWidth="1"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters