natural list sorting (desc date)

This commit is contained in:
danijoo
2016-01-02 23:31:11 +01:00
parent 5906bc2710
commit 4b11515ae8
4 changed files with 4 additions and 8 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -61,7 +61,7 @@ public class NotificationListFragment extends Fragment implements LoaderManager.
null,
null,
null,
null
Logged_notificationTable.FIELD_DATE + " DESC"
);
}