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

Swipe profile through media #546

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
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 @@ -32,11 +32,13 @@ import java.net.URLDecoder
actual fun PlatformStatusMediaScene(
statusKey: String,
selectedIndex: Int?,
userKey: String?,
navigator: Navigator,
) {
StatusMediaScene(
statusKey = statusKey,
selectedIndex = selectedIndex ?: 0,
userKey = userKey,
navigator = navigator,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.min
import com.google.accompanist.pager.ExperimentalPagerApi
import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.rememberPagerState
import com.twidere.services.microblog.model.IRelationship
import com.twidere.twiderex.component.foundation.DropdownMenu
import com.twidere.twiderex.component.foundation.DropdownMenuItem
import com.twidere.twiderex.component.foundation.HorizontalDivider
import com.twidere.twiderex.component.foundation.NetworkImage
import com.twidere.twiderex.component.foundation.Pager
import com.twidere.twiderex.component.foundation.SwipeToRefreshLayout
import com.twidere.twiderex.component.foundation.rememberPagerState
import com.twidere.twiderex.component.lazy.ui.LazyUiStatusImageList
import com.twidere.twiderex.component.lazy.ui.LazyUiStatusList
import com.twidere.twiderex.component.status.HtmlText
Expand Down Expand Up @@ -144,7 +144,9 @@ fun UserComponent(
) {
UserMediaTimeline(
state = state.userMediaTimelineState,
openMedia = userNavigationData.statusNavigation.toMediaWithIndex,
openMedia = { statusKey, index ->
userNavigationData.statusNavigation.toMediaWithIndex(statusKey, index, userKey)
},
)
},
).let {
Expand Down Expand Up @@ -186,7 +188,7 @@ fun UserComponent(
)
},
content = {
val pagerState = rememberPagerState(pageCount = tabs.size)
val pagerState = rememberPagerState()
Column {
val scope = rememberCoroutineScope()
TabRow(
Expand All @@ -206,7 +208,7 @@ fun UserComponent(
selected = pagerState.currentPage == index,
onClick = {
scope.launch {
pagerState.currentPage = index
pagerState.animateScrollToPage(index)
}
},
content = {
Expand All @@ -223,11 +225,11 @@ fun UserComponent(
)
}
}
Pager(
HorizontalPager(
count = tabs.size,
modifier = Modifier.weight(1f),
state = pagerState,
offscreenLimit = 0,
) {
) { page ->
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.TopCenter,
Expand Down
Loading