Skip to content

Commit f09a98e

Browse files
authored
refactor(auth, analytics): remove RelativeLayout from xml files (#1246)
* refactor(auth): remove RelativeLayout from activity_generic_idp.xml * refactor(analytics): use FrameLayout in fragment_main.xml
1 parent 52007fe commit f09a98e

File tree

2 files changed

+49
-31
lines changed

2 files changed

+49
-31
lines changed

analytics/app/src/main/res/layout/fragment_main.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
1212
CONDITIONS OF ANY KIND, either express or implied. See the License for the
1313
specific language governing permissions and limitations under the License.
1414
-->
15-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
15+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
1616
xmlns:tools="http://schemas.android.com/tools"
1717
android:layout_width="match_parent"
1818
android:layout_height="match_parent"
@@ -29,10 +29,9 @@ specific language governing permissions and limitations under the License.
2929
android:id="@+id/imageView"
3030
android:minHeight="256dp"
3131
android:minWidth="256dp"
32-
android:layout_centerVertical="true"
33-
android:layout_centerHorizontal="true"
32+
android:layout_gravity="center"
3433
android:elevation="2dp"
3534
android:scaleType="center"
3635
android:background="@drawable/circle"/>
3736

38-
</RelativeLayout>
37+
</FrameLayout>

auth/app/src/main/res/layout/activity_generic_idp.xml

+46-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout 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:id="@+id/main_layout"
56
android:layout_width="match_parent"
@@ -8,7 +9,7 @@
89
android:orientation="vertical"
910
android:weightSum="4">
1011

11-
<LinearLayout
12+
<androidx.constraintlayout.widget.ConstraintLayout
1213
android:layout_width="match_parent"
1314
android:layout_height="0dp"
1415
android:layout_weight="3"
@@ -18,55 +19,73 @@
1819
<ImageView
1920
android:id="@+id/icon"
2021
style="@style/ThemeOverlay.FirebaseIcon"
22+
android:layout_width="wrap_content"
23+
android:layout_height="wrap_content"
2124
android:contentDescription="@string/desc_firebase_lockup"
2225
android:src="@drawable/firebase_lockup_400"
23-
android:layout_width="wrap_content"
24-
android:layout_height="wrap_content" />
26+
app:layout_constraintEnd_toEndOf="parent"
27+
app:layout_constraintStart_toStartOf="parent"
28+
app:layout_constraintTop_toTopOf="parent" />
2529

2630
<TextView
2731
android:id="@+id/titleText"
2832
android:layout_width="wrap_content"
2933
android:layout_height="wrap_content"
30-
android:layout_marginBottom="@dimen/title_bottom_margin"
31-
android:text="@string/generic_title_text"
34+
android:layout_marginTop="16dp"
3235
android:gravity="center"
33-
android:theme="@style/ThemeOverlay.MyTitleText" />
36+
android:text="@string/generic_title_text"
37+
android:theme="@style/ThemeOverlay.MyTitleText"
38+
app:layout_constraintEnd_toEndOf="@+id/icon"
39+
app:layout_constraintStart_toStartOf="@+id/icon"
40+
app:layout_constraintTop_toBottomOf="@+id/icon" />
3441

3542
<TextView
3643
android:id="@+id/status"
3744
style="@style/ThemeOverlay.MyTextDetail"
38-
android:text="@string/signed_out" />
45+
android:layout_marginTop="16dp"
46+
android:text="@string/signed_out"
47+
app:layout_constraintEnd_toEndOf="@+id/titleText"
48+
app:layout_constraintStart_toStartOf="@+id/titleText"
49+
app:layout_constraintTop_toBottomOf="@+id/titleText" />
3950

4051
<TextView
4152
android:id="@+id/detail"
4253
style="@style/ThemeOverlay.MyTextDetail"
54+
app:layout_constraintEnd_toEndOf="@+id/status"
55+
app:layout_constraintStart_toStartOf="@+id/status"
56+
app:layout_constraintTop_toBottomOf="@+id/status"
4357
tools:text="Firebase User ID: 123456789abc" />
4458

45-
<RelativeLayout
46-
android:id="@+id/spinnerLayout"
59+
<TextView
60+
android:id="@+id/providerSpinnerLabel"
4761
android:layout_width="wrap_content"
4862
android:layout_height="wrap_content"
49-
android:layout_marginTop="16dp">
50-
51-
<TextView
52-
android:id="@+id/providerSpinnerLabel"
53-
android:layout_width="wrap_content"
54-
android:layout_height="wrap_content"
55-
android:textSize="16sp"
56-
android:textStyle="bold"
57-
android:text="@string/generic_label_provider"/>
63+
android:layout_marginTop="16dp"
64+
android:text="@string/generic_label_provider"
65+
android:textSize="16sp"
66+
android:textStyle="bold"
67+
app:layout_constraintStart_toStartOf="@+id/detail"
68+
app:layout_constraintTop_toBottomOf="@+id/detail" />
5869

59-
<Spinner
60-
android:id="@+id/providerSpinner"
61-
android:layout_width="wrap_content"
62-
android:layout_height="wrap_content"
63-
android:layout_alignBaseline="@+id/providerSpinnerLabel"
64-
android:layout_toRightOf="@+id/providerSpinnerLabel"
65-
android:layout_toEndOf="@+id/providerSpinnerLabel" />
70+
<Spinner
71+
android:id="@+id/providerSpinner"
72+
android:layout_width="0dp"
73+
android:layout_height="wrap_content"
74+
android:layout_alignBaseline="@+id/providerSpinnerLabel"
75+
android:layout_toEndOf="@+id/providerSpinnerLabel"
76+
android:layout_toRightOf="@+id/providerSpinnerLabel"
77+
app:layout_constraintBottom_toBottomOf="@+id/providerSpinnerLabel"
78+
app:layout_constraintEnd_toEndOf="@+id/detail"
79+
app:layout_constraintStart_toEndOf="@+id/providerSpinnerLabel"
80+
app:layout_constraintTop_toTopOf="@+id/providerSpinnerLabel" />
6681

67-
</RelativeLayout>
82+
<androidx.constraintlayout.widget.Group
83+
android:id="@+id/spinnerLayout"
84+
android:layout_width="wrap_content"
85+
android:layout_height="wrap_content"
86+
app:constraint_referenced_ids="providerSpinner, providerSpinnerLabel"/>
6887

69-
</LinearLayout>
88+
</androidx.constraintlayout.widget.ConstraintLayout>
7089

7190
<FrameLayout
7291
android:layout_width="match_parent"

0 commit comments

Comments
 (0)