~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.


6028da8e pyrossh

1 year ago
remove unused deps
app/build.gradle.kts CHANGED
@@ -88,32 +88,17 @@ composeCompiler {
88
88
  }
89
89
 
90
90
  dependencies {
91
- implementation(libs.kotlinx.serialization.json)
92
- implementation(libs.androidx.core.ktx)
93
- implementation(libs.androidx.lifecycle.runtime.ktx)
94
91
  implementation(libs.androidx.activity.compose)
95
- implementation(platform(libs.androidx.compose.bom))
96
- implementation(libs.androidx.ui)
92
+ implementation(libs.androidx.foundation)
97
- implementation(libs.androidx.ui.graphics)
98
- implementation(libs.androidx.ui.tooling.preview)
99
93
  implementation(libs.androidx.material3)
100
94
  implementation(libs.androidx.material.icons.extended)
101
- implementation(libs.androidx.navigation.fragment.ktx)
102
- implementation(libs.androidx.navigation.ui.ktx)
103
95
  implementation(libs.androidx.navigation.compose)
104
- implementation(libs.androidx.foundation)
96
+ implementation(libs.androidx.lifecycle.runtime.ktx)
105
- implementation(libs.accompanist.systemuicontroller)
97
+ implementation(libs.androidx.lifecycle.viewmodel.compose)
106
98
  implementation(libs.speech.client.sdk)
99
+ implementation(libs.kotlinx.serialization.json)
107
100
  implementation(libs.kotlinx.coroutines.core)
108
- implementation(libs.androidx.lifecycle.viewmodel.compose)
109
- implementation(libs.androidx.appcompat)
110
- implementation(libs.androidx.appcompat.resources)
111
101
 
112
102
  testImplementation(libs.junit)
113
103
  androidTestImplementation(libs.androidx.junit)
114
- androidTestImplementation(platform(libs.androidx.compose.bom))
115
- androidTestImplementation(libs.androidx.ui.test.junit4)
116
-
117
- debugImplementation(libs.androidx.ui.tooling)
118
- debugImplementation(libs.androidx.ui.test.manifest)
119
104
  }
app/src/main/AndroidManifest.xml CHANGED
@@ -2,7 +2,6 @@
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
3
3
 
4
4
  <uses-permission android:name="android.permission.INTERNET" />
5
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6
5
 
7
6
  <uses-permission android:name="android.permission.RECORD_AUDIO"
8
7
  tools:node="remove" />
@@ -18,7 +17,7 @@
18
17
  <activity
19
18
  android:name=".MainActivity"
20
19
  android:exported="true"
21
- android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar">
20
+ android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar">
22
21
  <intent-filter>
23
22
  <action android:name="android.intent.action.MAIN" />
24
23
  <category android:name="android.intent.category.LAUNCHER" />
app/src/main/java/dev/pyrossh/onlyBible/AppTheme.kt CHANGED
@@ -1,5 +1,8 @@
1
1
  package dev.pyrossh.onlyBible
2
2
 
3
+ import androidx.activity.ComponentActivity
4
+ import androidx.activity.SystemBarStyle
5
+ import androidx.activity.enableEdgeToEdge
3
6
  import androidx.compose.foundation.isSystemInDarkTheme
4
7
  import androidx.compose.material3.MaterialTheme
5
8
  import androidx.compose.material3.dynamicDarkColorScheme
@@ -7,10 +10,10 @@ import androidx.compose.material3.dynamicLightColorScheme
7
10
  import androidx.compose.runtime.Composable
8
11
  import androidx.compose.runtime.LaunchedEffect
9
12
  import androidx.compose.ui.graphics.Color
13
+ import androidx.compose.ui.graphics.toArgb
10
14
  import androidx.compose.ui.platform.LocalContext
11
15
  import androidx.compose.ui.text.font.FontFamily
12
16
  import androidx.compose.ui.text.font.GenericFontFamily
13
- import com.google.accompanist.systemuicontroller.rememberSystemUiController
14
17
 
