mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +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("notprop", "list")
|
||||||
.param("format", "xml")
|
.param("format", "xml")
|
||||||
.param("meta", "notifications")
|
.param("meta", "notifications")
|
||||||
|
// .param("meta", "notifications")
|
||||||
.param("notformat", "model")
|
.param("notformat", "model")
|
||||||
.get()
|
.get()
|
||||||
.getNode("/api/query/notifications/list");
|
.getNode("/api/query/notifications/list");
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import com.pedrogomez.renderers.RVRendererAdapter;
|
import com.pedrogomez.renderers.RVRendererAdapter;
|
||||||
|
|
||||||
|
|
@ -38,8 +39,8 @@ public class NotificationActivity extends NavigationBaseActivity {
|
||||||
NotificationAdapterFactory notificationAdapterFactory;
|
NotificationAdapterFactory notificationAdapterFactory;
|
||||||
|
|
||||||
@BindView(R.id.listView) RecyclerView recyclerView;
|
@BindView(R.id.listView) RecyclerView recyclerView;
|
||||||
@BindView(R.id.progressBar)
|
@BindView(R.id.progressBar) ProgressBar progressBar;
|
||||||
ProgressBar progressBar;
|
@BindView(R.id.container) RelativeLayout relativeLayout;
|
||||||
|
|
||||||
@Inject NotificationController controller;
|
@Inject NotificationController controller;
|
||||||
|
|
||||||
|
|
@ -82,7 +83,7 @@ public class NotificationActivity extends NavigationBaseActivity {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
}, throwable -> {
|
}, throwable -> {
|
||||||
Timber.e(throwable, "Error occurred while loading notifications");
|
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);
|
progressBar.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -98,6 +99,10 @@ public class NotificationActivity extends NavigationBaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAdapter(List<Notification> notificationList) {
|
private void setAdapter(List<Notification> notificationList) {
|
||||||
|
if(notificationList == null || notificationList.isEmpty()) {
|
||||||
|
ViewUtil.showSnackbar(relativeLayout, R.string.no_notifications);
|
||||||
|
return;
|
||||||
|
}
|
||||||
notificationAdapterFactory = new NotificationAdapterFactory(notification -> {
|
notificationAdapterFactory = new NotificationAdapterFactory(notification -> {
|
||||||
Timber.d("Notification clicked %s", notification.link);
|
Timber.d("Notification clicked %s", notification.link);
|
||||||
handleUrl(notification.link);
|
handleUrl(notification.link);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class NotificationRenderer extends Renderer<Notification> {
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
Notification notification = getContent();
|
Notification notification = getContent();
|
||||||
StringBuilder str = new StringBuilder(notification.notificationText);
|
StringBuilder str = new StringBuilder(notification.notificationText.trim());
|
||||||
str.append(" ");
|
str.append(" ");
|
||||||
title.setText(str);
|
title.setText(str);
|
||||||
time.setText(notification.date);
|
time.setText(notification.date);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,27 +45,11 @@
|
||||||
android:layout_toRightOf="@id/icon"
|
android:layout_toRightOf="@id/icon"
|
||||||
android:layout_toStartOf="@id/time"
|
android:layout_toStartOf="@id/time"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
app:trimLines="2"
|
app:trimMode="trimModeLength"
|
||||||
|
app:trimLength="60"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
app:colorClickableText="#969494"
|
app:colorClickableText="#969494"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||||
tools:text="@string/placeholder_place_name"
|
tools:text="@string/placeholder_place_name"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<com.borjabravo.readmoretextview.ReadMoreTextView
|
|
||||||
android:id="@+id/description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignEnd="@id/time"
|
|
||||||
android:layout_alignLeft="@id/title"
|
|
||||||
android:layout_alignRight="@id/time"
|
|
||||||
android:layout_alignStart="@id/title"
|
|
||||||
android:layout_below="@id/title"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
app:trimLines="2"
|
|
||||||
app:colorClickableText="#969494"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
|
||||||
tools:text="@string/placeholder_place_description"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
@ -249,4 +249,5 @@
|
||||||
<string name="welcome_skip_button">Skip Tutorial</string>
|
<string name="welcome_skip_button">Skip Tutorial</string>
|
||||||
|
|
||||||
<string name="error_notifications">Error fetching notifications</string>
|
<string name="error_notifications">Error fetching notifications</string>
|
||||||
|
<string name="no_notifications">No notifications found</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue