wrap more if's and else with braces

This commit is contained in:
CarlosEsco 2020-04-22 12:50:52 -04:00
parent 4e44ee3605
commit ca633b1f95

View file

@ -315,8 +315,10 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
private fun initializeMenu() { private fun initializeMenu() {
// Set toolbar // Set toolbar
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
val primaryColor = ColorUtils.setAlphaComponent(getResourceColor(R.attr.colorSecondary), val primaryColor = ColorUtils.setAlphaComponent(
200) getResourceColor(R.attr.colorSecondary),
200
)
appbar.setBackgroundColor(primaryColor) appbar.setBackgroundColor(primaryColor)
window.statusBarColor = Color.TRANSPARENT window.statusBarColor = Color.TRANSPARENT
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
@ -340,7 +342,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
chapters_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN chapters_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
reader_menu.doOnApplyWindowInsets { v, insets, _ -> reader_menu.doOnApplyWindowInsets { v, insets, _ ->
sheetManageNavColor = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && (insets sheetManageNavColor = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && (insets
.systemWindowInsetBottom != insets.tappableElementInsets.bottom)) { .systemWindowInsetBottom != insets.tappableElementInsets.bottom)
) {
window.navigationBarColor = Color.TRANSPARENT window.navigationBarColor = Color.TRANSPARENT
false false
} }
@ -407,9 +410,10 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
appbar.startAnimation(toolbarAnimation) appbar.startAnimation(toolbarAnimation)
BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true
BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_HIDDEN BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_HIDDEN
} else } else {
reader_menu.visibility = View.GONE reader_menu.visibility = View.GONE
} }
}
menuStickyVisible = false menuStickyVisible = false
} }
@ -530,12 +534,15 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
page_text.text = "${page.number} / ${pages.size}" page_text.text = "${page.number} / ${pages.size}"
if (newChapter) { if (newChapter) {
if (config?.showNewChapter == false) systemUi?.show() if (config?.showNewChapter == false) {
systemUi?.show()
}
} else if (chapters_bottom_sheet.shouldCollaspe && chapters_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) { } else if (chapters_bottom_sheet.shouldCollaspe && chapters_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) {
chapters_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED chapters_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
} }
if (chapters_bottom_sheet.selectedChapterId != page.chapter.chapter.id) if (chapters_bottom_sheet.selectedChapterId != page.chapter.chapter.id) {
chapters_bottom_sheet.refreshList() chapters_bottom_sheet.refreshList()
}
chapters_bottom_sheet.shouldCollaspe = true chapters_bottom_sheet.shouldCollaspe = true
// Set seekbar progress // Set seekbar progress
@ -638,11 +645,13 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
* depending on the [result]. * depending on the [result].
*/ */
fun onSetAsCoverResult(result: ReaderPresenter.SetAsCoverResult) { fun onSetAsCoverResult(result: ReaderPresenter.SetAsCoverResult) {
toast(when (result) { toast(
when (result) {
Success -> R.string.cover_updated Success -> R.string.cover_updated
AddToLibraryFirst -> R.string.must_be_in_library_to_edit AddToLibraryFirst -> R.string.must_be_in_library_to_edit
Error -> R.string.failed_to_update_cover Error -> R.string.failed_to_update_cover
}) }
)
} }
override fun onVisibilityChange(visible: Boolean) { override fun onVisibilityChange(visible: Boolean) {