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