Skip to content

Commit 86a64e8

Browse files
committed
Revert "Make the layout more adaptive with Flexbox when using sp"
This reverts commit c7d37a9.
1 parent 2043da7 commit 86a64e8

File tree

4 files changed

+49
-73
lines changed

4 files changed

+49
-73
lines changed

Diff for: app/build.gradle

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "cz.martykan.forecastie"
99
minSdkVersion 15
1010
targetSdkVersion 29
11-
versionCode 68
12-
versionName "1.18.2"
11+
versionCode 70
12+
versionName "1.19.1"
1313
}
1414

1515
lintOptions {
@@ -35,8 +35,6 @@ dependencies {
3535
implementation "androidx.recyclerview:recyclerview:1.1.0"
3636
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
3737
implementation "com.google.android.material:material:1.2.1"
38-
implementation "com.google.android.flexbox:flexbox:3.0.0"
39-
implementation "androidx.core:core:1.5.0"
4038

4139
/** Lifecycle */
4240
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"

Diff for: app/src/main/java/cz/martykan/forecastie/activities/MainActivity.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public class MainActivity extends BaseActivity implements LocationListener {
100100
private ViewPager viewPager;
101101
private TabLayout tabLayout;
102102
private SwipeRefreshLayout swipeRefreshLayout;
103-
private ViewPagerAdapter pagerAdapter;
104103

105104
private View appView;
106105

@@ -666,15 +665,12 @@ private void updateLongTermWeatherUI() {
666665
recyclerViewFragment.setArguments(bundle);
667666
viewPagerAdapter.addFragment(recyclerViewFragment, getString(R.string.later));
668667

669-
if(this.pagerAdapter == null) {
670-
pagerAdapter = viewPagerAdapter;
671-
viewPager.setAdapter(pagerAdapter);
672-
tabLayout.setupWithViewPager(viewPager);
673-
}
674-
pagerAdapter.notifyDataSetChanged();
675-
676668
int currentPage = viewPager.getCurrentItem();
677669

670+
viewPagerAdapter.notifyDataSetChanged();
671+
viewPager.setAdapter(viewPagerAdapter);
672+
tabLayout.setupWithViewPager(viewPager);
673+
678674
if (currentPage == 0 && longTermTodayWeather.isEmpty()) {
679675
currentPage = 1;
680676
}

Diff for: app/src/main/res/layout/activity_scrolling.xml

+15-19
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,12 @@
3232
android:background="?attr/colorPrimary"
3333
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
3434

35-
<com.google.android.flexbox.FlexboxLayout
35+
<LinearLayout
3636
android:layout_width="match_parent"
3737
android:layout_height="wrap_content"
3838
android:layout_marginLeft="16dp"
3939
android:layout_marginTop="6dp"
4040
android:layout_marginBottom="22dp"
41-
app:flexWrap="wrap"
42-
app:flexDirection="row"
43-
app:justifyContent="space_between"
44-
app:alignItems="flex_start"
4541
android:baselineAligned="false"
4642
android:paddingTop="?attr/actionBarSize">
4743

@@ -56,15 +52,15 @@
5652
android:layout_height="wrap_content"
5753
tools:text="0 °C"
5854
android:textColor="@color/text_light"
59-
android:textSize="36sp"/>
55+
android:textSize="36dp"/>
6056

6157
<TextView
6258
android:id="@+id/todayDescription"
6359
android:layout_width="wrap_content"
6460
android:layout_height="wrap_content"
6561
tools:text="No data"
6662
android:textColor="@color/text_light"
67-
android:textSize="16sp"/>
63+
android:textSize="16dp"/>
6864

6965
<TextView
7066
android:id="@+id/todayWind"
@@ -73,47 +69,47 @@
7369
android:layout_marginTop="8dp"
7470
tools:text="Wind: 0 m/s"
7571
android:textColor="@color/text_light"
76-
android:textSize="16sp"/>
72+
android:textSize="16dp"/>
7773

7874
<TextView
7975
android:id="@+id/todayPressure"
8076
android:layout_width="wrap_content"
8177
android:layout_height="wrap_content"
8278
tools:text="Pressure: 0 hpa"
8379
android:textColor="@color/text_light"
84-
android:textSize="16sp"/>
80+
android:textSize="16dp"/>
8581

8682
<TextView
8783
android:id="@+id/todayHumidity"
8884
android:layout_width="wrap_content"
8985
android:layout_height="wrap_content"
9086
tools:text="Humidity: 0 %"
9187
android:textColor="@color/text_light"
92-
android:textSize="16sp"/>
88+
android:textSize="16dp"/>
9389

9490
<TextView
9591
android:id="@+id/todaySunrise"
9692
android:layout_width="wrap_content"
9793
android:layout_height="wrap_content"
9894
tools:text="Sunrise: 00:00"
9995
android:textColor="@color/text_light"
100-
android:textSize="16sp"/>
96+
android:textSize="16dp"/>
10197

10298
<TextView
10399
android:id="@+id/todaySunset"
104100
android:layout_width="wrap_content"
105101
android:layout_height="wrap_content"
106102
tools:text="Sunset: 00:00"
107103
android:textColor="@color/text_light"
108-
android:textSize="16sp"/>
104+
android:textSize="16dp"/>
109105

110106
<TextView
111107
android:id="@+id/todayUvIndex"
112108
android:layout_width="wrap_content"
113109
android:layout_height="wrap_content"
114110
tools:text="Uv Index: Loading..."
115111
android:textColor="@color/text_light"
116-
android:textSize="16sp"/>
112+
android:textSize="16dp"/>
117113
</LinearLayout>
118114

119115
<LinearLayout
@@ -135,10 +131,11 @@
135131
android:layout_height="wrap_content"
136132
android:layout_gravity="center"
137133
android:gravity="center"
138-
android:paddingRight="42dp"
134+
android:paddingRight="16dp"
139135
android:textColor="@color/text_light"
140136
android:text=""
141-
android:textSize="72sp"/>
137+
android:textSize="72dp"
138+
android:paddingEnd="16dp" />
142139

143140
<TextView
144141
android:id="@+id/tapGraph"
@@ -150,7 +147,7 @@
150147
android:layout_marginTop="-20dp"
151148
android:textColor="@color/text_light"
152149
android:text=""
153-
android:textSize="14sp" />
150+
android:textSize="14dp" />
154151

155152

156153
</LinearLayout>
@@ -168,12 +165,11 @@
168165
android:gravity="bottom|end"
169166
android:paddingRight="16dp"
170167
android:textAlignment="viewEnd"
171-
android:textSize="14sp"/>
168+
android:textSize="14dp"/>
172169
</LinearLayout>
173170

174171

175-
176-
</com.google.android.flexbox.FlexboxLayout>
172+
</LinearLayout>
177173

178174
</com.google.android.material.appbar.CollapsingToolbarLayout>
179175

Diff for: app/src/main/res/layout/list_row.xml

+28-42
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@
1313
android:layout_height="1dp"
1414
android:background="?android:attr/listDivider" />
1515

16-
<com.google.android.flexbox.FlexboxLayout
16+
<RelativeLayout
1717
android:layout_width="match_parent"
18-
android:layout_height="wrap_content"
19-
app:alignItems="flex_start"
20-
app:flexDirection="row"
21-
app:flexWrap="wrap"
22-
app:justifyContent="space_between">
18+
android:layout_height="wrap_content">
2319

2420
<LinearLayout
2521
android:layout_width="wrap_content"
@@ -34,71 +30,61 @@
3430
android:layout_height="wrap_content"
3531
tools:text="16:00"
3632
android:textColor="?android:textColorPrimary"
37-
android:textSize="16sp"
33+
android:textSize="16dp"
3834
android:textStyle="bold" />
3935

4036
<TextView
4137
android:id="@+id/itemDescription"
4238
android:layout_width="wrap_content"
4339
android:layout_height="wrap_content"
4440
tools:text="No data"
45-
android:textSize="16sp" />
41+
android:textSize="16dp" />
4642

4743
<TextView
4844
android:id="@+id/itemWind"
4945
android:layout_width="wrap_content"
5046
android:layout_height="wrap_content"
5147
android:layout_marginTop="8dp"
5248
tools:text="Wind: 0 m/s"
53-
android:textSize="16sp" />
49+
android:textSize="16dp" />
5450

5551
<TextView
5652
android:id="@+id/itemPressure"
5753
android:layout_width="wrap_content"
5854
android:layout_height="wrap_content"
5955
tools:text="Pressure: 0 hpa"
60-
android:textSize="16sp" />
56+
android:textSize="16dp" />
6157

6258
<TextView
6359
android:id="@+id/itemHumidity"
6460
android:layout_width="wrap_content"
6561
android:layout_height="wrap_content"
6662
tools:text="Humidity: 0 %"
67-
android:textSize="16sp" />
63+
android:textSize="16dp" />
6864
</LinearLayout>
6965

70-
<LinearLayout
66+
<TextView
67+
android:id="@+id/itemIcon"
7168
android:layout_width="wrap_content"
7269
android:layout_height="wrap_content"
73-
android:layout_marginLeft="16dp"
74-
android:layout_marginTop="16dp"
70+
android:layout_alignParentEnd="true"
71+
android:layout_alignParentRight="true"
72+
android:layout_alignParentTop="true"
7573
android:layout_marginRight="16dp"
76-
android:orientation="vertical">
77-
78-
<TextView
79-
android:id="@+id/itemIcon"
80-
android:layout_width="wrap_content"
81-
android:layout_height="wrap_content"
82-
android:layout_alignParentEnd="true"
83-
android:layout_alignParentRight="true"
84-
android:layout_alignParentTop="true"
85-
android:layout_marginRight="16dp"
86-
android:layout_marginTop="16dp"
87-
android:layout_weight="1"
88-
tools:text="o"
89-
android:textSize="48sp" />
90-
91-
<TextView
92-
android:id="@+id/itemTemperature"
93-
android:layout_width="wrap_content"
94-
android:layout_height="wrap_content"
95-
tools:text="0 °C"
96-
android:textSize="22sp"
97-
android:layout_marginTop="8dp"
98-
android:layout_below="@+id/itemIcon"
99-
android:layout_alignRight="@+id/itemIcon"
100-
android:layout_alignEnd="@+id/itemIcon" />
74+
android:layout_marginTop="16dp"
75+
android:layout_weight="1"
76+
tools:text="o"
77+
android:textSize="48sp" />
10178

102-
</LinearLayout>
103-
</com.google.android.flexbox.FlexboxLayout>
104-
</LinearLayout>
79+
<TextView
80+
android:id="@+id/itemTemperature"
81+
android:layout_width="wrap_content"
82+
android:layout_height="wrap_content"
83+
tools:text="0 °C"
84+
android:textSize="22dp"
85+
android:layout_marginTop="8dp"
86+
android:layout_below="@+id/itemIcon"
87+
android:layout_alignRight="@+id/itemIcon"
88+
android:layout_alignEnd="@+id/itemIcon" />
89+
</RelativeLayout>
90+
</LinearLayout>

0 commit comments

Comments
 (0)