natural list sorting (desc date)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package net.headlezz.notificationlogger.logger;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import ckm.simple.sql_provider.annotation.SimpleSQLColumn;
|
||||
import ckm.simple.sql_provider.annotation.SimpleSQLTable;
|
||||
|
||||
@@ -18,7 +16,7 @@ public class LoggedNotification {
|
||||
public String message;
|
||||
|
||||
@SimpleSQLColumn("date")
|
||||
public Date date;
|
||||
public long date;
|
||||
|
||||
@SimpleSQLColumn("app_name")
|
||||
public String appName;
|
||||
|
||||
@@ -12,8 +12,6 @@ import android.service.notification.StatusBarNotification;
|
||||
|
||||
import net.headlezz.notificationlogger.PackageUtils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class NotificationLoggerService extends NotificationListenerService implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
@@ -69,7 +67,7 @@ public class NotificationLoggerService extends NotificationListenerService imple
|
||||
int notificationId = sbn.getId();
|
||||
|
||||
int userId = sbn.getUserId();
|
||||
Date date = new Date(sbn.getPostTime());
|
||||
long date = sbn.getPostTime();
|
||||
String packageName = sbn.getPackageName();
|
||||
int iconId = sbn.getNotification().icon;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class NotificationListAdapter extends CursorRecyclerViewAdapter<Notificat
|
||||
tvMessage.setText(n.message);
|
||||
tvTitle.setText(n.title);
|
||||
tvAppName.setText(n.appName);
|
||||
CharSequence formattedDate = DateUtils.getRelativeTimeSpanString(n.date.getTime(), System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS, DateUtils.FORMAT_ABBREV_ALL);
|
||||
CharSequence formattedDate = DateUtils.getRelativeTimeSpanString(n.date, System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS, DateUtils.FORMAT_ABBREV_ALL);
|
||||
tvDate.setText(formattedDate);
|
||||
|
||||
Drawable appIcon = PackageUtils.getApplicationLauncherIcon(context, n.packageName);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class NotificationListFragment extends Fragment implements LoaderManager.
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
Logged_notificationTable.FIELD_DATE + " DESC"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user