This commit is contained in:
len 2016-07-02 14:12:52 +02:00
parent ce7118084a
commit 5fe1799dab
4 changed files with 40 additions and 51 deletions

View File

@ -26,7 +26,7 @@ class DownloadHolder(private val view: View) : RecyclerView.ViewHolder(view) {
this.download = download
// Update the chapter name.
view.download_title.text = download.chapter.name
view.chapter_title.text = download.chapter.name
// Update the manga title
view.manga_title.text = download.manga.title

View File

@ -266,7 +266,7 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
// Restore active category.
view_pager.setCurrentItem(activeCat, false)
// Delay the scroll position to allow the view to be properly measured.
view_pager.post { tabs.setScrollPosition(view_pager.currentItem, 0f, true) }
view_pager.post { if (isAdded) tabs.setScrollPosition(view_pager.currentItem, 0f, true) }
// Send the manga map to child fragments after the adapter is updated.
presenter.libraryMangaSubject.onNext(LibraryMangaEvent(mangaMap))

View File

@ -21,8 +21,6 @@ class LibraryHolder(private val view: View,
listener: FlexibleViewHolder.OnListItemClickListener)
: FlexibleViewHolder(view, adapter, listener) {
private var manga: Manga? = null
/**
* Method called from [LibraryCategoryAdapter.onBindViewHolder]. It updates the data for this
* holder with the given manga.
@ -30,8 +28,6 @@ class LibraryHolder(private val view: View,
* @param manga the manga to bind.
*/
fun onSetValues(manga: Manga) {
this.manga = manga
// Update the title of the manga.
view.title.text = manga.title

View File

@ -1,55 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/manga_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Manga Title"
android:textAppearance="@style/TextAppearance.Regular.Body1"/>
<TextView
android:id="@+id/download_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chapter Title"
android:textAppearance="@style/TextAppearance.Regular.Caption"/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
android:paddingLeft="@dimen/material_layout_keylines_screen_edge_margin"
android:paddingRight="@dimen/material_layout_keylines_screen_edge_margin"
android:paddingTop="@dimen/material_component_lists_padding_above_list">
<TextView
android:id="@+id/download_progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_alignParentRight="true"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.Regular.Caption.Hint"
android:text="(0/10)"/>
tools:text="(0/10)"/>
</LinearLayout>
<TextView
android:id="@+id/manga_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/download_progress_text"
android:layout_alignParentLeft="true"
android:maxLines="1"
android:ellipsize="end"
android:textAppearance="@style/TextAppearance.Regular.Body1"
tools:text="Manga title"/>
<TextView
android:id="@+id/chapter_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/manga_title"
android:maxLines="1"
android:ellipsize="end"
tools:text="Chapter Title"
android:textAppearance="@style/TextAppearance.Regular.Caption"/>
<ProgressBar
android:id="@+id/download_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_below="@id/chapter_title"
style="?android:attr/progressBarStyleHorizontal"/>
</LinearLayout>
</RelativeLayout>