~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.
1f786bfe
—
pyrossh 1 year ago
remove locale change
- .idea/other.xml +0 -11
- app/src/main/java/dev/pyrossh/onlyBible/AppViewModel.kt +6 -34
- app/src/main/java/dev/pyrossh/onlyBible/ChapterScreen.kt +113 -115
- app/src/main/java/dev/pyrossh/onlyBible/MainActivity.kt +3 -2
- app/src/main/java/dev/pyrossh/onlyBible/composables/BibleSelector.kt +3 -6
- app/src/main/java/dev/pyrossh/onlyBible/composables/ChapterSelector.kt +2 -3
- app/src/main/java/dev/pyrossh/onlyBible/{TextSettingsBottomSheet.kt → composables/TextSettingsBottomSheet.kt} +4 -2
- app/src/main/java/dev/pyrossh/onlyBible/composables/VerseView.kt +1 -2
- app/src/main/java/dev/pyrossh/onlyBible/domain/Bible.kt +0 -16
- app/src/main/java/dev/pyrossh/onlyBible/domain/Verse.kt +25 -0
- app/src/main/res/values-bn/strings.xml +0 -8
- app/src/main/res/values-gu/strings.xml +0 -8
- app/src/main/res/values-hi/strings.xml +0 -7
- app/src/main/res/values-kn/strings.xml +0 -8
- app/src/main/res/values-ml/strings.xml +0 -8
- app/src/main/res/values-ne/strings.xml +0 -7
- app/src/main/res/values-or/strings.xml +0 -8
- app/src/main/res/values-pa/strings.xml +0 -8
- app/src/main/res/values-ta/strings.xml +0 -8
- app/src/main/res/values-te/strings.xml +0 -8
- app/src/main/res/values/strings.xml +0 -4
.idea/other.xml
CHANGED
|
@@ -182,17 +182,6 @@
|
|
|
182
182
|
<option name="screenX" value="1080" />
|
|
183
183
|
<option name="screenY" value="2400" />
|
|
184
184
|
</PersistentDeviceSelectionData>
|
|
185
|
-
<PersistentDeviceSelectionData>
|
|
186
|
-
<option name="api" value="31" />
|
|
187
|
-
<option name="brand" value="samsung" />
|
|
188
|
-
<option name="codename" value="q2q" />
|
|
189
|
-
<option name="id" value="q2q" />
|
|
190
|
-
<option name="manufacturer" value="Samsung" />
|
|
191
|
-
<option name="name" value="Galaxy Z Fold3" />
|
|
192
|
-
<option name="screenDensity" value="420" />
|
|
193
|
-
<option name="screenX" value="1768" />
|
|
194
|
-
<option name="screenY" value="2208" />
|
|
195
|
-
</PersistentDeviceSelectionData>
|
|
196
185
|
<PersistentDeviceSelectionData>
|
|
197
186
|
<option name="api" value="34" />
|
|
198
187
|
<option name="brand" value="samsung" />
|
app/src/main/java/dev/pyrossh/onlyBible/AppViewModel.kt
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
package dev.pyrossh.onlyBible
|
|
2
2
|
|
|
3
3
|
import android.app.Application
|
|
4
|
-
import android.app.LocaleManager
|
|
5
4
|
import android.app.UiModeManager
|
|
6
5
|
import android.content.Context
|
|
7
6
|
import android.content.Context.MODE_PRIVATE
|
|
8
7
|
import android.content.Context.UI_MODE_SERVICE
|
|
9
8
|
import android.content.Intent
|
|
10
|
-
import android.os.Build
|
|
11
|
-
import android.os.LocaleList
|
|
12
|
-
import androidx.appcompat.app.AppCompatDelegate
|
|
13
9
|
import androidx.compose.foundation.lazy.LazyListState
|
|
14
10
|
import androidx.compose.runtime.getValue
|
|
15
11
|
import androidx.compose.runtime.mutableIntStateOf
|
|
16
12
|
import androidx.compose.runtime.mutableStateOf
|
|
17
13
|
import androidx.compose.runtime.setValue
|
|
18
|
-
import androidx.core.os.LocaleListCompat
|
|
19
14
|
import androidx.lifecycle.AndroidViewModel
|
|
20
15
|
import androidx.lifecycle.viewModelScope
|
|
21
16
|
import com.microsoft.cognitiveservices.speech.SpeechConfig
|
|
@@ -37,7 +32,6 @@ import kotlinx.coroutines.flow.stateIn
|
|
|
37
32
|
import kotlinx.coroutines.launch
|
|
38
33
|
import org.json.JSONObject
|
|
39
34
|
import java.io.IOException
|
|
40
|
-
import java.util.Locale
|
|
41
35
|
|
|
42
36
|
class AppViewModel(application: Application) : AndroidViewModel(application) {
|
|
43
37
|
private val context
|
|
@@ -87,7 +81,7 @@ class AppViewModel(application: Application) : AndroidViewModel(application) {
|
|
|
87
81
|
var showBottomSheet by mutableStateOf(false)
|
|
88
82
|
private val highlightedVerses = MutableStateFlow(JSONObject())
|
|
89
83
|
|
|
90
|
-
var bible by mutableStateOf(
|
|
84
|
+
var bible by mutableStateOf(bibles.first())
|
|
91
85
|
var bookIndex by mutableIntStateOf(0)
|
|
92
86
|
var chapterIndex by mutableIntStateOf(0)
|
|
93
87
|
var fontType by mutableStateOf(FontType.Sans)
|
|
@@ -166,9 +160,10 @@ class AppViewModel(application: Application) : AndroidViewModel(application) {
|
|
|
166
160
|
selectedVerses.value = listOf()
|
|
167
161
|
}
|
|
168
162
|
|
|
169
|
-
fun loadData() {
|
|
163
|
+
private fun loadData() {
|
|
170
164
|
viewModelScope.launch(Dispatchers.IO) {
|
|
171
|
-
|
|
165
|
+
val bibleFileName = prefs.getString("bible", "en_kjv") ?: "en_kjv"
|
|
166
|
+
bible = bibles.find { it.filename() == bibleFileName } ?: bibles.first()
|
|
172
167
|
bookIndex = prefs.getInt("bookIndex", 0)
|
|
173
168
|
chapterIndex = prefs.getInt("chapterIndex", 0)
|
|
174
169
|
fontType =
|
|
@@ -191,7 +186,7 @@ class AppViewModel(application: Application) : AndroidViewModel(application) {
|
|
|
191
186
|
fun loadBible() {
|
|
192
187
|
try {
|
|
193
188
|
val buffer =
|
|
194
|
-
context.assets.open("bibles/${bible}.txt").bufferedReader()
|
|
189
|
+
context.assets.open("bibles/${bible.filename()}.txt").bufferedReader()
|
|
195
190
|
val localVerses = buffer.readLines().filter { it.isNotEmpty() }.map {
|
|
196
191
|
val arr = it.split("|")
|
|
197
192
|
val bookName = arr[0]
|
|
@@ -221,7 +216,7 @@ class AppViewModel(application: Application) : AndroidViewModel(application) {
|
|
|
221
216
|
fun saveData() {
|
|
222
217
|
viewModelScope.launch(Dispatchers.IO) {
|
|
223
218
|
with(prefs.edit()) {
|
|
224
|
-
putString("bible", bible)
|
|
219
|
+
putString("bible", bible.filename())
|
|
225
220
|
putInt("bookIndex", bookIndex)
|
|
226
221
|
putInt("chapterIndex", chapterIndex)
|
|
227
222
|
putString("fontType", fontType.name)
|
|
@@ -263,10 +258,6 @@ class AppViewModel(application: Application) : AndroidViewModel(application) {
|
|
|
263
258
|
scrollState = LazyListState(0, 0)
|
|
264
259
|
}
|
|
265
260
|
|
|
266
|
-
fun getBibleName(): String {
|
|
267
|
-
return bible.split("_").last().uppercase()
|
|
268
|
-
}
|
|
269
|
-
|
|
270
261
|
fun getHighlightForVerse(v: Verse): Int? {
|
|
271
262
|
if (highlightedVerses.value.has(v.key()))
|
|
272
263
|
return highlightedVerses.value.getInt(v.key())
|
|
@@ -307,23 +298,4 @@ fun shareVerses(context: Context, verses: List<Verse>) {
|
|
|
307
298
|
}
|
|
308
299
|
val shareIntent = Intent.createChooser(sendIntent, null)
|
|
309
300
|
context.startActivity(shareIntent)
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
fun Context.getCurrentLocale(): Locale {
|
|
313
|
-
return if (Build.VERSION.SDK_INT >= 33) {
|
|
314
|
-
resources.configuration.locales.get(0)
|
|
315
|
-
} else {
|
|
316
|
-
AppCompatDelegate.getApplicationLocales().get(0) ?: Locale("en")
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
fun Context.setLocale(loc: Locale) {
|
|
321
|
-
if (Build.VERSION.SDK_INT >= 33) {
|
|
322
|
-
val localeManager = getSystemService(LocaleManager::class.java)
|
|
323
|
-
localeManager.applicationLocales = LocaleList(loc)
|
|
324
|
-
} else {
|
|
325
|
-
val locales = (listOf(loc) + bibles.map { Locale(it.split("_")[0]) })
|
|
326
|
-
.joinToString(separator = ",") { it.language }
|
|
327
|
-
AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(locales))
|
|
328
|
-
}
|
|
329
301
|
}
|
app/src/main/java/dev/pyrossh/onlyBible/ChapterScreen.kt
CHANGED
|
@@ -5,11 +5,11 @@ import android.view.SoundEffectConstants
|
|
|
5
5
|
import androidx.compose.animation.AnimatedContentTransitionScope
|
|
6
6
|
import androidx.compose.foundation.gestures.detectDragGestures
|
|
7
7
|
import androidx.compose.foundation.layout.Arrangement
|
|
8
|
+
import androidx.compose.foundation.layout.Column
|
|
8
9
|
import androidx.compose.foundation.layout.PaddingValues
|
|
9
10
|
import androidx.compose.foundation.layout.Row
|
|
10
11
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
11
12
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
12
|
-
import androidx.compose.foundation.layout.height
|
|
13
13
|
import androidx.compose.foundation.layout.padding
|
|
14
14
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
15
15
|
import androidx.compose.foundation.lazy.LazyListState
|
|
@@ -18,14 +18,12 @@ import androidx.compose.material.icons.Icons
|
|
|
18
18
|
import androidx.compose.material.icons.outlined.MoreVert
|
|
19
19
|
import androidx.compose.material.icons.rounded.Search
|
|
20
20
|
import androidx.compose.material3.ButtonDefaults.ContentPadding
|
|
21
|
-
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
22
21
|
import androidx.compose.material3.Icon
|
|
23
22
|
import androidx.compose.material3.IconButton
|
|
24
23
|
import androidx.compose.material3.MaterialTheme
|
|
25
24
|
import androidx.compose.material3.Scaffold
|
|
26
25
|
import androidx.compose.material3.Text
|
|
27
26
|
import androidx.compose.material3.TextButton
|
|
28
|
-
import androidx.compose.material3.TopAppBar
|
|
29
27
|
import androidx.compose.runtime.Composable
|
|
30
28
|
import androidx.compose.runtime.LaunchedEffect
|
|
31
29
|
import androidx.compose.runtime.MutableIntState
|
|
@@ -110,7 +108,6 @@ suspend fun PointerInputScope.detectSwipe(
|
|
|
110
108
|
}
|
|
111
109
|
)
|
|
112
110
|
|
|
113
|
-
@OptIn(ExperimentalMaterial3Api::class)
|
|
114
111
|
@Composable
|
|
115
112
|
fun ChapterScreen(
|
|
116
113
|
model: AppViewModel,
|
|
@@ -140,73 +137,90 @@ fun ChapterScreen(
|
|
|
140
137
|
Scaffold(
|
|
141
138
|
modifier = Modifier
|
|
142
139
|
.fillMaxSize(),
|
|
140
|
+
) { innerPadding ->
|
|
141
|
+
if (bibleSelectorShown) {
|
|
142
|
+
BibleSelector(
|
|
143
|
-
|
|
143
|
+
model = model,
|
|
144
|
+
onClose = { bibleSelectorShown = false },
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
if (chapterSelectorShown) {
|
|
148
|
+
ChapterSelector(
|
|
149
|
+
model = model,
|
|
150
|
+
onClose = { chapterSelectorShown = false },
|
|
151
|
+
navigateToChapter = navigateToChapter,
|
|
152
|
+
)
|
|
153
|
+
}
|
|
144
|
-
|
|
154
|
+
if (isSearching) {
|
|
145
|
-
|
|
155
|
+
EmbeddedSearchBar(
|
|
146
|
-
|
|
156
|
+
query = searchText,
|
|
147
|
-
|
|
157
|
+
onQueryChange = model::onSearchTextChange,
|
|
148
|
-
|
|
158
|
+
onSearch = model::onSearchTextChange,
|
|
149
|
-
|
|
159
|
+
onClose = { model.onCloseSearch() },
|
|
150
|
-
|
|
160
|
+
) {
|
|
151
|
-
|
|
161
|
+
val groups = versesList.groupBy { "${it.bookName} ${it.chapterIndex + 1}" }
|
|
152
|
-
|
|
162
|
+
LazyColumn {
|
|
153
|
-
|
|
163
|
+
groups.forEach {
|
|
154
|
-
|
|
164
|
+
item(
|
|
155
|
-
|
|
165
|
+
contentType = "header"
|
|
156
|
-
) {
|
|
157
|
-
Text(
|
|
158
|
-
modifier = Modifier.padding(
|
|
159
|
-
vertical = 12.dp,
|
|
160
|
-
),
|
|
161
|
-
style = TextStyle(
|
|
162
|
-
fontFamily = model.fontType.family(),
|
|
163
|
-
fontSize = (16 + fontSizeDelta).sp,
|
|
164
|
-
fontWeight = FontWeight.W700,
|
|
165
|
-
color = headingColor,
|
|
166
|
-
),
|
|
167
|
-
text = it.key,
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
items(it.value) { v ->
|
|
171
|
-
VerseView(
|
|
172
|
-
model = model,
|
|
173
|
-
verse = v,
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
TopAppBar(
|
|
181
|
-
modifier = Modifier
|
|
182
|
-
.height(72.dp),
|
|
183
|
-
title = {
|
|
184
|
-
Row(
|
|
185
|
-
modifier = Modifier
|
|
186
|
-
.fillMaxWidth(),
|
|
187
|
-
) {
|
|
188
|
-
TextButton(
|
|
189
|
-
contentPadding = PaddingValues(
|
|
190
|
-
top = ContentPadding.calculateTopPadding(),
|
|
191
|
-
end = 12.dp,
|
|
192
|
-
bottom = ContentPadding.calculateBottomPadding()
|
|
193
|
-
),
|
|
194
|
-
onClick = {
|
|
195
|
-
chapterSelectorShown = true
|
|
196
|
-
}
|
|
197
166
|
) {
|
|
198
167
|
Text(
|
|
199
|
-
|
|
168
|
+
modifier = Modifier.padding(
|
|
169
|
+
vertical = 12.dp,
|
|
170
|
+
),
|
|
200
171
|
style = TextStyle(
|
|
172
|
+
fontFamily = model.fontType.family(),
|
|
201
|
-
fontSize =
|
|
173
|
+
fontSize = (16 + fontSizeDelta).sp,
|
|
202
|
-
fontWeight = FontWeight.
|
|
174
|
+
fontWeight = FontWeight.W700,
|
|
203
175
|
color = headingColor,
|
|
176
|
+
),
|
|
177
|
+
text = it.key,
|
|
204
|
-
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
items(it.value) { v ->
|
|
181
|
+
VerseView(
|
|
182
|
+
model = model,
|
|
183
|
+
verse = v,
|
|
205
184
|
)
|
|
206
185
|
}
|
|
207
186
|
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
Column(
|
|
192
|
+
modifier = Modifier
|
|
193
|
+
.fillMaxSize()
|
|
194
|
+
.padding(innerPadding)
|
|
195
|
+
.padding(horizontal = 16.dp)
|
|
196
|
+
) {
|
|
197
|
+
Row(
|
|
198
|
+
modifier = Modifier
|
|
199
|
+
.fillMaxWidth(),
|
|
200
|
+
) {
|
|
201
|
+
TextButton(
|
|
202
|
+
contentPadding = PaddingValues(
|
|
203
|
+
top = ContentPadding.calculateTopPadding(),
|
|
204
|
+
end = 12.dp,
|
|
205
|
+
bottom = ContentPadding.calculateBottomPadding()
|
|
208
|
-
|
|
206
|
+
),
|
|
209
|
-
|
|
207
|
+
onClick = {
|
|
208
|
+
chapterSelectorShown = true
|
|
209
|
+
}
|
|
210
|
+
) {
|
|
211
|
+
Text(
|
|
212
|
+
text = "${bookNames[bookIndex]} ${chapterIndex + 1}",
|
|
213
|
+
style = TextStyle(
|
|
214
|
+
fontSize = 22.sp,
|
|
215
|
+
fontWeight = FontWeight.W500,
|
|
216
|
+
color = headingColor,
|
|
217
|
+
)
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
Row(
|
|
221
|
+
modifier = Modifier.weight(1f),
|
|
222
|
+
horizontalArrangement = Arrangement.End,
|
|
223
|
+
) {
|
|
210
224
|
IconButton(
|
|
211
225
|
onClick = { model.onOpenSearch() },
|
|
212
226
|
) {
|
|
@@ -220,7 +234,7 @@ fun ChapterScreen(
|
|
|
220
234
|
bibleSelectorShown = true
|
|
221
235
|
}) {
|
|
222
236
|
Text(
|
|
223
|
-
text = model.
|
|
237
|
+
text = model.bible.shortName(),
|
|
224
238
|
style = TextStyle(
|
|
225
239
|
fontSize = 18.sp,
|
|
226
240
|
fontWeight = FontWeight.W500,
|
|
@@ -239,59 +253,43 @@ fun ChapterScreen(
|
|
|
239
253
|
tint = headingColor,
|
|
240
254
|
)
|
|
241
255
|
}
|
|
242
|
-
},
|
|
243
|
-
)
|
|
244
|
-
},
|
|
245
|
-
) { innerPadding ->
|
|
246
|
-
if (bibleSelectorShown) {
|
|
247
|
-
BibleSelector(
|
|
248
|
-
model = model,
|
|
249
|
-
onClose = { bibleSelectorShown = false },
|
|
250
|
-
)
|
|
251
|
-
}
|
|
252
|
-
if (chapterSelectorShown) {
|
|
253
|
-
ChapterSelector(
|
|
254
|
-
model = model,
|
|
255
|
-
onClose = { chapterSelectorShown = false },
|
|
256
|
-
navigateToChapter = navigateToChapter,
|
|
257
|
-
)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
LazyColumn(
|
|
261
|
-
state = rememberSaveable(saver = LazyListState.Saver) {
|
|
262
|
-
model.scrollState
|
|
263
|
-
},
|
|
264
|
-
verticalArrangement = Arrangement.spacedBy(16.dp + (model.lineSpacingDelta * 2).dp),
|
|
265
|
-
modifier = Modifier
|
|
266
|
-
.fillMaxSize()
|
|
267
|
-
.padding(innerPadding)
|
|
268
|
-
.padding(horizontal = 16.dp)
|
|
269
|
-
.pointerInput(Unit) {
|
|
270
|
-
detectSwipe(
|
|
271
|
-
onSwipeLeft = onSwipeLeft,
|
|
272
|
-
onSwipeRight = { onSwipeRight() },
|
|
273
|
-
)
|
|
274
256
|
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
LazyColumn(
|
|
260
|
+
state = rememberSaveable(saver = LazyListState.Saver) {
|
|
261
|
+
model.scrollState
|
|
262
|
+
},
|
|
263
|
+
verticalArrangement = Arrangement.spacedBy(16.dp + (model.lineSpacingDelta * 2).dp),
|
|
264
|
+
modifier = Modifier
|
|
265
|
+
.fillMaxSize()
|
|
266
|
+
.pointerInput(Unit) {
|
|
267
|
+
detectSwipe(
|
|
268
|
+
onSwipeLeft = onSwipeLeft,
|
|
269
|
+
onSwipeRight = { onSwipeRight() },
|
|
270
|
+
)
|
|
271
|
+
}
|
|
275
|
-
|
|
272
|
+
) {
|
|
276
|
-
|
|
273
|
+
items(chapterVerses) { v ->
|
|
277
|
-
|
|
274
|
+
if (v.heading.isNotEmpty()) {
|
|
278
|
-
|
|
275
|
+
Text(
|
|
279
|
-
|
|
276
|
+
modifier = Modifier.padding(
|
|
280
|
-
|
|
277
|
+
top = if (v.verseIndex != 0) 12.dp else 0.dp, bottom = 12.dp
|
|
281
|
-
|
|
278
|
+
),
|
|
282
|
-
|
|
279
|
+
style = TextStyle(
|
|
283
|
-
|
|
280
|
+
fontFamily = model.fontType.family(),
|
|
284
|
-
|
|
281
|
+
fontSize = (16 + fontSizeDelta).sp,
|
|
285
|
-
|
|
282
|
+
fontWeight = FontWeight.W700,
|
|
286
|
-
|
|
283
|
+
color = headingColor,
|
|
287
|
-
|
|
284
|
+
),
|
|
288
|
-
|
|
285
|
+
text = v.heading.replace("<br>", "\n")
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
VerseView(
|
|
289
|
+
model = model,
|
|
290
|
+
verse = v,
|
|
289
291
|
)
|
|
290
292
|
}
|
|
291
|
-
VerseView(
|
|
292
|
-
model = model,
|
|
293
|
-
verse = v,
|
|
294
|
-
)
|
|
295
293
|
}
|
|
296
294
|
}
|
|
297
295
|
}
|
app/src/main/java/dev/pyrossh/onlyBible/MainActivity.kt
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
package dev.pyrossh.onlyBible
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
|
+
import androidx.activity.ComponentActivity
|
|
4
5
|
import androidx.activity.compose.setContent
|
|
5
6
|
import androidx.activity.enableEdgeToEdge
|
|
6
7
|
import androidx.activity.viewModels
|
|
7
|
-
import androidx.appcompat.app.AppCompatActivity
|
|
8
8
|
import androidx.lifecycle.lifecycleScope
|
|
9
|
+
import dev.pyrossh.onlyBible.composables.TextSettingsBottomSheet
|
|
9
10
|
import kotlinx.coroutines.launch
|
|
10
11
|
|
|
11
|
-
class MainActivity :
|
|
12
|
+
class MainActivity : ComponentActivity() {
|
|
12
13
|
|
|
13
14
|
private val model by viewModels<AppViewModel>()
|
|
14
15
|
|
app/src/main/java/dev/pyrossh/onlyBible/composables/BibleSelector.kt
CHANGED
|
@@ -20,7 +20,6 @@ import androidx.compose.ui.unit.dp
|
|
|
20
20
|
import androidx.compose.ui.window.Dialog
|
|
21
21
|
import dev.pyrossh.onlyBible.AppViewModel
|
|
22
22
|
import dev.pyrossh.onlyBible.domain.bibles
|
|
23
|
-
import dev.pyrossh.onlyBible.setLocale
|
|
24
23
|
import java.util.Locale
|
|
25
24
|
|
|
26
25
|
@Composable
|
|
@@ -40,14 +39,12 @@ fun BibleSelector(
|
|
|
40
39
|
) {
|
|
41
40
|
LazyColumn {
|
|
42
41
|
items(bibleList) {
|
|
43
|
-
val arr = it.split("_")
|
|
44
|
-
val loc = Locale(
|
|
42
|
+
val loc = Locale(it.languageCode)
|
|
45
43
|
ListItem(
|
|
46
44
|
modifier = Modifier.clickable {
|
|
47
45
|
onClose()
|
|
48
46
|
model.bible = it
|
|
49
47
|
model.loadBible()
|
|
50
|
-
context.setLocale(loc)
|
|
51
48
|
},
|
|
52
49
|
colors = ListItemDefaults.colors(
|
|
53
50
|
containerColor = if (it == model.bible)
|
|
@@ -65,8 +62,8 @@ fun BibleSelector(
|
|
|
65
62
|
supportingContent = {
|
|
66
63
|
Text(
|
|
67
64
|
modifier = Modifier.padding(start = 4.dp),
|
|
68
|
-
text = if (
|
|
65
|
+
text = if (it.version != null)
|
|
69
|
-
|
|
66
|
+
it.version.uppercase()
|
|
70
67
|
else
|
|
71
68
|
loc.getDisplayName(loc)
|
|
72
69
|
)
|
app/src/main/java/dev/pyrossh/onlyBible/composables/ChapterSelector.kt
CHANGED
|
@@ -41,7 +41,6 @@ import dev.pyrossh.onlyBible.AppViewModel
|
|
|
41
41
|
import dev.pyrossh.onlyBible.ChapterScreenProps
|
|
42
42
|
import dev.pyrossh.onlyBible.domain.chapterSizes
|
|
43
43
|
import dev.pyrossh.onlyBible.domain.engTitles
|
|
44
|
-
import dev.pyrossh.onlyBible.getCurrentLocale
|
|
45
44
|
|
|
46
45
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
47
46
|
@Composable
|
|
@@ -107,10 +106,10 @@ fun ChapterSelector(
|
|
|
107
106
|
)
|
|
108
107
|
},
|
|
109
108
|
supportingContent = {
|
|
110
|
-
if (
|
|
109
|
+
if (model.bible.languageCode != "en") {
|
|
111
110
|
Text(
|
|
112
111
|
modifier = Modifier.padding(start = 4.dp),
|
|
113
|
-
text = engTitles[
|
|
112
|
+
text = engTitles[bookNames.indexOf(it)],
|
|
114
113
|
)
|
|
115
114
|
}
|
|
116
115
|
}
|
app/src/main/java/dev/pyrossh/onlyBible/{TextSettingsBottomSheet.kt → composables/TextSettingsBottomSheet.kt}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package dev.pyrossh.onlyBible
|
|
1
|
+
package dev.pyrossh.onlyBible.composables
|
|
2
2
|
|
|
3
3
|
import android.app.UiModeManager.MODE_NIGHT_AUTO
|
|
4
4
|
import android.app.UiModeManager.MODE_NIGHT_NO
|
|
@@ -38,6 +38,8 @@ import androidx.compose.ui.text.TextStyle
|
|
|
38
38
|
import androidx.compose.ui.text.font.FontWeight
|
|
39
39
|
import androidx.compose.ui.unit.dp
|
|
40
40
|
import androidx.compose.ui.unit.sp
|
|
41
|
+
import dev.pyrossh.onlyBible.AppViewModel
|
|
42
|
+
import dev.pyrossh.onlyBible.FontType
|
|
41
43
|
import kotlinx.coroutines.launch
|
|
42
44
|
|
|
43
45
|
@Composable
|
|
@@ -67,7 +69,7 @@ fun TextSettingsBottomSheet(model: AppViewModel) {
|
|
|
67
69
|
verticalAlignment = Alignment.CenterVertically,
|
|
68
70
|
) {
|
|
69
71
|
Text(
|
|
70
|
-
text =
|
|
72
|
+
text = model.bible.tSettings,
|
|
71
73
|
style = TextStyle(
|
|
72
74
|
fontSize = 18.sp,
|
|
73
75
|
fontWeight = FontWeight.W600,
|
app/src/main/java/dev/pyrossh/onlyBible/composables/VerseView.kt
CHANGED
|
@@ -53,7 +53,6 @@ import androidx.compose.ui.unit.dp
|
|
|
53
53
|
import androidx.compose.ui.unit.sp
|
|
54
54
|
import androidx.compose.ui.window.Popup
|
|
55
55
|
import dev.pyrossh.onlyBible.AppViewModel
|
|
56
|
-
import dev.pyrossh.onlyBible.R
|
|
57
56
|
import dev.pyrossh.onlyBible.darkHighlights
|
|
58
57
|
import dev.pyrossh.onlyBible.domain.Verse
|
|
59
58
|
import dev.pyrossh.onlyBible.isLightTheme
|
|
@@ -242,7 +241,7 @@ private fun Menu(
|
|
|
242
241
|
scope.launch(Dispatchers.IO) {
|
|
243
242
|
for (v in selectedVerses.sortedBy { it.verseIndex }) {
|
|
244
243
|
model.speechService.StartSpeakingSsml(
|
|
245
|
-
v.toSSML(
|
|
244
|
+
v.toSSML(model.bible.voiceName),
|
|
246
245
|
)
|
|
247
246
|
}
|
|
248
247
|
}
|
app/src/main/java/dev/pyrossh/onlyBible/domain/Bible.kt
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
package dev.pyrossh.onlyBible.domain
|
|
2
|
-
|
|
3
|
-
var bibles = listOf(
|
|
4
|
-
"en_kjv",
|
|
5
|
-
"en_bsb",
|
|
6
|
-
"bn",
|
|
7
|
-
"gu",
|
|
8
|
-
"hi",
|
|
9
|
-
"kn",
|
|
10
|
-
"ml",
|
|
11
|
-
"ne",
|
|
12
|
-
"or",
|
|
13
|
-
"pa",
|
|
14
|
-
"ta",
|
|
15
|
-
"te",
|
|
16
|
-
)
|
app/src/main/java/dev/pyrossh/onlyBible/domain/Verse.kt
CHANGED
|
@@ -4,6 +4,31 @@ import android.os.Parcelable
|
|
|
4
4
|
import kotlinx.parcelize.Parcelize
|
|
5
5
|
import kotlinx.serialization.Serializable
|
|
6
6
|
|
|
7
|
+
data class Bible(
|
|
8
|
+
val languageCode: String,
|
|
9
|
+
val version: String?,
|
|
10
|
+
val voiceName: String,
|
|
11
|
+
val tSettings: String,
|
|
12
|
+
) {
|
|
13
|
+
fun shortName() = (version ?: languageCode).uppercase()
|
|
14
|
+
fun filename() = if (version != null) "${languageCode}_${version}" else languageCode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var bibles = listOf(
|
|
18
|
+
Bible("en", "kjv", "en-GB-RyanNeural", "Text Settings"),
|
|
19
|
+
Bible("en", "bsb", "en-GB-RyanNeural", "Text Settings"),
|
|
20
|
+
Bible("bn", null, "bn-IN-TanishaaNeural", "সেটিংস"),
|
|
21
|
+
Bible("gu", null, "gu-IN-DhwaniNeural", "સેટિંગ્સ"),
|
|
22
|
+
Bible("hi", null, "hi-IN-SwaraNeural", "समायोजन"),
|
|
23
|
+
Bible("kn", null, "kn-IN-GaganNeural", "ಸಂಯೋಜನೆಗಳು"),
|
|
24
|
+
Bible("ml", null, "ml-IN-SobhanaNeural", "ക്രമീകരണങ്ങൾ"),
|
|
25
|
+
Bible("ne", null, "ne-NP-HemkalaNeural", "सेटिङहरू"),
|
|
26
|
+
Bible("or", null, "or-IN-SubhasiniNeural", "ସେଟିଂସମୂହ"),
|
|
27
|
+
Bible("pa", null, "pa-IN-OjasNeural", "ਸੈਟਿੰਗਾਂ"),
|
|
28
|
+
Bible("ta", null, "ta-IN-PallaviNeural", "அமைப்புகள்"),
|
|
29
|
+
Bible("te", null, "te-IN-ShrutiNeural", "సెట్టింగ్\\\\u200Cలు"),
|
|
30
|
+
)
|
|
31
|
+
|
|
7
32
|
const val BOOKS_COUNT = 66;
|
|
8
33
|
|
|
9
34
|
val engTitles = listOf(
|
app/src/main/res/values-bn/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">পুরানো ইচ্ছাপত্র</string>
|
|
5
|
-
<string name="new_testament">নববিধান</string>
|
|
6
|
-
<string name="settings">সেটিংস</string>
|
|
7
|
-
<string name="voice">bn-IN-TanishaaNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values-gu/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">ઓલ્ડ ટેસ્ટામેન્ટ</string>
|
|
5
|
-
<string name="new_testament">ન્યૂ વસિયતનામું</string>
|
|
6
|
-
<string name="settings">સેટિંગ્સ</string>
|
|
7
|
-
<string name="voice">gu-IN-DhwaniNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values-hi/strings.xml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<resources>
|
|
2
|
-
<string name="app_name">Only Bible</string>
|
|
3
|
-
<string name="old_testament">पुराना नियम</string>
|
|
4
|
-
<string name="new_testament">नया नियम</string>
|
|
5
|
-
<string name="settings">समायोजन</string>
|
|
6
|
-
<string name="voice">hi-IN-SwaraNeural</string>
|
|
7
|
-
</resources>
|
app/src/main/res/values-kn/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">ಹಳೆಯ ಒಡಂಬಡಿಕೆ</string>
|
|
5
|
-
<string name="new_testament">ಹೊಸ ಒಡಂಬಡಿಕೆಯು</string>
|
|
6
|
-
<string name="settings">ಸಂಯೋಜನೆಗಳು</string>
|
|
7
|
-
<string name="voice">kn-IN-GaganNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values-ml/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">പഴയ നിയമം</string>
|
|
5
|
-
<string name="new_testament">പുതിയ നിയമം</string>
|
|
6
|
-
<string name="settings">ക്രമീകരണങ്ങൾ</string>
|
|
7
|
-
<string name="voice">ml-IN-SobhanaNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values-ne/strings.xml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<resources>
|
|
2
|
-
<string name="app_name">Only Bible</string>
|
|
3
|
-
<string name="old_testament">पुरानो नियम</string>
|
|
4
|
-
<string name="new_testament">नयाँ नियम</string>
|
|
5
|
-
<string name="settings">सेटिङहरू</string>
|
|
6
|
-
<string name="voice">ne-NP-HemkalaNeural</string>
|
|
7
|
-
</resources>
|
app/src/main/res/values-or/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">ଓଲ୍ଡ ଷ୍ଟେଟାମେଣ୍ଟ</string>
|
|
5
|
-
<string name="new_testament">ନ୍ୟୁ ଷ୍ଟେଟାମେଣ୍ଟ</string>
|
|
6
|
-
<string name="settings">ସେଟିଂସମୂହ</string>
|
|
7
|
-
<string name="voice">or-IN-SubhasiniNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values-pa/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">ਪੁਰਾਣੇ ਨੇਮ</string>
|
|
5
|
-
<string name="new_testament">ਨਵਾਂ ਨੇਮ</string>
|
|
6
|
-
<string name="settings">ਸੈਟਿੰਗਾਂ</string>
|
|
7
|
-
<string name="voice">pa-IN-OjasNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values-ta/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">பழைய ஏற்பாடு</string>
|
|
5
|
-
<string name="new_testament">புதிய ஏற்பாடு</string>
|
|
6
|
-
<string name="settings">அமைப்புகள்</string>
|
|
7
|
-
<string name="voice">ta-IN-PallaviNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values-te/strings.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
<string name="app_name">Only Bible</string>
|
|
4
|
-
<string name="old_testament">పాత నిబంధన</string>
|
|
5
|
-
<string name="new_testament">కొత్త నిబంధన</string>
|
|
6
|
-
<string name="settings">సెట్టింగ్\\u200Cలు</string>
|
|
7
|
-
<string name="voice">te-IN-ShrutiNeural</string>
|
|
8
|
-
</resources>
|
app/src/main/res/values/strings.xml
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
<resources>
|
|
2
2
|
<string name="app_name">Only Bible</string>
|
|
3
|
-
<string name="old_testament">Old Testament</string>
|
|
4
|
-
<string name="new_testament">New Testament</string>
|
|
5
|
-
<string name="settings">Text Settings</string>
|
|
6
|
-
<string name="voice">en-GB-RyanNeural</string>
|
|
7
3
|
</resources>
|