Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/com/owncloud/android/ui/activity/UploadFilesActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import android.os.Environment;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -108,8 +107,7 @@ public void onCreate(Bundle savedInstanceState) {
/// USER INTERFACE

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

mFileListFragment = (LocalFileListFragment)
getSupportFragmentManager().findFragmentById(R.id.local_files_list);
mFileListFragment = (LocalFileListFragment) getSupportFragmentManager().findFragmentById(R.id.local_files_list);


// Set input controllers
Expand Down Expand Up @@ -210,7 +207,7 @@ public boolean onOptionsItemSelected(MenuItem item) {

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.actionbar_sort_title)
.setSingleChoiceItems(R.array.actionbar_sortby, sortOrder ,
.setSingleChoiceItems(R.array.menu_items_sort_by_options, sortOrder,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
switch (which){
Expand All @@ -220,6 +217,9 @@ public void onClick(DialogInterface dialog, int which) {
case 1:
mFileListFragment.sortByDate(false);
break;
case 2:
mFileListFragment.sortBySize(false);
break;
}

dialog.dismiss();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
/**
* This Adapter populates a ListView with following types of uploads: pending,
* active, completed. Filtering possible.
*
*/
public class ExpandableUploadListAdapter extends BaseExpandableListAdapter implements Observer {

Expand Down
8 changes: 4 additions & 4 deletions src/com/owncloud/android/utils/FileStorageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.webkit.MimeTypeMap;

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

List<File> files = new ArrayList<File>(Arrays.asList(filesArray));
List<File> files = new ArrayList<>(Arrays.asList(filesArray));

Collections.sort(files, new Comparator<File>() {
public int compare(File o1, File o2) {
if (o1.isDirectory() && o2.isDirectory()) {
Long obj1 = getFolderSize(o1);
return multiplier * obj1.compareTo(getFolderSize(o2));
// Long obj1 = getFolderSize(o1);
// return multiplier * obj1.compareTo(getFolderSize(o2));
return o1.getPath().toLowerCase().compareTo(o2.getPath().toLowerCase());
} else if (o1.isDirectory()) {
return -1;
} else if (o2.isDirectory()) {
Expand Down