only reload timeline on pref change when necessary

main
Conny Duck 6 years ago
parent 8c425c44e5
commit 51e2ccc5a5
  1. 4
      app/src/main/java/com/keylesspalace/tusky/adapter/TimelineAdapter.java
  2. 7
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java

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

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

Loading…
Cancel
Save