mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:55:11 +01:00
UI Fixing
Fixed source migration being clipped Fixed shadow of unread badge being clipped
This commit is contained in:
parent
93cb8f649e
commit
d62c0f00c4
@ -73,6 +73,8 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
|
||||
var customTitle = ""
|
||||
|
||||
var showingExtenions = false
|
||||
|
||||
/**
|
||||
* Called when controller is initialized.
|
||||
*/
|
||||
@ -87,7 +89,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
* @return title.
|
||||
*/
|
||||
override fun getTitle(): String? {
|
||||
return if (ext_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED)
|
||||
return if (showingExtenions)
|
||||
applicationContext?.getString(R.string.label_extensions)
|
||||
else applicationContext?.getString(R.string.label_catalogues)
|
||||
}
|
||||
@ -144,24 +146,36 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
shadow2.alpha = (1 - max(0f, progress)) * 0.25f
|
||||
sheet_layout.alpha = 1 - progress
|
||||
activity?.appbar?.y = max(activity!!.appbar.y, -headerHeight * (1 - progress))
|
||||
val oldShow = showingExtenions
|
||||
showingExtenions = progress > 0.92f
|
||||
if (oldShow != showingExtenions) {
|
||||
setTitle()
|
||||
activity?.invalidateOptionsMenu()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStateChanged(p0: View, state: Int) {
|
||||
if (state == BottomSheetBehavior.STATE_EXPANDED) activity?.appbar?.y = 0f
|
||||
if (state == BottomSheetBehavior.STATE_EXPANDED ||
|
||||
state == BottomSheetBehavior.STATE_COLLAPSED)
|
||||
state == BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
sheet_layout.alpha =
|
||||
if (state == BottomSheetBehavior.STATE_COLLAPSED) 1f else 0f
|
||||
showingExtenions = state == BottomSheetBehavior.STATE_EXPANDED
|
||||
setTitle()
|
||||
activity?.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
retainViewMode = if (state == BottomSheetBehavior.STATE_EXPANDED)
|
||||
RetainViewMode.RETAIN_DETACH else RetainViewMode.RELEASE_DETACH
|
||||
activity?.invalidateOptionsMenu()
|
||||
setTitle()
|
||||
sheet_layout.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED
|
||||
sheet_layout.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED
|
||||
}
|
||||
})
|
||||
|
||||
if (showingExtenions) {
|
||||
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun toggleExtensions() {
|
||||
@ -253,7 +267,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
* @param inflater used to load the menu xml.
|
||||
*/
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
if (ext_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||
if (showingExtenions) {
|
||||
// Inflate menu
|
||||
inflater.inflate(R.menu.extension_main, menu)
|
||||
|
||||
@ -305,7 +319,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
// Initialize option to open catalogue settings.
|
||||
R.id.action_filter -> {
|
||||
val controller =
|
||||
if (ext_bottom_sheet.sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED)
|
||||
if (showingExtenions)
|
||||
SettingsExtensionsController()
|
||||
else SettingsSourcesController()
|
||||
router.pushController(
|
||||
|
@ -314,8 +314,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
|
||||
|
||||
override fun layoutView(view: View) {
|
||||
adapter = LibraryCategoryAdapter(this)
|
||||
if (libraryLayout == 0)recycler.spanCount = 1
|
||||
else recycler.columnWidth = (90 + (preferences.gridSize().getOrDefault() * 30)).dpToPx
|
||||
setRecyclerLayout()
|
||||
recycler.manager.spanSizeLookup = (object : GridLayoutManager.SpanSizeLookup() {
|
||||
override fun getSpanSize(position: Int): Int {
|
||||
if (libraryLayout == 0) return 1
|
||||
@ -353,6 +352,17 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
|
||||
}
|
||||
}
|
||||
|
||||
private fun setRecyclerLayout() {
|
||||
if (libraryLayout == 0) {
|
||||
recycler.spanCount = 1
|
||||
recycler.setPaddingRelative(0,0,0,0)
|
||||
}
|
||||
else {
|
||||
recycler.columnWidth = (90 + (preferences.gridSize().getOrDefault() * 30)).dpToPx
|
||||
recycler.setPaddingRelative(3.dpToPx,0,3.dpToPx, 0)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||
super.onChangeStarted(handler, type)
|
||||
if (type.isEnter) {
|
||||
@ -475,8 +485,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
|
||||
|
||||
override fun reattachAdapter() {
|
||||
libraryLayout = preferences.libraryLayout().getOrDefault()
|
||||
if (libraryLayout == 0) recycler.spanCount = 1
|
||||
else recycler.columnWidth = (90 + (preferences.gridSize().getOrDefault() * 30)).dpToPx
|
||||
setRecyclerLayout()
|
||||
val position =
|
||||
(recycler.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
|
||||
recycler.adapter = adapter
|
||||
|
@ -210,7 +210,6 @@ fun View.doOnApplyWindowInsets(f: (View, WindowInsets, ViewPaddingState) -> Unit
|
||||
}
|
||||
|
||||
fun View.applyWindowInsetsForController() {
|
||||
// Create a snapshot of the view's padding state
|
||||
setOnApplyWindowInsetsListener(ControllerViewWindowInsetsListener)
|
||||
requestApplyInsetsWhenAttached()
|
||||
}
|
||||
|
@ -21,9 +21,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/text_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@ -113,6 +113,7 @@
|
||||
<include
|
||||
layout="@layout/unread_download_badge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/badge_guide"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
@ -123,17 +124,15 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="30sp">
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
style="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
@ -143,12 +142,10 @@
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
style="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
|
@ -6,15 +6,15 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:minHeight="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="25dp">
|
||||
android:minHeight="@dimen/material_component_lists_single_line_with_avatar_height">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -95,7 +95,7 @@
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
style="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
|
@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/migration_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/migration_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="false"/>
|
||||
</FrameLayout>
|
@ -11,7 +11,7 @@
|
||||
app:actionViewClass="androidx.appcompat.widget.SearchView"/>
|
||||
|
||||
<item android:id="@+id/action_filter"
|
||||
android:title="@string/action_view_all_sources"
|
||||
android:title="@string/action_change_sources"
|
||||
android:icon="@drawable/ic_filter_list_white_24dp"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
<!-- Actions -->
|
||||
<string name="action_filter">Filter</string>
|
||||
<string name="action_view_all_sources">View all sources</string>
|
||||
<string name="action_change_sources">Change sources</string>
|
||||
<string name="action_view_options">View options</string>
|
||||
<string name="action_filter_downloaded">Downloaded</string>
|
||||
<string name="action_filter_not_downloaded">Not downloaded</string>
|
||||
@ -109,7 +109,7 @@
|
||||
<string name="action_add_to_home_screen">Add to home screen</string>
|
||||
<string name="action_display_mode">Display mode</string>
|
||||
<string name="action_display">Display</string>
|
||||
<string name="action_display_comfy_grid">Comfy Grid</string>
|
||||
<string name="action_display_comfy_grid">Comfortable Grid</string>
|
||||
<string name="action_display_grid">Compact Grid</string>
|
||||
<string name="action_display_list">List</string>
|
||||
<string name="action_display_download_badge">Download badges</string>
|
||||
|
@ -180,7 +180,6 @@
|
||||
</style>
|
||||
|
||||
<style name="Theme.Widget.GridView.Catalogue">
|
||||
<item name="android:padding">5dp</item>
|
||||
<item name="android:gravity">top|left</item>
|
||||
<item name="android:smoothScrollbar">true</item>
|
||||
<item name="android:cacheColorHint">?android:attr/textColorHint</item>
|
||||
|
Loading…
Reference in New Issue
Block a user