Skip to content

Commit d64eabc

Browse files
re-add sort by size for local folder views while sorting folders in the list alphabetically
1 parent eeff36b commit d64eabc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/com/owncloud/android/ui/activity/UploadFilesActivity.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ public void onCreate(Bundle savedInstanceState) {
107107
/// USER INTERFACE
108108

109109
// Drop-down navigation
110-
mDirectories = new CustomArrayAdapter<String>(this,
111-
R.layout.support_simple_spinner_dropdown_item);
110+
mDirectories = new CustomArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item);
112111
File currDir = mCurrentDir;
113112
while(currDir != null && currDir.getParentFile() != null) {
114113
mDirectories.add(currDir.getName());
@@ -119,8 +118,7 @@ public void onCreate(Bundle savedInstanceState) {
119118
// Inflate and set the layout view
120119
setContentView(R.layout.upload_files_layout);
121120

122-
mFileListFragment = (LocalFileListFragment)
123-
getSupportFragmentManager().findFragmentById(R.id.local_files_list);
121+
mFileListFragment = (LocalFileListFragment) getSupportFragmentManager().findFragmentById(R.id.local_files_list);
124122

125123

126124
// Set input controllers
@@ -209,7 +207,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
209207

210208
AlertDialog.Builder builder = new AlertDialog.Builder(this);
211209
builder.setTitle(R.string.actionbar_sort_title)
212-
.setSingleChoiceItems(R.array.menu_items_sort_by_options_local, sortOrder,
210+
.setSingleChoiceItems(R.array.menu_items_sort_by_options, sortOrder,
213211
new DialogInterface.OnClickListener() {
214212
public void onClick(DialogInterface dialog, int which) {
215213
switch (which){
@@ -219,6 +217,9 @@ public void onClick(DialogInterface dialog, int which) {
219217
case 1:
220218
mFileListFragment.sortByDate(false);
221219
break;
220+
case 2:
221+
mFileListFragment.sortBySize(false);
222+
break;
222223
}
223224

224225
dialog.dismiss();

src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
/**
6262
* This Adapter populates a ListView with following types of uploads: pending,
6363
* active, completed. Filtering possible.
64-
*
6564
*/
6665
public class ExpandableUploadListAdapter extends BaseExpandableListAdapter implements Observer {
6766

src/com/owncloud/android/utils/FileStorageUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import android.content.Context;
2525
import android.content.SharedPreferences;
2626
import android.net.Uri;
27-
import android.os.Environment;
2827
import android.preference.PreferenceManager;
2928
import android.webkit.MimeTypeMap;
3029

@@ -331,13 +330,14 @@ public int compare(OCFile o1, OCFile o2) {
331330
public static File[] sortLocalFilesBySize(File[] filesArray) {
332331
final int multiplier = mSortAscending ? 1 : -1;
333332

334-
List<File> files = new ArrayList<File>(Arrays.asList(filesArray));
333+
List<File> files = new ArrayList<>(Arrays.asList(filesArray));
335334

336335
Collections.sort(files, new Comparator<File>() {
337336
public int compare(File o1, File o2) {
338337
if (o1.isDirectory() && o2.isDirectory()) {
339-
Long obj1 = getFolderSize(o1);
340-
return multiplier * obj1.compareTo(getFolderSize(o2));
338+
// Long obj1 = getFolderSize(o1);
339+
// return multiplier * obj1.compareTo(getFolderSize(o2));
340+
return o1.getPath().toLowerCase().compareTo(o2.getPath().toLowerCase());
341341
} else if (o1.isDirectory()) {
342342
return -1;
343343
} else if (o2.isDirectory()) {

0 commit comments

Comments
 (0)