From 238b59784e0f667e08accef8c71c51cef7f1976e Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 14 Mar 2020 17:54:55 -0700 Subject: [PATCH] More library layout fixes --- .../eu/kanade/tachiyomi/ui/library/LibraryHolder.kt | 6 ++++-- .../tachiyomi/ui/library/LibraryListController.kt | 7 +++---- app/src/main/res/drawable/library_item_selector.xml | 10 ++++------ app/src/main/res/layout/catalogue_grid_item.xml | 7 ++++--- app/src/main/res/layout/unread_download_badge.xml | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt index f77172b3e3..5a7737e6fb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt @@ -52,7 +52,9 @@ abstract class LibraryHolder( } override fun onLongClick(view: View?): Boolean { - super.onLongClick(view) - return false // !adapter.libraryListener.recyclerIsScrolling() + return if (adapter.isLongPressDragEnabled) { + super.onLongClick(view) + false + } else super.onLongClick(view) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt index f9518fec2b..b9a4e6c8b5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt @@ -355,11 +355,11 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), private fun setRecyclerLayout() { if (libraryLayout == 0) { recycler.spanCount = 1 - recycler.setPaddingRelative(0,0,0,0) + recycler.updatePaddingRelative(start = 0, end = 0) } else { recycler.columnWidth = (90 + (preferences.gridSize().getOrDefault() * 30)).dpToPx - recycler.setPaddingRelative(3.dpToPx,0,3.dpToPx, 0) + recycler.updatePaddingRelative(start = 5.dpToPx, end = 5.dpToPx) } } @@ -594,7 +594,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), return if (adapter.mode == SelectableAdapter.Mode.MULTI) { lastClickPosition = position toggleSelection(position) - true + false } else { openManga(item.manga, null) false @@ -812,7 +812,6 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), return val distance = recycler_layout.alpha val speed = max(3000f / abs(x), 0.75f) - Timber.d("Flinged $distance, velo ${abs(x)}, speed $speed") if (sign(recycler_layout.x) == sign(x)) { flinging = true val duration = (distance * 100 * speed).toLong() diff --git a/app/src/main/res/drawable/library_item_selector.xml b/app/src/main/res/drawable/library_item_selector.xml index 4ff60d3d73..5ef551b915 100644 --- a/app/src/main/res/drawable/library_item_selector.xml +++ b/app/src/main/res/drawable/library_item_selector.xml @@ -3,9 +3,8 @@ android:color="@color/fullRippleColor"> + android:left="6dp" + android:right="6dp"> @@ -13,9 +12,8 @@ + android:left="6dp" + android:right="6dp"> diff --git a/app/src/main/res/layout/catalogue_grid_item.xml b/app/src/main/res/layout/catalogue_grid_item.xml index e269449f5c..46b9f92972 100644 --- a/app/src/main/res/layout/catalogue_grid_item.xml +++ b/app/src/main/res/layout/catalogue_grid_item.xml @@ -35,6 +35,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" + android:foreground="?android:attr/selectableItemBackground" android:background="?android:attr/colorBackground" android:maxHeight="250dp" tools:background="?android:attr/colorBackground" @@ -113,7 +114,7 @@ @@ -124,8 +125,8 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="parent" - android:layout_marginStart="10dp" - android:layout_marginEnd="10dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" android:orientation="vertical" android:layout_height="30sp">