Skip to content

Commit 5c2e88f

Browse files
committed
Add a landscape breakpoint to ensure the UI fits
The changes to add the new per-app picker button mean that it doesn't on some smaller devices, so we now breakpoint the landscape UI to handle that cleanly.
1 parent 03f10f2 commit 5c2e88f

File tree

4 files changed

+141
-48
lines changed

4 files changed

+141
-48
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.widget.LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent">
8+
9+
<androidx.constraintlayout.widget.ConstraintLayout
10+
android:layout_width="0dp"
11+
android:layout_height="match_parent"
12+
android:layout_weight="1.1"
13+
tools:context=".MainActivity">
14+
15+
<androidx.constraintlayout.widget.Guideline
16+
android:id="@+id/guideline"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:orientation="horizontal"
20+
app:layout_constraintGuide_percent="0.06" />
21+
22+
<ImageView
23+
android:id="@+id/logoImage"
24+
android:layout_width="wrap_content"
25+
android:layout_height="wrap_content"
26+
android:layout_marginBottom="18dp"
27+
android:contentDescription="The HTTP Toolkit Logo"
28+
app:layout_constraintTop_toTopOf="@+id/guideline"
29+
app:layout_constraintBottom_toTopOf="@+id/statusText"
30+
app:layout_constraintStart_toStartOf="parent"
31+
app:layout_constraintEnd_toEndOf="parent"
32+
app:srcCompat="@drawable/ic_transparent_icon" />
33+
34+
<TextView
35+
android:id="@+id/statusText"
36+
style="@style/StatusText"
37+
android:layout_width="wrap_content"
38+
android:layout_height="wrap_content"
39+
android:layout_marginStart="8dp"
40+
android:layout_marginEnd="8dp"
41+
android:layout_marginBottom="8dp"
42+
android:text="Not Connected"
43+
app:layout_constraintBottom_toTopOf="@+id/statusDetailContainer"
44+
app:layout_constraintTop_toBottomOf="@+id/logoImage"
45+
app:layout_constraintStart_toStartOf="parent"
46+
app:layout_constraintEnd_toEndOf="parent" />
47+
48+
<LinearLayout
49+
android:id="@+id/statusDetailContainer"
50+
android:layout_width="match_parent"
51+
android:layout_height="wrap_content"
52+
app:layout_constrainedWidth="true"
53+
app:layout_constraintTop_toBottomOf="@+id/statusText"
54+
app:layout_constraintStart_toStartOf="parent"
55+
app:layout_constraintEnd_toEndOf="parent"
56+
android:orientation="vertical" />
57+
58+
</androidx.constraintlayout.widget.ConstraintLayout>
59+
60+
<com.google.android.material.card.MaterialCardView
61+
android:layout_height="wrap_content"
62+
android:layout_width="0dp"
63+
android:layout_weight="1"
64+
android:layout_marginStart="16dp"
65+
android:layout_marginEnd="16dp"
66+
android:layout_gravity="center"
67+
app:layout_constraintBottom_toBottomOf="parent"
68+
app:layout_constraintEnd_toEndOf="parent"
69+
app:layout_constraintStart_toStartOf="parent"
70+
style="@style/LandscapeButtonsCard"
71+
>
72+
<LinearLayout
73+
android:id="@+id/buttonLayoutContainer"
74+
android:layout_width="match_parent"
75+
android:layout_height="wrap_content"
76+
android:orientation="vertical"
77+
android:paddingStart="16dp"
78+
android:paddingEnd="16dp"
79+
android:paddingTop="12dp"
80+
android:paddingBottom="10dp">
81+
</LinearLayout>
82+
</com.google.android.material.card.MaterialCardView>
83+
</android.widget.LinearLayout>

app/src/main/res/layout-h680dp/main_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
android:layout_height="wrap_content"
3939
android:layout_marginStart="8dp"
4040
android:layout_marginEnd="8dp"
41-
android:text="Not Connected"
41+
android:text="@string/disconnected_status"
4242
app:layout_constraintBottom_toBottomOf="@+id/statusGuideline"
4343
app:layout_constraintTop_toTopOf="@+id/statusGuideline"
4444
app:layout_constraintEnd_toEndOf="parent"

app/src/main/res/layout-land/main_layout.xml

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,72 +12,73 @@
1212
android:layout_weight="1.1"
1313
tools:context=".MainActivity">
1414

