~repos /only-bible-app

#kotlin#android#ios

git clone https://pyrossh.dev/repos/only-bible-app.git

The only bible app you will ever need. No ads. No in-app purchases. No distractions.


13ca1de9 pyrossh

1 year ago
improve selectors
app/src/main/java/dev/pyrossh/onlyBible/composables/BibleSelector.kt CHANGED
@@ -30,6 +30,7 @@ fun BibleSelector(
30
30
  ) {
31
31
  val context = LocalContext.current
32
32
  val height = context.resources.configuration.screenHeightDp.dp / 2
33
+ val bibleList = bibles.sortedBy { it != model.bible }
33
34
  Dialog(onDismissRequest = { onClose() }) {
34
35
  Card(
35
36
  modifier = Modifier
@@ -38,7 +39,7 @@ fun BibleSelector(
38
39
  shape = RoundedCornerShape(8.dp),
39
40
  ) {
40
41
  LazyColumn {
41
- items(bibles) {
42
+ items(bibleList) {
42
43
  val arr = it.split("_")
43
44
  val loc = Locale(arr[0])
44
45
  ListItem(
@@ -49,8 +50,8 @@ fun BibleSelector(
49
50
  context.setLocale(loc)
50
51
  },
51
52
  colors = ListItemDefaults.colors(
52
- containerColor = if (model.bible == it)
53
+ containerColor = if (it == model.bible)
53
- MaterialTheme.colorScheme.outline
54
+ MaterialTheme.colorScheme.primaryContainer
54
55
  else
55
56
  MaterialTheme.colorScheme.background
56
57
  ),
app/src/main/java/dev/pyrossh/onlyBible/composables/ChapterSelector.kt CHANGED
@@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.padding
10
10
  import androidx.compose.foundation.lazy.LazyColumn
11
11
  import androidx.compose.foundation.lazy.grid.GridCells
12
12
  import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
13
+ import androidx.compose.foundation.lazy.items
13
14
  import androidx.compose.foundation.lazy.rememberLazyListState
14
15
  import androidx.compose.foundation.shape.RoundedCornerShape
15
16
  import androidx.compose.material3.ButtonColors
@@ -38,8 +39,9 @@ import androidx.compose.ui.unit.dp
38
39
  import androidx.compose.ui.window.Dialog
39
40
  import dev.pyrossh.onlyBible.AppViewModel
40
41
  import dev.pyrossh.onlyBible.ChapterScreenProps
41
- import dev.pyrossh.onlyBible.domain.BOOKS_COUNT
42
42
  import dev.pyrossh.onlyBible.domain.chapterSizes
43
+ import dev.pyrossh.onlyBible.domain.engTitles
44
+ import dev.pyrossh.onlyBible.getCurrentLocale
43
45
 
44
46
  @OptIn(ExperimentalMaterial3Api::class)
45
47
  @Composable
@@ -54,6 +56,7 @@ fun ChapterSelector(
54
56
  var expanded by remember { mutableStateOf(false) }
55
57
  var bookIndex by remember { mutableIntStateOf(model.bookIndex) }
56
58
  val scrollState = rememberLazyListState()
59
+ val bookList = bookNames - bookNames[bookIndex]
57
60
  LaunchedEffect(key1 = bookIndex) {
58
61
  scrollState.scrollToItem(0, 0)
59
62
  }
@@ -69,6 +72,12 @@ fun ChapterSelector(
69
72
  .clickable {
70
73
  expanded = !expanded
71
74
  },
75
+ colors = ListItemDefaults.colors(
76
+ containerColor = if (expanded)
77
+ MaterialTheme.colorScheme.primaryContainer
78
+ else
79
+ MaterialTheme.colorScheme.background
80
+ ),
72
81
  headlineContent = {
73
82
  Text(
74
83
  modifier = Modifier.padding(start = 4.dp),
@@ -84,25 +93,27 @@ fun ChapterSelector(
84
93
  LazyColumn(
85
94
  state = scrollState,
86
95
  ) {
87
- items(BOOKS_COUNT) {
96
+ items(bookList) {
88
97
  ListItem(
89
98
  modifier = Modifier.clickable {
90
- bookIndex = it
99
+ bookIndex = bookNames.indexOf(it)
91
100
  expanded = false
92
101
  },
93
- colors = ListItemDefaults.colors(
94
- containerColor = if (bookIndex == it)
95
- MaterialTheme.colorScheme.outline
96
- else
97
- MaterialTheme.colorScheme.background
98
- ),
99
102
  headlineContent = {
100
103
  Text(
101
104
  modifier = Modifier.padding(start = 4.dp),
102
105
  fontWeight = FontWeight.W600,
103
- text = bookNames[it],
106
+ text = it,
104
107
  )
105
108
  },
109
+ supportingContent = {
110
+ if (context.getCurrentLocale().language != "en") {
111
+ Text(
112
+ modifier = Modifier.padding(start = 4.dp),
113
+ text = engTitles[bookList.indexOf(it)],
114
+ )
115
+ }
116
+ }
106
117
  )
107
118
  }
108
119
  }
readme.md CHANGED
@@ -16,6 +16,9 @@ Online Audio Playback
16
16
  brew install fastlane
17
17
  ```
18
18
 
19
+ For emulators,
20
+ 1. Turn on developer options
21
+ 2. Disable HW overlays in those options
19
22
 
20
23
  ## Release Process
21
24
  * Create file fastlane/metadata/android/en-GB/changelogs/$versionCode.txt and add change details