Skip to content

Commit 4bbaa29

Browse files
committed
android: update dialog and add app info to incompatible page
1 parent 95cd677 commit 4bbaa29

7 files changed

Lines changed: 330 additions & 328 deletions

File tree

.github/workflows/ci-android.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ jobs:
8787

8888
steps:
8989
- uses: actions/checkout@v4
90-
90+
with:
91+
fetch-depth: 0
92+
fetch-tags: true
9193
- uses: actions/download-artifact@v4
9294
with:
9395
name: apk-release

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

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ import dev.chrisbanes.haze.materials.ExperimentalHazeMaterialsApi
121121
import dev.chrisbanes.haze.rememberHazeState
122122
import me.kavishdevar.librepods.data.AirPodsNotifications
123123
import me.kavishdevar.librepods.data.ControlCommandRepository
124+
import me.kavishdevar.librepods.presentation.components.AppInfoCard
124125
import me.kavishdevar.librepods.presentation.components.ConfirmationDialog
125126
import me.kavishdevar.librepods.presentation.components.DeviceInfoCard
126127
import me.kavishdevar.librepods.presentation.components.SelectItem
@@ -249,27 +250,25 @@ fun Main() {
249250
verticalArrangement = Arrangement
250251
.spacedBy(16.dp)
251252
) {
252-
val innerBackdrop = rememberLayerBackdrop()
253253
Spacer(modifier = Modifier.height(48.dp))
254254
Column(
255-
modifier = Modifier.layerBackdrop(innerBackdrop),
255+
modifier = Modifier,
256256
verticalArrangement = Arrangement
257257
.spacedBy(16.dp)
258258
) {
259+
Spacer(modifier = Modifier.height(16.dp))
259260
Text(
260261
text = stringResource(R.string.not_supported),
261262
style = TextStyle(
262263
fontFamily = FontFamily(Font(R.font.sf_pro)),
263264
fontWeight = FontWeight.SemiBold,
264265
color = textColor,
265-
fontSize = 20.sp,
266+
fontSize = 28.sp,
266267
textAlign = TextAlign.Center
267268
),
268269
modifier = Modifier.fillMaxWidth()
269270
)
270271

271-
DeviceInfoCard()
272-
273272
Box(
274273
modifier = Modifier
275274
.fillMaxWidth()
@@ -281,30 +280,35 @@ fun Main() {
281280
style = TextStyle(
282281
fontFamily = FontFamily(Font(R.font.sf_pro)),
283282
fontWeight = FontWeight.Medium,
284-
color = if (isSystemInDarkTheme()) Color.White else Color.Black,
283+
color = if (isDarkTheme) Color.White else Color.Black,
285284
fontSize = 16.sp
286285
),
287286
modifier = Modifier
288287
.fillMaxWidth()
289288
.padding(horizontal = 12.dp, vertical = 16.dp)
290289
)
291290
}
292-
}
293-
StyledButton(
294-
onClick = { showDialog.value = true },
295-
backdrop = innerBackdrop,
296-
modifier = Modifier
297-
.fillMaxWidth()
298-
) {
299-
Text(
300-
text = stringResource(R.string.bypass_compatibility_check),
301-
style = TextStyle(
302-
fontFamily = FontFamily(Font(R.font.sf_pro)),
303-
fontWeight = FontWeight.Medium,
304-
color = if (isSystemInDarkTheme()) Color.White else Color.Black,
305-
fontSize = 16.sp
306-
),
307-
)
291+
StyledButton(
292+
onClick = { showDialog.value = true },
293+
backdrop = rememberLayerBackdrop(),
294+
modifier = Modifier
295+
.fillMaxWidth(),
296+
isInteractive = false,
297+
surfaceColor = if (isDarkTheme) Color(0xFF862424) else Color(0xFFC94646)
298+
) {
299+
Text(
300+
text = stringResource(R.string.bypass_compatibility_check),
301+
style = TextStyle(
302+
fontFamily = FontFamily(Font(R.font.sf_pro)),
303+
fontWeight = FontWeight.Medium,
304+
color = Color.White,
305+
fontSize = 16.sp
306+
),
307+
)
308+
}
309+
Spacer(modifier = Modifier.height(24.dp))
310+
DeviceInfoCard()
311+
AppInfoCard()
308312
}
309313
Spacer(modifier = Modifier.height(48.dp))
310314
}
@@ -332,7 +336,8 @@ fun Main() {
332336
onDismiss = {
333337
showDialog.value = false
334338
},
335-
hazeState = hazeState
339+
backdrop = backdrop
340+
// hazeState = hazeState
336341
)
337342