15-
<androidx.constraintlayout.widget.Guideline
16-
android:id="@+id/guideline"
17-
android:layout_width="wrap_content"
18-
android:layout_height="wrap_content"
19-
android:orientation="horizontal"
20-
app:layout_constraintGuide_percent="0.06" />
21-
22-
<ImageView
23-
android:id="@+id/logoImage"
24-
android:layout_width="wrap_content"
25-
android:layout_height="wrap_content"
26-
android:layout_marginBottom="18dp"
27-
android:contentDescription="The HTTP Toolkit Logo"
28-
app:layout_constraintTop_toTopOf="@+id/guideline"
29-
app:layout_constraintBottom_toTopOf="@+id/statusText"
30-
app:layout_constraintStart_toStartOf="parent"
31-
app:layout_constraintEnd_toEndOf="parent"
32-
app:srcCompat="@drawable/ic_transparent_icon" />
33-
3415
<TextView
3516
android:id="@+id/statusText"
3617
style="@style/StatusText"
3718
android:layout_width="wrap_content"
3819
android:layout_height="wrap_content"
3920
android:layout_marginStart="8dp"
4021
android:layout_marginEnd="8dp"
41-
android:layout_marginBottom="8dp"
4222
android:text="Not Connected"
4323
app:layout_constraintBottom_toTopOf="@+id/statusDetailContainer"
44-
app:layout_constraintTop_toBottomOf="@+id/logoImage"
24+
app:layout_constraintEnd_toEndOf="parent"
4525
app:layout_constraintStart_toStartOf="parent"
46-
app:layout_constraintEnd_toEndOf="parent" />
26+
app:layout_constraintTop_toTopOf="parent"
27+
app:layout_constraintVertical_chainStyle="packed" />
4728

4829
<LinearLayout
4930
android:id="@+id/statusDetailContainer"
50-
android:layout_width="wrap_content"
31+
android:layout_width="match_parent"
5132
android:layout_height="wrap_content"
33+
android:orientation="vertical"
5234
app:layout_constrainedWidth="true"
53-
app:layout_constraintTop_toBottomOf="@+id/statusText"
54-
app:layout_constraintStart_toStartOf="parent"
35+
app:layout_constraintBottom_toBottomOf="parent"
5536
app:layout_constraintEnd_toEndOf="parent"
56-
android:orientation="vertical" />
37+
app:layout_constraintStart_toStartOf="parent"
38+
app:layout_constraintTop_toBottomOf="@+id/statusText" />
5739

5840
</androidx.constraintlayout.widget.ConstraintLayout>
5941

60-
<com.google.android.material.card.MaterialCardView
61-
android:layout_height="wrap_content"
42+
<androidx.constraintlayout.widget.ConstraintLayout
6243
android:layout_width="0dp"
63-
android:layout_weight="1"
64-
android:layout_marginStart="16dp"
65-
android:layout_marginEnd="16dp"
66-
android:layout_gravity="center"
67-
app:layout_constraintBottom_toBottomOf="parent"
68-
app:layout_constraintEnd_toEndOf="parent"
69-
app:layout_constraintStart_toStartOf="parent"
70-
style="@style/LandscapeButtonsCard"
71-
>
72-
<LinearLayout
73-
android:id="@+id/buttonLayoutContainer"
74-
android:layout_width="match_parent"
44+
android:layout_height="match_parent"
45+
android:layout_weight="1.1"
46+
tools:context=".MainActivity">
47+
48+
<ImageView
49+
android:id="@+id/logoImage"
50+
android:layout_width="wrap_content"
7551
android:layout_height="wrap_content"
76-
android:orientation="vertical"
77-
android:paddingStart="16dp"
78-
android:paddingEnd="16dp"
79-
android:paddingTop="12dp"
80-
android:paddingBottom="10dp">
81-
</LinearLayout>
82-
</com.google.android.material.card.MaterialCardView>
52+
android:contentDescription="The HTTP Toolkit Logo"
53+
app:layout_constraintBottom_toTopOf="@id/materialCardView"
54+
app:layout_constraintEnd_toEndOf="parent"
55+
app:layout_constraintStart_toStartOf="parent"
56+
app:layout_constraintTop_toTopOf="parent"
57+
app:srcCompat="@drawable/ic_transparent_icon" />
58+
59+
<com.google.android.material.card.MaterialCardView
60+
android:id="@+id/materialCardView"
61+
style="@style/LandscapeButtonsCard"
62+
android:layout_width="0dp"
63+
android:layout_height="wrap_content"
64+
android:layout_gravity="center"
65+
android:layout_marginStart="16dp"
66+
android:layout_marginEnd="16dp"
67+
android:layout_weight="1"
68+
app:layout_constraintBottom_toBottomOf="parent"
69+
app:layout_constraintEnd_toEndOf="parent"
70+
app:layout_constraintStart_toStartOf="parent"
71+
app:layout_constraintTop_toBottomOf="@+id/logoImage">
72+
73+
<LinearLayout
74+
android:id="@+id/buttonLayoutContainer"
75+
android:layout_width="match_parent"
76+
android:layout_height="wrap_content"
77+
android:orientation="vertical"
78+
android:paddingStart="16dp"
79+
android:paddingTop="12dp"
80+
android:paddingEnd="16dp"
81+
android:paddingBottom="10dp"></LinearLayout>
82+
</com.google.android.material.card.MaterialCardView>
83+
</androidx.constraintlayout.widget.ConstraintLayout>
8384
</android.widget.LinearLayout>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<resources>
2+
3+
<style name="ConnectionStatusCard" parent="@style/Widget.MaterialComponents.CardView">
4+
<item name="cardElevation">0dp</item>
5+
<item name="contentPadding">10dp</item>
6+
<item name="android:layout_marginBottom">6dp</item>
7+
</style>
8+
9+
</resources>

0 commit comments

Comments
 (0)