From ed5a83e8601bb6ae94f7f7abb507beb4f671726d Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 5 Sep 2019 10:21:21 +0800 Subject: [PATCH] up --- .../app/ui/main/explore/FindBookAdapter.kt | 14 +------- app/src/main/res/layout/item_find_book.xml | 11 +++++-- app/src/main/res/layout/item_text.xml | 32 ++++++++----------- 3 files changed, 22 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/main/explore/FindBookAdapter.kt b/app/src/main/java/io/legado/app/ui/main/explore/FindBookAdapter.kt index c43c4bf6e..20c625bfa 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/FindBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/FindBookAdapter.kt @@ -3,7 +3,6 @@ package io.legado.app.ui.main.explore import android.content.Context import android.view.LayoutInflater import android.view.Menu -import android.widget.GridLayout import android.widget.PopupMenu import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder @@ -60,8 +59,6 @@ class FindBookAdapter(context: Context, private val scope: CoroutineScope, val c }.onSuccess { it?.let { gl_child.visible() - var rowNum = 0 - var columnNum = 0 gl_child.removeAllViews() it.map { kind -> val tv = LayoutInflater.from(context) @@ -74,16 +71,7 @@ class FindBookAdapter(context: Context, private val scope: CoroutineScope, val c kind.url ) } - val rowSpecs = GridLayout.spec(rowNum, 1.0f) - val colSpecs = GridLayout.spec(columnNum, 1.0f) - val params = GridLayout.LayoutParams(rowSpecs, colSpecs) - gl_child.addView(tv, params) - if (columnNum < 2) { - columnNum++ - } else { - columnNum = 0 - rowNum++ - } + gl_child.addView(tv) } } }.onFinally { diff --git a/app/src/main/res/layout/item_find_book.xml b/app/src/main/res/layout/item_find_book.xml index 9fa766c19..e5911c942 100644 --- a/app/src/main/res/layout/item_find_book.xml +++ b/app/src/main/res/layout/item_find_book.xml @@ -40,13 +40,18 @@ - + android:visibility="gone" + app:dividerDrawable="@drawable/shape_space_divider" + app:flexDirection="row" + app:flexWrap="wrap" + app:showDivider="middle" /> - - - - - + android:layout_margin="3dp" + android:background="@drawable/shape_card_view" + android:clickable="true" + android:ellipsize="end" + android:focusable="true" + android:gravity="center" + android:padding="5dp" + android:singleLine="true" + android:textColor="@color/tv_text_default" + android:textSize="14sp" />