Null fix for notifications

This commit is contained in:
maskara 2018-03-15 00:35:34 +05:30
parent f34af1ee4b
commit 528faa1c52
4 changed files with 9 additions and 16 deletions

View file

@ -24,6 +24,7 @@ import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
import fr.free.nrw.commons.utils.ViewUtil;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -81,6 +82,7 @@ public class NotificationActivity extends NavigationBaseActivity {
progressBar.setVisibility(View.GONE);
}, throwable -> {
Timber.e(throwable, "Error occurred while loading notifications");
ViewUtil.showSnackbar(this, R.string.error_notifications);
progressBar.setVisibility(View.GONE);
});
} else {

View file

@ -20,7 +20,6 @@ import fr.free.nrw.commons.R;
public class NotificationRenderer extends Renderer<Notification> {
@BindView(R.id.title) ReadMoreTextView title;
@BindView(R.id.description) ReadMoreTextView description;
@BindView(R.id.time) TextView time;
@BindView(R.id.icon) ImageView icon;
private NotificationClicked listener;
@ -49,12 +48,9 @@ public class NotificationRenderer extends Renderer<Notification> {
public void render() {
Notification notification = getContent();
StringBuilder str = new StringBuilder(notification.notificationText);
str.append(" " );
str.append(" ");
title.setText(str);
time.setText(notification.date);
StringBuilder desc = new StringBuilder(notification.description);
desc.append(" ");
description.setText(desc);
switch (notification.notificationType) {
case THANK_YOU_EDIT:
icon.setImageResource(R.drawable.ic_edit_black_24dp);