mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:35:10 +01:00
Fixed action mode bar + drawer in 3 button landscape
This commit is contained in:
parent
a7e349b1b2
commit
1d0f6e8bce
@ -5,6 +5,7 @@ import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
@ -12,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ActionMode
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import android.view.*
|
||||
import androidx.appcompat.widget.ActionBarContextView
|
||||
import androidx.core.view.GravityCompat
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
@ -155,6 +157,13 @@ class LibraryController(
|
||||
if (selectedMangas.isNotEmpty()) {
|
||||
createActionModeIfNeeded()
|
||||
}
|
||||
view.doOnApplyWindowInsets { view, insets, psdding ->
|
||||
val contextView = activity?.window?.decorView?.findViewById<View>(R.id.action_mode_bar)
|
||||
if (Build.VERSION.SDK_INT >= 23) contextView?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
leftMargin = view.rootWindowInsets.systemWindowInsetLeft
|
||||
rightMargin = view.rootWindowInsets.systemWindowInsetRight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||
@ -197,8 +206,7 @@ class LibraryController(
|
||||
view.doOnApplyWindowInsets { v, insets, padding ->
|
||||
view.recycler.updatePaddingRelative(
|
||||
bottom = view.recycler.marginBottom + insets.systemWindowInsetBottom,
|
||||
top = view.recycler.marginTop + insets.systemWindowInsetTop,
|
||||
end = view.recycler.marginRight + insets.systemWindowInsetRight
|
||||
top = view.recycler.marginTop + insets.systemWindowInsetTop
|
||||
)
|
||||
}
|
||||
return view
|
||||
|
@ -20,6 +20,8 @@ import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowInsets
|
||||
import android.view.WindowManager
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import com.bluelinelabs.conductor.*
|
||||
import eu.kanade.tachiyomi.Migrations
|
||||
@ -31,6 +33,7 @@ import eu.kanade.tachiyomi.ui.catalogue.CatalogueController
|
||||
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchController
|
||||
import eu.kanade.tachiyomi.ui.download.DownloadController
|
||||
import eu.kanade.tachiyomi.ui.extension.ExtensionController
|
||||
import eu.kanade.tachiyomi.ui.library.HeightTopWindowInsetsListener
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryController
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
|
||||
@ -38,8 +41,12 @@ import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
||||
import eu.kanade.tachiyomi.util.NoopWindowInsetsListener
|
||||
import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
|
||||
import eu.kanade.tachiyomi.util.marginBottom
|
||||
import eu.kanade.tachiyomi.util.marginTop
|
||||
import eu.kanade.tachiyomi.util.openInBrowser
|
||||
import eu.kanade.tachiyomi.util.updatePadding
|
||||
import eu.kanade.tachiyomi.util.updatePaddingRelative
|
||||
import kotlinx.android.synthetic.main.chapters_controller.view.*
|
||||
import kotlinx.android.synthetic.main.main_activity.*
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
@ -120,27 +127,45 @@ class MainActivity : BaseActivity() {
|
||||
true
|
||||
}
|
||||
|
||||
nav_view.doOnApplyWindowInsets { v, insets, padding ->
|
||||
/*nav_view.doOnApplyWindowInsets { v, insets, padding ->
|
||||
v.updatePaddingRelative(
|
||||
start = padding.left + insets.systemWindowInsetLeft
|
||||
)
|
||||
}
|
||||
}*/
|
||||
|
||||
val container: ViewGroup = findViewById(R.id.controller_container)
|
||||
|
||||
val content: LinearLayout = findViewById(R.id.main_content)
|
||||
container.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
content.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
nav_view.doOnApplyWindowInsets { v, insets, padding ->
|
||||
v.updatePaddingRelative(
|
||||
bottom = v.marginBottom,
|
||||
top = v.marginTop
|
||||
)
|
||||
}
|
||||
content.setOnApplyWindowInsetsListener(NoopWindowInsetsListener)
|
||||
val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
||||
if (Build.VERSION.SDK_INT >= 26 && currentNightMode == Configuration.UI_MODE_NIGHT_NO) {
|
||||
content.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
|
||||
}
|
||||
|
||||
val drawerContainer: FrameLayout = findViewById(R.id.drawer_container)
|
||||
drawerContainer.setOnApplyWindowInsetsListener { v, insets ->
|
||||
|
||||
// Consume any horizontal insets and pad all content in. There's not much we can do
|
||||
// with horizontal insets
|
||||
v.updatePadding(
|
||||
left = insets.systemWindowInsetLeft,
|
||||
right = insets.systemWindowInsetRight
|
||||
)
|
||||
insets.replaceSystemWindowInsets(
|
||||
0, insets.systemWindowInsetTop,
|
||||
0, insets.systemWindowInsetBottom
|
||||
)
|
||||
}
|
||||
|
||||
router = Conductor.attachRouter(this, container, savedInstanceState)
|
||||
if (!router.hasRootController()) {
|
||||
// Set start screen
|
||||
|
@ -1,8 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
android:id="@+id/drawer"
|
||||
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drawer_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
android:id="@+id/drawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
@ -57,3 +63,4 @@
|
||||
app:menu="@menu/menu_navigation"/>
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user