Move clock widget out of widget column
This commit is contained in:
parent
a3be3188fa
commit
b3a36f640b
@ -44,6 +44,7 @@ import de.mm20.launcher2.ui.launcher.search.SearchBarLevel
|
|||||||
import de.mm20.launcher2.ui.launcher.search.SearchColumn
|
import de.mm20.launcher2.ui.launcher.search.SearchColumn
|
||||||
import de.mm20.launcher2.ui.launcher.search.SearchVM
|
import de.mm20.launcher2.ui.launcher.search.SearchVM
|
||||||
import de.mm20.launcher2.ui.launcher.widgets.WidgetColumn
|
import de.mm20.launcher2.ui.launcher.widgets.WidgetColumn
|
||||||
|
import de.mm20.launcher2.ui.launcher.widgets.clock.ClockWidget
|
||||||
import de.mm20.launcher2.ui.utils.rememberNotificationShadeController
|
import de.mm20.launcher2.ui.utils.rememberNotificationShadeController
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
@ -290,7 +291,7 @@ fun PagerScaffold(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetColumn(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.requiredWidth(width)
|
.requiredWidth(width)
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
@ -299,14 +300,30 @@ fun PagerScaffold(
|
|||||||
.windowInsetsPadding(WindowInsets.safeDrawing)
|
.windowInsetsPadding(WindowInsets.safeDrawing)
|
||||||
.padding(horizontal = 8.dp)
|
.padding(horizontal = 8.dp)
|
||||||
.padding(top = 8.dp, bottom = 64.dp)
|
.padding(top = 8.dp, bottom = 64.dp)
|
||||||
.padding(top = editModePadding),
|
.padding(top = editModePadding)
|
||||||
clockHeight = { clockHeight },
|
) {
|
||||||
clockBottomPadding = { clockPadding },
|
|
||||||
editMode = isWidgetEditMode,
|
AnimatedVisibility(!isWidgetEditMode) {
|
||||||
onEditModeChange = {
|
Box(
|
||||||
viewModel.setWidgetEditMode(it)
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.then(clockHeight?.let { Modifier.height(it) } ?: Modifier)
|
||||||
|
.padding(bottom = clockPadding),
|
||||||
|
contentAlignment = Alignment.BottomCenter
|
||||||
|
) {
|
||||||
|
ClockWidget(
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
WidgetColumn(
|
||||||
|
editMode = isWidgetEditMode,
|
||||||
|
onEditModeChange = {
|
||||||
|
viewModel.setWidgetEditMode(it)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
val websearches by searchVM.websearchResults.observeAsState(emptyList())
|
val websearches by searchVM.websearchResults.observeAsState(emptyList())
|
||||||
|
|||||||
@ -41,6 +41,7 @@ import de.mm20.launcher2.ui.launcher.search.SearchBarLevel
|
|||||||
import de.mm20.launcher2.ui.launcher.search.SearchColumn
|
import de.mm20.launcher2.ui.launcher.search.SearchColumn
|
||||||
import de.mm20.launcher2.ui.launcher.search.SearchVM
|
import de.mm20.launcher2.ui.launcher.search.SearchVM
|
||||||
import de.mm20.launcher2.ui.launcher.widgets.WidgetColumn
|
import de.mm20.launcher2.ui.launcher.widgets.WidgetColumn
|
||||||
|
import de.mm20.launcher2.ui.launcher.widgets.clock.ClockWidget
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@ -307,9 +308,9 @@ fun PullDownScaffold(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WidgetColumn(
|
|
||||||
modifier =
|
Column(
|
||||||
Modifier
|
modifier = Modifier
|
||||||
.graphicsLayer {
|
.graphicsLayer {
|
||||||
transformOrigin = TransformOrigin.Center
|
transformOrigin = TransformOrigin.Center
|
||||||
scaleX = 1 - offset
|
scaleX = 1 - offset
|
||||||
@ -321,14 +322,28 @@ fun PullDownScaffold(
|
|||||||
.verticalScroll(widgetsScrollState)
|
.verticalScroll(widgetsScrollState)
|
||||||
.windowInsetsPadding(WindowInsets.safeDrawing)
|
.windowInsetsPadding(WindowInsets.safeDrawing)
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
.padding(top = 56.dp),
|
.padding(top = 56.dp)
|
||||||
clockHeight = { clockHeight },
|
) {
|
||||||
clockBottomPadding = { clockPadding },
|
AnimatedVisibility(!isWidgetEditMode) {
|
||||||
editMode = isWidgetEditMode,
|
Box(
|
||||||
onEditModeChange = {
|
modifier = Modifier
|
||||||
viewModel.setWidgetEditMode(it)
|
.fillMaxWidth()
|
||||||
|
.then(clockHeight?.let { Modifier.height(it) } ?: Modifier)
|
||||||
|
.padding(bottom = clockPadding),
|
||||||
|
contentAlignment = Alignment.BottomCenter
|
||||||
|
) {
|
||||||
|
ClockWidget(
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
WidgetColumn(
|
||||||
|
editMode = isWidgetEditMode,
|
||||||
|
onEditModeChange = {
|
||||||
|
viewModel.setWidgetEditMode(it)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,8 +63,6 @@ import kotlinx.coroutines.launch
|
|||||||
@Composable
|
@Composable
|
||||||
fun WidgetColumn(
|
fun WidgetColumn(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
clockHeight: () -> Dp? = { null },
|
|
||||||
clockBottomPadding: () -> Dp = { 0.dp },
|
|
||||||
editMode: Boolean = false,
|
editMode: Boolean = false,
|
||||||
onEditModeChange: (Boolean) -> Unit,
|
onEditModeChange: (Boolean) -> Unit,
|
||||||
) {
|
) {
|
||||||
@ -103,20 +101,6 @@ fun WidgetColumn(
|
|||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
var showAddDialog by remember { mutableStateOf(false) }
|
var showAddDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
AnimatedVisibility(!editMode) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.then(clockHeight()?.let { Modifier.height(it) } ?: Modifier)
|
|
||||||
.padding(bottom = clockBottomPadding()),
|
|
||||||
contentAlignment = Alignment.BottomCenter
|
|
||||||
) {
|
|
||||||
ClockWidget(
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Column {
|
Column {
|
||||||
val widgets by viewModel.widgets.observeAsState(emptyList())
|
val widgets by viewModel.widgets.observeAsState(emptyList())
|
||||||
val swapThresholds = remember(widgets) {
|
val swapThresholds = remember(widgets) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user