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?hp=62f34c8fd5899a9ecc9115371abb3a35fb4b4245 Merge branch 'beta' of github.com:owncloud/android into beta --- diff --git a/.travis.yml b/.travis.yml index 0db9b1ec..1d648630 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,6 @@ before_install: - rm pom.xml script: - ./setup_env.sh ant - - ant clean - - ant debug + - ant clean -Djava.source=7 -Djava.target=7 + - ant debug -Djava.source=7 -Djava.target=7 diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 17945c85..ad5dcfd5 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -18,6 +18,7 @@ along with this program. If not, see . --> - + diff --git a/CHANGELOG.md b/CHANGELOG.md index 3be88b44..22f32dee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2015-11-10 +- update master +- PR [#1277] (https://github.com/owncloud/android/pull/1277) "Optimized uploader layout and user configured sorting" merged + # 2015-11-05 - update master - fix #1244 diff --git a/res/layout/uploader_layout.xml b/res/layout/uploader_layout.xml index 1c2b6cc3..51122ec3 100644 --- a/res/layout/uploader_layout.xml +++ b/res/layout/uploader_layout.xml @@ -18,35 +18,30 @@ along with this program. If not, see . --> - - - - + android:id="@+id/upload_list" + android:layout_above="@+id/upload_actions"> - + android:dividerHeight="1dp"> . --> - - - - - - + + + + + + + + + + + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index a65d2772..4e8f1800 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -61,7 +61,7 @@ Connect Upload New folder - Choose upload folder: + Choose upload folder No account found There are no %1$s accounts on your device. Please setup an account first. Setup diff --git a/src/com/owncloud/android/ui/activity/Uploader.java b/src/com/owncloud/android/ui/activity/Uploader.java index 37363e45..cd80a94e 100644 --- a/src/com/owncloud/android/ui/activity/Uploader.java +++ b/src/com/owncloud/android/ui/activity/Uploader.java @@ -84,6 +84,7 @@ import com.owncloud.android.ui.dialog.LoadingDialog; 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 @@ public class Uploader extends FileActivity 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 @@ public class Uploader extends FileActivity 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 @@ public class Uploader extends FileActivity 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 @@ public class Uploader extends FileActivity } } + 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 = ""; diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 48047547..c46b2968 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -207,7 +207,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { lastModV.setVisibility(View.VISIBLE); - lastModV.setText(showRelativeTimestamp(file)); + lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file)); fileSizeSeparatorV.setVisibility(View.VISIBLE); @@ -486,11 +486,6 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { notifyDataSetChanged(); } - - private CharSequence showRelativeTimestamp(OCFile file){ - return DisplayUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(), - DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0); - } public void setGridMode(boolean gridMode) { mGridMode = gridMode; diff --git a/src/com/owncloud/android/utils/DisplayUtils.java b/src/com/owncloud/android/utils/DisplayUtils.java index 25cc55a4..e3c94f21 100644 --- a/src/com/owncloud/android/utils/DisplayUtils.java +++ b/src/com/owncloud/android/utils/DisplayUtils.java @@ -198,8 +198,13 @@ public class DisplayUtils { return fileExtension; } + public static CharSequence getRelativeTimestamp(Context context, OCFile file) { + return getRelativeDateTimeString(context, file.getModificationTimestamp(), + DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0); + } + @SuppressWarnings("deprecation") - public static CharSequence getRelativeDateTimeString ( + private static CharSequence getRelativeDateTimeString ( Context c, long time, long minResolution, long transitionResolution, int flags ){