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


ba304f79 pyrossh

1 year ago
add search word highlighting
app/build.gradle.kts CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  import com.android.build.gradle.tasks.asJavaVersion
3
2
  import java.io.FileInputStream
4
3
  import java.util.Properties
@@ -31,6 +30,19 @@ android {
31
30
  vectorDrawables {
32
31
  useSupportLibrary = true
33
32
  }
33
+ resourceConfigurations += listOf(
34
+ "en",
35
+ "bn",
36
+ "gu",
37
+ "hi",
38
+ "kn",
39
+ "ml",
40
+ "ne",
41
+ "or",
42
+ "pa",
43
+ "te",
44
+ "ta"
45
+ )
34
46
  }
35
47
 
36
48
  signingConfigs {
app/src/main/java/dev/pyrossh/onlyBible/ChapterScreen.kt CHANGED
@@ -281,6 +281,7 @@ fun ChapterScreen(
281
281
  fontSizeDelta = model.fontSizeDelta,
282
282
  fontBoldEnabled = model.fontBoldEnabled,
283
283
  verse = v,
284
+ highlightWord = null,
284
285
  )
285
286
  }
286
287
  }
app/src/main/java/dev/pyrossh/onlyBible/composables/EmbeddedSearchBar.kt CHANGED
@@ -115,6 +115,7 @@ fun EmbeddedSearchBar(
115
115
  fontSizeDelta = model.fontSizeDelta,
116
116
  fontBoldEnabled = model.fontBoldEnabled,
117
117
  verse = v,
118
+ highlightWord = searchText,
118
119
  )
119
120
  }
120
121
  }
app/src/main/java/dev/pyrossh/onlyBible/composables/VerseText.kt CHANGED
@@ -68,6 +68,7 @@ fun VerseText(
68
68
  fontSizeDelta: Int,
69
69
  fontBoldEnabled: Boolean,
70
70
  verse: Verse,
71
+ highlightWord: String?,
71
72
  ) {
72
73
  var barYPosition by remember {
73
74
  mutableIntStateOf(0)
@@ -78,6 +79,15 @@ fun VerseText(
78
79
  val isSelected = selectedVerses.contains(verse)
79
80
  val highlightedColorIndex = model.getHighlightForVerse(verse)
80
81
  val currentHighlightColors = if (isLight) lightHighlights else darkHighlights
82
+ val currentHighlightWordKey = if (isLight) "background" else "color"
83
+ val text = if (highlightWord != null)
84
+ verse.text.replace(
85
+ highlightWord,
86
+ "<span style=\"${currentHighlightWordKey}: yellow;\">${highlightWord}</span>",
87
+ true
88
+ )
89
+ else
90
+ verse.text
81
91
  Text(
82
92
  modifier = Modifier
83
93
  .onPlaced {
@@ -134,7 +144,7 @@ fun VerseText(
134
144
  }
135
145
  append(
136
146
  AnnotatedString.Companion.fromHtml(
137
- htmlString = verse.text,
147
+ htmlString = text,
138
148
  linkStyles = TextLinkStyles(
139
149
  style = SpanStyle(
140
150
  fontSize = (14 + model.fontSizeDelta).sp,
readme.md CHANGED
@@ -28,8 +28,6 @@ For emulators,
28
28
  * Runner Target, Signing Tab, Release Tab, select that provisioning profile and Team and Certificate.
29
29
 
30
30
  ## TODO
31
-
32
- 1. Add search text highlight in each verse in search view
33
- 2. Add goto verse in the search view
31
+ 1. Add goto verse in the search view
34
- 3. Fix Long chapter name (Thessalonians) where menu button shrinks
32
+ 2. Fix Long chapter name (Thessalonians) where menu button shrinks
35
- 4. Add locales in the resources/localeList or app definition
33
+ 3. Add locales in the resources/localeList or app definition