Skip to content

Commit dfea594

Browse files
authored
refactor: Convert LinearLayout to ConstraintLayout (#1430)
1 parent a24cbdf commit dfea594

File tree

1 file changed

+96
-45
lines changed

1 file changed

+96
-45
lines changed
Lines changed: 96 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,137 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
34
xmlns:tools="http://schemas.android.com/tools"
45
android:layout_width="match_parent"
56
android:layout_height="match_parent"
6-
android:orientation="vertical"
7+
android:fillViewport="true"
78
android:paddingBottom="@dimen/activity_vertical_margin"
89
android:paddingLeft="@dimen/activity_horizontal_margin"
910
android:paddingRight="@dimen/activity_horizontal_margin"
1011
android:paddingTop="@dimen/activity_vertical_margin">
1112

12-
<ImageView
13-
android:layout_width="wrap_content"
14-
android:layout_height="wrap_content"
15-
android:layout_gravity="center_horizontal"
16-
android:layout_marginBottom="16dp"
17-
android:src="@drawable/firebase_lockup_400"/>
18-
19-
<LinearLayout
13+
<androidx.constraintlayout.widget.ConstraintLayout
2014
android:layout_width="match_parent"
21-
android:layout_height="80dp"
22-
android:orientation="vertical">
15+
android:layout_height="match_parent">
16+
17+
<ImageView
18+
android:id="@+id/imageView2"
19+
android:layout_width="wrap_content"
20+
android:layout_height="wrap_content"
21+
android:src="@drawable/firebase_lockup_400"
22+
app:layout_constraintEnd_toEndOf="parent"
23+
app:layout_constraintStart_toStartOf="parent"
24+
app:layout_constraintTop_toTopOf="parent" />
25+
26+
2327
<TextView
28+
android:id="@+id/textView4"
2429
style="@style/TextAppearance.AppCompat.Medium"
25-
android:layout_width="wrap_content"
30+
android:layout_width="0dp"
2631
android:layout_height="wrap_content"
27-
android:layout_marginBottom="8dp"
28-
android:text="@string/title_receive" />
32+
android:layout_marginTop="8dp"
33+
android:text="@string/title_receive"
34+
app:layout_constraintBottom_toTopOf="@+id/linkViewReceive"
35+
app:layout_constraintEnd_toEndOf="parent"
36+
app:layout_constraintStart_toStartOf="parent"
37+
app:layout_constraintTop_toBottomOf="@+id/imageView2"
38+
app:layout_constraintVertical_bias="0.0"
39+
app:layout_constraintVertical_chainStyle="packed" />
40+
2941
<TextView
3042
android:id="@+id/linkViewReceive"
31-
android:layout_width="wrap_content"
43+
android:layout_width="0dp"
3244
android:layout_height="wrap_content"
45+
android:layout_marginTop="8dp"
3346
android:autoLink="web"
34-
android:text="@string/msg_no_deep_link" />
35-
</LinearLayout>
36-
<LinearLayout
37-
android:layout_width="match_parent"
38-
android:layout_height="164dp"
39-
android:orientation="vertical">
47+
android:text="@string/msg_no_deep_link"
48+
app:layout_constraintBottom_toTopOf="@+id/textView5"
49+
app:layout_constraintEnd_toEndOf="parent"
50+
app:layout_constraintStart_toStartOf="parent"
51+
app:layout_constraintTop_toBottomOf="@+id/textView4" />
52+
53+
4054
<TextView
55+
android:id="@+id/textView5"
4156
style="@style/TextAppearance.AppCompat.Medium"
42-
android:layout_width="wrap_content"
57+
android:layout_width="0dp"
4358
android:layout_height="wrap_content"
44-
android:layout_marginTop="24dp"
45-
android:layout_marginBottom="8dp"
46-
android:text="@string/dynamic_link" />
59+
android:layout_marginTop="32dp"
60+
android:text="@string/dynamic_link"
61+
app:layout_constraintBottom_toTopOf="@+id/linkViewSend"
62+
app:layout_constraintEnd_toEndOf="parent"
63+
app:layout_constraintStart_toStartOf="parent"
64+
app:layout_constraintTop_toBottomOf="@+id/linkViewReceive"
65+
app:layout_constraintVertical_chainStyle="packed" />
66+
4767
<TextView
4868
android:id="@+id/linkViewSend"
49-
android:layout_width="wrap_content"
69+
android:layout_width="0dp"
5070
android:layout_height="wrap_content"
71+
android:layout_marginTop="8dp"
72+
app:layout_constraintBottom_toTopOf="@+id/buttonShare"
73+
app:layout_constraintEnd_toEndOf="parent"
74+
app:layout_constraintStart_toStartOf="parent"
75+
app:layout_constraintTop_toBottomOf="@+id/textView5"
5176
tools:text="https://abc.xyz/foo" />
77+
5278
<Button
5379
android:id="@+id/buttonShare"
54-
android:layout_width="match_parent"
80+
android:layout_width="0dp"
5581
android:layout_height="wrap_content"
56-
android:text="@string/share_dynamic_link" />
57-
</LinearLayout>
58-
<LinearLayout
59-
android:layout_width="match_parent"
60-
android:layout_height="298dp"
61-
android:orientation="vertical">
82+
android:layout_marginTop="1dp"
83+
android:text="@string/share_dynamic_link"
84+
app:layout_constraintBottom_toTopOf="@+id/textView"
85+
app:layout_constraintEnd_toEndOf="parent"
86+
app:layout_constraintStart_toStartOf="parent"
87+
app:layout_constraintTop_toBottomOf="@+id/linkViewSend" />
88+
89+
6290
<TextView
6391
android:id="@+id/textView"
6492
style="@style/TextAppearance.AppCompat.Medium"
65-
android:layout_width="match_parent"
93+
android:layout_width="0dp"
6694
android:layout_height="wrap_content"
67-
android:layout_marginTop="24dp"
68-
android:layout_marginBottom="8dp"
69-
android:text="@string/short_dynamic_link" />
95+
android:layout_marginTop="32dp"
96+
android:text="@string/short_dynamic_link"
97+
app:layout_constraintBottom_toTopOf="@+id/shortLinkViewSend"
98+
app:layout_constraintEnd_toEndOf="parent"
99+
app:layout_constraintStart_toStartOf="parent"
100+
app:layout_constraintTop_toBottomOf="@+id/buttonShare"
101+
app:layout_constraintVertical_chainStyle="packed" />
102+
70103
<TextView
71104
android:id="@+id/shortLinkViewSend"
72-
android:layout_width="match_parent"
105+
android:layout_width="0dp"
73106
android:layout_height="wrap_content"
107+
android:layout_marginTop="8dp"
108+
app:layout_constraintBottom_toTopOf="@+id/buttonGenerateShortLink"
109+
app:layout_constraintEnd_toEndOf="parent"
110+
app:layout_constraintStart_toStartOf="parent"
111+
app:layout_constraintTop_toBottomOf="@+id/textView"
74112
tools:text="https://abc.xyz/foo" />
113+
75114
<Button
76115
android:id="@+id/buttonGenerateShortLink"
77-
android:layout_width="match_parent"
116+
android:layout_width="0dp"
78117
android:layout_height="wrap_content"
79-
android:text="@string/generate_short_link" />
118+
android:text="@string/generate_short_link"
119+
app:layout_constraintBottom_toTopOf="@+id/buttonShareShortLink"
120+
app:layout_constraintEnd_toEndOf="parent"
121+
app:layout_constraintStart_toStartOf="parent"
122+
app:layout_constraintTop_toBottomOf="@+id/shortLinkViewSend" />
123+
124+
80125
<Button
81126
android:id="@+id/buttonShareShortLink"
82-
android:layout_width="match_parent"
127+
android:layout_width="0dp"
83128
android:layout_height="wrap_content"
84-
android:text="@string/share_short_link" />
85-
</LinearLayout>
86-
</LinearLayout>
129+
android:layout_marginBottom="16dp"
130+
android:text="@string/share_short_link"
131+
app:layout_constraintBottom_toBottomOf="parent"
132+
app:layout_constraintEnd_toEndOf="parent"
133+
app:layout_constraintStart_toStartOf="parent"
134+
app:layout_constraintTop_toBottomOf="@+id/buttonGenerateShortLink" />
135+
136+
</androidx.constraintlayout.widget.ConstraintLayout>
137+
</ScrollView>

0 commit comments

Comments
 (0)