diff --git a/app/build.gradle b/app/build.gradle index 68b1088..c3b1a4b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,7 +22,7 @@ android { minSdk 24 targetSdk 34 versionCode 43 - versionName "1.6-beta29" + versionName "1.6-rc01" flavorDimensions = ["versionName"] testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/skyd/rays/ui/screen/add/AddScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/add/AddScreen.kt index 67ebc2f..eec9855 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/add/AddScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/add/AddScreen.kt @@ -219,7 +219,8 @@ fun AddScreen( (if (isEdit) pickStickerLauncher else pickStickersLauncher) .launch("image/*") }, - contentDescription = stringResource(R.string.add_screen_select_sticker), + contentDescription = if (isEdit) stringResource(R.string.add_screen_update_sticker) + else stringResource(R.string.add_screen_add_stickers), imageVector = if (isEdit) Icons.Default.Image else Icons.Default.AddPhotoAlternate, ) RaysIconButton( @@ -252,7 +253,7 @@ fun AddScreen( ) } }, - contentDescription = stringResource(R.string.add_screen_save), + contentDescription = stringResource(R.string.add_screen_save_current_sticker), imageVector = Icons.Default.Save, ) } diff --git a/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt index 3233313..8ea6fe0 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt @@ -75,6 +75,7 @@ import com.skyd.rays.base.LoadUiIntent import com.skyd.rays.config.refreshStickerData import com.skyd.rays.ext.dateTime import com.skyd.rays.ext.isCompact +import com.skyd.rays.ext.showSnackbar import com.skyd.rays.ext.showSnackbarWithLaunchedEffect import com.skyd.rays.model.bean.StickerWithTags import com.skyd.rays.model.bean.UriWithStickerUuidBean @@ -173,6 +174,9 @@ fun HomeScreen(viewModel: HomeViewModel = hiltViewModel()) { }, stickerWithTags = (stickerDetailUiState as? StickerDetailUiState.Success) ?.stickerWithTags, + onShowSnackbar = { + snackbarHostState.showSnackbar(scope = scope, message = it) + }, uiState = uiState, ) when (stickerDetailUiState) { diff --git a/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/HomeMenu.kt b/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/HomeMenu.kt index 15b0beb..77ca7f9 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/HomeMenu.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/HomeMenu.kt @@ -2,6 +2,7 @@ package com.skyd.rays.ui.screen.home.searchbar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ManageSearch +import androidx.compose.material.icons.filled.ContentCopy import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Done import androidx.compose.material.icons.filled.Edit @@ -72,6 +73,7 @@ fun HomeMenu( onDismissRequest: () -> Unit, onDeleteClick: () -> Unit, onExportClick: () -> Unit, + onCopyClick: () -> Unit, onStickerInfoClick: () -> Unit, onClearScreen: () -> Unit, ) { @@ -147,6 +149,20 @@ fun HomeMenu( ) } ) + DropdownMenuItem( + enabled = stickerMenuItemEnabled, + text = { Text(stringResource(R.string.home_screen_copy)) }, + onClick = { + onDismissRequest() + onCopyClick() + }, + leadingIcon = { + Icon( + Icons.Default.ContentCopy, + contentDescription = null + ) + } + ) DropdownMenuItem( enabled = stickerMenuItemEnabled, text = { Text(stringResource(R.string.home_screen_sticker_info)) }, diff --git a/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt b/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt index 371b6ed..83ef4b1 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt @@ -90,6 +90,7 @@ import com.skyd.rays.ui.screen.home.PopularTagsUiState import com.skyd.rays.ui.screen.home.SearchResultUiState import com.skyd.rays.ui.screen.home.StickerDetailInfo import com.skyd.rays.ui.screen.home.StickerDetailUiState +import com.skyd.rays.util.copyStickerToClipboard @Composable @@ -99,9 +100,11 @@ fun RaysSearchBar( active: Boolean, onActiveChange: (Boolean) -> Unit = {}, stickerWithTags: StickerWithTags?, + onShowSnackbar: (String) -> Unit, uiState: HomeState, viewModel: HomeViewModel = hiltViewModel() ) { + val context = LocalContext.current var menuExpanded by rememberSaveable { mutableStateOf(false) } var multiSelect by rememberSaveable { mutableStateOf(false) } val selectedStickers = remember { mutableStateListOf() } @@ -199,6 +202,10 @@ fun RaysSearchBar( onDismissRequest = { menuExpanded = false }, onDeleteClick = { openDeleteWarningDialog = true }, onExportClick = { openExportPathDialog = true }, + onCopyClick = { + context.copyStickerToClipboard(uuid = currentStickerUuid) + onShowSnackbar(context.getString(R.string.home_screen_copied)) + }, onStickerInfoClick = { openStickerInfoDialog = true }, onClearScreen = { viewModel.sendUiIntent( diff --git a/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/style/HomeScreenPreview.kt b/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/style/HomeScreenPreview.kt index f9f009d..5c772f2 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/style/HomeScreenPreview.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/style/HomeScreenPreview.kt @@ -124,6 +124,7 @@ private fun RaysSearchBarPreview() { onDismissRequest = { menuExpanded = false }, onDeleteClick = {}, onExportClick = {}, + onCopyClick = {}, onStickerInfoClick = {}, onClearScreen = {}, ) diff --git a/app/src/main/java/com/skyd/rays/util/StickerUtil.kt b/app/src/main/java/com/skyd/rays/util/StickerUtil.kt index f56cfd6..0d3a93c 100644 --- a/app/src/main/java/com/skyd/rays/util/StickerUtil.kt +++ b/app/src/main/java/com/skyd/rays/util/StickerUtil.kt @@ -160,21 +160,15 @@ fun Bitmap.shareToFile(outputDir: File = File(appContext.cacheDir, "TempSticker" } /** - * 针对外部应用 + * 把表情包复制到临时目录 */ -fun externalShareStickerUuidToFile(uuid: String): File { - val originFile = stickerUuidToFile(uuid) +fun File.copyStickerToTempFolder(fileExtension: Boolean): File { val outputDir = File(appContext.cacheDir, "TempSticker") - if (appContext.dataStore.get(StickerExtNamePreference.key) == false || - (!outputDir.exists() && !outputDir.mkdirs()) - ) { - return originFile - } - val extensionName = originFile.inputStream().use { - ImageFormatChecker.check(it).toString() - } - val resultFileName = uuid + "_" + Random.nextInt(0, Int.MAX_VALUE) + extensionName - val resultFile = originFile.copyTo( + check(outputDir.exists() || outputDir.mkdirs()) + val resultFileName = name + "_" + Random.nextInt(0, Int.MAX_VALUE) + if (fileExtension) { + inputStream().use { ImageFormatChecker.check(it).toString() } + } else "" + val resultFile = copyTo( target = File(outputDir, resultFileName), overwrite = true ) @@ -189,6 +183,14 @@ fun externalShareStickerUuidToFile(uuid: String): File { return resultFile } +/** + * 针对外部应用 + */ +fun externalShareStickerUuidToFile(uuid: String): File = + stickerUuidToFile(uuid).copyStickerToTempFolder( + fileExtension = appContext.dataStore.get(StickerExtNamePreference.key) ?: true + ) + /** * 针对内部操作,针对原图片本身 */ @@ -235,7 +237,20 @@ private fun List.shareStickerUriString(context: Context, packages: List首页 输入关键词搜索 添加 - 保存 + 保存当前项 标题(可选) 添加标签(可选) 添加表情包 @@ -31,6 +31,8 @@ 编辑 删除 导出 + 复制 + 已复制 提示 确定 关闭 @@ -148,6 +150,8 @@ 新建表情包或从搜索结果中选择一个表情包吧~ 空空如也呢~ 选择表情包 + 添加表情包 + 选择新表情包 导入与导出 发送 发送表情包 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 774c0ec..cdba4a3 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -5,7 +5,7 @@ 首頁 搜尋 添加 - 存檔 + 儲存目前項 標題(可選) 新增標籤(可選) 添加 @@ -46,7 +46,7 @@ 表情包顏色主題 密碼 刪除 Rays 管理的所有本地數據,包括圖片、標題、標籤等。此操作無法撤銷 - 選擇表情包分類模型,設置置信閾值等 + 選擇表情包分類模型,設定置信閾值等 刪除?此操作無法還原! 密碼已輸入 自拍分割 @@ -97,11 +97,11 @@ 匯出表情包、標籤等至本地文件 垂直 - 導入與導出 + 導入與匯出 深色模式 正則表達式 點擊次數 - 只有置信度高于此門檻值的標籤才會被建議,建議設置在 0.5 左右。 + 只有置信度高于此門檻值的標籤才會被建議,建議設定在 0.5 左右。 伺服器 加入 Discord 伺服器 拉取 @@ -115,7 +115,7 @@ 忽略匹配页面的存在 匯出成功 一個用於在手機上記錄、搜尋和管理表情包的工具。 - 設置深色模式策略 + 設定深色模式策略 從本地文件導入表情包、標籤等 外觀和風格 清空回收站 @@ -172,6 +172,8 @@ 搜尋領域(未選擇時搜索全部) URI 字符串分享 匯出 + 複製 + 已複製 亮色 編輯 關於 @@ -240,7 +242,7 @@ 表情包卡片 更新本地數據 搜尋 - 設置 + 設定 風格 主題、深色模式、風格等 發送 @@ -249,6 +251,8 @@ 透過 WebDAV 同步數據 標籤 選擇表情包 + 添加表情包 + 選擇新表情包 當您在晚上🌙使用手機時,Night Screen 可以幫助您降低屏幕的亮度,減少對眼睛的損害。 遠端回收站 數據 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 301e948..5697a05 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -5,7 +5,7 @@ Home Search Add - Save + Save current sticker Title (Optional) Add tags (Optional) Add @@ -31,6 +31,8 @@ Edit Delete Export + Copy + Copied Info OK Close @@ -154,6 +156,8 @@ Create a new sticker or select a sticker from the search results~ It\'s empty~ Select stickers + Add stickers + Select a new sticker Sync data Send Send sticker @@ -204,13 +208,13 @@ Share button position Horizontal Vertical - Update remote data + sticker - Move to remote recycle bin - Update remote data - Update local data + sticker - Update local data - Delete local data + sticker - Update backup information + Updating remote data + sticker + Moving to remote recycle bin + Updating remote data + Updating local data + sticker + Updating local data + Deleting local data + sticker + Updating backup information Please do not force kill the app or disconnect the network when pushing and pulling, as this may corrupt the data! Sticker info UUID