Skip to content

Commit

Permalink
Update version text using TextButton
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcoding810 committed Dec 5, 2024
1 parent 57ba6f6 commit 5654a46
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/src/main/java/com/paulcoding/hviewer/ui/component/H7Tap.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.paulcoding.hviewer.ui.component

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
Expand All @@ -19,9 +18,8 @@ import com.paulcoding.hviewer.helper.makeToast
fun H7Tap(modifier: Modifier = Modifier, onDevModeChange: (Boolean) -> Unit) {
var tapCount by remember { mutableIntStateOf(0) }
var lastTapTime by remember { mutableLongStateOf(0L) }
Box(modifier = modifier
.padding(16.dp)
.clickable {
TextButton(
onClick = {
val current = System.currentTimeMillis()
if (current - lastTapTime > 2000) {
tapCount = 1
Expand All @@ -34,8 +32,9 @@ fun H7Tap(modifier: Modifier = Modifier, onDevModeChange: (Boolean) -> Unit) {
}
}
lastTapTime = current

}) {
}, modifier = modifier
.padding(16.dp)
) {
Text("Version ${BuildConfig.VERSION_NAME}")
}
}

0 comments on commit 5654a46

Please sign in to comment.