Notification timestamp timezone fix. Tweak loading unread notification count.
This commit is contained in:
parent
f83a043664
commit
cead924ca5
2 changed files with 6 additions and 4 deletions
|
@ -2144,7 +2144,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleNotificationReceived(Intent intent) {
|
private void handleNotificationReceived(Intent intent) {
|
||||||
loadUnreadNotificationsCount();
|
|
||||||
loadRemoteNotifications(false);
|
loadRemoteNotifications(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3255,9 +3254,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<LbryNotification> notifications) {
|
public void onSuccess(List<LbryNotification> notifications) {
|
||||||
remoteNotifcationsLastLoaded = new Date();
|
remoteNotifcationsLastLoaded = new Date();
|
||||||
|
|
||||||
loadLocalNotifications();
|
loadLocalNotifications();
|
||||||
loadUnreadNotificationsCount();
|
|
||||||
if (markRead && findViewById(R.id.notifications_container).getVisibility() == View.VISIBLE) {
|
if (markRead && findViewById(R.id.notifications_container).getVisibility() == View.VISIBLE) {
|
||||||
markNotificationsRead();
|
markNotificationsRead();
|
||||||
}
|
}
|
||||||
|
@ -3293,6 +3290,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
protected void onPostExecute(List<LbryNotification> notifications) {
|
protected void onPostExecute(List<LbryNotification> notifications) {
|
||||||
findViewById(R.id.notification_list_empty_container).setVisibility(notifications.size() == 0 ? View.VISIBLE : View.GONE);
|
findViewById(R.id.notification_list_empty_container).setVisibility(notifications.size() == 0 ? View.VISIBLE : View.GONE);
|
||||||
findViewById(R.id.notifications_progress).setVisibility(View.GONE);
|
findViewById(R.id.notifications_progress).setVisibility(View.GONE);
|
||||||
|
loadUnreadNotificationsCount();
|
||||||
|
|
||||||
if (notificationListAdapter == null) {
|
if (notificationListAdapter == null) {
|
||||||
notificationListAdapter = new NotificationListAdapter(notifications, MainActivity.this);
|
notificationListAdapter = new NotificationListAdapter(notifications, MainActivity.this);
|
||||||
|
|
|
@ -16,8 +16,10 @@ import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import io.lbry.browser.R;
|
import io.lbry.browser.R;
|
||||||
import io.lbry.browser.model.Claim;
|
import io.lbry.browser.model.Claim;
|
||||||
|
@ -160,9 +162,11 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||||
vh.titleView.setVisibility(!Helper.isNullOrEmpty(notification.getTitle()) ? View.VISIBLE : View.GONE);
|
vh.titleView.setVisibility(!Helper.isNullOrEmpty(notification.getTitle()) ? View.VISIBLE : View.GONE);
|
||||||
vh.titleView.setText(notification.getTitle());
|
vh.titleView.setText(notification.getTitle());
|
||||||
vh.bodyView.setText(notification.getDescription());
|
vh.bodyView.setText(notification.getDescription());
|
||||||
|
|
||||||
|
Calendar utcCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
vh.timeView.setText(DateUtils.getRelativeTimeSpanString(
|
vh.timeView.setText(DateUtils.getRelativeTimeSpanString(
|
||||||
notification.getTimestamp().getTime(),
|
notification.getTimestamp().getTime(),
|
||||||
System.currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_RELATIVE));
|
utcCalendar.getTimeInMillis(), 0, DateUtils.FORMAT_ABBREV_RELATIVE));
|
||||||
|
|
||||||
vh.thumbnailView.setVisibility(notification.getCommentAuthor() == null ? View.INVISIBLE : View.VISIBLE);
|
vh.thumbnailView.setVisibility(notification.getCommentAuthor() == null ? View.INVISIBLE : View.VISIBLE);
|
||||||
if (notification.getCommentAuthor() != null) {
|
if (notification.getCommentAuthor() != null) {
|
||||||
|
|
Loading…
Reference in a new issue