Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
10a8be82
Commit
10a8be82
authored
10 months ago
by
Aleksandras Kostarevas
Browse files
Options
Downloads
Patches
Plain Diff
Hide actions on suggestedwords change
parent
3ea6a08c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/org/futo/inputmethod/latin/uix/ActionBar.kt
+17
-4
17 additions, 4 deletions
java/src/org/futo/inputmethod/latin/uix/ActionBar.kt
java/src/org/futo/inputmethod/latin/uix/actions/Registry.kt
+3
-3
3 additions, 3 deletions
java/src/org/futo/inputmethod/latin/uix/actions/Registry.kt
with
20 additions
and
7 deletions
java/src/org/futo/inputmethod/latin/uix/ActionBar.kt
+
17
−
4
View file @
10a8be82
...
...
@@ -37,6 +37,7 @@ import androidx.compose.material3.dynamicDarkColorScheme
import
androidx.compose.material3.dynamicLightColorScheme
import
androidx.compose.runtime.Composable
import
androidx.compose.runtime.CompositionLocalProvider
import
androidx.compose.runtime.LaunchedEffect
import
androidx.compose.runtime.MutableState
import
androidx.compose.runtime.mutableFloatStateOf
import
androidx.compose.runtime.mutableStateOf
...
...
@@ -56,6 +57,7 @@ import androidx.compose.ui.graphics.drawscope.Fill
import
androidx.compose.ui.graphics.drawscope.Stroke
import
androidx.compose.ui.graphics.drawscope.scale
import
androidx.compose.ui.graphics.drawscope.translate
import
androidx.compose.ui.graphics.graphicsLayer
import
androidx.compose.ui.hapticfeedback.HapticFeedbackType
import
androidx.compose.ui.input.pointer.pointerInput
import
androidx.compose.ui.platform.LocalContext
...
...
@@ -350,7 +352,7 @@ fun LazyItemScope.ActionItem(idx: Int, action: Action, onSelect: (Action) -> Uni
val
offsetY
=
remember
{
mutableFloatStateOf
(
0.0f
)
}
val
haptic
=
LocalHapticFeedback
.
current
val
width
=
6
4
.
dp
val
width
=
5
6
.
dp
val
widthPx
=
with
(
LocalDensity
.
current
)
{
width
.
toPx
()
}
...
...
@@ -362,7 +364,6 @@ fun LazyItemScope.ActionItem(idx: Int, action: Action, onSelect: (Action) -> Uni
val
col
=
MaterialTheme
.
colorScheme
.
secondaryContainer
val
modifier
=
Modifier
.
offset
{
IntOffset
(
offsetX
.
floatValue
.
roundToInt
(),
offsetY
.
floatValue
.
roundToInt
())
}
.
pointerInput
(
Unit
)
{
detectDragGesturesAfterLongPress
(
onDragStart
=
{
dragging
.
value
=
true
...
...
@@ -379,6 +380,7 @@ fun LazyItemScope.ActionItem(idx: Int, action: Action, onSelect: (Action) -> Uni
},
onDrag
=
{
change
,
dragAmount
->
change
.
consume
()
offsetX
.
floatValue
+=
dragAmount
.
x
offsetY
.
floatValue
+=
dragAmount
.
y
if
(
offsetX
.
floatValue
>=
widthPx
)
{
offsetX
.
floatValue
-=
widthPx
...
...
@@ -411,6 +413,11 @@ fun LazyItemScope.ActionItem(idx: Int, action: Action, onSelect: (Action) -> Uni
it
.
animateItemPlacement
()
}
else
{
it
.
zIndex
(
10.0f
)
.
graphicsLayer
{
clip
=
false
translationX
=
offsetX
.
floatValue
translationY
=
offsetY
.
floatValue
}
}
}
.
drawBehind
{
...
...
@@ -420,7 +427,7 @@ fun LazyItemScope.ActionItem(idx: Int, action: Action, onSelect: (Action) -> Uni
topLeft
=
Offset
(
size
.
width
*
0.1f
,
size
.
height
*
0.05f
),
size
=
Size
(
size
.
width
*
0.8f
,
size
.
height
*
0.9f
),
cornerRadius
=
CornerRadius
(
radius
,
radius
),
style
=
if
(
isWindowAction
)
{
style
=
if
(
isWindowAction
)
{
Fill
}
else
{
Stroke
(
width
=
4.0f
)
...
...
@@ -501,7 +508,7 @@ fun ExpandActionsButton(isActionsOpen: Boolean, onClick: () -> Unit) {
drawCircle
(
color
=
moreActionsColor
,
radius
=
size
.
width
/
3.0f
+
1.0f
,
style
=
if
(!
isActionsOpen
)
{
style
=
if
(!
isActionsOpen
)
{
Stroke
(
3.0f
)
}
else
{
Fill
...
...
@@ -576,6 +583,12 @@ fun ActionBar(
onActionActivated
(
it
)
}
LaunchedEffect
(
words
)
{
if
(
words
!=
null
&&
!
words
.
isEmpty
)
{
isActionsOpen
.
value
=
false
}
}
Surface
(
modifier
=
Modifier
.
fillMaxWidth
()
.
height
(
40
.
dp
),
color
=
MaterialTheme
.
colorScheme
.
background
)
...
...
This diff is collapsed.
Click to expand it.
java/src/org/futo/inputmethod/latin/uix/actions/Registry.kt
+
3
−
3
View file @
10a8be82
...
...
@@ -58,12 +58,12 @@ object ActionRegistry {
val
DefaultActions
=
listOf
(
EmojiAction
,
SettingsAction
,
TextEditAction
,
ThemeAction
,
ClipboardAction
,
UndoAction
,
RedoAction
,
ClipboardAction
,
SettingsAction
,
ThemeAction
,
)
val
DefaultActionsString
=
ActionRegistry
.
actionsToString
(
DefaultActions
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment