mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Merge branch '11-dev' of https://github.com/LawnchairLauncher/lawnchair into 11-dev
This commit is contained in:
@@ -63,7 +63,17 @@ fun HiddenAppsPreferences() {
|
||||
val apps = optionalApps.get()
|
||||
val toggleHiddenApp = { app: App ->
|
||||
val key = app.key.toString()
|
||||
if (hiddenApps.contains(key)) hiddenApps -= key else hiddenApps += key
|
||||
val newSet = apps
|
||||
.filter { hiddenApps.contains(it.key.toString()) }
|
||||
.map { it.key.toString() }
|
||||
.toMutableSet()
|
||||
val isHidden = !hiddenApps.contains(key)
|
||||
if (isHidden) {
|
||||
newSet.add(key)
|
||||
} else {
|
||||
newSet.remove(key)
|
||||
}
|
||||
hiddenApps = newSet
|
||||
}
|
||||
PreferenceLayoutLazyColumn {
|
||||
preferenceGroupItems(apps, isFirstChild = true) { index, app ->
|
||||
|
||||
@@ -52,11 +52,13 @@ class PreferenceViewModel(application: Application) : AndroidViewModel(applicati
|
||||
)
|
||||
|
||||
for (info in list) {
|
||||
iconPacks[info.activityInfo.packageName] = IconPackInfo(
|
||||
info.loadLabel(pm).toString(),
|
||||
info.activityInfo.packageName,
|
||||
info.loadIcon(pm)
|
||||
)
|
||||
iconPacks.getOrPut(info.activityInfo.packageName) {
|
||||
IconPackInfo(
|
||||
info.loadLabel(pm).toString(),
|
||||
info.activityInfo.packageName,
|
||||
info.loadIcon(pm)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val iconPackList = iconPacks.values.toMutableList()
|
||||
|
||||
@@ -34,23 +34,5 @@ fun SystemUi() {
|
||||
color = Color.Transparent,
|
||||
darkIcons = useDarkIcons
|
||||
)
|
||||
|
||||
// setStatusBarsColor() and setNavigationBarsColor() also exist
|
||||
}
|
||||
}
|
||||
// LawnchairTheme {
|
||||
// window.statusBarColor = MaterialTheme.colors.background.toArgb()
|
||||
// window.navigationBarColor = MaterialTheme.colors.background.toArgb()
|
||||
//
|
||||
// @Suppress("DEPRECATION")
|
||||
// if (MaterialTheme.colors.background.luminance() > 0.5f) {
|
||||
// window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or
|
||||
// View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
// }
|
||||
//
|
||||
// @Suppress("DEPRECATION")
|
||||
// if (MaterialTheme.colors.background.luminance() > 0.5f && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or
|
||||
// View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -6,9 +6,11 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.ModalBottomSheetValue
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@@ -26,6 +28,7 @@ import com.android.launcher3.Insettable
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.icons.GraphicsUtils
|
||||
import com.android.launcher3.uioverrides.WallpaperColorInfo
|
||||
import com.android.launcher3.util.SystemUiController
|
||||
import com.google.accompanist.insets.ProvideWindowInsets
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -55,8 +58,13 @@ class ComposeFloatingView(context: Context) :
|
||||
handler(animate)
|
||||
}
|
||||
|
||||
fun setSystemUiFlags(flags: Int) {
|
||||
launcher.systemUiController.updateUiState(SystemUiController.UI_STATE_WIDGET_BOTTOM_SHEET, flags)
|
||||
}
|
||||
|
||||
fun removeFromDragLayer() {
|
||||
launcher.dragLayer.removeView(this)
|
||||
launcher.systemUiController.updateUiState(SystemUiController.UI_STATE_WIDGET_BOTTOM_SHEET, 0)
|
||||
}
|
||||
|
||||
override fun setInsets(insets: Rect) {
|
||||
@@ -125,6 +133,7 @@ fun LawnchairLauncher.showBottomSheet(
|
||||
state.show()
|
||||
}
|
||||
|
||||
SystemUi(setStatusBar = false)
|
||||
BottomSheet(
|
||||
sheetState = state,
|
||||
sheetContent = {
|
||||
@@ -134,3 +143,23 @@ fun LawnchairLauncher.showBottomSheet(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ComposeFloatingView.SystemUi(setStatusBar: Boolean = true, setNavBar: Boolean = true) {
|
||||
val useDarkIcons = MaterialTheme.colors.isLight
|
||||
|
||||
SideEffect {
|
||||
var flags = 0
|
||||
if (setStatusBar) {
|
||||
flags = flags or (
|
||||
if (useDarkIcons) SystemUiController.FLAG_LIGHT_STATUS
|
||||
else SystemUiController.FLAG_DARK_STATUS)
|
||||
}
|
||||
if (setNavBar) {
|
||||
flags = flags or (
|
||||
if (useDarkIcons) SystemUiController.FLAG_LIGHT_NAV
|
||||
else SystemUiController.FLAG_DARK_NAV)
|
||||
}
|
||||
setSystemUiFlags(flags)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user