fix crash in NotificationsFragment when Preferences are first accessed

fixes #797
This commit is contained in:
Conny Duck 2018-08-24 19:47:27 +02:00
parent d1630d11bd
commit 1fef8c0c2b
2 changed files with 8 additions and 2 deletions

View File

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

View File

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