~repos /only-bible-app
git clone
https://pyrossh.dev/repos/only-bible-app.git
Discussions:
https://groups.google.com/g/rust-embed-devs
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
b3f2b94b
—
Peter John 1 year ago
fix popup menubar size
app/src/main/java/dev/pyrossh/onlyBible/ChapterScreen.kt
CHANGED
|
@@ -2,41 +2,28 @@ package dev.pyrossh.onlyBible
|
|
|
2
2
|
|
|
3
3
|
import android.os.Parcelable
|
|
4
4
|
import androidx.compose.animation.AnimatedContentTransitionScope
|
|
5
|
-
import androidx.compose.animation.AnimatedVisibility
|
|
6
|
-
import androidx.compose.animation.slideInVertically
|
|
7
|
-
import androidx.compose.animation.slideOutVertically
|
|
8
5
|
import androidx.compose.foundation.gestures.detectDragGestures
|
|
9
6
|
import androidx.compose.foundation.layout.Arrangement
|
|
10
7
|
import androidx.compose.foundation.layout.PaddingValues
|
|
11
8
|
import androidx.compose.foundation.layout.Row
|
|
12
|
-
import androidx.compose.foundation.layout.WindowInsets
|
|
13
|
-
import androidx.compose.foundation.layout.asPaddingValues
|
|
14
9
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
15
10
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
16
11
|
import androidx.compose.foundation.layout.height
|
|
17
|
-
import androidx.compose.foundation.layout.navigationBars
|
|
18
12
|
import androidx.compose.foundation.layout.padding
|
|
19
|
-
import androidx.compose.foundation.layout.size
|
|
20
13
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
21
14
|
import androidx.compose.foundation.lazy.LazyListState
|
|
22
15
|
import androidx.compose.foundation.lazy.items
|
|
23
16
|
import androidx.compose.material.icons.Icons
|
|
24
|
-
import androidx.compose.material.icons.outlined.Cancel
|
|
25
17
|
import androidx.compose.material.icons.outlined.MoreVert
|
|
26
|
-
import androidx.compose.material.icons.outlined.PauseCircle
|
|
27
|
-
import androidx.compose.material.icons.outlined.PlayCircle
|
|
28
|
-
import androidx.compose.material.icons.outlined.Share
|
|
29
18
|
import androidx.compose.material.icons.rounded.Close
|
|
30
19
|
import androidx.compose.material.icons.rounded.Search
|
|
31
20
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
32
|
-
import androidx.compose.material3.HorizontalDivider
|
|
33
21
|
import androidx.compose.material3.Icon
|
|
34
22
|
import androidx.compose.material3.IconButton
|
|
35
23
|
import androidx.compose.material3.MaterialTheme
|
|
36
24
|
import androidx.compose.material3.ProvideTextStyle
|
|
37
25
|
import androidx.compose.material3.Scaffold
|
|
38
26
|
import androidx.compose.material3.SearchBar
|
|
39
|
-
import androidx.compose.material3.Surface
|
|
40
27
|
import androidx.compose.material3.Text
|
|
41
28
|
import androidx.compose.material3.TextButton
|
|
42
29
|
import androidx.compose.material3.TopAppBar
|
|
@@ -52,24 +39,19 @@ import androidx.compose.runtime.remember
|
|
|
52
39
|
import androidx.compose.runtime.rememberCoroutineScope
|
|
53
40
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
54
41
|
import androidx.compose.runtime.setValue
|
|
55
|
-
import androidx.compose.ui.Alignment
|
|
56
42
|
import androidx.compose.ui.Modifier
|
|
57
43
|
import androidx.compose.ui.focus.FocusRequester
|
|
58
44
|
import androidx.compose.ui.focus.focusRequester
|
|
59
|
-
import androidx.compose.ui.graphics.Color
|
|
60
45
|
import androidx.compose.ui.input.pointer.PointerInputScope
|
|
61
46
|
import androidx.compose.ui.input.pointer.pointerInput
|
|
62
47
|
import androidx.compose.ui.platform.LocalContext
|
|
63
|
-
import androidx.compose.ui.platform.LocalDensity
|
|
64
48
|
import androidx.compose.ui.text.TextStyle
|
|
65
49
|
import androidx.compose.ui.text.font.FontWeight
|
|
66
50
|
import androidx.compose.ui.unit.dp
|
|
67
51
|
import androidx.compose.ui.unit.sp
|
|
68
52
|
import dev.pyrossh.onlyBible.composables.VerseView
|
|
69
53
|
import dev.pyrossh.onlyBible.domain.Verse
|
|
70
|
-
import kotlinx.coroutines.Dispatchers
|
|
71
54
|
import kotlinx.coroutines.Job
|
|
72
|
-
import kotlinx.coroutines.launch
|
|
73
55
|
import kotlinx.parcelize.Parcelize
|
|
74
56
|
import kotlinx.serialization.Serializable
|
|
75
57
|
import kotlin.math.abs
|
|
@@ -340,82 +322,6 @@ fun ChapterScreen(
|
|
|
340
322
|
},
|
|
341
323
|
)
|
|
342
324
|
},
|
|
343
|
-
bottomBar = {
|
|
344
|
-
val bottomOffset = WindowInsets.navigationBars.getBottom(LocalDensity.current)
|
|
345
|
-
val bottomPadding =
|
|
346
|
-
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
|
|
347
|
-
AnimatedVisibility(
|
|
348
|
-
modifier = Modifier
|
|
349
|
-
.height(104.dp)
|
|
350
|
-
.padding(bottom = bottomPadding),
|
|
351
|
-
visible = false,
|
|
352
|
-
enter = slideInVertically(initialOffsetY = { it / 2 + bottomOffset }),
|
|
353
|
-
exit = slideOutVertically(targetOffsetY = { it / 2 + bottomOffset }),
|
|
354
|
-
) {
|
|
355
|
-
Surface(
|
|
356
|
-
modifier = Modifier,
|
|
357
|
-
color = Color.Transparent,
|
|
358
|
-
// contentColor = MaterialTheme.colorScheme.primary,
|
|
359
|
-
) {
|
|
360
|
-
HorizontalDivider(
|
|
361
|
-
color = MaterialTheme.colorScheme.outline,
|
|
362
|
-
modifier = Modifier
|
|
363
|
-
.height(1.dp)
|
|
364
|
-
.padding(bottom = 12.dp)
|
|
365
|
-
.fillMaxWidth()
|
|
366
|
-
)
|
|
367
|
-
Row(
|
|
368
|
-
modifier = Modifier
|
|
369
|
-
.fillMaxSize(),
|
|
370
|
-
horizontalArrangement = Arrangement.SpaceAround,
|
|
371
|
-
verticalAlignment = Alignment.CenterVertically,
|
|
372
|
-
) {
|
|
373
|
-
IconButton(onClick = {
|
|
374
|
-
selectedVerses = listOf()
|
|
375
|
-
}) {
|
|
376
|
-
Icon(
|
|
377
|
-
modifier = Modifier.size(36.dp),
|
|
378
|
-
imageVector = Icons.Outlined.Cancel,
|
|
379
|
-
contentDescription = "Clear",
|
|
380
|
-
)
|
|
381
|
-
}
|
|
382
|
-
IconButton(onClick = {
|
|
383
|
-
if (isPlaying) {
|
|
384
|
-
model.speechService.StopSpeakingAsync()
|
|
385
|
-
} else {
|
|
386
|
-
scope.launch(Dispatchers.IO) {
|
|
387
|
-
for (v in selectedVerses.sortedBy { it.verseIndex }) {
|
|
388
|
-
model.speechService.StartSpeakingSsml(
|
|
389
|
-
v.toSSML(context.getString(R.string.voice)),
|
|
390
|
-
)
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}) {
|
|
395
|
-
Icon(
|
|
396
|
-
modifier = Modifier.size(36.dp),
|
|
397
|
-
imageVector = if (isPlaying)
|
|
398
|
-
Icons.Outlined.PauseCircle
|
|
399
|
-
else
|
|
400
|
-
Icons.Outlined.PlayCircle,
|
|
401
|
-
contentDescription = "Audio",
|
|
402
|
-
)
|
|
403
|
-
}
|
|
404
|
-
IconButton(onClick = {
|
|
405
|
-
shareVerses(
|
|
406
|
-
context,
|
|
407
|
-
selectedVerses.sortedBy { it.verseIndex })
|
|
408
|
-
}) {
|
|
409
|
-
Icon(
|
|
410
|
-
modifier = Modifier.size(32.dp),
|
|
411
|
-
imageVector = Icons.Outlined.Share,
|
|
412
|
-
contentDescription = "Share",
|
|
413
|
-
)
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
325
|
) { innerPadding ->
|
|
420
326
|
LazyColumn(
|
|
421
327
|
state = rememberSaveable(saver = LazyListState.Saver) {
|
app/src/main/java/dev/pyrossh/onlyBible/composables/VerseView.kt
CHANGED
|
@@ -167,13 +167,18 @@ fun VerseView(
|
|
|
167
167
|
Surface(
|
|
168
168
|
modifier = Modifier
|
|
169
169
|
.width(300.dp)
|
|
170
|
-
.height(
|
|
170
|
+
.height(56.dp)
|
|
171
171
|
.border(
|
|
172
172
|
width = 1.dp,
|
|
173
173
|
color = MaterialTheme.colorScheme.outline,
|
|
174
|
-
shape = RoundedCornerShape(
|
|
174
|
+
shape = RoundedCornerShape(4.dp)
|
|
175
175
|
)
|
|
176
|
+
.shadow(
|
|
177
|
+
elevation = 2.dp,
|
|
178
|
+
spotColor = MaterialTheme.colorScheme.outline,
|
|
179
|
+
ambientColor = MaterialTheme.colorScheme.outline,
|
|
176
|
-
|
|
180
|
+
shape = RoundedCornerShape(4.dp)
|
|
181
|
+
),
|
|
177
182
|
) {
|
|
178
183
|
Row(
|
|
179
184
|
modifier = Modifier
|