diff --git a/app/shared/src/commonMain/composeResources/drawable/content_copy.xml b/app/shared/src/commonMain/composeResources/drawable/content_copy.xml
deleted file mode 100644
index c744e1aa..00000000
--- a/app/shared/src/commonMain/composeResources/drawable/content_copy.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
diff --git a/app/shared/src/commonMain/composeResources/drawable/select_all.xml b/app/shared/src/commonMain/composeResources/drawable/select_all.xml
deleted file mode 100644
index 17d20a75..00000000
--- a/app/shared/src/commonMain/composeResources/drawable/select_all.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
diff --git a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/screens/ReadingScreen.kt b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/screens/ReadingScreen.kt
index 28ca8b90..251f1fb0 100644
--- a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/screens/ReadingScreen.kt
+++ b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/screens/ReadingScreen.kt
@@ -9,8 +9,8 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.offset
@@ -36,8 +36,8 @@ import androidx.compose.ui.draw.clipToBounds
import androidx.compose.ui.input.pointer.PointerEventPass
import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.input.pointer.isCtrlPressed
-import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
diff --git a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BibleReadingHelpers.kt b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BibleReadingHelpers.kt
index 0cce5710..47ccbad3 100644
--- a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BibleReadingHelpers.kt
+++ b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BibleReadingHelpers.kt
@@ -47,7 +47,7 @@ internal fun Modifier.verseTapGestures(
onVerseTap: (Int) -> Unit,
onVerseDoubleTap: (Int) -> Unit
): Modifier {
- return pointerInput(verse) {
+ return pointerInput(verse, onVerseTap, onVerseDoubleTap) {
detectTapGestures(
onTap = { onVerseTap(verse) },
onDoubleTap = { onVerseDoubleTap(verse) }
@@ -160,4 +160,4 @@ fun getVersePairs(bible: Bible, bibleState: BibleState): List
- val background = animatedVerseBackgroundColor(bibleState, verse, highlightedVerse).value
- val textColor = animatedVerseTextColor(verse, highlightedVerse).value
+ SelectionContainer {
+ Column {
+ versePairs.forEachIndexed { verse, pair ->
+ val animatedBackground = animatedVerseBackgroundColor(bibleState, verse, highlightedVerse).value
+ val animatedTextColor = animatedVerseTextColor(verse, highlightedVerse).value
+ val verseNumber = verse + 1
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .verseTapGestures(
- verse = verse + 1,
- onVerseTap = onVerseTap,
- onVerseDoubleTap = onVerseDoubleTap
- )
- .onGloballyPositioned { coordinates ->
- onVersePositioned(
- verse + 1,
- VerseLayoutInfo(
- topPx = coordinates.positionInParent().y.toInt(),
- heightPx = coordinates.size.height
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .verseTapGestures(
+ verse = verseNumber,
+ onVerseTap = onVerseTap,
+ onVerseDoubleTap = onVerseDoubleTap
)
- )
+ .onGloballyPositioned { coordinates ->
+ onVersePositioned(
+ verseNumber,
+ VerseLayoutInfo(
+ topPx = coordinates.positionInParent().y.toInt(),
+ heightPx = (coordinates.size.height - verseSpacingPx).coerceAtLeast(0)
+ )
+ )
+ }
+ ) {
+ Row(
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Text(
+ text = "$verseNumber ${pair.first}",
+ style = TextStyle(
+ fontSize = bibleState.fontSize.sp,
+ fontFamily = if (bibleState.isFontFamilySerif) bibleState.mainTranslation.language.serifFontFamily() else bibleState.mainTranslation.language.sansFontFamily(),
+ color = animatedTextColor
+ ),
+ modifier = Modifier
+ .weight(1f)
+ .background(animatedBackground)
+ )
+ Text(
+ text = "$verseNumber ${pair.second}",
+ style = TextStyle(
+ fontSize = bibleState.fontSize.sp,
+ fontFamily = if (bibleState.isFontFamilySerif) bibleState.subTranslation.language.serifFontFamily() else bibleState.subTranslation.language.sansFontFamily(),
+ color = animatedTextColor
+ ),
+ modifier = Modifier
+ .weight(1f)
+ .background(animatedBackground)
+ )
+ }
+ Spacer(modifier = Modifier.height(bibleState.spaceBetweenVerses.dp))
}
- ) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .background(background)
- ) {
- Text(
- text = "${verse + 1} ${pair.first}",
- style = TextStyle(
- fontSize = bibleState.fontSize.sp,
- fontFamily = if (bibleState.isFontFamilySerif) bibleState.mainTranslation.language.serifFontFamily() else bibleState.mainTranslation.language.sansFontFamily(),
- color = textColor
- ),
- modifier = Modifier.weight(1f)
- )
- Text(
- text = "${verse + 1} ${pair.second}",
- style = TextStyle(
- fontSize = bibleState.fontSize.sp,
- fontFamily = if (bibleState.isFontFamilySerif) bibleState.subTranslation.language.serifFontFamily() else bibleState.subTranslation.language.sansFontFamily(),
- color = textColor
- ),
- modifier = Modifier.weight(1f)
- )
}
- Spacer(modifier = Modifier.height(bibleState.spaceBetweenVerses.dp))
}
}
}
@@ -121,4 +131,4 @@ fun BilingualSideBiblePreview() {
scrollState = scrollState
)
}
-}
\ No newline at end of file
+}
diff --git a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BilingualUnderBible.kt b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BilingualUnderBible.kt
index ac8642d6..14de2516 100644
--- a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BilingualUnderBible.kt
+++ b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/BilingualUnderBible.kt
@@ -9,11 +9,13 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInParent
+import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@@ -42,6 +44,7 @@ fun BilingualUnderBible(
val readingMode = bibleState.readingMode
require(readingMode == ReadingMode.BILINGUAL_UNDER) { "Expected ${ReadingMode.BILINGUAL_UNDER}, got $readingMode" }
requireNotNull(bibleState.subTranslation) { "subTranslation is required for ${ReadingMode.BILINGUAL_UNDER}" }
+ val verseSpacingPx = with(LocalDensity.current) { bibleState.spaceBetweenVerses.dp.roundToPx() }
ScrollableColumn(
bibleState = bibleState,
@@ -51,62 +54,67 @@ fun BilingualUnderBible(
bottomContentPadding = bottomContentPadding,
onTitleTap = onTitleTap
) {
- versePairs.forEachIndexed { verse, pair ->
- val mainBackground = animatedBilingualUnderTranslationBackgroundColor(
- bibleState = bibleState,
- verseIndex = verse,
- highlightedVerse = highlightedVerse,
- isSubTranslation = false
- ).value
- val subBackground = animatedBilingualUnderTranslationBackgroundColor(
- bibleState = bibleState,
- verseIndex = verse,
- highlightedVerse = highlightedVerse,
- isSubTranslation = true
- ).value
- val textColor = animatedVerseTextColor(verse, highlightedVerse).value
+ SelectionContainer {
+ Column {
+ versePairs.forEachIndexed { verse, pair ->
+ val animatedMainBackground = animatedBilingualUnderTranslationBackgroundColor(
+ bibleState = bibleState,
+ verseIndex = verse,
+ highlightedVerse = highlightedVerse,
+ isSubTranslation = false
+ ).value
+ val animatedSubBackground = animatedBilingualUnderTranslationBackgroundColor(
+ bibleState = bibleState,
+ verseIndex = verse,
+ highlightedVerse = highlightedVerse,
+ isSubTranslation = true
+ ).value
+ val animatedTextColor = animatedVerseTextColor(verse, highlightedVerse).value
+ val verseNumber = verse + 1
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .verseTapGestures(
- verse = verse + 1,
- onVerseTap = onVerseTap,
- onVerseDoubleTap = onVerseDoubleTap
- )
- .onGloballyPositioned { coordinates ->
- onVersePositioned(
- verse + 1,
- VerseLayoutInfo(
- topPx = coordinates.positionInParent().y.toInt(),
- heightPx = coordinates.size.height
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .verseTapGestures(
+ verse = verseNumber,
+ onVerseTap = onVerseTap,
+ onVerseDoubleTap = onVerseDoubleTap
)
+ .onGloballyPositioned { coordinates ->
+ onVersePositioned(
+ verseNumber,
+ VerseLayoutInfo(
+ topPx = coordinates.positionInParent().y.toInt(),
+ heightPx = (coordinates.size.height - verseSpacingPx).coerceAtLeast(0)
+ )
+ )
+ }
+ ) {
+ Text(
+ text = "$verseNumber ${pair.first}",
+ style = TextStyle(
+ fontSize = bibleState.fontSize.sp,
+ fontFamily = if (bibleState.isFontFamilySerif) bibleState.mainTranslation.language.serifFontFamily() else bibleState.mainTranslation.language.sansFontFamily(),
+ color = animatedTextColor
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .background(animatedMainBackground)
)
+ Text(
+ text = "$verseNumber ${pair.second}",
+ style = TextStyle(
+ fontSize = bibleState.fontSize.sp,
+ fontFamily = if (bibleState.isFontFamilySerif) bibleState.subTranslation.language.serifFontFamily() else bibleState.subTranslation.language.sansFontFamily(),
+ color = animatedTextColor
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .background(animatedSubBackground)
+ )
+ Spacer(modifier = Modifier.height(bibleState.spaceBetweenVerses.dp))
}
- ) {
- Text(
- text = "${verse + 1} ${pair.first}",
- style = TextStyle(
- fontSize = bibleState.fontSize.sp,
- fontFamily = if (bibleState.isFontFamilySerif) bibleState.mainTranslation.language.serifFontFamily() else bibleState.mainTranslation.language.sansFontFamily(),
- color = textColor
- ),
- modifier = Modifier
- .fillMaxWidth()
- .background(mainBackground)
- )
- Text(
- text = "${verse + 1} ${pair.second}",
- style = TextStyle(
- fontSize = bibleState.fontSize.sp,
- fontFamily = if (bibleState.isFontFamilySerif) bibleState.subTranslation.language.serifFontFamily() else bibleState.subTranslation.language.sansFontFamily(),
- color = textColor
- ),
- modifier = Modifier
- .fillMaxWidth()
- .background(subBackground)
- )
- Spacer(modifier = Modifier.height(bibleState.spaceBetweenVerses.dp))
+ }
}
}
}
@@ -129,4 +137,4 @@ fun BilingualUnderBiblePreview() {
scrollState = scrollState
)
}
-}
\ No newline at end of file
+}
diff --git a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/SingleBible.kt b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/SingleBible.kt
index 8b11bf74..a873dcce 100644
--- a/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/SingleBible.kt
+++ b/app/shared/src/commonMain/kotlin/org/gnit/bible/app/ui/widgets/SingleBible.kt
@@ -7,11 +7,13 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInParent
+import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@@ -37,6 +39,7 @@ fun SingleBible(
onTitleTap: () -> Unit = {}
) {
val translation = bibleState.mainTranslation
+ val verseSpacingPx = with(LocalDensity.current) { bibleState.spaceBetweenVerses.dp.roundToPx() }
ScrollableColumn(
bibleState = bibleState,
@@ -46,44 +49,48 @@ fun SingleBible(
bottomContentPadding = bottomContentPadding,
onTitleTap = onTitleTap
) {
- verses.forEachIndexed { verse, text ->
- val background = animatedVerseBackgroundColor(bibleState, verse, highlightedVerse).value
- val textColor = animatedVerseTextColor(verse, highlightedVerse).value
+ SelectionContainer {
+ Column {
+ verses.forEachIndexed { verse, text ->
+ val animatedBackground = animatedVerseBackgroundColor(bibleState, verse, highlightedVerse).value
+ val animatedTextColor = animatedVerseTextColor(verse, highlightedVerse).value
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .verseTapGestures(
- verse = verse + 1,
- onVerseTap = onVerseTap,
- onVerseDoubleTap = onVerseDoubleTap
- )
- .onGloballyPositioned { coordinates ->
- onVersePositioned(
- verse + 1,
- VerseLayoutInfo(
- topPx = coordinates.positionInParent().y.toInt(),
- heightPx = coordinates.size.height
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .verseTapGestures(
+ verse = verse + 1,
+ onVerseTap = onVerseTap,
+ onVerseDoubleTap = onVerseDoubleTap
)
+ .onGloballyPositioned { coordinates ->
+ onVersePositioned(
+ verse + 1,
+ VerseLayoutInfo(
+ topPx = coordinates.positionInParent().y.toInt(),
+ heightPx = (coordinates.size.height - verseSpacingPx).coerceAtLeast(0)
+ )
+ )
+ }
+ ) {
+ Text(
+ text = "${verse + 1} $text",
+ style = TextStyle(
+ fontSize = bibleState.fontSize.sp,
+ fontFamily = if (bibleState.isFontFamilySerif) {
+ translation.language.serifFontFamily()
+ } else {
+ translation.language.sansFontFamily()
+ },
+ color = animatedTextColor
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .background(animatedBackground)
)
+ Spacer(modifier = Modifier.height(bibleState.spaceBetweenVerses.dp))
}
- ) {
- Text(
- text = "${verse + 1} $text",
- style = TextStyle(
- fontSize = bibleState.fontSize.sp,
- fontFamily = if (bibleState.isFontFamilySerif) {
- translation.language.serifFontFamily()
- } else {
- translation.language.sansFontFamily()
- },
- color = textColor
- ),
- modifier = Modifier
- .fillMaxWidth()
- .background(background)
- )
- Spacer(modifier = Modifier.height(bibleState.spaceBetweenVerses.dp))
+ }
}
}
}
@@ -100,4 +107,4 @@ fun SingleBiblePreview() {
scrollState = scrollState
)
}
-}
\ No newline at end of file
+}