1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-2332 Multiplayer | Fix | Fix scrolling behavior on space-list screen (#1176)

This commit is contained in:
Evgenii Kozlov 2024-04-25 12:44:48 +02:00 committed by uburoiubu
parent dea9ddf57c
commit 34a7718f5b
No known key found for this signature in database
GPG key ID: C8FB80E0A595FBB6
4 changed files with 21 additions and 12 deletions

View file

@ -136,7 +136,7 @@ class ProfileSettingsFragment : BaseBottomSheetComposeFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupBottomSheetBehavior(PADDING_TOP)
setupBottomSheetBehavior(DEFAULT_PADDING_TOP)
}
override fun onStart() {
@ -191,6 +191,4 @@ class ProfileSettingsFragment : BaseBottomSheetComposeFragment() {
}
}
private const val PADDING_TOP = 28
private const val SELECT_IMAGE_CODE = 1

View file

@ -10,6 +10,7 @@ import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.fragment.app.viewModels
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.anytypeio.anytype.core_ui.features.multiplayer.SpaceListScreen
import com.anytypeio.anytype.core_utils.ext.setupBottomSheetBehavior
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
import com.anytypeio.anytype.di.common.componentManager
import com.anytypeio.anytype.presentation.spaces.SpaceListViewModel
@ -38,6 +39,10 @@ class SpaceListFragment : BaseBottomSheetComposeFragment() {
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupBottomSheetBehavior(DEFAULT_PADDING_TOP)
}
override fun injectDependencies() {
componentManager().spaceListComponent.get().inject(this)

View file

@ -18,6 +18,8 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
@ -45,7 +47,9 @@ fun SpaceListScreen(
state: ViewState<List<SpaceListItemView>>
) {
Column(
modifier = Modifier.fillMaxSize()
modifier = Modifier
.fillMaxSize()
.nestedScroll(rememberNestedScrollInteropConnection())
) {
Dragger(
modifier = Modifier
@ -53,12 +57,8 @@ fun SpaceListScreen(
.align(Alignment.CenterHorizontally)
)
Header(text = stringResource(id = R.string.multiplayer_spaces))
if (state is ViewState.Success) {
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.weight(1.0f)
) {
LazyColumn {
if (state is ViewState.Success) {
itemsIndexed(
items = state.data,
itemContent = { idx, item ->
@ -68,8 +68,10 @@ fun SpaceListScreen(
permissions = item.permissions,
spaceIcon = item.icon,
modifier = Modifier.padding(
horizontal = 10.dp,
vertical = 7.dp
start = 10.dp,
end = 10.dp,
top = 7.dp,
bottom = if (idx == state.data.lastIndex) 24.dp else 7.dp
)
)
},

View file

@ -105,6 +105,10 @@ abstract class BaseBottomSheetComposeFragment : BottomSheetDialogFragment() {
open fun releaseDependencies() {
// Inject nothing by default. Override to inject.
}
companion object {
const val DEFAULT_PADDING_TOP = 28
}
}
fun Fragment.getNavigationId() = findNavController().currentDestination?.id