From af3fadd62aac4d17ccc89865cfa1e267b5c8d57c Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 22 Apr 2020 20:32:54 -0400 Subject: [PATCH] Fixed weird changing size of the fab in browse source view Co-Authored-By: Soitora --- .../tachiyomi/widget/FABMoveBehaviour.kt | 41 ------------------- .../res/layout/browse_source_controller.xml | 12 +----- .../res/layout/library_list_controller.xml | 14 +------ .../res/layout/pre_migration_controller.xml | 8 +--- app/src/main/res/values/styles.xml | 17 ++------ 5 files changed, 9 insertions(+), 83 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/widget/FABMoveBehaviour.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/FABMoveBehaviour.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/FABMoveBehaviour.kt deleted file mode 100644 index 0beb02e4e0..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/FABMoveBehaviour.kt +++ /dev/null @@ -1,41 +0,0 @@ -package eu.kanade.tachiyomi.widget - -import android.content.Context -import android.content.res.Configuration -import android.util.AttributeSet -import android.view.View -import androidx.coordinatorlayout.widget.CoordinatorLayout -import com.google.android.material.floatingactionbutton.FloatingActionButton -import com.google.android.material.snackbar.Snackbar -import kotlin.math.min - -class FABMoveBehaviour(context: Context, attrs: AttributeSet) : - CoordinatorLayout.Behavior(context, attrs) { - - override fun layoutDependsOn(parent: CoordinatorLayout, child: FloatingActionButton, dependency: View): Boolean { - return dependency is Snackbar.SnackbarLayout - } - override fun onDependentViewChanged(parent: CoordinatorLayout, child: FloatingActionButton, dependency: View): Boolean { - if (isTablet(child.context)) return true - val translationY = getFabTranslationYForSnackbar(parent, child) - child.translationY = translationY - return true - } - - private fun isTablet(context: Context): Boolean { - return (context.resources.configuration.screenLayout and Configuration - .SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE - } - - private fun getFabTranslationYForSnackbar(parent: CoordinatorLayout, fab: FloatingActionButton): Float { - var minOffset = 0f - val dependencies = parent.getDependencies(fab) - for (i in 0 until dependencies.size) { - val view = dependencies[i] - if (view is Snackbar.SnackbarLayout && view.isShown) { - minOffset = min(minOffset, view.translationY - view.height) - } - } - return minOffset - } -} diff --git a/app/src/main/res/layout/browse_source_controller.xml b/app/src/main/res/layout/browse_source_controller.xml index b68f988a3c..89c326eec0 100644 --- a/app/src/main/res/layout/browse_source_controller.xml +++ b/app/src/main/res/layout/browse_source_controller.xml @@ -26,16 +26,8 @@ + app:icon="@drawable/ic_filter_list_white_24dp"/> diff --git a/app/src/main/res/layout/library_list_controller.xml b/app/src/main/res/layout/library_list_controller.xml index 28c7421a8c..5087ad3de5 100644 --- a/app/src/main/res/layout/library_list_controller.xml +++ b/app/src/main/res/layout/library_list_controller.xml @@ -42,6 +42,7 @@ android:paddingTop="8dp" android:paddingBottom="8dp" android:paddingStart="3dp" + android:paddingEnd="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -82,19 +83,6 @@ - - + app:layout_constraintEnd_toEndOf="parent" /> \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 30085d5d32..8f42b798a4 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -119,21 +119,12 @@ fitCenter bottom|right|end @color/md_white_1000 + @dimen/fab_size ?attr/colorAccent @color/md_white_1000 - - -