~repos /only-bible-app
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.
1eb80acd
—
pyrossh 1 year ago
simplify EmbeddedSearchBar
app/src/main/java/dev/pyrossh/onlyBible/ChapterScreen.kt
CHANGED
|
@@ -120,12 +120,9 @@ fun ChapterScreen(
|
|
|
120
120
|
val view = LocalView.current
|
|
121
121
|
val verses by model.verses.collectAsState()
|
|
122
122
|
val bookNames by model.bookNames.collectAsState()
|
|
123
|
-
val searchText by model.searchText.collectAsState()
|
|
124
123
|
val isSearching by model.isSearching.collectAsState()
|
|
125
|
-
val versesList by model.versesList.collectAsState()
|
|
126
124
|
var chapterSelectorShown by remember { mutableStateOf(false) }
|
|
127
125
|
var bibleSelectorShown by remember { mutableStateOf(false) }
|
|
128
|
-
val fontSizeDelta = model.fontSizeDelta
|
|
129
126
|
val headingColor = MaterialTheme.colorScheme.onSurface // MaterialTheme.colorScheme.primary,
|
|
130
127
|
val chapterVerses =
|
|
131
128
|
verses.filter { it.bookIndex == bookIndex && it.chapterIndex == chapterIndex }
|
|
@@ -153,39 +150,8 @@ fun ChapterScreen(
|
|
|
153
150
|
}
|
|
154
151
|
if (isSearching) {
|
|
155
152
|
EmbeddedSearchBar(
|
|
156
|
-
query = searchText,
|
|
157
|
-
onQueryChange = model::onSearchTextChange,
|
|
158
|
-
onSearch = model::onSearchTextChange,
|
|
159
|
-
onClose = { model.onCloseSearch() },
|
|
160
|
-
) {
|
|
161
|
-
val groups = versesList.groupBy { "${it.bookName} ${it.chapterIndex + 1}" }
|
|
162
|
-
LazyColumn {
|
|
163
|
-
groups.forEach {
|
|
164
|
-
item(
|
|
165
|
-
contentType = "header"
|
|
166
|
-
) {
|
|
167
|
-
Text(
|
|
168
|
-
modifier = Modifier.padding(
|
|
169
|
-
vertical = 12.dp,
|
|
170
|
-
),
|
|
171
|
-
style = TextStyle(
|
|
172
|
-
fontFamily = model.fontType.family(),
|
|
173
|
-
fontSize = (16 + fontSizeDelta).sp,
|
|
174
|
-
fontWeight = FontWeight.W700,
|
|
175
|
-
color = headingColor,
|
|
176
|
-
),
|
|
177
|
-
|
|
153
|
+
model = model,
|
|
178
|
-
|
|
154
|
+
)
|
|
179
|
-
}
|
|
180
|
-
items(it.value) { v ->
|
|
181
|
-
VerseView(
|
|
182
|
-
model = model,
|
|
183
|
-
verse = v,
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
155
|
}
|
|
190
156
|
|
|
191
157
|
Column(
|
|
@@ -278,7 +244,7 @@ fun ChapterScreen(
|
|
|
278
244
|
),
|
|
279
245
|
style = TextStyle(
|
|
280
246
|
fontFamily = model.fontType.family(),
|
|
281
|
-
fontSize = (16 + fontSizeDelta).sp,
|
|
247
|
+
fontSize = (16 + model.fontSizeDelta).sp,
|
|
282
248
|
fontWeight = FontWeight.W700,
|
|
283
249
|
color = headingColor,
|
|
284
250
|
),
|
app/src/main/java/dev/pyrossh/onlyBible/composables/EmbeddedSearchBar.kt
CHANGED
|
@@ -2,6 +2,8 @@ package dev.pyrossh.onlyBible.composables
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
4
4
|
import androidx.compose.foundation.layout.padding
|
|
5
|
+
import androidx.compose.foundation.lazy.LazyColumn
|
|
6
|
+
import androidx.compose.foundation.lazy.items
|
|
5
7
|
import androidx.compose.material.icons.Icons
|
|
6
8
|
import androidx.compose.material.icons.rounded.Close
|
|
7
9
|
import androidx.compose.material.icons.rounded.Search
|
|
@@ -14,23 +16,25 @@ import androidx.compose.material3.SearchBar
|
|
|
14
16
|
import androidx.compose.material3.Text
|
|
15
17
|
import androidx.compose.runtime.Composable
|
|
16
18
|
import androidx.compose.runtime.SideEffect
|
|
19
|
+
import androidx.compose.runtime.collectAsState
|
|
20
|
+
import androidx.compose.runtime.getValue
|
|
17
21
|
import androidx.compose.runtime.remember
|
|
18
22
|
import androidx.compose.ui.Modifier
|
|
19
23
|
import androidx.compose.ui.focus.FocusRequester
|
|
20
24
|
import androidx.compose.ui.focus.focusRequester
|
|
21
25
|
import androidx.compose.ui.text.TextStyle
|
|
26
|
+
import androidx.compose.ui.text.font.FontWeight
|
|
22
27
|
import androidx.compose.ui.unit.dp
|
|
23
28
|
import androidx.compose.ui.unit.sp
|
|
29
|
+
import dev.pyrossh.onlyBible.AppViewModel
|
|
24
30
|
|
|
25
31
|
@Composable
|
|
26
32
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
27
33
|
fun EmbeddedSearchBar(
|
|
28
|
-
query: String,
|
|
29
|
-
onQueryChange: (String) -> Unit,
|
|
30
|
-
onSearch: ((String) -> Unit),
|
|
31
|
-
|
|
34
|
+
model: AppViewModel,
|
|
32
|
-
content: @Composable () -> Unit
|
|
33
35
|
) {
|
|
36
|
+
val searchText by model.searchText.collectAsState()
|
|
37
|
+
val versesList by model.versesList.collectAsState()
|
|
34
38
|
val textFieldFocusRequester = remember { FocusRequester() }
|
|
35
39
|
SideEffect {
|
|
36
40
|
textFieldFocusRequester.requestFocus()
|
|
@@ -46,9 +50,9 @@ fun EmbeddedSearchBar(
|
|
|
46
50
|
.fillMaxWidth()
|
|
47
51
|
.padding(horizontal = 16.dp)
|
|
48
52
|
.focusRequester(textFieldFocusRequester),
|
|
49
|
-
query =
|
|
53
|
+
query = searchText,
|
|
50
|
-
onQueryChange =
|
|
54
|
+
onQueryChange = model::onSearchTextChange,
|
|
51
|
-
onSearch =
|
|
55
|
+
onSearch = model::onSearchTextChange,
|
|
52
56
|
active = true,
|
|
53
57
|
onActiveChange = {},
|
|
54
58
|
placeholder = {
|
|
@@ -69,7 +73,7 @@ fun EmbeddedSearchBar(
|
|
|
69
73
|
trailingIcon = {
|
|
70
74
|
IconButton(
|
|
71
75
|
onClick = {
|
|
72
|
-
|
|
76
|
+
model.onCloseSearch()
|
|
73
77
|
},
|
|
74
78
|
) {
|
|
75
79
|
Icon(
|
|
@@ -81,7 +85,33 @@ fun EmbeddedSearchBar(
|
|
|
81
85
|
},
|
|
82
86
|
tonalElevation = 0.dp,
|
|
83
87
|
) {
|
|
88
|
+
val groups = versesList.groupBy { "${it.bookName} ${it.chapterIndex + 1}" }
|
|
89
|
+
LazyColumn {
|
|
90
|
+
groups.forEach {
|
|
84
|
-
|
|
91
|
+
item(
|
|
92
|
+
contentType = "header"
|
|
93
|
+
) {
|
|
94
|
+
Text(
|
|
95
|
+
modifier = Modifier.padding(
|
|
96
|
+
vertical = 12.dp,
|
|
97
|
+
),
|
|
98
|
+
style = TextStyle(
|
|
99
|
+
fontFamily = model.fontType.family(),
|
|
100
|
+
fontSize = (16 + model.fontSizeDelta).sp,
|
|
101
|
+
fontWeight = FontWeight.W700,
|
|
102
|
+
color = MaterialTheme.colorScheme.onSurface,
|
|
103
|
+
),
|
|
104
|
+
text = it.key,
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
items(it.value) { v ->
|
|
108
|
+
VerseView(
|
|
109
|
+
model = model,
|
|
110
|
+
verse = v,
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
85
115
|
}
|
|
86
116
|
}
|
|
87
117
|
}
|
readme.md
CHANGED
|
@@ -20,24 +20,16 @@ For emulators,
|
|
|
20
20
|
1. Turn on developer options
|
|
21
21
|
2. Disable HW overlays in those options
|
|
22
22
|
|
|
23
|
-
## Release Process
|
|
24
|
-
* Create file fastlane/metadata/android/en-GB/changelogs/$versionCode.txt and add change details
|
|
25
|
-
|
|
26
|
-
### android
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
flutter build appbundle --release --dart-define-from-file=.env
|
|
30
|
-
fastlane supply --aab ../build/app/outputs/bundle/release/app-release.aab
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
##
|
|
23
|
+
## iOS
|
|
34
24
|
|
|
35
25
|
* Make sure you've added a Distribution certificate to the system keystore and download it and install it
|
|
36
26
|
* Make sure you create an App Store provisioning profile for this certificate and download it and install it
|
|
37
27
|
* Add you Apple Developer Team account in xCode and open ios/Runner.xcworkspace and under Runner Project,
|
|
38
28
|
* Runner Target, Signing Tab, Release Tab, select that provisioning profile and Team and Certificate.
|
|
39
29
|
|
|
40
|
-
|
|
30
|
+
## TODO
|
|
31
|
+
|
|
32
|
+
1. Add search text highlight in each verse in search view
|
|
33
|
+
2. Add goto verse in the search view
|
|
34
|
+
3. Fix Long chapter name (Thessalonians) where menu button shrinks
|
|
41
|
-
|
|
35
|
+
4. Add locales in the resources/localeList or app definition
|
|
42
|
-
fastlane deliver --ipa "../build/ios/ipa/only-bible-app.ipa" --automatic_release --submit_for_review
|
|
43
|
-
```
|