From 794a27f0791f8f1dd98b996d31890be134a0485a Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 7 Jun 2019 09:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/lib/theme/view/ATEStockSwitch.kt | 35 ------- .../ui/main/booksource/BookSourceAdapter.kt | 26 +++++ app/src/main/res/layout/item_book_source.xml | 98 ++++++------------- app/src/main/res/values/ids.xml | 3 + 4 files changed, 59 insertions(+), 103 deletions(-) delete mode 100644 app/src/main/java/io/legado/app/lib/theme/view/ATEStockSwitch.kt diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEStockSwitch.kt b/app/src/main/java/io/legado/app/lib/theme/view/ATEStockSwitch.kt deleted file mode 100644 index d80e3a766..000000000 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEStockSwitch.kt +++ /dev/null @@ -1,35 +0,0 @@ -package io.legado.app.lib.theme.view - -import android.content.Context -import android.util.AttributeSet -import android.view.View -import android.widget.Switch -import androidx.appcompat.widget.SwitchCompat -import io.legado.app.lib.theme.ATH -import io.legado.app.lib.theme.ThemeStore - -/** - * @author Aidan Follestad (afollestad) - */ -class ATEStockSwitch : SwitchCompat { - - constructor(context: Context) : super(context) { - init(context, null) - } - - constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) - } - - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) - } - - private fun init(context: Context, attrs: AttributeSet?) { - ATH.setTint(this, ThemeStore.accentColor(context)) - } - - override fun isShown(): Boolean { - return parent != null && visibility == View.VISIBLE - } -} diff --git a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt index 50d830706..110adea2c 100644 --- a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt @@ -1,8 +1,10 @@ package io.legado.app.ui.main.booksource import android.view.LayoutInflater +import android.view.Menu import android.view.View import android.view.ViewGroup +import android.widget.PopupMenu import androidx.paging.PagedListAdapter import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.RecyclerView @@ -52,6 +54,30 @@ class BookSourceAdapter : PagedListAdapter{ + callback?.edit(bookSource) + true} + R.id.menu_del ->{ + callback?.del(bookSource) + true} + R.id.menu_top ->{ true} + else -> {false} + } + } + popupMenu.show() + } } } diff --git a/app/src/main/res/layout/item_book_source.xml b/app/src/main/res/layout/item_book_source.xml index deadf724c..0c185faf5 100644 --- a/app/src/main/res/layout/item_book_source.xml +++ b/app/src/main/res/layout/item_book_source.xml @@ -1,73 +1,35 @@ - - + + - - - - - - - - - - - - - - - - + android:layout_gravity="center" + android:layout_weight="1" + android:singleLine="true" + android:text="" + android:textColor="@color/tv_text_default"/> + + + + \ No newline at end of file diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml index 0d2c4cc40..341c5b250 100644 --- a/app/src/main/res/values/ids.xml +++ b/app/src/main/res/values/ids.xml @@ -1,4 +1,7 @@ + + + \ No newline at end of file