mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Fix crash due to read more text view
This commit is contained in:
parent
528faa1c52
commit
365bbc470d
6 changed files with 15 additions and 23 deletions
|
|
@ -429,6 +429,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
.param("notprop", "list")
|
||||
.param("format", "xml")
|
||||
.param("meta", "notifications")
|
||||
// .param("meta", "notifications")
|
||||
.param("notformat", "model")
|
||||
.get()
|
||||
.getNode("/api/query/notifications/list");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import android.support.v7.widget.LinearLayoutManager;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.pedrogomez.renderers.RVRendererAdapter;
|
||||
|
||||
|
|
@ -38,8 +39,8 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
NotificationAdapterFactory notificationAdapterFactory;
|
||||
|
||||
@BindView(R.id.listView) RecyclerView recyclerView;
|
||||
@BindView(R.id.progressBar)
|
||||
ProgressBar progressBar;
|
||||
@BindView(R.id.progressBar) ProgressBar progressBar;
|
||||
@BindView(R.id.container) RelativeLayout relativeLayout;
|
||||
|
||||
@Inject NotificationController controller;
|
||||
|
||||
|
|
@ -82,7 +83,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);
|
||||
ViewUtil.showSnackbar(relativeLayout, R.string.error_notifications);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -98,6 +99,10 @@ public class NotificationActivity extends NavigationBaseActivity {
|
|||
}
|
||||
|
||||
private void setAdapter(List<Notification> notificationList) {
|
||||
if(notificationList == null || notificationList.isEmpty()) {
|
||||
ViewUtil.showSnackbar(relativeLayout, R.string.no_notifications);
|
||||
return;
|
||||
}
|
||||
notificationAdapterFactory = new NotificationAdapterFactory(notification -> {
|
||||
Timber.d("Notification clicked %s", notification.link);
|
||||
handleUrl(notification.link);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class NotificationRenderer extends Renderer<Notification> {
|
|||
@Override
|
||||
public void render() {
|
||||
Notification notification = getContent();
|
||||
StringBuilder str = new StringBuilder(notification.notificationText);
|
||||
StringBuilder str = new StringBuilder(notification.notificationText.trim());
|
||||
str.append(" ");
|
||||
title.setText(str);
|
||||
time.setText(notification.date);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue