diff --git a/mastodon/build.gradle b/mastodon/build.gradle index f5456dc2..3ceaf30f 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -58,7 +58,7 @@ dependencies { implementation 'me.grishka.litex:dynamicanimation:1.1.0-alpha03' implementation 'me.grishka.litex:viewpager:1.0.0' implementation 'me.grishka.litex:viewpager2:1.0.0' - implementation 'me.grishka.appkit:appkit:1.2.1' + implementation 'me.grishka.appkit:appkit:1.2.2' implementation 'com.google.code.gson:gson:2.8.9' implementation 'org.jsoup:jsoup:1.14.3' implementation 'com.squareup:otto:1.3.8' diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index 94cf6dd7..c3ead66c 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -328,7 +328,6 @@ public abstract class BaseStatusListFragment exten public void onConfigurationChanged(Configuration newConfig){ super.onConfigurationChanged(newConfig); updateToolbar(); - list.invalidateItemDecorations(); } private void updateToolbar(){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/TileGridLayoutManager.java b/mastodon/src/main/java/org/joinmastodon/android/ui/TileGridLayoutManager.java index ceb58dd9..9062555b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/TileGridLayoutManager.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/TileGridLayoutManager.java @@ -2,12 +2,16 @@ package org.joinmastodon.android.ui; import android.content.Context; import android.util.AttributeSet; +import android.view.View; +import androidx.annotation.NonNull; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; public class TileGridLayoutManager extends GridLayoutManager{ private static final String TAG="TileGridLayoutManager"; + private int lastWidth=0; + public TileGridLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes){ super(context, attrs, defStyleAttr, defStyleRes); } @@ -24,4 +28,17 @@ public class TileGridLayoutManager extends GridLayoutManager{ public int getColumnCountForAccessibility(RecyclerView.Recycler recycler, RecyclerView.State state){ return 1; } + + @Override + public void onMeasure(@NonNull RecyclerView.Recycler recycler, @NonNull RecyclerView.State state, int widthSpec, int heightSpec){ + int width=View.MeasureSpec.getSize(widthSpec); + // Is there a better way to invalidate item decorations when the size changes? + if(lastWidth!=width){ + lastWidth=width; + if(getChildCount()>0){ + ((RecyclerView)getChildAt(0).getParent()).invalidateItemDecorations(); + } + } + super.onMeasure(recycler, state, widthSpec, heightSpec); + } }