Skip to content

Commit 7b0fa7c

Browse files
committed
Settings: integrate avatar inside A15-revamp search bar
**trying to copy scamsung xD Signed-off-by: drkphnx <[email protected]>
1 parent 0ec17a1 commit 7b0fa7c

File tree

2 files changed

+54
-28
lines changed

2 files changed

+54
-28
lines changed

res/layout/search_bar_unified_version.xml

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,61 @@
1717

1818
<com.google.android.material.card.MaterialCardView
1919
xmlns:android="http://schemas.android.com/apk/res/android"
20+
xmlns:app="http://schemas.android.com/apk/res-auto"
2021
style="@style/SearchBarStyle_v2"
2122
android:layout_width="match_parent"
2223
android:layout_height="wrap_content">
2324

24-
<LinearLayout
25-
android:id="@+id/search_action_bar"
26-
android:layout_width="match_parent"
25+
<androidx.constraintlayout.widget.ConstraintLayout
26+
android:id="@+id/search_action_bar"
27+
android:layout_width="match_parent"
28+
android:layout_height="wrap_content"
29+
android:minHeight="72dp"
30+
android:paddingStart="24dp"
31+
android:paddingEnd="24dp"
32+
android:gravity="center_vertical"
33+
android:focusedByDefault="true"
34+
android:background="@drawable/search_bar_selected_background_v2">
35+
36+
<!-- Search Icon -->
37+
<ImageView
38+
android:id="@+id/imageView"
39+
android:layout_width="wrap_content"
40+
android:layout_height="wrap_content"
41+
android:src="@drawable/ic_homepage_search"
42+
android:tint="@color/top_level_preference_text_color_primary"
43+
android:importantForAccessibility="no"
44+
app:layout_constraintStart_toStartOf="parent"
45+
app:layout_constraintTop_toTopOf="parent"
46+
app:layout_constraintBottom_toBottomOf="parent"/>
47+
48+
<!-- Search Text -->
49+
<TextView
50+
android:id="@+id/search_bar_title"
51+
style="@style/TextAppearance.SearchBar"
52+
android:layout_width="wrap_content"
2753
android:layout_height="wrap_content"
28-
android:minHeight="72dp"
29-
android:gravity="center_vertical"
30-
android:orientation="horizontal"
31-
android:paddingStart="24dp"
32-
android:paddingEnd="24dp"
33-
android:focusedByDefault="true"
34-
android:background="@drawable/search_bar_selected_background_v2">
35-
36-
<ImageView
37-
android:id="@+id/imageView"
38-
android:layout_width="wrap_content"
39-
android:layout_height="wrap_content"
40-
android:importantForAccessibility="no"
41-
android:src="@drawable/ic_homepage_search"
42-
android:tint="@color/top_level_preference_text_color_primary" />
43-
<TextView
44-
android:id="@+id/search_bar_title"
45-
style="@style/TextAppearance.SearchBar"
46-
android:layout_width="wrap_content"
47-
android:layout_height="wrap_content"
48-
android:layout_marginStart="8dp"
49-
android:paddingEnd="8dp"
50-
android:text="@string/search_settings"
51-
android:textColor="@color/top_level_preference_text_color_primary"/>
52-
</LinearLayout>
54+
android:layout_marginStart="8dp"
55+
android:paddingEnd="8dp"
56+
android:text="@string/search_settings"
57+
android:textColor="@color/top_level_preference_text_color_primary"
58+
app:layout_constraintStart_toEndOf="@id/imageView"
59+
app:layout_constraintTop_toTopOf="parent"
60+
app:layout_constraintBottom_toBottomOf="parent"
61+
app:layout_constraintEnd_toStartOf="@id/account_avatar"/>
62+
63+
<!-- Avatar aligned to end -->
64+
<ImageView
65+
android:id="@+id/account_avatar"
66+
android:layout_width="@dimen/custom_avatar_length"
67+
android:layout_height="@dimen/custom_avatar_length"
68+
android:layout_marginStart="8dp"
69+
android:layout_marginEnd="-16dp"
70+
android:visibility="invisible"
71+
android:contentDescription="@string/search_bar_account_avatar_content_description"
72+
app:layout_constraintEnd_toEndOf="parent"
73+
app:layout_constraintTop_toTopOf="parent"
74+
app:layout_constraintBottom_toBottomOf="parent"/>
75+
76+
</androidx.constraintlayout.widget.ConstraintLayout>
5377
</com.google.android.material.card.MaterialCardView>

res/values/dimens.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<resources>
1818
<dimen name="match_parent">-1px</dimen>
1919

20+
<dimen name="custom_avatar_length">60dp</dimen>
21+
2022
<dimen name="app_icon_size">40dip</dimen>
2123
<dimen name="min_tap_target_size">48dp</dimen>
2224
<dimen name="screen_margin_sides">64dip</dimen>

0 commit comments

Comments
 (0)