15
18
  enum class ThemeType {
16
19
  Light,
@@ -51,11 +54,11 @@ fun isLightTheme(themeType: ThemeType, isSystemDark: Boolean): Boolean {
51
54
  @Composable
52
55
  fun AppTheme(
53
56
  themeType: ThemeType,
54
- content: @Composable() () -> Unit
57
+ content: @Composable () -> Unit
55
58
  ) {
56
- val context = LocalContext.current
59
+ val context = LocalContext.current as ComponentActivity
57
- val systemUiController = rememberSystemUiController()
58
- val colorScheme = if (isLightTheme(themeType, isSystemInDarkTheme()))
60
+ val isLight = isLightTheme(themeType, isSystemInDarkTheme())
61
+ val colorScheme = if (isLight)
59
62
  dynamicLightColorScheme(context).copy(
60
63
  onSurface = Color.Black,
61
64
  outline = Color.LightGray,
@@ -67,8 +70,27 @@ fun AppTheme(
67
70
  outline = Color(0xAA5D4979),
68
71
  )
69
72
  LaunchedEffect(key1 = themeType) {
73
+ context.enableEdgeToEdge(
74
+ statusBarStyle = if (isLight) {
70
- systemUiController.setSystemBarsColor(
75
+ SystemBarStyle.light(
71
- color = colorScheme.background
76
+ colorScheme.background.toArgb(),
77
+ colorScheme.onBackground.toArgb()
78
+ )
79
+ } else {
80
+ SystemBarStyle.dark(
81
+ colorScheme.background.toArgb(),
82
+ )
83
+ },
84
+ navigationBarStyle = if (isLight) {
85
+ SystemBarStyle.light(
86
+ colorScheme.background.toArgb(),
87
+ colorScheme.onBackground.toArgb()
88
+ )
89
+ } else {
90
+ SystemBarStyle.dark(
91
+ colorScheme.background.toArgb(),
92
+ )
93
+ }
72
94
  )
73
95
  }
74
96
  MaterialTheme(
app/src/main/java/dev/pyrossh/onlyBible/composables/BibleSelector.kt CHANGED
@@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.height
6
6
  import androidx.compose.foundation.layout.padding
7
7
  import androidx.compose.foundation.lazy.LazyColumn
8
8
  import androidx.compose.foundation.lazy.items
9
+ import androidx.compose.foundation.lazy.rememberLazyListState
9
10
  import androidx.compose.foundation.shape.RoundedCornerShape
10
11
  import androidx.compose.material3.Card
11
12
  import androidx.compose.material3.ListItem
@@ -30,7 +31,13 @@ fun BibleSelector(
30
31
  ) {
31
32
  val context = LocalContext.current
32
33
  val height = context.resources.configuration.screenHeightDp.dp / 2
33
- val bibleList = bibles.sortedBy { it != bible }
34
+ val bibleIndex = bibles.indexOf(bible)
35
+ val scrollState = rememberLazyListState(
36
+ initialFirstVisibleItemIndex = if (bibleIndex - 2 >= 0)
37
+ bibleIndex - 2
38
+ else
39
+ 0,
40
+ )
34
41
  Dialog(onDismissRequest = { onClose() }) {
35
42
  Card(
36
43
  modifier = Modifier
@@ -38,19 +45,27 @@ fun BibleSelector(
38
45
  .height(height),
39
46
  shape = RoundedCornerShape(8.dp),
40
47
  ) {
48
+ ListItem(
49
+ colors = ListItemDefaults.colors(
50
+ containerColor = MaterialTheme.colorScheme.primaryContainer,
51
+ ),
52
+ headlineContent = {
53
+ Text(
54
+ modifier = Modifier.padding(start = 4.dp),
55
+ fontWeight = FontWeight.W600,
56
+ text = "Bibles",
57
+ )
58
+ },
59
+ )
41
- LazyColumn {
60
+ LazyColumn(
61
+ state = scrollState
62
+ ) {
42
- items(bibleList) {
63
+ items(bibles) {
43
64
  val loc = Locale(it.languageCode)
44
65
  ListItem(
45
66
  modifier = Modifier.clickable {
46
67
  onSelected(it)
47
68
  },
48
- colors = ListItemDefaults.colors(
49
- containerColor = if (it == bible)
50
- MaterialTheme.colorScheme.primaryContainer
51
- else
52
- MaterialTheme.colorScheme.background
53
- ),
54
69
  headlineContent = {
55
70
  Text(
56
71
  modifier = Modifier.padding(start = 4.dp),
app/src/main/java/dev/pyrossh/onlyBible/composables/ChapterSelector.kt CHANGED
@@ -84,6 +84,8 @@ fun ChapterSelector(
84
84
  headlineContent = {
85
85
  Text(
86
86
  modifier = Modifier.padding(start = 4.dp),
87
+ // .fillMaxWidth()
88
+ // .wrapContentWidth(Alignment.CenterHorizontally),
87
89
  fontWeight = FontWeight.W600,
88
90
  text = if (expanded)
89
91
  "Books"
app/src/main/java/dev/pyrossh/onlyBible/composables/TextSettingsBottomSheet.kt CHANGED
@@ -31,7 +31,6 @@ import androidx.compose.runtime.Composable
31
31
  import androidx.compose.runtime.rememberCoroutineScope
32
32
  import androidx.compose.ui.Alignment
33
33
  import androidx.compose.ui.Modifier
34
- import androidx.compose.ui.platform.LocalContext
35
34
  import androidx.compose.ui.platform.LocalView
36
35
  import androidx.compose.ui.text.TextStyle
37
36
  import androidx.compose.ui.text.font.FontWeight
@@ -49,7 +48,6 @@ fun TextSettingsBottomSheet(
49
48
  onDismiss: () -> Unit,
50
49
  ) {
51
50
  val view = LocalView.current
52
- val context = LocalContext.current
53
51
  val scope = rememberCoroutineScope()
54
52
  return ModalBottomSheet(
55
53
  tonalElevation = 2.dp,
gradle/libs.versions.toml CHANGED
@@ -1,47 +1,31 @@
1
1
  [versions]
2
- accompanistSystemuicontroller = "0.27.0"
3
2
  agp = "8.4.2"
4
- appcompat = "1.7.0"
5
3
  speechClientSdk = "1.34.0"
6
4
  foundation = "1.6.8"
7
5
  kotlin = "2.0.0"
8
6
  kotlinxCoroutinesCore = "1.9.0-RC"
9
7
  kotlinxSerialization = "1.7.0"
10
- coreKtx = "1.13.1"
11
8
  junit = "4.13.2"
12
9
  junitVersion = "1.2.1"
10
+ activityCompose = "1.9.1"
11
+ navigationCompose = "2.8.0-beta06"
13
- lifecycleRuntimeKtx = "2.8.3"
12
+ lifecycleRuntimeKtx = "2.8.4"
14
- activityCompose = "1.9.0"
15
- composeBom = "2024.06.00"
16
- lifecycleViewmodelCompose = "2.8.3"
13
+ lifecycleViewmodelCompose = "2.8.4"
14
+ material3 = "1.2.1"
17
15
  materialIconsExtended = "1.6.8"
18
- navigationFragmentKtx = "2.8.0-beta05"
19
16
  secretsGradlePlugin = "2.0.1"
20
17
 
21
18
  [libraries]
22
- accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanistSystemuicontroller" }
23
- androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
24
- androidx-appcompat-resources = { module = "androidx.appcompat:appcompat-resources", version.ref = "appcompat" }
25
- androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
26
19
  androidx-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "foundation" }
27
20
  androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
28
- androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "materialIconsExtended" }
29
- androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationFragmentKtx" }
21
+ androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
30
- androidx-navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigationFragmentKtx" }
31
- androidx-navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigationFragmentKtx" }
32
22
  speech-client-sdk = { module = "com.microsoft.cognitiveservices.speech:client-sdk", version.ref = "speechClientSdk" }
33
23
  junit = { group = "junit", name = "junit", version.ref = "junit" }
34
24
  androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
35
25
  androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
36
26
  androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
27
+ androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "materialIconsExtended" }
37
- androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
28
+ androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
38
- androidx-ui = { group = "androidx.compose.ui", name = "ui" }
39
- androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
40
- androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
41
- androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
42
- androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
43
- androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
44
- androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
45
29
  kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
46
30
  kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
47
31
  secrets-gradle-plugin = { module = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin", version.ref = "secretsGradlePlugin" }