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
62b4bcf7
Commit
62b4bcf7
authored
7 months ago
by
Aleksandras Kostarevas
Browse files
Options
Downloads
Patches
Plain Diff
Add BugViewer action
parent
9dde4679
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/res/values/strings-uix.xml
+1
-0
1 addition, 0 deletions
java/res/values/strings-uix.xml
java/src/org/futo/inputmethod/latin/uix/actions/BugViewer.kt
+87
-0
87 additions, 0 deletions
java/src/org/futo/inputmethod/latin/uix/actions/BugViewer.kt
with
88 additions
and
0 deletions
java/res/values/strings-uix.xml
+
1
−
0
View file @
62b4bcf7
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
<string
name=
"text_edit_action_title"
>
Text Editor
</string>
<string
name=
"text_edit_action_title"
>
Text Editor
</string>
<string
name=
"mem_debug_action_title"
>
Debug Info
</string>
<string
name=
"mem_debug_action_title"
>
Debug Info
</string>
<string
name=
"more_actions_action_title"
>
All Actions
</string>
<string
name=
"more_actions_action_title"
>
All Actions
</string>
<string
name=
"bug_viewer_action_title"
>
Bug Viewer
</string>
<string
name=
"action_kind_action_key"
>
Action Key
</string>
<string
name=
"action_kind_action_key"
>
Action Key
</string>
<string
name=
"action_kind_pinned_key"
>
Pinned Action(s)
</string>
<string
name=
"action_kind_pinned_key"
>
Pinned Action(s)
</string>
...
...
This diff is collapsed.
Click to expand it.
java/src/org/futo/inputmethod/latin/uix/actions/BugViewer.kt
0 → 100644
+
87
−
0
View file @
62b4bcf7
package
org.futo.inputmethod.latin.uix.actions
import
android.content.ClipData
import
android.content.ClipboardManager
import
android.content.Context
import
android.util.Log
import
androidx.compose.foundation.layout.Row
import
androidx.compose.foundation.layout.Spacer
import
androidx.compose.foundation.layout.height
import
androidx.compose.material3.Text
import
androidx.compose.material3.TextButton
import
androidx.compose.runtime.Composable
import
androidx.compose.ui.Modifier
import
androidx.compose.ui.res.stringResource
import
androidx.compose.ui.unit.dp
import
org.futo.inputmethod.latin.BuildConfig
import
org.futo.inputmethod.latin.R
import
org.futo.inputmethod.latin.uix.Action
import
org.futo.inputmethod.latin.uix.ActionWindow
import
org.futo.inputmethod.latin.uix.settings.ScrollableList
import
org.futo.inputmethod.updates.openURI
data class
BugInfo
(
val
name
:
String
,
val
details
:
String
)
public
object
BugViewerState
{
val
bugs
=
mutableListOf
<
BugInfo
>()
public
fun
pushBug
(
bug
:
BugInfo
)
{
Log
.
e
(
"BugViewerState"
,
"Bug pushed: $bug"
)
bugs
.
add
(
0
,
bug
)
}
}
val
BugViewerAction
=
Action
(
icon
=
R
.
drawable
.
code
,
name
=
R
.
string
.
bug_viewer_action_title
,
simplePressImpl
=
null
,
canShowKeyboard
=
true
,
windowImpl
=
{
manager
,
_
->
val
latinIme
=
manager
.
getLatinIMEForDebug
()
object
:
ActionWindow
{
@Composable
override
fun
windowName
():
String
{
return
stringResource
(
R
.
string
.
bug_viewer_action_title
)
}
@Composable
override
fun
WindowContents
(
keyboardShown
:
Boolean
)
{
ScrollableList
{
if
(
BugViewerState
.
bugs
.
isEmpty
())
{
Text
(
"No errors have been reported yet"
,
style
=
DebugLabel
)
}
BugViewerState
.
bugs
.
forEach
{
val
name
=
"Bug in ${it.name} (${BuildConfig.VERSION_NAME})"
Text
(
name
,
style
=
DebugTitle
)
Row
{
TextButton
(
onClick
=
{
val
clipboardManager
=
manager
.
getContext
()
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
)
as
ClipboardManager
val
clip
=
ClipData
.
newPlainText
(
"label"
,
"$name\n\n${it.details}"
)
clipboardManager
.
setPrimaryClip
(
clip
)
})
{
Text
(
"Copy to clipboard"
)
}
TextButton
(
onClick
=
{
manager
.
getContext
().
openURI
(
"mailto:keyboard@futo.org"
,
newTask
=
true
)
})
{
Text
(
"Email us (include the copy)"
)
}
}
Text
(
it
.
details
,
style
=
DebugLabel
)
Spacer
(
modifier
=
Modifier
.
height
(
8
.
dp
))
}
}
}
override
fun
close
()
{
}
}
},
shownInEditor
=
false
)
\ No newline at end of file
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