From f42c71ccfeadec297fbb8e07685214d89cc3da75 Mon Sep 17 00:00:00 2001 From: Amaan Marfatia Date: Tue, 27 Aug 2019 13:09:55 -0400 Subject: [PATCH] [fenix] Fixes https://github.com/mozilla-mobile/fenix/issues/4067 besides snackbar (https://github.com/mozilla-mobile/fenix/pull/4777) * Fixes https://github.com/mozilla-mobile/fenix/issues/4067 besides snackbar Makes layout hierarchy more shallow to increase performance. * Fix https://github.com/mozilla-mobile/fenix/issues/4067 Feedback Make sure quick_action_overlay appears on top and use horizontal chain in tab_header. --- .../quickactionsheet/QuickActionSheet.kt | 4 +- .../quickactionsheet/QuickActionSheetView.kt | 14 +- .../res/layout/collection_home_list_row.xml | 207 +++++++++-------- app/src/main/res/layout/component_share.xml | 164 +++++++------- app/src/main/res/layout/fenix_snackbar.xml | 52 ++--- .../res/layout/layout_quick_action_sheet.xml | 211 +++++++++--------- app/src/main/res/layout/tab_header.xml | 88 ++++---- app/src/main/res/layout/tab_in_collection.xml | 147 ++++++------ 8 files changed, 447 insertions(+), 440 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheet.kt b/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheet.kt index cb3657ba6c..f294a8646a 100644 --- a/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheet.kt +++ b/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheet.kt @@ -10,7 +10,7 @@ import android.util.AttributeSet import android.view.View import android.view.accessibility.AccessibilityEvent import android.view.accessibility.AccessibilityNodeInfo -import android.widget.LinearLayout +import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.widget.NestedScrollView import com.google.android.material.bottomsheet.BottomSheetBehavior import kotlinx.android.synthetic.main.layout_quick_action_sheet.view.* @@ -29,7 +29,7 @@ class QuickActionSheet @JvmOverloads constructor( attrs: AttributeSet? = null, defStyle: Int = 0, defStyleRes: Int = 0 -) : LinearLayout(context, attrs, defStyle, defStyleRes) { +) : ConstraintLayout(context, attrs, defStyle, defStyleRes) { private val scope = MainScope() diff --git a/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheetView.kt b/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheetView.kt index a9003e4650..2c1869a150 100644 --- a/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheetView.kt +++ b/app/src/main/java/org/mozilla/fenix/quickactionsheet/QuickActionSheetView.kt @@ -66,12 +66,12 @@ class QuickActionSheetView( updateImportantForAccessibility(quickActionSheetBehavior.state) - view.quick_action_share.setOnClickListener(this) - view.quick_action_downloads.setOnClickListener(this) - view.quick_action_bookmark.setOnClickListener(this) - view.quick_action_read.setOnClickListener(this) - view.quick_action_appearance.setOnClickListener(this) - view.quick_action_open_app_link.setOnClickListener(this) + quick_action_share.setOnClickListener(this) + quick_action_downloads.setOnClickListener(this) + quick_action_bookmark.setOnClickListener(this) + quick_action_read.setOnClickListener(this) + quick_action_appearance.setOnClickListener(this) + quick_action_open_app_link.setOnClickListener(this) } /** @@ -94,7 +94,7 @@ class QuickActionSheetView( * Changes alpha of overlay based on new offset of this sheet within [-1,1] range. */ private fun animateOverlay(offset: Float) { - overlay.alpha = (1 - offset) + quick_action_overlay.alpha = (1 - offset) } /** diff --git a/app/src/main/res/layout/collection_home_list_row.xml b/app/src/main/res/layout/collection_home_list_row.xml index e61b0ab21e..36834b5f4c 100644 --- a/app/src/main/res/layout/collection_home_list_row.xml +++ b/app/src/main/res/layout/collection_home_list_row.xml @@ -2,116 +2,111 @@ - + + + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:importantForAccessibility="no" + android:src="@drawable/ic_tab_collection" + android:tint="@null" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - + - + - + - - - - - - - + + diff --git a/app/src/main/res/layout/component_share.xml b/app/src/main/res/layout/component_share.xml index 8c62134c72..7b317a973d 100644 --- a/app/src/main/res/layout/component_share.xml +++ b/app/src/main/res/layout/component_share.xml @@ -26,103 +26,97 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - - + + + + + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:clipToPadding="false" + android:paddingStart="16dp" + android:paddingEnd="8dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/account_header" /> - + - + - + - + - - - - - - - - - + diff --git a/app/src/main/res/layout/fenix_snackbar.xml b/app/src/main/res/layout/fenix_snackbar.xml index bbe4ab97c8..a643f5b801 100644 --- a/app/src/main/res/layout/fenix_snackbar.xml +++ b/app/src/main/res/layout/fenix_snackbar.xml @@ -2,63 +2,65 @@ - + android:layout_height="match_parent"> + + android:orientation="horizontal" + android:paddingStart="16dp" + android:paddingTop="8dp" + android:paddingEnd="16dp" + android:paddingBottom="8dp"> + tools:text="This is a custom Snackbar text" />