From: tobiasKaminsky Date: Fri, 13 Nov 2015 16:52:18 +0000 (+0100) Subject: Merge branch 'beta' of github.com:owncloud/android into beta X-Git-Tag: beta-20151122~19 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/420051123c0d61b987f9427c2531b544dd2f68c0?ds=inline;hp=-c Merge branch 'beta' of github.com:owncloud/android into beta --- 420051123c0d61b987f9427c2531b544dd2f68c0 diff --combined src/com/owncloud/android/ui/activity/Uploader.java index 37363e45,daa136d0..cd80a94e --- a/src/com/owncloud/android/ui/activity/Uploader.java +++ b/src/com/owncloud/android/ui/activity/Uploader.java @@@ -84,6 -84,7 +84,7 @@@ import com.owncloud.android.ui.dialog.L import com.owncloud.android.utils.CopyTmpFileAsyncTask; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.ErrorMessageAdapter; + import com.owncloud.android.utils.FileStorageUtils; /** @@@ -333,7 -334,10 +334,10 @@@ public class Uploader extends FileActiv public void onItemClick(AdapterView parent, View view, int position, long id) { // click on folder in the list Log_OC.d(TAG, "on item click"); - Vector tmpfiles = getStorageManager().getFolderContent(mFile, false); + // TODO Enable when "On Device" is recovered ? + Vector tmpfiles = getStorageManager().getFolderContent(mFile , false); + tmpfiles = sortFileList(tmpfiles); + if (tmpfiles.size() <= 0) return; // filter on dirtype Vector files = new Vector(); @@@ -398,16 -402,17 +402,17 @@@ setContentView(R.layout.uploader_layout); ListView mListView = (ListView) findViewById(android.R.id.list); + ActionBar actionBar = getSupportActionBar(); String current_dir = mParents.peek(); if(current_dir.equals("")){ - getSupportActionBar().setTitle(getString(R.string.default_display_name_for_root_folder)); + actionBar.setTitle(getString(R.string.uploader_top_message)); } else{ - getSupportActionBar().setTitle(current_dir); + actionBar.setTitle(current_dir); } boolean notRoot = (mParents.size() > 1); - ActionBar actionBar = getSupportActionBar(); + actionBar.setDisplayHomeAsUpEnabled(notRoot); actionBar.setHomeButtonEnabled(notRoot); @@@ -417,20 -422,24 +422,24 @@@ mFile = getStorageManager().getFileByPath(full_path); if (mFile != null) { + // TODO Enable when "On Device" is recovered ? Vector files = getStorageManager().getFolderContent(mFile, false); + files = sortFileList(files); + List> data = new LinkedList>(); for (OCFile f : files) { - HashMap h = new HashMap(); if (f.isFolder()) { + HashMap h = new HashMap(); h.put("dirname", f.getFileName()); + h.put("last_mod", DisplayUtils.getRelativeTimestamp(this, f)); data.add(h); } } SimpleAdapter sa = new SimpleAdapter(this, data, R.layout.uploader_list_item_layout, - new String[] {"dirname"}, - new int[] {R.id.filename}); + new String[] {"dirname", "last_mod"}, + new int[] {R.id.filename, R.id.last_mod}); mListView.setAdapter(sa); Button btnChooseFolder = (Button) findViewById(R.id.uploader_choose_folder); @@@ -443,6 -452,18 +452,18 @@@ } } + private Vector sortFileList(Vector files) { + SharedPreferences sharedPreferences = PreferenceManager + .getDefaultSharedPreferences(this); + + // Read sorting order, default to sort by name ascending + FileStorageUtils.mSortOrder = sharedPreferences.getInt("sortOrder", 0); + FileStorageUtils.mSortAscending = sharedPreferences.getBoolean("sortAscending", true); + + files = FileStorageUtils.sortOcFolder(files); + return files; + } + private String generatePath(Stack dirs) { String full_path = ""; @@@ -605,10 -626,6 +626,10 @@@ private void onCreateFolderOperationFinish(CreateFolderOperation operation, RemoteOperationResult result) { if (result.isSuccess()) { + dismissLoadingDialog(); + String remotePath = operation.getRemotePath().substring(0, operation.getRemotePath().length() -1); + String newFolder = remotePath.substring(remotePath.lastIndexOf("/") + 1); + mParents.push(newFolder); populateDirectoryList(); } else { try {