From fd09c699eb3b321aa39126bda3f138fb285fff53 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 29 Aug 2019 18:06:17 +0800 Subject: [PATCH] up --- .../page/ContentSelectActionCallback.kt | 32 +++++++++++++++++++ .../legado/app/ui/widget/page/ContentView.kt | 1 + .../main/res/menu/content_select_action.xml | 9 ++++++ 3 files changed, 42 insertions(+) create mode 100644 app/src/main/java/io/legado/app/ui/widget/page/ContentSelectActionCallback.kt create mode 100644 app/src/main/res/menu/content_select_action.xml diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentSelectActionCallback.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentSelectActionCallback.kt new file mode 100644 index 000000000..91ef6e1b2 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentSelectActionCallback.kt @@ -0,0 +1,32 @@ +package io.legado.app.ui.widget.page + +import android.view.ActionMode +import android.view.Menu +import android.view.MenuItem + +import io.legado.app.R + +object ContentSelectActionCallback : ActionMode.Callback { + + override fun onActionItemClicked(mode: ActionMode?, item: MenuItem?): Boolean { + when (item?.itemId) { + R.id.menu_replace -> { + } + } + return false + } + + override fun onCreateActionMode(mode: ActionMode?, menu: Menu?): Boolean { + mode?.menuInflater?.inflate(R.menu.content_select_action, menu) + return true + } + + override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?): Boolean { + return false + } + + override fun onDestroyActionMode(mode: ActionMode?) { + + } + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt index d1b33ce0a..469e2d2a6 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt @@ -42,6 +42,7 @@ class ContentView : FrameLayout { inflate(context, R.layout.view_book_page, this) upStyle() upTime() + content_text_view.customSelectionActionModeCallback = ContentSelectActionCallback } fun upStyle() { diff --git a/app/src/main/res/menu/content_select_action.xml b/app/src/main/res/menu/content_select_action.xml new file mode 100644 index 000000000..d83b82ef3 --- /dev/null +++ b/app/src/main/res/menu/content_select_action.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file