Skip to content

Commit 6a8b30f

Browse files
committed
Fix release workflow
1 parent 9b03130 commit 6a8b30f

4 files changed

Lines changed: 32 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: ./gradlew :app:assembleRelease
2828

2929
- name: Sign APK (if secrets are configured)
30-
if: ${{ secrets.SIGNING_KEY != '' }}
30+
continue-on-error: true
3131
uses: r0adkll/sign-android-release@v1
3232
id: sign_app
3333
with:
@@ -40,12 +40,12 @@ jobs:
4040
BUILD_TOOLS_VERSION: "34.0.0"
4141

4242
- name: Rename signed APK
43-
if: ${{ secrets.SIGNING_KEY != '' }}
43+
if: steps.sign_app.outcome == 'success'
4444
run: |
4545
mv ${{steps.sign_app.outputs.signedReleaseFile}} klokk-android.apk
4646
4747
- name: Rename unsigned APK
48-
if: ${{ secrets.SIGNING_KEY == '' }}
48+
if: steps.sign_app.outcome != 'success'
4949
run: |
5050
mv app/build/outputs/apk/release/app-release-unsigned.apk klokk-android.apk
5151

app/src/main/kotlin/com/theapache64/klokk/MainActivity.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.theapache64.klokk
22

3+
import android.app.UiModeManager
4+
import android.content.res.Configuration
35
import android.os.Build
46
import android.os.Bundle
57
import android.view.View
@@ -20,6 +22,10 @@ class MainActivity : ComponentActivity() {
2022
override fun onCreate(savedInstanceState: Bundle?) {
2123
super.onCreate(savedInstanceState)
2224

25+
// Detect if running on Android TV
26+
val uiModeManager = getSystemService(UI_MODE_SERVICE) as UiModeManager
27+
val isTvMode = uiModeManager.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
28+
2329
// Enable edge-to-edge display
2430
WindowCompat.setDecorFitsSystemWindows(window, false)
2531

@@ -31,6 +37,7 @@ class MainActivity : ComponentActivity() {
3137

3238
setContent {
3339
MainScreen(
40+
isTvMode = isTvMode,
3441
onControlsVisibilityChanged = { visible ->
3542
areControlsVisible = visible
3643
updateSystemUiVisibility(visible)

shared/src/commonMain/kotlin/com/theapache64/klokk/MainScreen.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const val TOOLBAR_HEIGHT = 60
3939
@OptIn(ExperimentalFoundationApi::class)
4040
@Composable
4141
fun MainScreen(
42+
isTvMode: Boolean = false,
4243
onControlsVisibilityChanged: (Boolean) -> Unit = {},
4344
onShowControlsHandler: ((showControls: () -> Unit) -> Unit) = {}
4445
) {
@@ -188,6 +189,7 @@ fun MainScreen(
188189
// Show toolbar only when controls are visible
189190
if (areControlsVisible) {
190191
BottomToolBar(
192+
isTvMode = isTvMode,
191193
activeMovement = activeMovement,
192194
isAnimPlaying = shouldPlayAutoAnim,
193195

shared/src/commonMain/kotlin/com/theapache64/klokk/composable/BottomToolBar.kt

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import com.theapache64.klokk.movement.core.Movement
3838

3939
@Composable
4040
fun BottomToolBar(
41+
isTvMode: Boolean = false,
4142
activeMovement: Movement, // to show debug info
4243
isAnimPlaying: Boolean,
4344
textInput: String,
@@ -74,7 +75,8 @@ fun BottomToolBar(
7475
IconTextButton(
7576
text = "START AUTOPLAY",
7677
imageVector = Icons.Outlined.PlayArrow,
77-
onClicked = onPlayClicked
78+
onClicked = onPlayClicked,
79+
isTvMode = isTvMode
7880
)
7981
}
8082

@@ -83,7 +85,8 @@ fun BottomToolBar(
8385
IconTextButton(
8486
text = "STOP AUTOPLAY",
8587
imageVector = Icons.Outlined.Stop,
86-
onClicked = onStopClicked
88+
onClicked = onStopClicked,
89+
isTvMode = isTvMode
8790
)
8891
}
8992

@@ -93,15 +96,17 @@ fun BottomToolBar(
9396
text = "SHOW TIME",
9497
imageVector = Icons.Outlined.Update,
9598
onClicked = onShowTimeClicked,
96-
focusRequester = showTimeFocusRequester
99+
focusRequester = showTimeFocusRequester,
100+
isTvMode = isTvMode
97101
)
98102
}
99103

100104
// Immersive Mode Button
101105
IconTextButton(
102106
text = "HIDE CONTROLS",
103107
imageVector = Icons.Outlined.Fullscreen,
104-
onClicked = onHideControlsClicked
108+
onClicked = onHideControlsClicked,
109+
isTvMode = isTvMode
105110
)
106111

107112
Row(
@@ -137,10 +142,14 @@ private fun IconTextButton(
137142
text: String,
138143
imageVector: ImageVector,
139144
onClicked: () -> Unit,
145+
isTvMode: Boolean = false,
140146
focusRequester: FocusRequester? = null,
141147
) {
142148
var isFocused by remember { mutableStateOf(false) }
143149

150+
// Show focus highlighting only on TV
151+
val showFocusHighlight = isTvMode && isFocused
152+
144153
Box(
145154
modifier = Modifier
146155
.then(
@@ -154,34 +163,34 @@ private fun IconTextButton(
154163
isFocused = focusState.isFocused
155164
}
156165
.border(
157-
width = if (isFocused) 2.dp else 0.dp,
158-
color = if (isFocused) Color(0xFFFFD700) else Color.Transparent,
166+
width = if (showFocusHighlight) 2.dp else 0.dp,
167+
color = if (showFocusHighlight) Color(0xFFFFD700) else Color.Transparent,
159168
shape = RoundedCornerShape(4.dp)
160169
)
161-
.padding(if (isFocused) 2.dp else 0.dp)
170+
.padding(if (showFocusHighlight) 2.dp else 0.dp)
162171
) {
163172
OutlinedButton(
164173
onClick = onClicked,
165174
modifier = Modifier.focusable(),
166175
border = BorderStroke(
167176
width = 1.dp,
168-
color = if (isFocused) Color(0xFFFFD700) else Color.Gray
177+
color = if (showFocusHighlight) Color(0xFFFFD700) else Color.Gray
169178
),
170179
colors = ButtonDefaults.outlinedButtonColors(
171-
backgroundColor = if (isFocused) Color(0xFFFFD700).copy(alpha = 0.2f) else Color.Transparent
180+
backgroundColor = if (showFocusHighlight) Color(0xFFFFD700).copy(alpha = 0.2f) else Color.Transparent
172181
)
173182
) {
174183

175184
Icon(
176185
imageVector = imageVector,
177-
tint = if (isFocused) Color(0xFFFFD700) else Color.White,
186+
tint = if (showFocusHighlight) Color(0xFFFFD700) else Color.White,
178187
contentDescription = "ToolBar Icon",
179188
modifier = Modifier.padding(end = 10.dp)
180189
)
181190

182191
Text(
183192
text = text,
184-
color = if (isFocused) Color(0xFFFFD700) else Color.White
193+
color = if (showFocusHighlight) Color(0xFFFFD700) else Color.White
185194
)
186195
}
187196
}

0 commit comments

Comments
 (0)