Skip to content

Commit 39a64ec

Browse files
committed
android: add opensource licenses
should've done this a long time ago!
1 parent b7cc27f commit 39a64ec

File tree

10 files changed

+4662
-7
lines changed

10 files changed

+4662
-7
lines changed

android/app/build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ plugins {
22
alias(libs.plugins.android.application)
33
alias(libs.plugins.kotlin.android)
44
alias(libs.plugins.kotlin.compose)
5+
alias(libs.plugins.aboutLibraries)
56
id("kotlin-parcelize")
67
}
78

89
android {
910
namespace = "me.kavishdevar.librepods"
10-
compileSdk = 35
11+
compileSdk = 36
1112

1213
defaultConfig {
1314
applicationId = "me.kavishdevar.librepods"
1415
minSdk = 28
15-
targetSdk = 35
16+
targetSdk = 36
1617
versionCode = 8
1718
versionName = "0.2.0-alpha"
1819
}
@@ -65,9 +66,19 @@ dependencies {
6566
implementation(libs.androidx.compose.ui)
6667
debugImplementation(libs.androidx.compose.ui.tooling)
6768
implementation(libs.androidx.compose.foundation.layout)
69+
implementation(libs.aboutlibraries)
70+
implementation(libs.aboutlibraries.compose.m3)
6871
// compileOnly(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))
6972
// implementation(fileTree(mapOf("dir" to "lib", "include" to listOf("*.aar"))))
7073
compileOnly(files("libs/libxposed-api-100.aar"))
7174
debugImplementation(files("libs/backdrop-debug.aar"))
7275
releaseImplementation(files("libs/backdrop-release.aar"))
7376
}
77+
78+
aboutLibraries {
79+
export{
80+
prettyPrint = true
81+
excludeFields = listOf("generated")
82+
outputFile = file("src/main/res/raw/aboutlibraries.json")
83+
}
84+
}

android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import me.kavishdevar.librepods.screens.HearingAidAdjustmentsScreen
117117
import me.kavishdevar.librepods.screens.HearingAidScreen
118118
import me.kavishdevar.librepods.screens.LongPress
119119
import me.kavishdevar.librepods.screens.Onboarding
120+
import me.kavishdevar.librepods.screens.OpenSourceLicensesScreen
120121
import me.kavishdevar.librepods.screens.RenameScreen
121122
import me.kavishdevar.librepods.screens.TransparencySettingsScreen
122123
import me.kavishdevar.librepods.screens.TroubleshootingScreen
@@ -398,6 +399,9 @@ fun Main() {
398399
composable("camera_control") {
399400
CameraControlScreen(navController)
400401
}
402+
composable("open_source_licenses") {
403+
OpenSourceLicensesScreen(navController)
404+
}
401405
}
402406
}
403407

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import androidx.compose.foundation.layout.fillMaxSize
2727
import androidx.compose.foundation.layout.fillMaxWidth
2828
import androidx.compose.foundation.layout.height
2929
import androidx.compose.foundation.layout.padding
30+
import androidx.compose.foundation.shape.RoundedCornerShape
3031
import androidx.compose.material3.Scaffold
3132
import androidx.compose.material3.SnackbarHost
3233
import androidx.compose.material3.SnackbarHostState
@@ -35,6 +36,7 @@ import androidx.compose.runtime.Composable
3536
import androidx.compose.runtime.remember
3637
import androidx.compose.ui.Alignment
3738
import androidx.compose.ui.Modifier
39+
import androidx.compose.ui.draw.clip
3840
import androidx.compose.ui.graphics.Color
3941
import androidx.compose.ui.platform.LocalLayoutDirection
4042
import androidx.compose.ui.text.TextStyle
@@ -68,7 +70,9 @@ fun StyledScaffold(
6870

6971
Scaffold(
7072
containerColor = if (isDarkTheme) Color(0xFF000000) else Color(0xFFF2F2F7),
71-
snackbarHost = { SnackbarHost(snackbarHostState) }
73+
snackbarHost = { SnackbarHost(snackbarHostState) },
74+
modifier = Modifier
75+
.clip(RoundedCornerShape(52.dp))
7276
) { paddingValues ->
7377
val topPadding = paddingValues.calculateTopPadding()
7478
val bottomPadding = paddingValues.calculateBottomPadding()

android/app/src/main/java/me/kavishdevar/librepods/screens/AppSettingsScreen.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,15 @@ fun AppSettingsScreen(navController: NavController) {
648648
}
649649
}
650650

651+
Spacer(modifier = Modifier.height(16.dp))
652+
653+
NavigationButton(
654+
to = "open_source_licenses",
655+
name = stringResource(R.string.open_source_licenses),
656+
navController = navController,
657+
independent = true
658+
)
659+
651660
Spacer(modifier = Modifier.height(32.dp))
652661

653662
if (showResetDialog.value) {
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
* LibrePods - AirPods liberated from Apple’s ecosystem
3+
*
4+
* Copyright (C) 2025 LibrePods contributors
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published
8+
* by the Free Software Foundation, either version 3 of the License.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package me.kavishdevar.librepods.screens
20+
21+
import android.annotation.SuppressLint
22+
import androidx.compose.foundation.isSystemInDarkTheme
23+
import androidx.compose.foundation.layout.Arrangement
24+
import androidx.compose.foundation.layout.Column
25+
import androidx.compose.foundation.layout.Spacer
26+
import androidx.compose.foundation.layout.fillMaxSize
27+
import androidx.compose.foundation.layout.height
28+
import androidx.compose.foundation.layout.padding
29+
import androidx.compose.material3.ExperimentalMaterial3Api
30+
import androidx.compose.runtime.Composable
31+
import androidx.compose.runtime.DisposableEffect
32+
import androidx.compose.runtime.LaunchedEffect
33+
import androidx.compose.runtime.mutableFloatStateOf
34+
import androidx.compose.runtime.remember
35+
import androidx.compose.runtime.getValue
36+
import androidx.compose.ui.Modifier
37+
import androidx.compose.ui.res.stringResource
38+
import androidx.compose.ui.unit.dp
39+
import androidx.navigation.NavController
40+
import com.kyant.backdrop.backdrops.layerBackdrop
41+
import com.kyant.backdrop.backdrops.rememberLayerBackdrop
42+
import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
43+
import com.mikepenz.aboutlibraries.ui.compose.produceLibraries
44+
import dev.chrisbanes.haze.materials.ExperimentalHazeMaterialsApi
45+
import kotlinx.coroutines.CoroutineScope
46+
import kotlinx.coroutines.Dispatchers
47+
import kotlinx.coroutines.Job
48+
import kotlinx.coroutines.delay
49+
import kotlinx.coroutines.launch
50+
import me.kavishdevar.librepods.R
51+
import me.kavishdevar.librepods.composables.StyledIconButton
52+
import me.kavishdevar.librepods.composables.StyledScaffold
53+
import me.kavishdevar.librepods.composables.StyledSlider
54+
import me.kavishdevar.librepods.services.ServiceManager
55+
import me.kavishdevar.librepods.utils.AACPManager
56+
import kotlin.io.encoding.ExperimentalEncodingApi
57+
58+
private var debounceJob: Job? = null
59+
60+
@SuppressLint("DefaultLocale")
61+
@ExperimentalHazeMaterialsApi
62+
@OptIn(ExperimentalMaterial3Api::class, ExperimentalEncodingApi::class)
63+
@Composable
64+
fun OpenSourceLicensesScreen(navController: NavController) {
65+
val isDarkTheme = isSystemInDarkTheme()
66+
val backdrop = rememberLayerBackdrop()
67+
68+
StyledScaffold(
69+
title = stringResource(R.string.open_source_licenses),
70+
navigationButton = {
71+
StyledIconButton(
72+
onClick = { navController.popBackStack() },
73+
icon = "􀯶",
74+
darkMode = isDarkTheme,
75+
backdrop = backdrop
76+
)
77+
}
78+
) { spacerHeight ->
79+
Column(
80+
modifier = Modifier
81+
.fillMaxSize()
82+
.layerBackdrop(backdrop)
83+
.padding(horizontal = 16.dp),
84+
verticalArrangement = Arrangement.spacedBy(16.dp)
85+
) {
86+
Spacer(modifier = Modifier.height(spacerHeight))
87+
val context = androidx.compose.ui.platform.LocalContext.current
88+
val libraries by produceLibraries {
89+
context.resources.openRawResource(R.raw.aboutlibraries)
90+
.bufferedReader()
91+
.use { it.readText() }
92+
}
93+
LibrariesContainer(
94+
libraries = libraries,
95+
modifier = Modifier
96+
.padding(0.dp)
97+
.fillMaxSize()
98+
)
99+
}
100+
}
101+
}

android/app/src/main/java/me/kavishdevar/librepods/utils/MediaController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ object MediaController {
196196
}
197197
}
198198

199-
lastKnownIsMusicActive = isActive
199+
lastKnownIsMusicActive = hasNewMusicOrMovie && isActive
200200
}
201201
}
202202

0 commit comments

Comments
 (0)