Commit 763bd9b5 authored by fallenstardust's avatar fallenstardust

卡包展示按时间顺序排列

parent adca5ad1
......@@ -8,6 +8,7 @@ public class DeckFile extends TextSelect {
private String name;
private String path;
private Long date;
public DeckFile(String path) {
this.path = path;
......@@ -23,6 +24,7 @@ public class DeckFile extends TextSelect {
path = file.getAbsolutePath();
name = file.getName();
name = name.substring(0, name.lastIndexOf("."));
date = file.lastModified();
super.setName(name);
setObject(this);
}
......@@ -43,4 +45,6 @@ public class DeckFile extends TextSelect {
this.path = path;
}
public Long getDate() { return date; }
}
......@@ -113,6 +113,7 @@ public class SearchableListDialog extends DialogFragment implements
outState.putSerializable("item", _searchableItem);
super.onSaveInstanceState(outState);
}
// Change End
public void setTitle(String strTitle) {
_strTitle = strTitle;
......@@ -146,8 +147,8 @@ public class SearchableListDialog extends DialogFragment implements
_searchView.setOnQueryTextListener(this);
_searchView.setOnCloseListener(this);
_searchView.clearFocus();
int id =_searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView textView1= (TextView)_searchView.findViewById(id);
int id = _searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView textView1 = (TextView) _searchView.findViewById(id);
textView1.setTextColor(Color.parseColor("#ff8800"));
InputMethodManager mgr = (InputMethodManager) getActivity().getSystemService(Context
.INPUT_METHOD_SERVICE);
......
......@@ -49,7 +49,11 @@ public class DeckUtil {
}
}
}
Collections.sort(deckList, nameCom);
if (path.equals(AppsSettings.get().getPackDeckDir())) {
Collections.sort(deckList, dateCom);
} else {
Collections.sort(deckList, nameCom);
}
return deckList;
}
......@@ -122,4 +126,11 @@ public class DeckUtil {
}
};
static Comparator dateCom = new Comparator<DeckFile>() {
@Override
public int compare(DeckFile ydk1, DeckFile ydk2) {
return ydk2.getDate().compareTo(ydk1.getDate());
}
};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment