From: tobiasKaminsky Date: Mon, 2 Nov 2015 07:34:40 +0000 (+0100) Subject: wip X-Git-Tag: beta-20151124~7^2~12 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/309f8c699de8591ac525428ef69fb3a3cf998878 wip --- 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; }