书架管理添加书源信息

pull/2337/head
kunfei 2 years ago
parent 8fd179cf64
commit 4f59ec0b55
  1. 6
      app/src/main/java/io/legado/app/ui/book/manage/BookAdapter.kt
  2. 55
      app/src/main/res/layout/item_arrange_book.xml

@ -6,6 +6,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
@ -52,6 +53,11 @@ class BookAdapter(context: Context, val callBack: CallBack) :
tvAuthor.visibility = if (item.author.isEmpty()) View.GONE else View.VISIBLE tvAuthor.visibility = if (item.author.isEmpty()) View.GONE else View.VISIBLE
tvGroupS.text = getGroupName(item.group) tvGroupS.text = getGroupName(item.group)
checkbox.isChecked = selectedBooks.contains(item) checkbox.isChecked = selectedBooks.contains(item)
if (item.isLocalBook()) {
tvOrigin.setText(R.string.local_book)
} else {
tvOrigin.text = item.originName
}
} }
} }

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="6dp"> android:padding="6dp">
<io.legado.app.lib.theme.view.ThemeCheckBox <io.legado.app.lib.theme.view.ThemeCheckBox
@ -22,13 +23,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="3dp" android:padding="3dp"
android:textSize="15sp" android:singleLine="true"
android:text="@string/book_name" android:text="@string/book_name"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:singleLine="true" android:textSize="15sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tv_group_s" app:layout_constraintBottom_toTopOf="@id/tv_group_s"
app:layout_constraintLeft_toRightOf="@id/checkbox" /> app:layout_constraintLeft_toRightOf="@id/checkbox"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/tv_author" android:id="@+id/tv_author"
@ -36,29 +37,43 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="12dp" android:paddingLeft="12dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:singleLine="true"
android:text="@string/author" android:text="@string/author"
android:textColor="@color/tv_text_summary" android:textColor="@color/tv_text_summary"
android:textSize="12sp" android:textSize="12sp"
android:singleLine="true"
app:layout_constraintTop_toTopOf="@+id/tv_name"
app:layout_constraintLeft_toRightOf="@+id/tv_name"
app:layout_constraintBottom_toBottomOf="@+id/tv_name" app:layout_constraintBottom_toBottomOf="@+id/tv_name"
app:layout_constraintRight_toRightOf="parent" /> app:layout_constraintLeft_toRightOf="@+id/tv_name"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_name"
tools:ignore="RtlHardcoded" />
<TextView <TextView
android:id="@+id/tv_group_s" android:id="@+id/tv_origin"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:padding="3dp" android:padding="3dp"
android:hint="@string/no_group" android:textColor="@color/tv_text_summary"
android:textSize="12sp" android:textSize="12sp"
android:textColor="@color/secondaryText" app:layout_constraintBottom_toBottomOf="parent"
android:singleLine="true"
android:layout_marginTop="8dp"
app:layout_constraintLeft_toRightOf="@+id/checkbox" app:layout_constraintLeft_toRightOf="@+id/checkbox"
app:layout_constraintTop_toBottomOf="@id/tv_author" app:layout_constraintTop_toBottomOf="@id/tv_author"
tools:text="书源" />
<TextView
android:id="@+id/tv_group_s"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/no_group"
android:padding="3dp"
android:singleLine="true"
android:textColor="@color/secondaryText"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_group" /> app:layout_constraintLeft_toRightOf="@+id/tv_origin"
app:layout_constraintRight_toLeftOf="@+id/tv_group"
app:layout_constraintTop_toBottomOf="@id/tv_author" />
<TextView <TextView
android:id="@+id/tv_group" android:id="@+id/tv_group"
@ -68,9 +83,9 @@
android:padding="10dp" android:padding="10dp"
android:text="@string/group" android:text="@string/group"
android:textColor="@color/secondaryText" android:textColor="@color/secondaryText"
app:layout_constraintTop_toBottomOf="@id/tv_author"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_delete" /> app:layout_constraintRight_toLeftOf="@+id/tv_delete"
app:layout_constraintTop_toBottomOf="@id/tv_author" />
<TextView <TextView
android:id="@+id/tv_delete" android:id="@+id/tv_delete"
@ -80,8 +95,8 @@
android:padding="10dp" android:padding="10dp"
android:text="@string/delete" android:text="@string/delete"
android:textColor="@color/secondaryText" android:textColor="@color/secondaryText"
app:layout_constraintTop_toBottomOf="@id/tv_author"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" /> app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_author" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save