From 309f8c699de8591ac525428ef69fb3a3cf998878 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 2 Nov 2015 08:34:40 +0100 Subject: [PATCH] wip --- owncloud-android-library | 2 +- res/menu/file_actions_menu.xml | 5 +++++ res/values/strings.xml | 1 + .../owncloud/android/files/FileOperationsHelper.java | 18 ++++++++++++++++++ .../android/ui/preview/PreviewImageFragment.java | 4 ++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/owncloud-android-library b/owncloud-android-library index f02dffb1..59fb6160 160000 --- a/owncloud-android-library +++ b/owncloud-android-library @@ -1 +1 @@ -Subproject commit f02dffb1d3c46305c70d246f696cde7b8c3b0971 +Subproject commit 59fb61601de4dd8bfcab1afb619e016e1a7b904d diff --git a/res/menu/file_actions_menu.xml b/res/menu/file_actions_menu.xml index 63fadbbc..e95f945d 100644 --- a/res/menu/file_actions_menu.xml +++ b/res/menu/file_actions_menu.xml @@ -84,6 +84,11 @@ android:icon="@android:drawable/ic_menu_set_as" android:orderInCategory="1" /> + %1$d files %1$d files, 1 folder %1$d files, %2$d folders + Set picture as diff --git a/src/com/owncloud/android/files/FileOperationsHelper.java b/src/com/owncloud/android/files/FileOperationsHelper.java index cf0f50f0..cc1a0c37 100644 --- a/src/com/owncloud/android/files/FileOperationsHelper.java +++ b/src/com/owncloud/android/files/FileOperationsHelper.java @@ -236,6 +236,24 @@ public class FileOperationsHelper { } } + public void setPictureAs(OCFile file) { + if (file != null) { + String storagePath = file.getStoragePath(); + String encodedStoragePath = WebdavUtils.encodePath(storagePath); + Intent sendIntent = new Intent(Intent.ACTION_ATTACH_DATA); + // set MimeType + sendIntent.setData(Uri.parse(encodedStoragePath)); +// sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + encodedStoragePath)); +// sendIntent.putExtra("jpg", "image/*"); + + mFileActivity.startActivity(Intent.createChooser(sendIntent, + mFileActivity.getString(R.string.set_picture_as))); + + } else { + Log_OC.wtf(TAG, "Trying to send a NULL OCFile"); + } + } + /** * Request the synchronization of a file or folder with the OC server, including its contents. * diff --git a/src/com/owncloud/android/ui/preview/PreviewImageFragment.java b/src/com/owncloud/android/ui/preview/PreviewImageFragment.java index e61e3355..3ad1f8ba 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewImageFragment.java @@ -322,6 +322,10 @@ public class PreviewImageFragment extends FileFragment { mContainerActivity.getFileOperationsHelper().toggleFavorite(getFile(), false); return true; } + case R.id.action_set_as_wallpaper:{ + mContainerActivity.getFileOperationsHelper().setPictureAs(getFile()); + return true; + } default: return false; } -- 2.11.0