Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the position of the page number for line pages #3019

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Spacer
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.unit.LayoutDirection
import com.quran.data.source.PageContentType
import com.quran.labs.androidquran.extra.feature.linebyline.model.PageInfo
import com.quran.labs.androidquran.extra.feature.linebyline.model.SidelinesPosition
Expand Down Expand Up @@ -132,12 +135,19 @@ fun QuranPageWrapper(
"" to displayInfo.localizedPageText
}

QuranHeaderFooter(
leftText,
rightText,
overlayColor,
modifier = Modifier
)
// always render the footer as LTR, otherwise, the page number will be rendered
// on the wrong side of the page for RTL due to Row being smart and flipping the
// children based on LTR/RTL. We want this flipping for the header, but not for
// the footer, so that the page number is always on the right side for odd numbered
// pages and always on the left side for even numbered pages.
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
QuranHeaderFooter(
leftText,
rightText,
overlayColor,
modifier = Modifier
)
}
} else {
Spacer(modifier = Modifier)
}
Expand Down
Loading