mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 21:41:50 +01:00
Remove some relayed chapter info from main manga info view
This commit is contained in:
parent
9dc184adff
commit
c67e62bac3
@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.source.Source
|
|||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||||
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
||||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||||
import java.util.Date
|
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
@ -22,6 +21,7 @@ import rx.schedulers.Schedulers
|
|||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Presenter of [ChaptersController].
|
* Presenter of [ChaptersController].
|
||||||
@ -90,14 +90,6 @@ class ChaptersPresenter(
|
|||||||
|
|
||||||
// Listen for download status changes
|
// Listen for download status changes
|
||||||
observeDownloads()
|
observeDownloads()
|
||||||
|
|
||||||
// Emit the number of chapters to the info tab.
|
|
||||||
chapterCountRelay.call(chapters.maxBy { it.chapter_number }?.chapter_number
|
|
||||||
?: 0f)
|
|
||||||
|
|
||||||
// Emit the upload date of the most recent chapter
|
|
||||||
lastUpdateRelay.call(Date(chapters.maxBy { it.date_upload }?.date_upload
|
|
||||||
?: 0))
|
|
||||||
}
|
}
|
||||||
.subscribe { chaptersRelay.call(it) })
|
.subscribe { chaptersRelay.call(it) })
|
||||||
}
|
}
|
||||||
|
@ -54,13 +54,11 @@ import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
|||||||
import eu.kanade.tachiyomi.util.lang.truncateCenter
|
import eu.kanade.tachiyomi.util.lang.truncateCenter
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import java.text.DateFormat
|
|
||||||
import java.text.DecimalFormat
|
|
||||||
import java.util.Date
|
|
||||||
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.text.DateFormat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that shows manga information.
|
* Fragment that shows manga information.
|
||||||
@ -85,8 +83,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
|
|
||||||
override fun createPresenter(): MangaInfoPresenter {
|
override fun createPresenter(): MangaInfoPresenter {
|
||||||
val ctrl = parentController as MangaController
|
val ctrl = parentController as MangaController
|
||||||
return MangaInfoPresenter(ctrl.manga!!, ctrl.source!!,
|
return MangaInfoPresenter(ctrl.manga!!, ctrl.source!!, ctrl.mangaFavoriteRelay)
|
||||||
ctrl.chapterCountRelay, ctrl.lastUpdateRelay, ctrl.mangaFavoriteRelay)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
@ -268,27 +265,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update chapter count TextView.
|
|
||||||
*
|
|
||||||
* @param count number of chapters.
|
|
||||||
*/
|
|
||||||
fun setChapterCount(count: Float) {
|
|
||||||
if (count > 0f) {
|
|
||||||
binding.mangaChapters.text = DecimalFormat("#.#").format(count)
|
|
||||||
} else {
|
|
||||||
binding.mangaChapters.text = resources?.getString(R.string.unknown)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setLastUpdateDate(date: Date) {
|
|
||||||
if (date.time != 0L) {
|
|
||||||
binding.mangaLastUpdate.text = dateFormat.format(date)
|
|
||||||
} else {
|
|
||||||
binding.mangaLastUpdate.text = resources?.getString(R.string.unknown)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles the favorite status and asks for confirmation to delete downloaded chapters.
|
* Toggles the favorite status and asks for confirmation to delete downloaded chapters.
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.ui.manga.info
|
package eu.kanade.tachiyomi.ui.manga.info
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.jakewharton.rxrelay.BehaviorRelay
|
|
||||||
import com.jakewharton.rxrelay.PublishRelay
|
import com.jakewharton.rxrelay.PublishRelay
|
||||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
@ -12,7 +11,6 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
|
|||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||||
import java.util.Date
|
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
@ -28,8 +26,6 @@ import uy.kohesive.injekt.api.get
|
|||||||
class MangaInfoPresenter(
|
class MangaInfoPresenter(
|
||||||
val manga: Manga,
|
val manga: Manga,
|
||||||
val source: Source,
|
val source: Source,
|
||||||
private val chapterCountRelay: BehaviorRelay<Float>,
|
|
||||||
private val lastUpdateRelay: BehaviorRelay<Date>,
|
|
||||||
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
||||||
private val db: DatabaseHelper = Injekt.get(),
|
private val db: DatabaseHelper = Injekt.get(),
|
||||||
private val downloadManager: DownloadManager = Injekt.get(),
|
private val downloadManager: DownloadManager = Injekt.get(),
|
||||||
@ -50,18 +46,10 @@ class MangaInfoPresenter(
|
|||||||
super.onCreate(savedState)
|
super.onCreate(savedState)
|
||||||
sendMangaToView()
|
sendMangaToView()
|
||||||
|
|
||||||
// Update chapter count
|
|
||||||
chapterCountRelay.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribeLatestCache(MangaInfoController::setChapterCount)
|
|
||||||
|
|
||||||
// Update favorite status
|
// Update favorite status
|
||||||
mangaFavoriteRelay.observeOn(AndroidSchedulers.mainThread())
|
mangaFavoriteRelay.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe { setFavorite(it) }
|
.subscribe { setFavorite(it) }
|
||||||
.apply { add(this) }
|
.apply { add(this) }
|
||||||
|
|
||||||
// update last update date
|
|
||||||
lastUpdateRelay.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribeLatestCache(MangaInfoController::setLastUpdateDate)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,52 +113,6 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/manga_artist_label" />
|
app:layout_constraintStart_toEndOf="@+id/manga_artist_label" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_chapters_label"
|
|
||||||
style="@style/TextAppearance.Medium.Body2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/manga_info_last_chapter_label"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_artist_label" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_chapters"
|
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_chapters_label"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/manga_chapters_label" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_last_update_label"
|
|
||||||
style="@style/TextAppearance.Medium.Body2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/manga_info_latest_data_label"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_chapters_label" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_last_update"
|
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_last_update_label"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/manga_last_update_label" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status_label"
|
android:id="@+id/manga_status_label"
|
||||||
style="@style/TextAppearance.Medium.Body2"
|
style="@style/TextAppearance.Medium.Body2"
|
||||||
@ -167,7 +121,7 @@
|
|||||||
android:text="@string/manga_info_status_label"
|
android:text="@string/manga_info_status_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_last_update_label" />
|
app:layout_constraintTop_toBottomOf="@+id/manga_artist_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status"
|
android:id="@+id/manga_status"
|
||||||
|
@ -101,7 +101,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/manga_info_author_label"
|
android:text="@string/manga_info_author_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_full_title" />
|
app:layout_constraintTop_toBottomOf="@+id/manga_full_title" />
|
||||||
|
|
||||||
@ -141,52 +140,6 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/manga_artist_label" />
|
app:layout_constraintStart_toEndOf="@+id/manga_artist_label" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_chapters_label"
|
|
||||||
style="@style/TextAppearance.Medium.Body2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/manga_info_last_chapter_label"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_artist_label" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_chapters"
|
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_chapters_label"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/manga_chapters_label" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_last_update_label"
|
|
||||||
style="@style/TextAppearance.Medium.Body2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/manga_info_latest_data_label"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_chapters_label" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manga_last_update"
|
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
app:layout_constraintBaseline_toBaselineOf="@+id/manga_last_update_label"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/manga_last_update_label" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status_label"
|
android:id="@+id/manga_status_label"
|
||||||
style="@style/TextAppearance.Medium.Body2"
|
style="@style/TextAppearance.Medium.Body2"
|
||||||
@ -195,7 +148,7 @@
|
|||||||
android:text="@string/manga_info_status_label"
|
android:text="@string/manga_info_status_label"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/manga_last_update_label" />
|
app:layout_constraintTop_toBottomOf="@+id/manga_artist_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/manga_status"
|
android:id="@+id/manga_status"
|
||||||
|
@ -413,8 +413,6 @@
|
|||||||
<string name="manga_info_author_label">Author</string>
|
<string name="manga_info_author_label">Author</string>
|
||||||
<string name="manga_info_artist_label">Artist</string>
|
<string name="manga_info_artist_label">Artist</string>
|
||||||
<string name="manga_info_chapters_label">Chapters</string>
|
<string name="manga_info_chapters_label">Chapters</string>
|
||||||
<string name="manga_info_last_chapter_label">Last chapter</string>
|
|
||||||
<string name="manga_info_latest_data_label">Updated</string>
|
|
||||||
<string name="manga_info_status_label">Status</string>
|
<string name="manga_info_status_label">Status</string>
|
||||||
<string name="manga_info_source_label">Source</string>
|
<string name="manga_info_source_label">Source</string>
|
||||||
<string name="manga_info_genres_label">Genres</string>
|
<string name="manga_info_genres_label">Genres</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user