Fixed search activity back button
This commit is contained in:
parent
4162b57b24
commit
31670b8113
3 changed files with 25 additions and 15 deletions
|
@ -1,7 +1,6 @@
|
||||||
package eu.kanade.tachiyomi.ui.main
|
package eu.kanade.tachiyomi.ui.main
|
||||||
|
|
||||||
import android.app.SearchManager
|
import android.app.SearchManager
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
@ -98,8 +97,8 @@ class SearchActivity: MainActivity() {
|
||||||
content.systemUiVisibility = content.systemUiVisibility.or(View
|
content.systemUiVisibility = content.systemUiVisibility.or(View
|
||||||
.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
|
.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
|
||||||
|
|
||||||
val drawerContainer: FrameLayout = findViewById(R.id.search_container)
|
val searchContainer: FrameLayout = findViewById(R.id.search_container)
|
||||||
drawerContainer.setOnApplyWindowInsetsListener { v, insets ->
|
searchContainer.setOnApplyWindowInsetsListener { v, insets ->
|
||||||
window.statusBarColor = getResourceColor(R.attr.colorPrimary)
|
window.statusBarColor = getResourceColor(R.attr.colorPrimary)
|
||||||
val contextView = window?.decorView?.findViewById<View>(R.id.action_mode_bar)
|
val contextView = window?.decorView?.findViewById<View>(R.id.action_mode_bar)
|
||||||
contextView?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
contextView?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
|
@ -147,13 +146,22 @@ class SearchActivity: MainActivity() {
|
||||||
syncActivityViewWithController(router.backstack.lastOrNull()?.controller())
|
syncActivityViewWithController(router.backstack.lastOrNull()?.controller())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Context.popToRoot() {
|
override fun onBackPressed() {
|
||||||
|
if (router.backstack.size <= 1 || !router.handleBack()) {
|
||||||
|
unlocked = false
|
||||||
|
super.onBackPressed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun popToRoot() {
|
||||||
|
if (!router.handleBack()) {
|
||||||
val intent = Intent(this, MainActivity::class.java).apply {
|
val intent = Intent(this, MainActivity::class.java).apply {
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
}
|
}
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
finishAfterTransition()
|
finishAfterTransition()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun syncActivityViewWithController(to: Controller?, from: Controller?) {
|
override fun syncActivityViewWithController(to: Controller?, from: Controller?) {
|
||||||
if (from is DialogController || to is DialogController) {
|
if (from is DialogController || to is DialogController) {
|
||||||
|
|
|
@ -72,7 +72,10 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||||
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
||||||
import jp.wasabeef.glide.transformations.MaskTransformation
|
import jp.wasabeef.glide.transformations.MaskTransformation
|
||||||
|
import kotlinx.android.synthetic.main.edit_manga_dialog.*
|
||||||
import kotlinx.android.synthetic.main.manga_info_controller.*
|
import kotlinx.android.synthetic.main.manga_info_controller.*
|
||||||
|
import kotlinx.android.synthetic.main.manga_info_controller.manga_artist
|
||||||
|
import kotlinx.android.synthetic.main.manga_info_controller.manga_author
|
||||||
import kotlinx.android.synthetic.main.manga_info_controller.manga_cover
|
import kotlinx.android.synthetic.main.manga_info_controller.manga_cover
|
||||||
import kotlinx.android.synthetic.main.manga_info_controller.manga_genres_tags
|
import kotlinx.android.synthetic.main.manga_info_controller.manga_genres_tags
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
|
@ -198,9 +201,10 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
val fabBaseMarginBottom = fab_favorite.marginBottom
|
val fabBaseMarginBottom = fab_favorite.marginBottom
|
||||||
val mangaCoverMarginBottom = manga_cover.marginBottom
|
val mangaCoverMarginBottom = manga_cover.marginBottom
|
||||||
val fullMarginBottom = manga_cover_full?.marginBottom ?: 0
|
val fullMarginBottom = manga_cover_full?.marginBottom ?: 0
|
||||||
|
manga_cover.viewTreeObserver.addOnGlobalLayoutListener {
|
||||||
setFullCoverToThumb()
|
setFullCoverToThumb()
|
||||||
|
}
|
||||||
container?.setOnApplyWindowInsetsListener { _, insets ->
|
container?.setOnApplyWindowInsetsListener { _, insets ->
|
||||||
setFullCoverToThumb()
|
|
||||||
if (MainActivity.bottomNav)
|
if (MainActivity.bottomNav)
|
||||||
return@setOnApplyWindowInsetsListener insets
|
return@setOnApplyWindowInsetsListener insets
|
||||||
if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/swipe_refresh"
|
android:id="@+id/swipe_refresh"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
Reference in a new issue