fix crash in NotificationsFragment when Preferences are first accessed

fixes #797
main
Conny Duck 6 years ago
parent 974c4f37b1
commit 62ed1a9d57
  1. 4
      app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java
  2. 2
      app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java

@ -233,6 +233,10 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
mediaPreviewEnabled = enabled;
}
public boolean isMediaPreviewEnabled() {
return mediaPreviewEnabled;
}
public interface NotificationActionListener {
void onViewAccount(String id);

@ -522,8 +522,10 @@ public class NotificationsFragment extends SFragment implements
}
case "mediaPreviewEnabled": {
boolean enabled = sharedPreferences.getBoolean("mediaPreviewEnabled", true);
if (enabled != adapter.isMediaPreviewEnabled()) {
adapter.setMediaPreviewEnabled(enabled);
fullyRefresh();
}
break;
}
}

Loading…
Cancel
Save