Skip to content

Commit

Permalink
Revert "Make the layout more adaptive with Flexbox when using sp"
Browse files Browse the repository at this point in the history
This reverts commit c7d37a9.
  • Loading branch information
robinpaulson committed Dec 12, 2021
1 parent 2043da7 commit 86a64e8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 73 deletions.
6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "cz.martykan.forecastie"
minSdkVersion 15
targetSdkVersion 29
versionCode 68
versionName "1.18.2"
versionCode 70
versionName "1.19.1"
}

lintOptions {
Expand All @@ -35,8 +35,6 @@ dependencies {
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "com.google.android.material:material:1.2.1"
implementation "com.google.android.flexbox:flexbox:3.0.0"
implementation "androidx.core:core:1.5.0"

/** Lifecycle */
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public class MainActivity extends BaseActivity implements LocationListener {
private ViewPager viewPager;
private TabLayout tabLayout;
private SwipeRefreshLayout swipeRefreshLayout;
private ViewPagerAdapter pagerAdapter;

private View appView;

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

if(this.pagerAdapter == null) {
pagerAdapter = viewPagerAdapter;
viewPager.setAdapter(pagerAdapter);
tabLayout.setupWithViewPager(viewPager);
}
pagerAdapter.notifyDataSetChanged();

int currentPage = viewPager.getCurrentItem();

viewPagerAdapter.notifyDataSetChanged();
viewPager.setAdapter(viewPagerAdapter);
tabLayout.setupWithViewPager(viewPager);

if (currentPage == 0 && longTermTodayWeather.isEmpty()) {
currentPage = 1;
}
Expand Down
34 changes: 15 additions & 19 deletions app/src/main/res/layout/activity_scrolling.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,12 @@
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

<com.google.android.flexbox.FlexboxLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="22dp"
app:flexWrap="wrap"
app:flexDirection="row"
app:justifyContent="space_between"
app:alignItems="flex_start"
android:baselineAligned="false"
android:paddingTop="?attr/actionBarSize">

Expand All @@ -56,15 +52,15 @@
android:layout_height="wrap_content"
tools:text="0 °C"
android:textColor="@color/text_light"
android:textSize="36sp"/>
android:textSize="36dp"/>

<TextView
android:id="@+id/todayDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="No data"
android:textColor="@color/text_light"
android:textSize="16sp"/>
android:textSize="16dp"/>

<TextView
android:id="@+id/todayWind"
Expand All @@ -73,47 +69,47 @@
android:layout_marginTop="8dp"
tools:text="Wind: 0 m/s"
android:textColor="@color/text_light"
android:textSize="16sp"/>
android:textSize="16dp"/>

<TextView
android:id="@+id/todayPressure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Pressure: 0 hpa"
android:textColor="@color/text_light"
android:textSize="16sp"/>
android:textSize="16dp"/>

<TextView
android:id="@+id/todayHumidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Humidity: 0 %"
android:textColor="@color/text_light"
android:textSize="16sp"/>
android:textSize="16dp"/>

<TextView
android:id="@+id/todaySunrise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Sunrise: 00:00"
android:textColor="@color/text_light"
android:textSize="16sp"/>
android:textSize="16dp"/>

<TextView
android:id="@+id/todaySunset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Sunset: 00:00"
android:textColor="@color/text_light"
android:textSize="16sp"/>
android:textSize="16dp"/>

<TextView
android:id="@+id/todayUvIndex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Uv Index: Loading..."
android:textColor="@color/text_light"
android:textSize="16sp"/>
android:textSize="16dp"/>
</LinearLayout>

<LinearLayout
Expand All @@ -135,10 +131,11 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingRight="42dp"
android:paddingRight="16dp"
android:textColor="@color/text_light"
android:text=""
android:textSize="72sp"/>
android:textSize="72dp"
android:paddingEnd="16dp" />

<TextView
android:id="@+id/tapGraph"
Expand All @@ -150,7 +147,7 @@
android:layout_marginTop="-20dp"
android:textColor="@color/text_light"
android:text=""
android:textSize="14sp" />
android:textSize="14dp" />


</LinearLayout>
Expand All @@ -168,12 +165,11 @@
android:gravity="bottom|end"
android:paddingRight="16dp"
android:textAlignment="viewEnd"
android:textSize="14sp"/>
android:textSize="14dp"/>
</LinearLayout>



</com.google.android.flexbox.FlexboxLayout>
</LinearLayout>

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

Expand Down
70 changes: 28 additions & 42 deletions app/src/main/res/layout/list_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
android:layout_height="1dp"
android:background="?android:attr/listDivider" />

<com.google.android.flexbox.FlexboxLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:alignItems="flex_start"
app:flexDirection="row"
app:flexWrap="wrap"
app:justifyContent="space_between">
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="wrap_content"
Expand All @@ -34,71 +30,61 @@
android:layout_height="wrap_content"
tools:text="16:00"
android:textColor="?android:textColorPrimary"
android:textSize="16sp"
android:textSize="16dp"
android:textStyle="bold" />

<TextView
android:id="@+id/itemDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="No data"
android:textSize="16sp" />
android:textSize="16dp" />

<TextView
android:id="@+id/itemWind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
tools:text="Wind: 0 m/s"
android:textSize="16sp" />
android:textSize="16dp" />

<TextView
android:id="@+id/itemPressure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Pressure: 0 hpa"
android:textSize="16sp" />
android:textSize="16dp" />

<TextView
android:id="@+id/itemHumidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Humidity: 0 %"
android:textSize="16sp" />
android:textSize="16dp" />
</LinearLayout>

<LinearLayout
<TextView
android:id="@+id/itemIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp"
android:orientation="vertical">

<TextView
android:id="@+id/itemIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
tools:text="o"
android:textSize="48sp" />

<TextView
android:id="@+id/itemTemperature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="0 °C"
android:textSize="22sp"
android:layout_marginTop="8dp"
android:layout_below="@+id/itemIcon"
android:layout_alignRight="@+id/itemIcon"
android:layout_alignEnd="@+id/itemIcon" />
android:layout_marginTop="16dp"
android:layout_weight="1"
tools:text="o"
android:textSize="48sp" />

</LinearLayout>
</com.google.android.flexbox.FlexboxLayout>
</LinearLayout>
<TextView
android:id="@+id/itemTemperature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="0 °C"
android:textSize="22dp"
android:layout_marginTop="8dp"
android:layout_below="@+id/itemIcon"
android:layout_alignRight="@+id/itemIcon"
android:layout_alignEnd="@+id/itemIcon" />
</RelativeLayout>
</LinearLayout>

13 comments on commit 86a64e8

@robinpaulson
Copy link
Contributor Author

@robinpaulson robinpaulson commented on 86a64e8 Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @FridoDeluxe @igor-cali @fAntel, a couple of weeks back a commit introduced a bug to Forecastie which is fairly serious, breaking the UI. Before I noticed, I accepted a series of other PRs. I've tried to revert the original problem, but may have made it worse. Would you be able to help? I ask you as you've made most significant additions to the app over the last few year.

Thanks, robin

@igor-cali
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the referenced bug?

@robinpaulson
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#618 , also
#628

@robinpaulson
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've since done a git reset --hard, back to v1.18. This may have been a bad idea. I then released v1.20, which is v1.18 with the replacement API key.

@FridoDeluxe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, I'm neither an expert of GitHub nor Git itself.

It seems like the revert didn't work. For example in activity_scrolling.xml the master branch still shows the changes introduced in c7d37a9.

@robinpaulson
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FridoDeluxe Yes, so it does. I don't understand that, I'm sure I did a hard reset back to the end of October.....

@robinpaulson
Copy link
Contributor Author

@robinpaulson robinpaulson commented on 86a64e8 Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think I understand what happened. Reintroducing the "chance of precipitation" PR brought all the other changes which had happened between the hard reset point and that merge. I did another hard reset, then added the new API key again. It appears I'm not a github/git expert either.

I think the 1.20 release out shortly on f-droid will be OK.

@robinpaulson
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an aside, I've told Tomas I won't be looking after the app any more, maybe he will take it on himself again, or maybe get somebody else to do it.

@FridoDeluxe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an aside, I've told Tomas I won't be looking after the app any more, maybe he will take it on himself again, or maybe get somebody else to do it.

Sad to hear, but thank you for all the years of organizing and advancing the Forecastie development!

@igor-cali
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ciao @robinpaulson , are there any Issue or PR left to complete for the UI? Please let me know if help is needed and where.

@robinpaulson
Copy link
Contributor Author

@robinpaulson robinpaulson commented on 86a64e8 Dec 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @igor-cali . I'm not sure, I had abandoned the flexbox UI improvements, given the original coder is not responding. If you want to take up where he left it though, that would be great.

As far as I can tell, all the problems from the bad commit have been fixed. In the next day or so, I'll merge the PR you made, plus a couple of others put forward in the last few days.

@igor-cali
Copy link
Contributor

@igor-cali igor-cali commented on 86a64e8 Dec 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had abandoned the flexbox UI improvements, given the original coder is not responding. If you want to take up where he left it though, that would be great.

@robinpaulson I'm not familiar with Flexbox; never had a look at it. Do you think it's worth the effort to reintroduce that change, after all the struggle to revert and revamp? I could try to have a look, if you like. IMHO, I would prefer to improve the native code rather than adding an extra library.

@robinpaulson
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igor-cali I'm not sure the Flexbox code is worth it (I think I misunderstood your original question), there are other more pressing issues. Up to you I guess.

Please sign in to comment.