From 7549f09ae3bb0282f615e5280a072c1c87457482 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 4 Jul 2018 08:08:20 +0200 Subject: [PATCH 1/5] adapt Notification layout to server Signed-off-by: tobiasKaminsky --- .../ui/adapter/NotificationListAdapter.java | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java index 8a0cd3d414..b3b1d2d9ff 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java @@ -20,6 +20,7 @@ package com.owncloud.android.ui.adapter; import android.content.Intent; +import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.Typeface; import android.graphics.drawable.PictureDrawable; @@ -27,7 +28,11 @@ import android.net.Uri; import android.os.AsyncTask; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; +import android.text.Spannable; +import android.text.SpannableStringBuilder; import android.text.TextUtils; +import android.text.style.ForegroundColorSpan; +import android.text.style.StyleSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -48,6 +53,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.notifications.models.Action; import com.owncloud.android.lib.resources.notifications.models.Notification; +import com.owncloud.android.lib.resources.notifications.models.RichObject; import com.owncloud.android.ui.activity.NotificationsActivity; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.ThemeUtils; @@ -109,10 +115,17 @@ public class NotificationListAdapter extends RecyclerView.Adapter openLink(notification.getLink())); + holder.subject.setText(subject); + } else { + if (!TextUtils.isEmpty(notification.subjectRich)) { + holder.subject.setText(makeSpecialPartsBold(notification)); + } else { + holder.subject.setText(subject); + } } - holder.subject.setText(subject); holder.message.setText(notification.getMessage()); + holder.message.setAlpha(0.57f); // TODO set in xml, once there is an own notification_list_item.xml // Todo set proper action icon (to be clarified how to pick) if (!TextUtils.isEmpty(notification.getIcon())) { @@ -139,6 +152,33 @@ public class NotificationListAdapter extends RecyclerView.Adapter { private NotificationViewHolder holder; From f77caf892697dd6c7eadae208e73d055d9f06956 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 19 Jul 2018 13:57:02 +0200 Subject: [PATCH 2/5] fix codacy issues --- .../android/ui/adapter/NotificationListAdapter.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java index b3b1d2d9ff..31e51c6ca4 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java @@ -80,6 +80,8 @@ import butterknife.ButterKnife; */ public class NotificationListAdapter extends RecyclerView.Adapter { private static final String TAG = NotificationListAdapter.class.getSimpleName(); + private StyleSpan styleSpanBold = new StyleSpan(Typeface.BOLD); + private ForegroundColorSpan foregroundColorSpanBlack = new ForegroundColorSpan(Color.BLACK); private List notificationsList; private OwnCloudClient client; @@ -156,10 +158,10 @@ public class NotificationListAdapter extends RecyclerView.Adapter Date: Thu, 19 Jul 2018 13:58:34 +0200 Subject: [PATCH 3/5] fix codacy issue --- .../owncloud/android/ui/adapter/NotificationListAdapter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java index 31e51c6ca4..6744eb52a3 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java @@ -160,9 +160,10 @@ public class NotificationListAdapter extends RecyclerView.Adapter Date: Fri, 20 Jul 2018 13:47:35 +0200 Subject: [PATCH 4/5] set alpha in layout --- .../owncloud/android/ui/adapter/NotificationListAdapter.java | 1 - src/main/res/layout/notification_list_item.xml | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java index 6744eb52a3..dde75dc80b 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java @@ -127,7 +127,6 @@ public class NotificationListAdapter extends RecyclerView.Adapter From cf95da0e16a2a1b708e25a923c0d72f3d8388f37 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Fri, 20 Jul 2018 14:51:24 +0200 Subject: [PATCH 5/5] fix float --- src/main/res/layout/notification_list_item.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/res/layout/notification_list_item.xml b/src/main/res/layout/notification_list_item.xml index e293de246c..cf16d5824d 100644 --- a/src/main/res/layout/notification_list_item.xml +++ b/src/main/res/layout/notification_list_item.xml @@ -63,7 +63,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:text="@string/placeholder_sentence" - android:alpha="0.57f" + android:alpha="0.57" android:textAppearance="?android:attr/textAppearanceListItem"/>