Display the running app first on the app grid

This commit is contained in:
Cameron Gutman 2016-06-18 13:38:37 -07:00
parent 55b9645651
commit 36f8cc02cb

View File

@ -66,6 +66,14 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
Collections.sort(itemList, new Comparator<AppView.AppObject>() {
@Override
public int compare(AppView.AppObject lhs, AppView.AppObject rhs) {
// Bubble the running app up to the top of the list
if (lhs.app.getIsRunning() && !rhs.app.getIsRunning()) {
return -1;
}
else if (!lhs.app.getIsRunning() && rhs.app.getIsRunning()) {
return 1;
}
return lhs.app.getAppName().compareTo(rhs.app.getAppName());
}
});