Skip to content

Commit b3678f2

Browse files
Merge pull request #346 from nextcloud/sortFix
Use correct array of options
2 parents 113ebf6 + b38cd1f commit b3678f2

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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import android.os.Environment;
3131
import android.support.v4.app.DialogFragment;
3232
import android.support.v4.app.Fragment;
33-
import android.support.v4.content.ContextCompat;
3433
import android.support.v7.app.ActionBar;
3534
import android.view.Menu;
3635
import android.view.MenuItem;
@@ -108,8 +107,7 @@ public void onCreate(Bundle savedInstanceState) {
108107
/// USER INTERFACE
109108

110109
// Drop-down navigation
111-
mDirectories = new CustomArrayAdapter<String>(this,
112-
R.layout.support_simple_spinner_dropdown_item);
110+
mDirectories = new CustomArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item);
113111
File currDir = mCurrentDir;
114112
while(currDir != null && currDir.getParentFile() != null) {
115113
mDirectories.add(currDir.getName());
@@ -120,8 +118,7 @@ public void onCreate(Bundle savedInstanceState) {
120118
// Inflate and set the layout view
121119
setContentView(R.layout.upload_files_layout);
122120

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

126123

127124
// Set input controllers
@@ -210,7 +207,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
210207

211208
AlertDialog.Builder builder = new AlertDialog.Builder(this);
212209
builder.setTitle(R.string.actionbar_sort_title)
213-
.setSingleChoiceItems(R.array.actionbar_sortby, sortOrder ,
210+
.setSingleChoiceItems(R.array.menu_items_sort_by_options, sortOrder,
214211
new DialogInterface.OnClickListener() {
215212
public void onClick(DialogInterface dialog, int which) {
216213
switch (which){
@@ -220,6 +217,9 @@ public void onClick(DialogInterface dialog, int which) {
220217
case 1:
221218
mFileListFragment.sortByDate(false);
222219
break;
220+
case 2:
221+
mFileListFragment.sortBySize(false);
222+
break;
223223
}
224224

225225
dialog.dismiss();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
/**
6464
* This Adapter populates a ListView with following types of uploads: pending,
6565
* active, completed. Filtering possible.
66-
*
6766
*/
6867
public class ExpandableUploadListAdapter extends BaseExpandableListAdapter implements Observer {
6968

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,15 @@ public int compare(OCFile o1, OCFile o2) {
335335
public static File[] sortLocalFilesBySize(File[] filesArray) {
336336
final int multiplier = mSortAscending ? 1 : -1;
337337

338-
List<File> files = new ArrayList<File>(Arrays.asList(filesArray));
338+
List<File> files = new ArrayList<>(Arrays.asList(filesArray));
339339

340340
Collections.sort(files, new Comparator<File>() {
341341
@SuppressFBWarnings(value = "Bx")
342342
public int compare(File o1, File o2) {
343343
if (o1.isDirectory() && o2.isDirectory()) {
344-
Long obj1 = getFolderSize(o1);
345-
return multiplier * obj1.compareTo(getFolderSize(o2));
344+
// Long obj1 = getFolderSize(o1);
345+
// return multiplier * obj1.compareTo(getFolderSize(o2));
346+
return o1.getPath().toLowerCase().compareTo(o2.getPath().toLowerCase());
346347
} else if (o1.isDirectory()) {
347348
return -1;
348349
} else if (o2.isDirectory()) {

0 commit comments

Comments
 (0)