feat: exit selection mode on back press
This commit is contained in:
1 parent
2513c76e52
commit
32f3a7d7cc
2 files changed
+10
No files matched your search
@@ -13,6 +13,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.IntentSenderRequest
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
@@ -90,6 +91,10 @@ fun GalleryScreen(
|
||||
val scope = rememberCoroutineScope()
|
||||
var shouldRenderGrid by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
BackHandler(enabled = isSelectionMode) {
|
||||
viewModel.exitSelectionMode()
|
||||
}
|
||||
|
||||
val launcher = rememberLauncherForActivityResult(
|
||||
contract = ActivityResultContracts.GetMultipleContents()
|
||||
) { uris ->
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.hinnka.mycamera.ui.settings
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.net.Uri
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
@@ -178,6 +179,10 @@ fun FilterManagementScreen(
|
||||
var selectedIds by remember { mutableStateOf(setOf<String>()) }
|
||||
val isSelectionMode = selectedIds.isNotEmpty()
|
||||
|
||||
BackHandler(enabled = isSelectionMode) {
|
||||
selectedIds = emptySet()
|
||||
}
|
||||
|
||||
// 分类管理状态
|
||||
val categoryOrder by viewModel.categoryOrder.collectAsState(emptyList())
|
||||
var showCategoryManagement by remember { mutableStateOf(false) }
|
||||
|
||||
Reference in new issue
Block a user