public int compare(Note arg0, Note arg1) {
int comp = 0;
-
+ long lcomp = 0;
+
switch (noteOrder){
case Constant.NOTE_ORDER_CREATE:
- comp = (int)(arg0.getCreated() - arg1.getCreated());
+ lcomp = arg0.getCreated() - arg1.getCreated();
break;
case Constant.NOTE_ORDER_UPDATE:
- comp = (int)(arg0.getUpdated() - arg1.getUpdated());
+ lcomp = arg0.getUpdated() - arg1.getUpdated();
break;
case Constant.NOTE_ORDER_TEXT:
- comp = arg0.getText().compareTo(arg1.getText());
+ lcomp = (long)arg0.getText().compareTo(arg1.getText());
break;
}
+ if (lcomp > 0){
+ comp = 1;
+ }
+ else if (lcomp < 0){
+ comp = -1;
+ }
if (orderBy == Constant.NOTE_ORDER_BY_DES){
comp = -comp;
}
return comp;
}
-
- /*
- int noteOrder = pref.getInt(Constant.PREF_NOTE_ORDER,
- Constant.NOTE_ORDER_CREATE);
-
- int orderBy = pref.getInt(Constant.PREF_NOTE_ORDER_BY,
- Constant.NOTE_ORDER_BY_ASC);
- switch (orderBy) {
- case Constant.NOTE_ORDER_BY_ASC:
- break;
- case Constant.NOTE_ORDER_BY_DES:
- break;
- }
-*/
}