fix: 看图页面底栏内容颜色

This commit is contained in:
HuanCheng65 2023-05-05 22:56:45 +08:00
parent c347420dee
commit 7d8c7ed3e6
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
1 changed files with 70 additions and 67 deletions

View File

@ -5,6 +5,7 @@ import android.net.Uri
import android.os.Build import android.os.Build
import android.view.MotionEvent import android.view.MotionEvent
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
@ -13,6 +14,8 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Icon import androidx.compose.material.Icon
import androidx.compose.material.IconButton import androidx.compose.material.IconButton
@ -40,9 +43,6 @@ import com.github.panpf.sketch.displayImage
import com.github.panpf.sketch.zoom.Edge import com.github.panpf.sketch.zoom.Edge
import com.github.panpf.sketch.zoom.ReadModeDecider import com.github.panpf.sketch.zoom.ReadModeDecider
import com.github.panpf.sketch.zoom.SketchZoomImageView import com.github.panpf.sketch.zoom.SketchZoomImageView
import com.google.accompanist.pager.ExperimentalPagerApi
import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.rememberPagerState
import com.huanchengfly.tieba.post.R import com.huanchengfly.tieba.post.R
import com.huanchengfly.tieba.post.arch.BaseComposeActivityWithParcelable import com.huanchengfly.tieba.post.arch.BaseComposeActivityWithParcelable
import com.huanchengfly.tieba.post.arch.collectPartialAsState import com.huanchengfly.tieba.post.arch.collectPartialAsState
@ -50,6 +50,7 @@ import com.huanchengfly.tieba.post.models.protos.PhotoViewData
import com.huanchengfly.tieba.post.toastShort import com.huanchengfly.tieba.post.toastShort
import com.huanchengfly.tieba.post.ui.common.theme.compose.ExtendedTheme import com.huanchengfly.tieba.post.ui.common.theme.compose.ExtendedTheme
import com.huanchengfly.tieba.post.ui.widgets.compose.LazyLoad import com.huanchengfly.tieba.post.ui.widgets.compose.LazyLoad
import com.huanchengfly.tieba.post.ui.widgets.compose.ProvideContentColor
import com.huanchengfly.tieba.post.utils.ImageUtil import com.huanchengfly.tieba.post.utils.ImageUtil
import com.huanchengfly.tieba.post.utils.download import com.huanchengfly.tieba.post.utils.download
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -137,7 +138,7 @@ class PhotoViewActivity : BaseComposeActivityWithParcelable<PhotoViewData>() {
override val dataExtraKey: String = EXTRA_PHOTO_VIEW_DATA override val dataExtraKey: String = EXTRA_PHOTO_VIEW_DATA
@OptIn(ExperimentalPagerApi::class) @OptIn(ExperimentalFoundationApi::class)
@Composable @Composable
override fun createContent(data: PhotoViewData) { override fun createContent(data: PhotoViewData) {
LazyLoad(loaded = viewModel.initialized) { LazyLoad(loaded = viewModel.initialized) {
@ -174,7 +175,7 @@ class PhotoViewActivity : BaseComposeActivityWithParcelable<PhotoViewData>() {
} }
Box(modifier = Modifier.fillMaxSize()) { Box(modifier = Modifier.fillMaxSize()) {
HorizontalPager( HorizontalPager(
count = pageCount, pageCount = pageCount,
state = pagerState, state = pagerState,
key = { key = {
"${items[it].originUrl}_${items[it].overallIndex}" "${items[it].originUrl}_${items[it].overallIndex}"
@ -207,6 +208,7 @@ class PhotoViewActivity : BaseComposeActivityWithParcelable<PhotoViewData>() {
.fillMaxWidth() .fillMaxWidth()
.align(Alignment.BottomCenter) .align(Alignment.BottomCenter)
) { ) {
ProvideContentColor(color = Color.White) {
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@ -279,6 +281,7 @@ class PhotoViewActivity : BaseComposeActivityWithParcelable<PhotoViewData>() {
} }
} }
} }
}
override fun dispatchTouchEvent(ev: MotionEvent): Boolean { override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
return try { return try {