Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b6172bc

Browse filesBrowse files
rockamokapsing
authored andcommitted
Long press to share clipboard content
1 parent 4751305 commit b6172bc
Copy full SHA for b6172bc

File tree

Expand file treeCollapse file tree

4 files changed

+27
-0
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+27
-0
lines changed

‎app/src/main/java/org/fcitx/fcitx5/android/input/clipboard/ClipboardAdapter.kt

Copy file name to clipboardExpand all lines: app/src/main/java/org/fcitx/fcitx5/android/input/clipboard/ClipboardAdapter.kt
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ abstract class ClipboardAdapter(
111111
menu.item(R.string.edit, R.drawable.ic_baseline_edit_24, iconTint) {
112112
onEdit(entry.id)
113113
}
114+
menu.item(R.string.share, R.drawable.ic_baseline_share_24, iconTint) {
115+
onShare(entry)
116+
}
114117
menu.item(R.string.delete, R.drawable.ic_baseline_delete_24, iconTint) {
115118
onDelete(entry.id)
116119
}
@@ -143,6 +146,8 @@ abstract class ClipboardAdapter(
143146

144147
abstract fun onEdit(id: Int)
145148

149+
abstract fun onShare(entry: ClipboardEntry)
150+
146151
abstract fun onDelete(id: Int)
147152

148153
}

‎app/src/main/java/org/fcitx/fcitx5/android/input/clipboard/ClipboardWindow.kt

Copy file name to clipboardExpand all lines: app/src/main/java/org/fcitx/fcitx5/android/input/clipboard/ClipboardWindow.kt
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package org.fcitx.fcitx5.android.input.clipboard
66

77
import android.annotation.SuppressLint
8+
import android.content.Intent
89
import android.view.View
910
import android.view.ViewGroup
1011
import android.widget.FrameLayout
@@ -103,6 +104,17 @@ class ClipboardWindow : InputWindow.ExtendedInputWindow<ClipboardWindow>() {
103104
AppUtil.launchClipboardEdit(context, id)
104105
}
105106

107+
override fun onShare(entry: ClipboardEntry) {
108+
val target = Intent(Intent.ACTION_SEND).apply {
109+
type = "text/plain"
110+
putExtra(Intent.EXTRA_TEXT, entry.text)
111+
}
112+
val chooser = Intent.createChooser(target, null).apply {
113+
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
114+
}
115+
service.startActivity(chooser)
116+
}
117+
106118
override fun onDelete(id: Int) {
107119
service.lifecycleScope.launch {
108120
ClipboardManager.delete(id)
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:fillColor="#ffffff"
8+
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z" />
9+
</vector>

‎app/src/main/res/values/strings.xml

Copy file name to clipboardExpand all lines: app/src/main/res/values/strings.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,5 @@
310310
<string name="move_cursor_to_end">Move cursor to end</string>
311311
<string name="open_input_method_settings">Open input method settings</string>
312312
<string name="delete_all">Delete all</string>
313+
<string name="share">Share</string>
313314
</resources>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.