From: tobiasKaminsky Date: Mon, 2 Nov 2015 08:38:24 +0000 (+0100) Subject: Merge branch 'setAsWallpaper' into beta X-Git-Tag: beta-20151122~45^2~8 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/fdf892fed3acab6f994a6393ad9426595b97c625?ds=inline Merge branch 'setAsWallpaper' into beta --- fdf892fed3acab6f994a6393ad9426595b97c625 diff --cc res/values/strings.xml index 2e35e5ff,c9ec4b0e..c4b93e05 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@@ -366,26 -364,6 +366,27 @@@ %1$d files %1$d files, 1 folder %1$d files, %2$d folders + Switch to grid view + Switch to list view + Common + Cache size + Upload file to server and ... + Behaviour + Copy file + Move file + + do nothing + copy file to OC folder + move file to OC folder + delete origin file + Do you really want to remove selected items? + Do you really want to remove a folder and its content? + selected items + Exit + Send Log + Error Log + Stream file with external player + Do you want to stream this file with an external app?\n\nCAUTION: This may expose your password! + Set picture as diff --cc src/com/owncloud/android/files/FileOperationsHelper.java index e799e176,a4e23ae8..8722ccfc --- a/src/com/owncloud/android/files/FileOperationsHelper.java +++ b/src/com/owncloud/android/files/FileOperationsHelper.java @@@ -51,16 -47,9 +51,17 @@@ import com.owncloud.android.ui.dialog.S import org.apache.http.protocol.HTTP; + import java.io.File; import java.util.List; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import java.util.ArrayList; + /** * */ @@@ -248,19 -237,29 +249,32 @@@ public class FileOperationsHelper } } + public void setPictureAs(OCFile file) { ++ if (file != null || file.isDown()) { ++ File externalFile=new File(file.getStoragePath()); ++ Uri sendUri = Uri.fromFile(externalFile); ++ Intent intent = new Intent(Intent.ACTION_ATTACH_DATA); ++ intent.setDataAndType(sendUri, file.getMimetype()); ++ intent.putExtra("mimeType", file.getMimetype()); ++ mFileActivity.startActivityForResult(Intent.createChooser(intent, "Set As"), 200); ++ } else { ++ Log_OC.wtf(TAG, "Trying to send a NULL OCFile"); ++ } ++ } ++ + public void sendCachedImage(OCFile file) { if (file != null) { - if (file.isDown()) { - File externalFile=new File(file.getStoragePath()); - Uri sendUri = Uri.fromFile(externalFile); - Intent intent = new Intent(Intent.ACTION_ATTACH_DATA); - intent.setDataAndType(sendUri, file.getMimetype()); - intent.putExtra("mimeType", file.getMimetype()); - mFileActivity.startActivityForResult(Intent.createChooser(intent, "Set As"), 200); - } else { - // TODO re-enable after resized images is available -// Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND); -// // set MimeType -// sendIntent.setType(file.getMimetype()); -//// sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" + DiskLruImageCacheFileProvider.AUTHORITY + "/#" + file.getRemoteId() + "#" + file.getFileName())); -// sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" + DiskLruImageCacheFileProvider.AUTHORITY + file.getRemotePath())); -// sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action -// -// // Show dialog, without the own app -// String[] packagesToExclude = new String[] { mFileActivity.getPackageName() }; -// DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude, file); -// chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG); - } + Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND); + // set MimeType + sendIntent.setType(file.getMimetype()); +// sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" + DiskLruImageCacheFileProvider.AUTHORITY + "/#" + file.getRemoteId() + "#" + file.getFileName())); + sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" + DiskLruImageCacheFileProvider.AUTHORITY + file.getRemotePath())); + sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action + + // Show dialog, without the own app + String[] packagesToExclude = new String[] { mFileActivity.getPackageName() }; + DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude, file); + chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG); } else { Log_OC.wtf(TAG, "Trying to send a NULL OCFile"); }