only reload timeline on pref change when necessary

This commit is contained in:
Conny Duck 2018-06-25 17:20:41 +02:00
parent 970551adee
commit b655985997
2 changed files with 9 additions and 2 deletions

View file

@ -98,6 +98,10 @@ public final class TimelineAdapter extends RecyclerView.Adapter {
mediaPreviewEnabled = enabled; mediaPreviewEnabled = enabled;
} }
public boolean getMediaPreviewEnabled() {
return mediaPreviewEnabled;
}
@Override @Override
public long getItemId(int position) { public long getItemId(int position) {
return dataSource.getItemAt(position).getViewDataId(); return dataSource.getItemAt(position).getViewDataId();

View file

@ -610,8 +610,11 @@ public class TimelineFragment extends SFragment implements
} }
case "mediaPreviewEnabled": { case "mediaPreviewEnabled": {
boolean enabled = sharedPreferences.getBoolean("mediaPreviewEnabled", true); boolean enabled = sharedPreferences.getBoolean("mediaPreviewEnabled", true);
boolean oldMediaPreviewEnabled = adapter.getMediaPreviewEnabled();
if(enabled != oldMediaPreviewEnabled) {
adapter.setMediaPreviewEnabled(enabled); adapter.setMediaPreviewEnabled(enabled);
fullyRefresh(); fullyRefresh();
}
break; break;
} }
case "tabFilterHomeReplies": { case "tabFilterHomeReplies": {