parent
8b6ffa9b7a
commit
ba6190c95f
|
|
@ -4,7 +4,7 @@
|
|||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2026-03-11T09:00:47.807813Z">
|
||||
<DropdownSelection timestamp="2026-03-12T03:05:40.770377400Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=JRBI89BIE6AI5TG6" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package com.img.rabbit.bean.local
|
||||
|
||||
data class UIItemBean(
|
||||
val id: Int,
|
||||
val name: String,
|
||||
val icon: Int,
|
||||
val route: String
|
||||
)
|
||||
|
|
@ -194,7 +194,7 @@ fun MainScreen(generalViewModel: GeneralViewModel, loginViewModel: LoginViewMode
|
|||
composable(ScreenRoute.Cutout.route) {
|
||||
CutoutScreen(navController = navController)
|
||||
}
|
||||
// 证件页面(Certificate)
|
||||
// 改尺寸证件页面(Certificate)
|
||||
composable(ScreenRoute.Resize.route) {
|
||||
ResizeScreen(navController = navController)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.img.rabbit.pages.screen
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.Image
|
||||
|
|
@ -35,6 +36,7 @@ import androidx.compose.runtime.mutableStateOf
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshots.SnapshotStateMap
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
|
@ -47,11 +49,15 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import coil3.compose.AsyncImage
|
||||
import com.img.rabbit.R
|
||||
import com.img.rabbit.bean.local.UIItemBean
|
||||
import com.img.rabbit.bean.response.UniVersionEntity
|
||||
import com.img.rabbit.components.CenterToast
|
||||
import com.img.rabbit.pages.LoadingCallback
|
||||
import com.img.rabbit.provider.storage.PreferenceUtil
|
||||
|
|
@ -82,6 +88,13 @@ fun HomeScreen(
|
|||
val scope: CoroutineScope = rememberCoroutineScope()
|
||||
val progressPair = remember { mutableStateMapOf<String, Float>() }
|
||||
|
||||
val otherItems = mutableListOf<UIItemBean>().apply {
|
||||
add(UIItemBean(id = 1, name = "拼长图", icon = R.mipmap.ic_home_other_1_puzzle, route = ScreenRoute.LongImage.route))
|
||||
add(UIItemBean(id = 2, name = "格式转换", icon = R.mipmap.ic_home_other_2_format, route = ScreenRoute.Format.route))
|
||||
add(UIItemBean(id = 3, name = "改尺寸", icon = R.mipmap.ic_home_other_3_size, route = ScreenRoute.Resize.route))
|
||||
add(UIItemBean(id = 4, name = "拍照指南", icon = R.mipmap.ic_home_other_4_camera, route = ScreenRoute.CameraGuide.route))
|
||||
}
|
||||
|
||||
// 获取当前路由状态
|
||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||
val currentRoute = navBackStackEntry?.destination?.route
|
||||
|
|
@ -201,69 +214,15 @@ fun HomeScreen(
|
|||
interactionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
val uniMp = uniVersionConfig[0]
|
||||
val uniMpId = uniMp.unimp_id
|
||||
// 处理点击事件,微信模拟器
|
||||
if (UniAppUtils.isDownloadUniMp(uniMp)) {
|
||||
//强制更新(更新释放新版本并启动)
|
||||
UniAppUtils.downloadWGT(
|
||||
dealUniMpDownloadLaunch(
|
||||
context,
|
||||
scope,
|
||||
uniMp
|
||||
) { uniState, _, progress ->
|
||||
progressPair[uniMpId]
|
||||
?: mutableMapOf<String, Float>().apply { put(uniMpId, 0f) }
|
||||
when (uniState) {
|
||||
UniMpUpdate.DOWNLOAD_START -> {
|
||||
//资源开始下载
|
||||
progressPair.apply { put(uniMpId, 0f) }
|
||||
Log.i(TAG, "DOWNLOAD_START")
|
||||
}
|
||||
|
||||
UniMpUpdate.DOWNLOAD_FINISH -> {
|
||||
//资源下载完成
|
||||
progressPair.apply { put(uniMpId, 1f) }
|
||||
Log.i(TAG, "DOWNLOAD_FINISH")
|
||||
}
|
||||
|
||||
UniMpUpdate.DOWNLOAD_FAIL -> {
|
||||
//资源下载失败
|
||||
progressPair.apply { put(uniMpId, -1f) }
|
||||
Log.i(TAG, "DOWNLOAD_FAIL")
|
||||
}
|
||||
|
||||
else -> {
|
||||
//资源下载进度
|
||||
if (progress != null) {
|
||||
progressPair.apply {
|
||||
put(
|
||||
uniMpId,
|
||||
progress
|
||||
uniMp,
|
||||
progressPair,
|
||||
reportViewModel,
|
||||
loadingCallback
|
||||
)
|
||||
}
|
||||
Log.i(
|
||||
TAG,
|
||||
"DOWNLOAD_PROGRESS:$progress"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (UniAppUtils.isUpdate(uniMp)) {
|
||||
// 提示更新(1、更新释放新版本并启动;2、直接启动现有版本)
|
||||
UniAppUtils.currentUpdateUniMp = uniMp
|
||||
scope.launch {
|
||||
GlobalEventBus.emit(
|
||||
GlobalEvent.ShowUniUpdateNotify(uniMp))
|
||||
}
|
||||
} else {
|
||||
loadingCallback?.showLoading()
|
||||
//启动uni小程序(1、直接启动;2、释放并启动)
|
||||
UniAppUtils.distributeUniMp(context, uniMp, reportViewModel) {
|
||||
loadingCallback?.hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
) {
|
||||
val uniMpId = uniVersionConfig[0].unimp_id
|
||||
val uniIcon = uniVersionConfig[0].icon
|
||||
|
|
@ -325,74 +284,15 @@ fun HomeScreen(
|
|||
interactionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
val uniMp = uniVersionConfig[1]
|
||||
val uniMpId = uniMp.unimp_id
|
||||
// 处理点击事件,微信模拟器
|
||||
if (UniAppUtils.isDownloadUniMp(uniMp)) {
|
||||
//强制更新(更新释放新版本并启动)
|
||||
UniAppUtils.downloadWGT(
|
||||
dealUniMpDownloadLaunch(
|
||||
context,
|
||||
scope,
|
||||
uniMp
|
||||
) { uniState, _, progress ->
|
||||
progressPair[uniMpId]
|
||||
?: mutableMapOf<String, Float>().apply {
|
||||
put(
|
||||
uniMpId,
|
||||
0f
|
||||
uniMp,
|
||||
progressPair,
|
||||
reportViewModel,
|
||||
loadingCallback
|
||||
)
|
||||
}
|
||||
when (uniState) {
|
||||
UniMpUpdate.DOWNLOAD_START -> {
|
||||
//资源开始下载
|
||||
progressPair.apply { put(uniMpId, 0f) }
|
||||
Log.i(TAG, "DOWNLOAD_START")
|
||||
}
|
||||
|
||||
UniMpUpdate.DOWNLOAD_FINISH -> {
|
||||
//资源下载完成
|
||||
progressPair.apply { put(uniMpId, 1f) }
|
||||
Log.i(TAG, "DOWNLOAD_FINISH")
|
||||
}
|
||||
|
||||
UniMpUpdate.DOWNLOAD_FAIL -> {
|
||||
//资源下载失败
|
||||
progressPair.apply { put(uniMpId, -1f) }
|
||||
Log.i(TAG, "DOWNLOAD_FAIL")
|
||||
}
|
||||
|
||||
else -> {
|
||||
//资源下载进度
|
||||
if (progress != null) {
|
||||
progressPair.apply {
|
||||
put(
|
||||
uniMpId,
|
||||
progress
|
||||
)
|
||||
}
|
||||
Log.i(
|
||||
TAG,
|
||||
"DOWNLOAD_PROGRESS:$progress"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (UniAppUtils.isUpdate(uniMp)) {
|
||||
// 提示更新(1、更新释放新版本并启动;2、直接启动现有版本)
|
||||
UniAppUtils.currentUpdateUniMp = uniMp
|
||||
scope.launch {
|
||||
GlobalEventBus.emit(
|
||||
GlobalEvent.ShowUniUpdateNotify(uniMp))
|
||||
}
|
||||
} else {
|
||||
loadingCallback?.showLoading()
|
||||
//启动uni小程序(1、直接启动;2、释放并启动)
|
||||
UniAppUtils.distributeUniMp(context, uniMp, reportViewModel) {
|
||||
loadingCallback?.hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
) {
|
||||
val uniMpId = uniVersionConfig[1].unimp_id
|
||||
val uniIcon = uniVersionConfig[1].icon
|
||||
|
|
@ -1276,6 +1176,14 @@ fun HomeScreen(
|
|||
//其他
|
||||
item {
|
||||
//其他
|
||||
OtherItems(navController, generalViewModel, otherItems)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun OtherItems(navController: NavController, generalViewModel: GeneralViewModel, data: List<UIItemBean>){
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
|
@ -1294,7 +1202,8 @@ fun HomeScreen(
|
|||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, end = 16.dp, top = 12.dp)
|
||||
){
|
||||
) {
|
||||
data.forEachIndexed { index, item ->
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentWidth()
|
||||
|
|
@ -1305,103 +1214,19 @@ fun HomeScreen(
|
|||
) {
|
||||
// 隐藏TabBar
|
||||
generalViewModel.setNavigationBarVisible(false)
|
||||
|
||||
// 跳转格式页面
|
||||
navController.navigate(ScreenRoute.LongImage.route)
|
||||
}
|
||||
) {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(start = 8.dp)
|
||||
.align(Alignment.Center)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.mipmap.ic_home_other_1_puzzle),
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.align(Alignment.CenterHorizontally),
|
||||
contentDescription = null,
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "拼长图",
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color(0xFF1A1A1A),
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(top = 12.dp)
|
||||
.align(Alignment.CenterHorizontally)
|
||||
)
|
||||
}
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(8.dp)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentWidth()
|
||||
.weight(1f)
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
// 隐藏TabBar
|
||||
generalViewModel.setNavigationBarVisible(false)
|
||||
// 跳转格式页面
|
||||
navController.navigate(ScreenRoute.Format.route)
|
||||
}
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(start = 8.dp)
|
||||
.align(Alignment.Center)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.mipmap.ic_home_other_2_format),
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.align(Alignment.CenterHorizontally),
|
||||
contentDescription = null,
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "格式转换",
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color(0xFF1A1A1A),
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(top = 12.dp)
|
||||
.align(Alignment.CenterHorizontally)
|
||||
)
|
||||
}
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(8.dp)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentWidth()
|
||||
.weight(1f)
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
// 隐藏TabBar
|
||||
generalViewModel.setNavigationBarVisible(false)
|
||||
// 跳转证件页面
|
||||
navController.apply {
|
||||
// 带参数
|
||||
if(item.id == 3){
|
||||
currentBackStackEntry?.savedStateHandle?.set("width", 25f)
|
||||
currentBackStackEntry?.savedStateHandle?.set("height", 35f)
|
||||
navigate(ScreenRoute.Resize.route)
|
||||
}
|
||||
navigate(item.route)
|
||||
}
|
||||
}
|
||||
) {
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
|
|
@ -1409,7 +1234,7 @@ fun HomeScreen(
|
|||
.align(Alignment.Center)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.mipmap.ic_home_other_3_size),
|
||||
painter = painterResource(id = item.icon),
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.align(Alignment.CenterHorizontally),
|
||||
|
|
@ -1417,7 +1242,7 @@ fun HomeScreen(
|
|||
)
|
||||
|
||||
Text(
|
||||
text = "改尺寸",
|
||||
text = item.name,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color(0xFF1A1A1A),
|
||||
|
|
@ -1428,73 +1253,95 @@ fun HomeScreen(
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
if(index != data.size - 1){
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(8.dp)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentWidth()
|
||||
.weight(1f)
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
// 隐藏TabBar
|
||||
generalViewModel.setNavigationBarVisible(false)
|
||||
// 跳转拍照指南页面
|
||||
navController.navigate(ScreenRoute.CameraGuide.route)
|
||||
}
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(start = 8.dp)
|
||||
.align(Alignment.Center)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.mipmap.ic_home_other_4_camera),
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.align(Alignment.CenterHorizontally),
|
||||
contentDescription = null,
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "拍照指南",
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color(0xFF1A1A1A),
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(top = 12.dp)
|
||||
.align(Alignment.CenterHorizontally)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(56.dp)
|
||||
}
|
||||
}
|
||||
|
||||
//处理模拟器下载和启动逻辑
|
||||
private fun dealUniMpDownloadLaunch(
|
||||
context: Context,
|
||||
scope: CoroutineScope,
|
||||
uniMp: UniVersionEntity,
|
||||
progressPair: SnapshotStateMap<String, Float>,
|
||||
reportViewModel: ReportViewModel,
|
||||
loadingCallback: LoadingCallback?){
|
||||
val TAG = "Rabbit_HomeScreen"
|
||||
|
||||
val uniMpId = uniMp.unimp_id
|
||||
// 处理点击事件,微信模拟器
|
||||
if (UniAppUtils.isDownloadUniMp(uniMp)) {
|
||||
//强制更新(更新释放新版本并启动)
|
||||
UniAppUtils.downloadWGT(
|
||||
context,
|
||||
scope,
|
||||
uniMp
|
||||
) { uniState, _, progress ->
|
||||
progressPair[uniMpId]
|
||||
?: mutableMapOf<String, Float>().apply { put(uniMpId, 0f) }
|
||||
when (uniState) {
|
||||
UniMpUpdate.DOWNLOAD_START -> {
|
||||
//资源开始下载
|
||||
progressPair.apply { put(uniMpId, 0f) }
|
||||
Log.i(TAG, "DOWNLOAD_START")
|
||||
}
|
||||
|
||||
UniMpUpdate.DOWNLOAD_FINISH -> {
|
||||
//资源下载完成
|
||||
progressPair.apply { put(uniMpId, 1f) }
|
||||
Log.i(TAG, "DOWNLOAD_FINISH")
|
||||
}
|
||||
|
||||
UniMpUpdate.DOWNLOAD_FAIL -> {
|
||||
//资源下载失败
|
||||
progressPair.apply { put(uniMpId, -1f) }
|
||||
Log.i(TAG, "DOWNLOAD_FAIL")
|
||||
}
|
||||
|
||||
else -> {
|
||||
//资源下载进度
|
||||
if (progress != null) {
|
||||
progressPair.apply {
|
||||
put(
|
||||
uniMpId,
|
||||
progress
|
||||
)
|
||||
}
|
||||
Log.i(
|
||||
TAG,
|
||||
"DOWNLOAD_PROGRESS:$progress"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (UniAppUtils.isUpdate(uniMp)) {
|
||||
// 提示更新(1、更新释放新版本并启动;2、直接启动现有版本)
|
||||
UniAppUtils.currentUpdateUniMp = uniMp
|
||||
scope.launch {
|
||||
GlobalEventBus.emit(
|
||||
GlobalEvent.ShowUniUpdateNotify(uniMp))
|
||||
}
|
||||
} else {
|
||||
loadingCallback?.showLoading()
|
||||
//启动uni小程序(1、直接启动;2、释放并启动)
|
||||
UniAppUtils.distributeUniMp(context, uniMp, reportViewModel) {
|
||||
loadingCallback?.hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun PreviewHomeScreen() {
|
||||
HomeScreen(navController = rememberNavController(), loginViewModel = viewModel(), generalViewModel = viewModel(), reportViewModel = viewModel(), object: LoadingCallback{
|
||||
override fun showLoading() {
|
||||
|
||||
}
|
||||
|
||||
override fun hideLoading() {
|
||||
|
||||
}
|
||||
})
|
||||
private fun PreviewOtherItems() {
|
||||
OtherItems(navController = rememberNavController(), generalViewModel = viewModel(), data = mutableListOf(UIItemBean(0,"其他",0,"")))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
|
|
@ -120,7 +122,9 @@ fun FormatScreen(navController: NavController) {
|
|||
} else {
|
||||
// 空状态
|
||||
Column(
|
||||
modifier = Modifier.align(Alignment.Center)
|
||||
modifier = Modifier.align(Alignment.Center).clickable(indication = null, interactionSource = remember { MutableInteractionSource() }) {
|
||||
imagePickerLauncher.launch("image/*")
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.mipmap.ic_image_empty_pld),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.img.rabbit.pages.screen.make
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.util.Log
|
||||
import androidx.activity.compose.ManagedActivityResultLauncher
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
|
@ -88,15 +91,21 @@ fun LongImageScreen(navController: NavController) {
|
|||
|
||||
Scaffold {
|
||||
LaunchedEffect(Unit) {
|
||||
val matisse = Matisse(
|
||||
maxSelectable = 10,
|
||||
imageEngine = CoilImageEngine(),
|
||||
mediaType = MediaType.ImageOnly
|
||||
)
|
||||
mediaPickerLauncher.launch(matisse)
|
||||
openMediaPicker(mediaPickerLauncher)
|
||||
}
|
||||
Column (
|
||||
modifier = Modifier.fillMaxSize().background(Color(0xFFF4F4F4)).navigationBarsPadding()
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color(0xFFF4F4F4))
|
||||
.navigationBarsPadding()
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() }
|
||||
){
|
||||
if(imageItems.isEmpty()){
|
||||
openMediaPicker(mediaPickerLauncher)
|
||||
}
|
||||
}
|
||||
) {
|
||||
TitleBar(
|
||||
navController = navController,
|
||||
|
|
@ -130,7 +139,9 @@ fun LongImageScreen(navController: NavController) {
|
|||
bitmap = item.bitmap.asImageBitmap(),
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = Modifier.fillMaxWidth().wrapContentHeight()
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -208,7 +219,14 @@ fun FullScreenCropDialog(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun openMediaPicker(mediaPicker: ManagedActivityResultLauncher<Matisse, List<MediaResource>?>){
|
||||
val matisse = Matisse(
|
||||
maxSelectable = 10,
|
||||
imageEngine = CoilImageEngine(),
|
||||
mediaType = MediaType.ImageOnly
|
||||
)
|
||||
mediaPicker.launch(matisse)
|
||||
}
|
||||
|
||||
|
||||
@Preview(showBackground = true)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ import androidx.compose.foundation.Canvas
|
|||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.gestures.awaitFirstDown
|
||||
import androidx.compose.foundation.gestures.detectTransformGestures
|
||||
import androidx.compose.foundation.gestures.forEachGesture
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
|
|
@ -260,7 +262,9 @@ fun ResizeScreen(navController: NavController) {
|
|||
} else {
|
||||
// 空状态
|
||||
Column(
|
||||
modifier = Modifier.align(Alignment.Center)
|
||||
modifier = Modifier.align(Alignment.Center).clickable(indication = null, interactionSource = remember { MutableInteractionSource() }) {
|
||||
imagePickerLauncher.launch("image/*")
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.mipmap.ic_image_empty_pld),
|
||||
|
|
|
|||
Loading…
Reference in New Issue