-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add placeholders for data
- Loading branch information
Showing
32 changed files
with
799 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
app/src/main/java/ru/neexol/rtut/presentation/components/ImagePlaceholder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ru.neexol.rtut.presentation.components | ||
|
||
import androidx.annotation.DrawableRes | ||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material.ContentAlpha | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.alpha | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
fun ImagePlaceholder( | ||
@DrawableRes iconId: Int, | ||
@StringRes labelId: Int | ||
) { | ||
Box( | ||
modifier = Modifier.fillMaxSize().imePadding(), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Column( | ||
modifier = Modifier.padding(horizontal = 90.dp).alpha(ContentAlpha.medium), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Icon( | ||
modifier = Modifier.size(80.dp), | ||
painter = painterResource(iconId), | ||
contentDescription = stringResource(labelId) | ||
) | ||
Text( | ||
text = stringResource(labelId), | ||
fontSize = 20.sp, | ||
textAlign = TextAlign.Center | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/src/main/java/ru/neexol/rtut/presentation/components/SyncPagersScroll.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package ru.neexol.rtut.presentation.components | ||
|
||
import androidx.compose.runtime.snapshotFlow | ||
import com.google.accompanist.pager.ExperimentalPagerApi | ||
import com.google.accompanist.pager.PagerState | ||
import java.math.BigDecimal | ||
|
||
@ExperimentalPagerApi | ||
fun scrollingPair(state1: PagerState, state2: PagerState) = when { | ||
state1.isScrollInProgress -> state1 to state2 | ||
state2.isScrollInProgress -> state2 to state1 | ||
else -> null | ||
} | ||
|
||
@ExperimentalPagerApi | ||
suspend fun syncScroll(pair: Pair<PagerState, PagerState>?) { | ||
val (scrollingState, followingState) = pair ?: return | ||
snapshotFlow { scrollingState.currentPage + scrollingState.currentPageOffset } | ||
.collect { pagePart -> | ||
val divideAndRemainder = BigDecimal.valueOf(pagePart.toDouble()) | ||
.divideAndRemainder(BigDecimal.ONE) | ||
|
||
followingState.scrollToPage( | ||
divideAndRemainder[0].toInt(), | ||
divideAndRemainder[1].toFloat(), | ||
) | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
app/src/main/java/ru/neexol/rtut/presentation/screens/main/ui/InitialGroupChoose.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package ru.neexol.rtut.presentation.screens.main.ui | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import kotlinx.coroutines.launch | ||
import ru.neexol.rtut.R | ||
import ru.neexol.rtut.presentation.components.GroupTextField | ||
import ru.neexol.rtut.presentation.screens.settings.SettingsViewModel | ||
|
||
@Composable | ||
fun InitialGroupChoose(vm: SettingsViewModel) { | ||
val coroutineScope = rememberCoroutineScope() | ||
val snackbarHostState = remember { SnackbarHostState() } | ||
LaunchedEffect(vm.groupUiState.message) { | ||
vm.groupUiState.message?.let { | ||
coroutineScope.launch { | ||
snackbarHostState.currentSnackbarData?.dismiss() | ||
snackbarHostState.showSnackbar(it) | ||
vm.clearGroupMessage() | ||
} | ||
} | ||
} | ||
|
||
Surface { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(MaterialTheme.colors.primaryVariant), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Column( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Icon( | ||
modifier = Modifier.size(148.dp), | ||
tint = MaterialTheme.colors.primary, | ||
painter = painterResource(R.drawable.ic_launcher_foreground), | ||
contentDescription = null | ||
) | ||
Text(stringResource(R.string.enter_group)) | ||
Spacer(Modifier.size(16.dp)) | ||
GroupTextField(stringResource(R.string.group_pattern), vm::editGroup) | ||
} | ||
SnackbarHost( | ||
hostState = snackbarHostState, | ||
modifier = Modifier.align(Alignment.BottomCenter) | ||
) | ||
} | ||
} | ||
} |
58 changes: 0 additions & 58 deletions
58
app/src/main/java/ru/neexol/rtut/presentation/screens/main/ui/InitialScreen.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.