Скрыт инпут и оверлеи при рисовании на фото
All checks were successful
Android Kernel Build / build (push) Successful in 16h20m6s
All checks were successful
Android Kernel Build / build (push) Successful in 16h20m6s
This commit is contained in:
@@ -343,6 +343,7 @@ private fun SimpleFullscreenPhotoContent(
|
|||||||
localCaption = value
|
localCaption = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val isDrawingModeActive = currentTool == EditorTool.DRAW
|
||||||
|
|
||||||
LaunchedEffect(imageUri, sourceThumbnail) {
|
LaunchedEffect(imageUri, sourceThumbnail) {
|
||||||
localCaption = caption
|
localCaption = caption
|
||||||
@@ -394,6 +395,15 @@ private fun SimpleFullscreenPhotoContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LaunchedEffect(isDrawingModeActive) {
|
||||||
|
if (isDrawingModeActive) {
|
||||||
|
showEmojiPicker = false
|
||||||
|
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||||
|
focusManager.clearFocus(force = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun hideKeyboard() {
|
fun hideKeyboard() {
|
||||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||||
@@ -851,16 +861,18 @@ private fun SimpleFullscreenPhotoContent(
|
|||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
.padding(horizontal = 4.dp, vertical = 8.dp)
|
.padding(horizontal = 4.dp, vertical = 8.dp)
|
||||||
) {
|
) {
|
||||||
IconButton(
|
if (!isDrawingModeActive) {
|
||||||
onClick = { closeViewer() },
|
IconButton(
|
||||||
modifier = Modifier.align(Alignment.CenterStart)
|
onClick = { closeViewer() },
|
||||||
) {
|
modifier = Modifier.align(Alignment.CenterStart)
|
||||||
Icon(
|
) {
|
||||||
painter = TelegramIcons.Close,
|
Icon(
|
||||||
contentDescription = "Close",
|
painter = TelegramIcons.Close,
|
||||||
tint = Color.White,
|
contentDescription = "Close",
|
||||||
modifier = Modifier.size(28.dp)
|
tint = Color.White,
|
||||||
)
|
modifier = Modifier.size(28.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -990,136 +1002,144 @@ private fun SimpleFullscreenPhotoContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(
|
AnimatedVisibility(
|
||||||
modifier =
|
visible = !isDrawingModeActive,
|
||||||
Modifier.fillMaxWidth()
|
enter = fadeIn() + slideInVertically { it / 2 },
|
||||||
.background(Color.Black.copy(alpha = 0.75f))
|
exit = fadeOut() + slideOutVertically { it / 2 }
|
||||||
.padding(
|
|
||||||
start = 12.dp,
|
|
||||||
end = 12.dp,
|
|
||||||
top = 10.dp,
|
|
||||||
bottom =
|
|
||||||
if (isKeyboardVisible || coordinator.isEmojiBoxVisible) 10.dp
|
|
||||||
else 16.dp
|
|
||||||
)
|
|
||||||
.then(
|
|
||||||
if (shouldAddNavBarPadding) Modifier.navigationBarsPadding()
|
|
||||||
else Modifier
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Box(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier =
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
Modifier.fillMaxWidth()
|
||||||
horizontalArrangement = Arrangement.spacedBy(10.dp)
|
.background(Color.Black.copy(alpha = 0.75f))
|
||||||
|
.padding(
|
||||||
|
start = 12.dp,
|
||||||
|
end = 12.dp,
|
||||||
|
top = 10.dp,
|
||||||
|
bottom =
|
||||||
|
if (isKeyboardVisible || coordinator.isEmojiBoxVisible) 10.dp
|
||||||
|
else 16.dp
|
||||||
|
)
|
||||||
|
.then(
|
||||||
|
if (shouldAddNavBarPadding) Modifier.navigationBarsPadding()
|
||||||
|
else Modifier
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
IconButton(
|
Row(
|
||||||
onClick = { toggleEmojiPicker() },
|
modifier = Modifier.fillMaxWidth(),
|
||||||
modifier = Modifier.size(32.dp)
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(10.dp)
|
||||||
) {
|
) {
|
||||||
Crossfade(
|
IconButton(
|
||||||
targetState = showEmojiPicker,
|
onClick = { toggleEmojiPicker() },
|
||||||
animationSpec = tween(150),
|
modifier = Modifier.size(32.dp)
|
||||||
label = "simpleViewerEmojiToggle"
|
) {
|
||||||
) { isEmoji ->
|
Crossfade(
|
||||||
Icon(
|
targetState = showEmojiPicker,
|
||||||
painter = if (isEmoji) TelegramIcons.Keyboard else TelegramIcons.Smile,
|
animationSpec = tween(150),
|
||||||
contentDescription = if (isEmoji) "Keyboard" else "Emoji",
|
label = "simpleViewerEmojiToggle"
|
||||||
tint = Color.White.copy(alpha = 0.72f),
|
) { isEmoji ->
|
||||||
modifier = Modifier.size(26.dp)
|
Icon(
|
||||||
|
painter = if (isEmoji) TelegramIcons.Keyboard else TelegramIcons.Smile,
|
||||||
|
contentDescription = if (isEmoji) "Keyboard" else "Emoji",
|
||||||
|
tint = Color.White.copy(alpha = 0.72f),
|
||||||
|
modifier = Modifier.size(26.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier =
|
||||||
|
Modifier.weight(1f)
|
||||||
|
.heightIn(min = 24.dp, max = 100.dp)
|
||||||
|
) {
|
||||||
|
AppleEmojiTextField(
|
||||||
|
value = captionText,
|
||||||
|
onValueChange = updateCaption,
|
||||||
|
textColor = Color.White,
|
||||||
|
textSize = 16f,
|
||||||
|
hint = "Add a caption...",
|
||||||
|
hintColor = Color.White.copy(alpha = 0.5f),
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
requestFocus = false,
|
||||||
|
onViewCreated = { textView -> editTextView = textView },
|
||||||
|
onFocusChanged = { hasFocus ->
|
||||||
|
if (hasFocus && showEmojiPicker) {
|
||||||
|
toggleEmojiPicker()
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.weight(1f)
|
Modifier.size(44.dp)
|
||||||
.heightIn(min = 24.dp, max = 100.dp)
|
.shadow(
|
||||||
) {
|
elevation = 4.dp,
|
||||||
AppleEmojiTextField(
|
shape = CircleShape,
|
||||||
value = captionText,
|
clip = false
|
||||||
onValueChange = updateCaption,
|
)
|
||||||
textColor = Color.White,
|
.clip(CircleShape)
|
||||||
textSize = 16f,
|
.background(PrimaryBlue)
|
||||||
hint = "Add a caption...",
|
.clickable(enabled = !isSaving) {
|
||||||
hintColor = Color.White.copy(alpha = 0.5f),
|
if (isSaving || isClosing) return@clickable
|
||||||
modifier = Modifier.fillMaxWidth(),
|
showEmojiPicker = false
|
||||||
requestFocus = false,
|
hideKeyboard()
|
||||||
onViewCreated = { textView -> editTextView = textView },
|
focusManager.clearFocus(force = true)
|
||||||
onFocusChanged = { hasFocus ->
|
scope.launch {
|
||||||
if (hasFocus && showEmojiPicker) {
|
isSaving = true
|
||||||
toggleEmojiPicker()
|
val savedUri =
|
||||||
}
|
saveEditedImageSync(
|
||||||
}
|
context = context,
|
||||||
)
|
photoEditor = photoEditor,
|
||||||
}
|
photoEditorView = photoEditorView,
|
||||||
|
imageUri = currentImageUri,
|
||||||
Box(
|
hasDrawingEdits = hasDrawingEdits
|
||||||
modifier =
|
)
|
||||||
Modifier.size(44.dp)
|
isSaving = false
|
||||||
.shadow(
|
val finalUri = savedUri ?: currentImageUri
|
||||||
elevation = 4.dp,
|
if (onSend != null) {
|
||||||
shape = CircleShape,
|
onSend(finalUri, captionText)
|
||||||
clip = false
|
} else {
|
||||||
)
|
closeViewer()
|
||||||
.clip(CircleShape)
|
}
|
||||||
.background(PrimaryBlue)
|
|
||||||
.clickable(enabled = !isSaving) {
|
|
||||||
if (isSaving || isClosing) return@clickable
|
|
||||||
showEmojiPicker = false
|
|
||||||
hideKeyboard()
|
|
||||||
focusManager.clearFocus(force = true)
|
|
||||||
scope.launch {
|
|
||||||
isSaving = true
|
|
||||||
val savedUri =
|
|
||||||
saveEditedImageSync(
|
|
||||||
context = context,
|
|
||||||
photoEditor = photoEditor,
|
|
||||||
photoEditorView = photoEditorView,
|
|
||||||
imageUri = currentImageUri,
|
|
||||||
hasDrawingEdits = hasDrawingEdits
|
|
||||||
)
|
|
||||||
isSaving = false
|
|
||||||
val finalUri = savedUri ?: currentImageUri
|
|
||||||
if (onSend != null) {
|
|
||||||
onSend(finalUri, captionText)
|
|
||||||
} else {
|
|
||||||
closeViewer()
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
contentAlignment = Alignment.Center
|
||||||
contentAlignment = Alignment.Center
|
) {
|
||||||
) {
|
if (isSaving) {
|
||||||
if (isSaving) {
|
CircularProgressIndicator(
|
||||||
CircularProgressIndicator(
|
modifier = Modifier.size(18.dp),
|
||||||
modifier = Modifier.size(18.dp),
|
color = Color.White,
|
||||||
color = Color.White,
|
strokeWidth = 2.dp
|
||||||
strokeWidth = 2.dp
|
)
|
||||||
)
|
} else {
|
||||||
} else {
|
Icon(
|
||||||
Icon(
|
painter = TelegramIcons.Send,
|
||||||
painter = TelegramIcons.Send,
|
contentDescription = "Send",
|
||||||
contentDescription = "Send",
|
tint = Color.White,
|
||||||
tint = Color.White,
|
modifier =
|
||||||
modifier =
|
Modifier.size(24.dp)
|
||||||
Modifier.size(24.dp)
|
.offset(x = 1.dp)
|
||||||
.offset(x = 1.dp)
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedKeyboardTransition(
|
if (!isDrawingModeActive) {
|
||||||
coordinator = coordinator,
|
AnimatedKeyboardTransition(
|
||||||
showEmojiPicker = showEmojiPicker
|
coordinator = coordinator,
|
||||||
) {
|
showEmojiPicker = showEmojiPicker
|
||||||
OptimizedEmojiPicker(
|
) {
|
||||||
isVisible = true,
|
OptimizedEmojiPicker(
|
||||||
isDarkTheme = isDarkTheme,
|
isVisible = true,
|
||||||
onEmojiSelected = { emoji -> updateCaption(captionText + emoji) },
|
isDarkTheme = isDarkTheme,
|
||||||
onClose = { toggleEmojiPicker() },
|
onEmojiSelected = { emoji -> updateCaption(captionText + emoji) },
|
||||||
modifier = Modifier.fillMaxWidth()
|
onClose = { toggleEmojiPicker() },
|
||||||
)
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user