mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 02:48:08 -04:00
Merge pull request #2395 from kiwix/feature/macgills/2300-library-layout-improvements
#2300 Missing wrap in library
This commit is contained in:
commit
fdcfc95b15
@ -34,22 +34,18 @@ import kotlinx.android.synthetic.main.item_library.libraryBookCreator
|
|||||||
import kotlinx.android.synthetic.main.item_library.libraryBookDate
|
import kotlinx.android.synthetic.main.item_library.libraryBookDate
|
||||||
import kotlinx.android.synthetic.main.item_library.libraryBookDescription
|
import kotlinx.android.synthetic.main.item_library.libraryBookDescription
|
||||||
import kotlinx.android.synthetic.main.item_library.libraryBookFavicon
|
import kotlinx.android.synthetic.main.item_library.libraryBookFavicon
|
||||||
import kotlinx.android.synthetic.main.item_library.libraryBookFileName
|
|
||||||
import kotlinx.android.synthetic.main.item_library.libraryBookLanguage
|
import kotlinx.android.synthetic.main.item_library.libraryBookLanguage
|
||||||
import kotlinx.android.synthetic.main.item_library.libraryBookPublisher
|
|
||||||
import kotlinx.android.synthetic.main.item_library.libraryBookSize
|
import kotlinx.android.synthetic.main.item_library.libraryBookSize
|
||||||
import kotlinx.android.synthetic.main.item_library.libraryBookTitle
|
import kotlinx.android.synthetic.main.item_library.libraryBookTitle
|
||||||
import kotlinx.android.synthetic.main.item_library.tags
|
import kotlinx.android.synthetic.main.item_library.tags
|
||||||
import kotlinx.android.synthetic.main.item_library.unableToDownload
|
import kotlinx.android.synthetic.main.item_library.unableToDownload
|
||||||
import kotlinx.android.synthetic.main.library_divider.divider_text
|
import kotlinx.android.synthetic.main.library_divider.divider_text
|
||||||
import org.kiwix.kiwixmobile.R
|
import org.kiwix.kiwixmobile.R
|
||||||
import org.kiwix.kiwixmobile.core.CoreApp
|
|
||||||
import org.kiwix.kiwixmobile.core.base.adapter.BaseViewHolder
|
import org.kiwix.kiwixmobile.core.base.adapter.BaseViewHolder
|
||||||
import org.kiwix.kiwixmobile.core.downloader.model.Base64String
|
import org.kiwix.kiwixmobile.core.downloader.model.Base64String
|
||||||
import org.kiwix.kiwixmobile.core.extensions.setBitmap
|
import org.kiwix.kiwixmobile.core.extensions.setBitmap
|
||||||
import org.kiwix.kiwixmobile.core.extensions.setTextAndVisibility
|
import org.kiwix.kiwixmobile.core.extensions.setTextAndVisibility
|
||||||
import org.kiwix.kiwixmobile.core.utils.BookUtils
|
import org.kiwix.kiwixmobile.core.utils.BookUtils
|
||||||
import org.kiwix.kiwixmobile.core.utils.NetworkUtils
|
|
||||||
import org.kiwix.kiwixmobile.core.zim_manager.KiloByte
|
import org.kiwix.kiwixmobile.core.zim_manager.KiloByte
|
||||||
import org.kiwix.kiwixmobile.zim_manager.Fat32Checker.FileSystemState.CannotWrite4GbFile
|
import org.kiwix.kiwixmobile.zim_manager.Fat32Checker.FileSystemState.CannotWrite4GbFile
|
||||||
import org.kiwix.kiwixmobile.zim_manager.Fat32Checker.FileSystemState.Unknown
|
import org.kiwix.kiwixmobile.zim_manager.Fat32Checker.FileSystemState.Unknown
|
||||||
@ -69,11 +65,9 @@ sealed class LibraryViewHolder<in T : LibraryListItem>(containerView: View) :
|
|||||||
libraryBookTitle.setTextAndVisibility(item.book.title)
|
libraryBookTitle.setTextAndVisibility(item.book.title)
|
||||||
libraryBookDescription.setTextAndVisibility(item.book.description)
|
libraryBookDescription.setTextAndVisibility(item.book.description)
|
||||||
libraryBookCreator.setTextAndVisibility(item.book.creator)
|
libraryBookCreator.setTextAndVisibility(item.book.creator)
|
||||||
libraryBookPublisher.setTextAndVisibility(item.book.publisher)
|
|
||||||
libraryBookDate.setTextAndVisibility(item.book.date)
|
libraryBookDate.setTextAndVisibility(item.book.date)
|
||||||
libraryBookSize.setTextAndVisibility(KiloByte(item.book.size).humanReadable)
|
libraryBookSize.setTextAndVisibility(KiloByte(item.book.size).humanReadable)
|
||||||
libraryBookLanguage.text = bookUtils.getLanguage(item.book.getLanguage())
|
libraryBookLanguage.text = bookUtils.getLanguage(item.book.getLanguage())
|
||||||
libraryBookFileName.text = NetworkUtils.parseURL(CoreApp.instance, item.book.url)
|
|
||||||
libraryBookFavicon.setBitmap(Base64String(item.book.favicon))
|
libraryBookFavicon.setBitmap(Base64String(item.book.favicon))
|
||||||
|
|
||||||
containerView.setOnClickListener { clickAction.invoke(item) }
|
containerView.setOnClickListener { clickAction.invoke(item) }
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView xmlns:app="http://schemas.android.com/apk/res-auto"
|
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
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:layout_margin="@dimen/card_margin"
|
android:layout_margin="@dimen/card_margin">
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/constraint_layout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackground"
|
android:background="?selectableItemBackground"
|
||||||
@ -33,13 +32,15 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/libraryBookTitle"
|
android:id="@+id/libraryBookTitle"
|
||||||
style="@style/list_item_title"
|
style="@style/list_item_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/favicon_margin_right"
|
android:layout_marginStart="@dimen/favicon_margin_right"
|
||||||
android:layout_marginTop="@dimen/item_library_margin_top"
|
android:layout_marginTop="@dimen/item_library_margin_top"
|
||||||
|
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/libraryBookFavicon"
|
app:layout_constraintStart_toEndOf="@+id/libraryBookFavicon"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Title" />
|
tools:text="Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title Title " />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/libraryBookDescription"
|
android:id="@+id/libraryBookDescription"
|
||||||
@ -47,88 +48,64 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||||
android:textColor="?textSecondary"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:textColor="?textSecondary"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/libraryBookTitle"
|
app:layout_constraintStart_toStartOf="@+id/libraryBookTitle"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/libraryBookTitle"
|
app:layout_constraintTop_toBottomOf="@+id/libraryBookTitle"
|
||||||
tools:text="Description a really really really really really really really really really really long descricption" />
|
tools:text="Description a really really really really really really really really really really long descricption elipsisisisss" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/libraryBookSize"
|
android:id="@+id/libraryBookSize"
|
||||||
style="@style/list_item_body"
|
style="@style/list_item_body.detail"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?textTertiary"
|
app:layout_constraintEnd_toStartOf="@id/libraryBookDate"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||||
app:layout_constraintStart_toStartOf="@+id/libraryBookTitle"
|
app:layout_constraintStart_toStartOf="@+id/libraryBookTitle"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/libraryBookDescription"
|
app:layout_constraintTop_toBottomOf="@+id/libraryBookDescription"
|
||||||
tools:text="File Size" />
|
tools:text="File Size File Size File Size File Size File Size File Size File Size File Size File Size " />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/libraryBookCreator"
|
|
||||||
style="@style/list_item_body"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="?textTertiary"
|
|
||||||
android:gravity="start"
|
|
||||||
android:layout_marginRight="10dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/libraryBookSize"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/libraryBookSize"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/libraryBookDate"
|
|
||||||
tools:text="Author" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/libraryBookPublisher"
|
|
||||||
style="@style/list_item_body"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="?textTertiary"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/libraryBookCreator"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/libraryBookCreator"
|
|
||||||
tools:text="Publisher" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/libraryBookDate"
|
android:id="@+id/libraryBookDate"
|
||||||
style="@style/list_item_body"
|
style="@style/list_item_body.detail.end"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?textTertiary"
|
|
||||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/libraryBookSize"
|
app:layout_constraintStart_toEndOf="@id/libraryBookSize"
|
||||||
tools:text="Date" />
|
app:layout_constraintTop_toTopOf="@id/libraryBookSize"
|
||||||
|
tools:text="Date Date Date Date Date " />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/libraryBookCreator"
|
||||||
|
style="@style/list_item_body.detail"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/libraryBookLanguage"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/libraryBookTitle"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/libraryBookSize"
|
||||||
|
tools:text="Author" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/libraryBookLanguage"
|
android:id="@+id/libraryBookLanguage"
|
||||||
style="@style/list_item_body"
|
style="@style/list_item_body.detail.end"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?textTertiary"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_marginStart="50dp"
|
app:layout_constraintStart_toEndOf="@id/libraryBookCreator"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/libraryBookDate"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/libraryBookDate"
|
app:layout_constraintTop_toBottomOf="@+id/libraryBookDate"
|
||||||
tools:text="Language" />
|
tools:text="Language" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/libraryBookFileName"
|
|
||||||
style="@style/list_item_body"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="?textTertiary"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/libraryBookLanguage"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/libraryBookLanguage"
|
|
||||||
tools:text="File Name" />
|
|
||||||
|
|
||||||
<org.kiwix.kiwixmobile.core.zim_manager.TagsView
|
<org.kiwix.kiwixmobile.core.zim_manager.TagsView
|
||||||
android:id="@+id/tags"
|
android:id="@+id/tags"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/libraryBookTitle"
|
app:layout_constraintStart_toStartOf="@+id/libraryBookTitle"
|
||||||
app:layout_constraintTop_toBottomOf="@id/libraryBookPublisher" />
|
app:layout_constraintTop_toBottomOf="@id/libraryBookCreator" />
|
||||||
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@ -137,12 +114,11 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:alpha=".5"
|
android:alpha=".5"
|
||||||
android:background="@color/pure_gray"
|
android:background="@color/pure_gray"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/constraint_layout"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="@id/constraint_layout"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/constraint_layout"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/constraint_layout"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:visibility="gone" />
|
tools:visibility="gone" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
@ -52,6 +52,20 @@
|
|||||||
|
|
||||||
<style name="list_item_body" parent="TextAppearance.KiwixTheme.Subtitle2" />
|
<style name="list_item_body" parent="TextAppearance.KiwixTheme.Subtitle2" />
|
||||||
|
|
||||||
|
<style name="list_item_body.detail">
|
||||||
|
<item name="android:maxLines">1</item>
|
||||||
|
<item name="android:textColor">?textTertiary</item>
|
||||||
|
<item name="android:paddingEnd">5dp</item>
|
||||||
|
<item name="android:ellipsize">end</item>
|
||||||
|
<item name="layout_constrainedWidth">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="list_item_body.detail.end">
|
||||||
|
<item name="android:layout_marginEnd">@dimen/activity_horizontal_margin</item>
|
||||||
|
|
||||||
|
<item name="android:gravity">end</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="no_content_text" parent="TextAppearance.KiwixTheme.Headline5" />
|
<style name="no_content_text" parent="TextAppearance.KiwixTheme.Headline5" />
|
||||||
|
|
||||||
<style name="switch_style">
|
<style name="switch_style">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user