338343
if (BuildConfig.PLAY_BUILD) {
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
/*
2+
LibrePods - AirPods liberated from Apple’s ecosystem
3+
Copyright (C) 2025 LibrePods contributors
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
any later version.
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 General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package me.kavishdevar.librepods.presentation.components
20+
21+
import androidx.compose.foundation.background
22+
import androidx.compose.foundation.isSystemInDarkTheme
23+
import androidx.compose.foundation.layout.Arrangement
24+
import androidx.compose.foundation.layout.Box
25+
import androidx.compose.foundation.layout.Column
26+
import androidx.compose.foundation.layout.Row
27+
import androidx.compose.foundation.layout.fillMaxWidth
28+
import androidx.compose.foundation.layout.padding
29+
import androidx.compose.foundation.shape.RoundedCornerShape
30+
import androidx.compose.material3.HorizontalDivider
31+
import androidx.compose.material3.Text
32+
import androidx.compose.runtime.Composable
33+
import androidx.compose.runtime.mutableStateOf
34+
import androidx.compose.runtime.remember
35+
import androidx.compose.ui.Modifier
36+
import androidx.compose.ui.draw.clip
37+
import androidx.compose.ui.graphics.Color
38+
import androidx.compose.ui.layout.onGloballyPositioned
39+
import androidx.compose.ui.platform.LocalDensity
40+
import androidx.compose.ui.res.stringResource
41+
import androidx.compose.ui.text.TextStyle
42+
import androidx.compose.ui.text.font.Font
43+
import androidx.compose.ui.text.font.FontFamily
44+
import androidx.compose.ui.text.font.FontWeight
45+
import androidx.compose.ui.unit.dp
46+
import androidx.compose.ui.unit.sp
47+
import me.kavishdevar.librepods.BuildConfig
48+
import me.kavishdevar.librepods.R
49+
50+
@Composable
51+
fun AppInfoCard() {
52+
val rowHeight = remember { mutableStateOf(0.dp) }
53+
val density = LocalDensity.current
54+
val isDarkTheme = isSystemInDarkTheme()
55+
val backgroundColor = if (isDarkTheme) Color(0xFF1C1C1E) else Color(0xFFFFFFFF)
56+
val textColor = if (isDarkTheme) Color.White else Color.Black
57+
58+
Column {
59+
Box(
60+
modifier = Modifier
61+
.background(if (isDarkTheme) Color.Black else Color(0xFFF2F2F7))
62+
.padding(start = 16.dp, bottom = 8.dp, end = 4.dp)
63+
) {
64+
Text(
65+
text = stringResource(R.string.about), style = TextStyle(
66+
fontSize = 14.sp,
67+
fontWeight = FontWeight.Bold,
68+
color = textColor.copy(alpha = 0.6f),
69+
fontFamily = FontFamily(Font(R.font.sf_pro))
70+
)
71+
)
72+
}
73+
74+
Column(
75+
modifier = Modifier
76+
.clip(RoundedCornerShape(28.dp))
77+
.fillMaxWidth()
78+
.background(backgroundColor, RoundedCornerShape(28.dp))
79+
) {
80+
Row(
81+
modifier = Modifier
82+
.fillMaxWidth()
83+
.padding(16.dp)
84+
.onGloballyPositioned { coordinates ->
85+
rowHeight.value = with(density) { coordinates.size.height.toDp() }
86+
},
87+
horizontalArrangement = Arrangement.SpaceBetween,
88+
) {
89+
Text(
90+
text = stringResource(R.string.version), style = TextStyle(
91+
fontSize = 16.sp,
92+
color = textColor,
93+
fontFamily = FontFamily(Font(R.font.sf_pro))
94+
)
95+
)
96+
Text(
97+
text = BuildConfig.VERSION_NAME, style = TextStyle(
98+
fontSize = 16.sp,
99+
color = if (isDarkTheme) Color.White.copy(alpha = 0.6f) else Color.Black.copy(
100+
alpha = 0.8f
101+
),
102+
fontFamily = FontFamily(Font(R.font.sf_pro))
103+
)
104+
)
105+
}
106+
HorizontalDivider(
107+
thickness = 1.dp,
108+
color = Color(0x40888888),
109+
modifier = Modifier.padding(horizontal = 12.dp)
110+
)
111+
Row(
112+
modifier = Modifier
113+
.fillMaxWidth()
114+
.padding(16.dp),
115+
horizontalArrangement = Arrangement.SpaceBetween,
116+
) {
117+
Text(
118+
text = stringResource(R.string.version_code), style = TextStyle(
119+
fontSize = 16.sp,
120+
color = textColor,
121+
fontFamily = FontFamily(Font(R.font.sf_pro))
122+
)
123+
)
124+
Text(
125+
text = BuildConfig.VERSION_CODE.toString(), style = TextStyle(
126+
fontSize = 16.sp,
127+
color = if (isDarkTheme) Color.White.copy(alpha = 0.6f) else Color.Black.copy(
128+
alpha = 0.8f
129+
),
130+
fontFamily = FontFamily(Font(R.font.sf_pro))
131+
)
132+
)
133+
}
134+
HorizontalDivider(
135+
thickness = 1.dp,
136+
color = Color(0x40888888),
137+
modifier = Modifier.padding(horizontal = 12.dp)
138+
)
139+
Row(
140+
modifier = Modifier
141+
.fillMaxWidth()
142+
.padding(16.dp),
143+
horizontalArrangement = Arrangement.SpaceBetween,
144+
) {
145+
Text(
146+
text = stringResource(R.string.flavor), style = TextStyle(
147+
fontSize = 16.sp,
148+
color = textColor,
149+
fontFamily = FontFamily(Font(R.font.sf_pro))
150+
)
151+
)
152+
Text(
153+
text = BuildConfig.FLAVOR, style = TextStyle(
154+
fontSize = 16.sp,
155+
color = if (isDarkTheme) Color.White.copy(alpha = 0.6f) else Color.Black.copy(
156+
alpha = 0.8f
157+
),
158+
fontFamily = FontFamily(Font(R.font.sf_pro))
159+
)
160+
)
161+
}
162+
HorizontalDivider(
163+
thickness = 1.dp,
164+
color = Color(0x40888888),
165+
modifier = Modifier.padding(horizontal = 12.dp)
166+
)
167+
Row(
168+
modifier = Modifier
169+
.fillMaxWidth()
170+
.padding(16.dp),
171+
horizontalArrangement = Arrangement.SpaceBetween,
172+
) {
173+
Text(
174+
text = stringResource(R.string.build_type), style = TextStyle(
175+
fontSize = 16.sp,
176+
color = textColor,
177+
fontFamily = FontFamily(Font(R.font.sf_pro))
178+
)
179+
)
180+
Text(
181+
text = BuildConfig.BUILD_TYPE,
182+
style = TextStyle(
183+
fontSize = 16.sp,
184+
color = if (isDarkTheme) Color.White.copy(alpha = 0.6f) else Color.Black.copy(
185+
alpha = 0.8f
186+
),
187+
fontFamily = FontFamily(Font(R.font.sf_pro))
188+
)
189+
)
190+
}
191+
}
192+
}
193+
}

0 commit comments

Comments
 (0)