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
|
||||
|
||||
import android.app.SearchManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
|
@ -98,8 +97,8 @@ class SearchActivity: MainActivity() {
|
|||
content.systemUiVisibility = content.systemUiVisibility.or(View
|
||||
.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
|
||||
|
||||
val drawerContainer: FrameLayout = findViewById(R.id.search_container)
|
||||
drawerContainer.setOnApplyWindowInsetsListener { v, insets ->
|
||||
val searchContainer: FrameLayout = findViewById(R.id.search_container)
|
||||
searchContainer.setOnApplyWindowInsetsListener { v, insets ->
|
||||
window.statusBarColor = getResourceColor(R.attr.colorPrimary)
|
||||
val contextView = window?.decorView?.findViewById<View>(R.id.action_mode_bar)
|
||||
contextView?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
|
@ -147,12 +146,21 @@ class SearchActivity: MainActivity() {
|
|||
syncActivityViewWithController(router.backstack.lastOrNull()?.controller())
|
||||
}
|
||||
|
||||
private fun Context.popToRoot() {
|
||||
val intent = Intent(this, MainActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
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 {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
}
|
||||
startActivity(intent)
|
||||
finishAfterTransition()
|
||||
}
|
||||
startActivity(intent)
|
||||
finishAfterTransition()
|
||||
}
|
||||
|
||||
override fun syncActivityViewWithController(to: Controller?, from: Controller?) {
|
||||
|
|
|
@ -72,7 +72,10 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
|||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
||||
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.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_genres_tags
|
||||
import uy.kohesive.injekt.Injekt
|
||||
|
@ -198,9 +201,10 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||
val fabBaseMarginBottom = fab_favorite.marginBottom
|
||||
val mangaCoverMarginBottom = manga_cover.marginBottom
|
||||
val fullMarginBottom = manga_cover_full?.marginBottom ?: 0
|
||||
setFullCoverToThumb()
|
||||
container?.setOnApplyWindowInsetsListener { _, insets ->
|
||||
manga_cover.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
setFullCoverToThumb()
|
||||
}
|
||||
container?.setOnApplyWindowInsetsListener { _, insets ->
|
||||
if (MainActivity.bottomNav)
|
||||
return@setOnApplyWindowInsetsListener insets
|
||||
if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/track_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/track_item"/>
|
||||
tools:listitem="@layout/track_item" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
Reference in a new issue