Merge branch 'master' of github.com:owncloud/android into setAsWallpaper
authortobiasKaminsky <tobias@kaminsky.me>
Mon, 2 Nov 2015 21:11:22 +0000 (22:11 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Mon, 2 Nov 2015 21:11:22 +0000 (22:11 +0100)
AndroidManifest.xml
owncloud-android-library
res/menu/file_actions_menu.xml
res/values/setup.xml
res/values/strings.xml
src/com/owncloud/android/files/FileOperationsHelper.java
src/com/owncloud/android/ui/preview/PreviewImageFragment.java

index acb5f1d..b1d26a5 100644 (file)
             android:name=".providers.FileContentProvider"
             android:authorities="@string/authority"
             android:enabled="true"
-            android:exported="false"
+            android:exported="true"
             android:label="@string/sync_string_files"
             android:syncable="true"></provider>
 
index f02dffb..652cd28 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f02dffb1d3c46305c70d246f696cde7b8c3b0971
+Subproject commit 652cd28bb15672eaedfe8c1d9a46cf293c909b89
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 76bdd9f..1c65801 100644 (file)
@@ -4,6 +4,7 @@
     <string name="app_name">ownCloud</string>
     <string name="account_type">owncloud</string>      <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
     <string name="authority">org.owncloud</string>     <!-- better if was the app package with ".provider" appended ; it identifies the provider -->
+    <string name="authorityCache">org.owncloud.imageCache.provider</string>
     <string name ="db_file">owncloud.db</string>
     <string name ="db_name">ownCloud</string>
     <string name ="data_folder">owncloud</string>
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..7820662 100644 (file)
@@ -47,6 +47,7 @@ import com.owncloud.android.ui.dialog.ShareLinkToDialog;
 
 import org.apache.http.protocol.HTTP;
 
+import java.io.File;
 import java.util.List;
 
 /**
@@ -236,6 +237,28 @@ public class FileOperationsHelper {
         }
     }
 
+    public void setPictureAs(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
+//                Uri sendUri = Uri.parse("content://" + DiskLruImageCacheFileProvider.AUTHORITY + file.getRemotePath());
+//                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");
+        }
+    }
+
     /**
      * Request the synchronization of a file or folder with the OC server, including its contents.
      *
index e61e335..aea5e5d 100644 (file)
@@ -224,6 +224,9 @@ public class PreviewImageFragment extends FileFragment {
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
         inflater.inflate(R.menu.file_actions_menu, menu);
+
+        MenuItem item = menu.findItem(R.id.action_set_as_wallpaper);
+        item.setVisible(getFile().isDown());
     }
 
     /**
@@ -322,6 +325,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;
         }