|
|
|
|
@ -7,6 +7,7 @@ import androidx.activity.compose.LocalActivity
|
|
|
|
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
|
|
|
|
import androidx.activity.result.contract.ActivityResultContracts
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity.RESULT_OK
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
|
|
import androidx.compose.foundation.layout.PaddingValues
|
|
|
|
|
@ -20,8 +21,6 @@ import androidx.compose.foundation.layout.imePadding
|
|
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
|
|
import androidx.compose.foundation.layout.systemBars
|
|
|
|
|
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
|
|
|
|
import androidx.compose.foundation.layout.windowInsetsTopHeight
|
|
|
|
|
import androidx.compose.material3.DrawerState
|
|
|
|
|
import androidx.compose.material3.Icon
|
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
|
@ -44,6 +43,7 @@ import androidx.compose.ui.platform.LocalContext
|
|
|
|
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
|
|
|
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
|
import androidx.compose.ui.unit.LayoutDirection
|
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
|
import androidx.core.content.IntentCompat.getParcelableExtra
|
|
|
|
|
import androidx.fragment.compose.AndroidFragment
|
|
|
|
|
@ -123,7 +123,6 @@ fun HomeScreen(
|
|
|
|
|
) {
|
|
|
|
|
val context = LocalContext.current
|
|
|
|
|
val scope = rememberCoroutineScope()
|
|
|
|
|
Box(modifier = Modifier.fillMaxSize()) {
|
|
|
|
|
TaskListDrawer(
|
|
|
|
|
arrangement = if (state.menuQuery.isBlank()) Arrangement.Top else Arrangement.Bottom,
|
|
|
|
|
filters = if (state.menuQuery.isNotEmpty()) state.searchItems else state.drawerItems,
|
|
|
|
|
@ -211,23 +210,12 @@ fun HomeScreen(
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
SystemBarScrim(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.windowInsetsTopHeight(WindowInsets.systemBars)
|
|
|
|
|
.align(Alignment.TopCenter)
|
|
|
|
|
)
|
|
|
|
|
SystemBarScrim(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.windowInsetsBottomHeight(WindowInsets.systemBars)
|
|
|
|
|
.align(Alignment.BottomCenter),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
) {
|
|
|
|
|
Box(modifier = Modifier.fillMaxSize()) {
|
|
|
|
|
val scope = rememberCoroutineScope()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ListDetailPaneScaffold(
|
|
|
|
|
directive = navigator.scaffoldDirective,
|
|
|
|
|
value = navigator.scaffoldValue,
|
|
|
|
|
@ -266,17 +254,25 @@ fun HomeScreen(
|
|
|
|
|
},
|
|
|
|
|
detailPane = {
|
|
|
|
|
val direction = LocalLayoutDirection.current
|
|
|
|
|
val imeOpen = rememberImeState().value
|
|
|
|
|
val insets = windowInsets.value
|
|
|
|
|
val topPad = insets.calculateTopPadding()
|
|
|
|
|
val startPad = insets.calculateStartPadding(direction)
|
|
|
|
|
val endPad = insets.calculateEndPadding(direction)
|
|
|
|
|
val bottomPad = if (imeOpen)
|
|
|
|
|
WindowInsets.ime.asPaddingValues().calculateBottomPadding()
|
|
|
|
|
else
|
|
|
|
|
insets.calculateBottomPadding()
|
|
|
|
|
|
|
|
|
|
Box(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.fillMaxSize()
|
|
|
|
|
|
|
|
|
|
.padding(
|
|
|
|
|
top = windowInsets.value.calculateTopPadding(),
|
|
|
|
|
start = windowInsets.value.calculateStartPadding(direction),
|
|
|
|
|
end = windowInsets.value.calculateEndPadding(direction),
|
|
|
|
|
bottom = if (rememberImeState().value)
|
|
|
|
|
WindowInsets.ime.asPaddingValues().calculateBottomPadding()
|
|
|
|
|
else
|
|
|
|
|
windowInsets.value.calculateBottomPadding()
|
|
|
|
|
top = topPad,
|
|
|
|
|
start = startPad,
|
|
|
|
|
end = endPad,
|
|
|
|
|
bottom = bottomPad
|
|
|
|
|
),
|
|
|
|
|
contentAlignment = Alignment.Center,
|
|
|
|
|
) {
|
|
|
|
|
@ -304,13 +300,6 @@ fun HomeScreen(
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
SystemBarScrim(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.windowInsetsTopHeight(WindowInsets.systemBars)
|
|
|
|
|
.align(Alignment.TopCenter),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|