2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/15788: Remove nested layouts in search dialog layout.

This commit is contained in:
mcarare 2020-11-17 19:39:46 +02:00 committed by ekager
parent 363618cfb2
commit 56bc46801c
2 changed files with 84 additions and 54 deletions

View File

@ -501,9 +501,15 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
searchState.query.isEmpty() && searchState.query.isEmpty() &&
!clipboardUrl.isNullOrEmpty() !clipboardUrl.isNullOrEmpty()
fill_link_from_clipboard.visibility = if (shouldShowView) View.VISIBLE else View.GONE fill_link_from_clipboard.isVisible = shouldShowView
clipboard_url.isVisible = shouldShowView
clipboard_title.isVisible = shouldShowView
link_icon.isVisible = shouldShowView
clipboard_url.text = clipboardUrl clipboard_url.text = clipboardUrl
fill_link_from_clipboard.contentDescription = "${clipboard_title.text}, ${clipboard_url.text}."
if (clipboardUrl != null && !((activity as HomeActivity).browsingModeManager.mode.isPrivate)) { if (clipboardUrl != null && !((activity as HomeActivity).browsingModeManager.mode.isPrivate)) {
requireComponents.core.engine.speculativeConnect(clipboardUrl) requireComponents.core.engine.speculativeConnect(clipboardUrl)
} }

View File

@ -4,6 +4,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/search_wrapper" android:id="@+id/search_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -74,82 +75,105 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout <View
android:id="@+id/fill_link_from_clipboard" android:id="@+id/fill_link_from_clipboard"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/search_fragment_clipboard_item_height" android:layout_height="@dimen/search_fragment_clipboard_item_height"
android:paddingStart="@dimen/search_fragment_clipboard_item_horizontal_margin"
android:paddingEnd="@dimen/search_fragment_clipboard_item_horizontal_margin"
android:background="?foundation" android:background="?foundation"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:paddingStart="@dimen/search_fragment_clipboard_item_horizontal_margin"
android:paddingEnd="@dimen/search_fragment_clipboard_item_horizontal_margin"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar"> app:layout_constraintTop_toBottomOf="@+id/toolbar"
tools:visibility="visible" />
<ImageView <ImageView
android:id="@+id/link_icon" android:id="@+id/link_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:importantForAccessibility="no" android:clickable="false"
app:layout_constraintBottom_toBottomOf="parent" android:focusable="false"
app:layout_constraintStart_toStartOf="parent" android:importantForAccessibility="no"
app:layout_constraintTop_toTopOf="parent" android:visibility="gone"
app:srcCompat="@drawable/ic_link" /> app:layout_constraintBottom_toBottomOf="@+id/fill_link_from_clipboard"
app:layout_constraintStart_toStartOf="@+id/fill_link_from_clipboard"
app:layout_constraintTop_toTopOf="@+id/fill_link_from_clipboard"
app:srcCompat="@drawable/ic_link"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/clipboard_title" android:id="@+id/clipboard_title"
style="@style/SearchClipboardTitleStyle" style="@style/SearchClipboardTitleStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/search_fragment_clipboard_item_title_margin_start" android:layout_marginStart="@dimen/search_fragment_clipboard_item_title_margin_start"
android:text="@string/awesomebar_clipboard_title" android:clickable="false"
app:layout_constraintBottom_toTopOf="@id/clipboard_url" android:focusable="false"
app:layout_constraintEnd_toEndOf="parent" android:importantForAccessibility="no"
app:layout_constraintStart_toEndOf="@id/link_icon" android:text="@string/awesomebar_clipboard_title"
app:layout_constraintTop_toTopOf="parent" android:visibility="gone"
app:layout_constraintVertical_chainStyle="packed" /> app:layout_constraintBottom_toTopOf="@id/clipboard_url"
app:layout_constraintEnd_toEndOf="@+id/fill_link_from_clipboard"
app:layout_constraintStart_toEndOf="@id/link_icon"
app:layout_constraintTop_toTopOf="@id/fill_link_from_clipboard"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Title"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/clipboard_url" android:id="@+id/clipboard_url"
style="@style/SearchClipboardUrlStyle" style="@style/SearchClipboardUrlStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginStart="@dimen/search_fragment_clipboard_item_title_margin_start"
app:layout_constraintEnd_toEndOf="parent" android:clickable="false"
app:layout_constraintStart_toStartOf="@id/clipboard_title" android:focusable="false"
app:layout_constraintTop_toBottomOf="@id/clipboard_title" android:importantForAccessibility="no"
app:layout_constraintVertical_chainStyle="packed" /> android:visibility="gone"
</androidx.constraintlayout.widget.ConstraintLayout> app:layout_constraintBottom_toBottomOf="@+id/fill_link_from_clipboard"
app:layout_constraintEnd_toEndOf="@+id/fill_link_from_clipboard"
app:layout_constraintStart_toEndOf="@id/link_icon"
app:layout_constraintTop_toBottomOf="@id/clipboard_title"
app:layout_constraintVertical_chainStyle="packed"
tools:text="url"
tools:visibility="visible" />
<LinearLayout <View
android:id="@+id/pill_wrapper" android:id="@+id/pill_wrapper"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/search_fragment_pill_height" android:layout_height="@dimen/search_fragment_pill_height"
android:background="?foundation" android:background="?foundation"
android:orientation="horizontal" android:importantForAccessibility="no"
android:paddingStart="@dimen/search_fragment_pill_padding_start" android:paddingStart="@dimen/search_fragment_pill_padding_start"
android:paddingTop="@dimen/search_fragment_pill_padding_vertical" android:paddingTop="@dimen/search_fragment_pill_padding_vertical"
android:paddingEnd="@dimen/search_fragment_pill_padding_end" android:paddingEnd="@dimen/search_fragment_pill_padding_end"
android:paddingBottom="@dimen/search_fragment_pill_padding_vertical" android:paddingBottom="@dimen/search_fragment_pill_padding_vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent" />
<ToggleButton <ToggleButton
android:id="@+id/qr_scan_button" android:id="@+id/qr_scan_button"
style="@style/search_pill" style="@style/search_pill"
android:layout_marginEnd="@dimen/search_fragment_scan_button_margin_end" android:layout_marginEnd="@dimen/search_fragment_scan_button_margin_end"
android:textOff="@string/search_scan_button" android:textOff="@string/search_scan_button"
android:textOn="@string/search_scan_button" android:textOn="@string/search_scan_button"
app:drawableStartCompat="@drawable/ic_qr" /> app:drawableStartCompat="@drawable/ic_qr"
app:layout_constraintBottom_toBottomOf="@id/pill_wrapper"
app:layout_constraintEnd_toStartOf="@id/search_engines_shortcut_button"
app:layout_constraintStart_toStartOf="@id/pill_wrapper"
app:layout_constraintTop_toTopOf="@id/pill_wrapper" />
<ToggleButton <ToggleButton
android:id="@+id/search_engines_shortcut_button" android:id="@+id/search_engines_shortcut_button"
style="@style/search_pill" style="@style/search_pill"
android:textOff="@string/search_engine_button" android:textOff="@string/search_engine_button"
android:textOn="@string/search_engine_button" android:textOn="@string/search_engine_button"
app:drawableStartCompat="@drawable/ic_search" /> app:drawableStartCompat="@drawable/ic_search"
</LinearLayout> app:layout_constraintBottom_toBottomOf="@id/pill_wrapper"
app:layout_constraintStart_toEndOf="@id/qr_scan_button"
app:layout_constraintTop_toTopOf="@id/pill_wrapper" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>