add copy image

This commit is contained in:
o0kam1 authored and tarsin committed 2023-01-02 20:45:24 +08:00
1 parent 98d401f9c3
commit 1a86eef52c
6 files changed
+36 -1

No files matched your search

@@ -377,7 +377,7 @@ class ReaderActivity : EhActivity() {
}
private fun copyImage(page: Int) {
fun copyImage(page: Int) {
if (null == mGalleryProvider) {
return
}
@@ -20,6 +20,7 @@ class ReaderPageSheet(
binding = ReaderPageSheetBinding.inflate(activity.layoutInflater, null, false)
binding.share.setOnClickListener { share() }
binding.copy.setOnClickListener { copy() }
binding.save.setOnClickListener { save() }
binding.saveTo.setOnClickListener { saveTo() }
@@ -34,6 +35,14 @@ class ReaderPageSheet(
dismiss()
}
/**
* Copy the image of this page with external apps.
*/
private fun copy() {
activity.copyImage(page.index)
dismiss()
}
/**
* Saves the image of this page on external storage.
*/
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM15,5L8,5c-1.1,0 -1.99,0.9 -1.99,2L6,21c0,1.1 0.89,2 1.99,2L19,23c1.1,0 2,-0.9 2,-2L21,11l-6,-6zM8,21L8,7h6v5h5v9L8,21z" />
</vector>
@@ -20,6 +20,21 @@
app:drawableStartCompat="@drawable/ic_share_24dp"
app:drawableTint="?attr/colorOnBackground" />
<TextView
android:id="@+id/copy"
android:layout_width="match_parent"
android:layout_height="56dp"
android:drawablePadding="32dp"
android:gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:paddingHorizontal="16dp"
android:foreground="?attr/selectableItemBackground"
android:text="@string/action_copy"
android:textColor="?attr/colorOnBackground"
app:drawableStartCompat="@drawable/ic_file_copy_24"
app:drawableTint="?attr/colorOnBackground" />
<TextView
android:id="@+id/save"
android:layout_width="match_parent"
@@ -595,6 +595,7 @@
<string name="action_settings">设置</string>
<string name="action_retry">重试</string>
<string name="action_share">分享</string>
<string name="action_copy">复制</string>
<string name="action_save">保存</string>
<string name="action_save_to">保存到&#8230;</string>
<string name="pref_category_general">通用</string>
+1
View File
@@ -738,6 +738,7 @@
<string name="pref_category_general">General</string>
<string name="custom_filter">Custom filter</string>
<string name="action_share">Share</string>
<string name="action_copy">Copy</string>
<string name="action_save">Save</string>
<string name="action_save_to">Save to&#8230;</string>
<string name="wide_color_gamut">Use Display P3 color space</string>