wip
authortobiasKaminsky <tobias@kaminsky.me>
Mon, 2 Nov 2015 07:34:40 +0000 (08:34 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Mon, 2 Nov 2015 07:34:40 +0000 (08:34 +0100)
owncloud-android-library
res/menu/file_actions_menu.xml
res/values/strings.xml
src/com/owncloud/android/files/FileOperationsHelper.java
src/com/owncloud/android/ui/preview/PreviewImageFragment.java

index f02dffb..59fb616 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f02dffb1d3c46305c70d246f696cde7b8c3b0971
+Subproject commit 59fb61601de4dd8bfcab1afb619e016e1a7b904d
index 63fadbb..e95f945 100644 (file)
         android:icon="@android:drawable/ic_menu_set_as"
         android:orderInCategory="1" />
     <item
+        android:id="@+id/action_set_as_wallpaper"
+        android:title="@string/set_picture_as"
+        android:icon="@android:drawable/ic_menu_set_as"
+        android:orderInCategory="1" />
+    <item
         android:id="@+id/action_see_details"
         android:title="@string/actionbar_see_details"
         android:icon="@android:drawable/ic_menu_info_details"
index 305a540..c9ec4b0 100644 (file)
     <string name="file_list__footer__files">%1$d files</string>
     <string name="file_list__footer__files_and_folder">%1$d files, 1 folder</string>
     <string name="file_list__footer__files_and_folders">%1$d files, %2$d folders</string>
+    <string name="set_picture_as">Set picture as</string>
 
 </resources>
index cf0f50f..cc1a0c3 100644 (file)
@@ -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.
      *
index e61e335..3ad1f8b 100644 (file)
@@ -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;
         }