Minor code cleanup

This commit is contained in:
arkon
2020-01-07 19:20:08 -05:00
parent 0d5099f230
commit 5cddb269d6
67 changed files with 184 additions and 184 deletions
@@ -109,8 +109,9 @@ class ChaptersPresenter(
.observeOn(AndroidSchedulers.mainThread())
.filter { download -> download.manga.id == manga.id }
.doOnNext { onDownloadStatusChange(it) }
.subscribeLatestCache(ChaptersController::onChapterStatusChange,
{ _, error -> Timber.e(error) })
.subscribeLatestCache(ChaptersController::onChapterStatusChange) {
_, error -> Timber.e(error)
}
}
/**
@@ -13,7 +13,7 @@ class DeletingChaptersDialog(bundle: Bundle? = null) : DialogController(bundle)
const val TAG = "deleting_dialog"
}
override fun onCreateDialog(savedState: Bundle?): Dialog {
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
return MaterialDialog.Builder(activity!!)
.progress(true, 0)
.content(R.string.deleting)
@@ -24,4 +24,4 @@ class DeletingChaptersDialog(bundle: Bundle? = null) : DialogController(bundle)
showDialog(router, TAG)
}
}
}
@@ -195,11 +195,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
}
// If manga source is known update source TextView.
manga_source.text = if (source == null) {
view.context.getString(R.string.unknown)
} else {
source.toString()
}
manga_source.text = source?.toString() ?: view.context.getString(R.string.unknown)
// Update genres list
if (manga.genre.isNullOrBlank().not()) {
@@ -32,7 +32,7 @@ class SetTrackStatusDialog<T> : DialogController
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val item = item
val statusList = item.service.getStatusList().orEmpty()
val statusList = item.service.getStatusList()
val statusString = statusList.mapNotNull { item.service.getStatus(it) }
val selectedIndex = statusList.indexOf(item.track?.status)
@@ -40,10 +40,10 @@ class SetTrackStatusDialog<T> : DialogController
.title(R.string.status)
.negativeText(android.R.string.cancel)
.items(statusString)
.itemsCallbackSingleChoice(selectedIndex, { _, _, i, _ ->
.itemsCallbackSingleChoice(selectedIndex) { _, _, i, _ ->
(targetController as? Listener)?.setStatus(item, i)
true
})
}
.build()
}
@@ -55,4 +55,4 @@ class SetTrackStatusDialog<T> : DialogController
const val KEY_ITEM_TRACK = "SetTrackStatusDialog.item.track"
}
}
}
@@ -25,7 +25,7 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
logo_container.setBackgroundColor(item.service.getLogoColor())
if (track != null) {
track_title.setTextAppearance(itemView.context, R.style.TextAppearance_Regular_Body1_Secondary)
track_title.setAllCaps(false)
track_title.isAllCaps = false
track_title.text = track.title
track_chapters.text = "${track.last_chapter_read}/" +
if (track.total_chapters > 0) track.total_chapters else "-"
@@ -50,7 +50,7 @@ class TrackSearchDialog : DialogController {
service = Injekt.get<TrackManager>().getService(bundle.getInt(KEY_SERVICE))!!
}
override fun onCreateDialog(savedState: Bundle?): Dialog {
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val dialog = MaterialDialog.Builder(activity!!)
.customView(R.layout.track_search_dialog, false)
.positiveText(android.R.string.ok)
@@ -63,7 +63,7 @@ class TrackSearchDialog : DialogController {
}
dialogView = dialog.view
onViewCreated(dialog.view, savedState)
onViewCreated(dialog.view, savedViewState)
return dialog
}