changed notification date style
This commit is contained in:
@@ -55,7 +55,13 @@ public class NotificationListAdapter extends CursorRecyclerViewAdapter<Notificat
|
||||
tvMessage.setText(n.message);
|
||||
tvTitle.setText(n.title);
|
||||
tvAppName.setText(n.appName);
|
||||
CharSequence formattedDate = DateUtils.getRelativeTimeSpanString(n.date, System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS, DateUtils.FORMAT_ABBREV_ALL);
|
||||
|
||||
CharSequence formattedDate;
|
||||
if(DateUtils.isToday(n.date))
|
||||
formattedDate = DateUtils.formatDateTime(context, n.date, DateUtils.FORMAT_SHOW_TIME);
|
||||
else
|
||||
formattedDate = DateUtils.formatDateTime(context, n.date, DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE);
|
||||
|
||||
tvDate.setText(formattedDate);
|
||||
|
||||
Drawable appIcon = PackageUtils.getApplicationLauncherIcon(context, n.packageName);
|
||||
|
||||
@@ -70,7 +70,13 @@ public class ListWidgetViewFactory implements RemoteViewsService.RemoteViewsFact
|
||||
titleSpan.setSpan(new StyleSpan(Typeface.BOLD), 0, title.length(), 0);
|
||||
|
||||
rv.setTextViewText(R.id.widget_list_item_notification, titleSpan);
|
||||
rv.setTextViewText(R.id.widget_list_item_date, DateUtils.formatDateTime(mContext, notification.date, DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE));
|
||||
|
||||
CharSequence formattedDate;
|
||||
if(DateUtils.isToday(notification.date))
|
||||
formattedDate = DateUtils.formatDateTime(mContext, notification.date, DateUtils.FORMAT_SHOW_TIME);
|
||||
else
|
||||
formattedDate = DateUtils.formatDateTime(mContext, notification.date, DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE);
|
||||
rv.setTextViewText(R.id.widget_list_item_date, formattedDate);
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Logged_notificationTable.FIELD__ID, notification.id);
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
tools:text="Notification title" />
|
||||
|
||||
<TextView
|
||||
android:textColor="@color/colorAccent"
|
||||
android:id="@+id/notification_item_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user