This commit is contained in:
Grishka 2022-04-20 15:43:25 +03:00
parent 94c864c8ac
commit ad825d6803
3 changed files with 18 additions and 2 deletions

View File

@ -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'

View File

@ -328,7 +328,6 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
updateToolbar();
list.invalidateItemDecorations();
}
private void updateToolbar(){

View File

@ -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);
}
}