Merge branch 'setAsWallpaper' into beta
authortobiasKaminsky <tobias@kaminsky.me>
Mon, 2 Nov 2015 08:38:24 +0000 (09:38 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Mon, 2 Nov 2015 08:38:24 +0000 (09:38 +0100)
1  2 
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

Simple merge
      <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="action_switch_grid_view">Switch to grid view</string>
 +    <string name="action_switch_list_view">Switch to list view</string>
 +    <string name="common_category">Common</string>
 +    <string name="pref_cache_size">Cache size</string>
 +    <string name="prefs_instant_behaviour_dialogTitle">Upload file to server and ...</string>
 +    <string name="prefs_instant_behaviour_title">Behaviour</string>
 +    <string name="upload_copy_files">Copy file</string>
 +    <string name="upload_move_files">Move file</string>
 +
 +    <string name="pref_behaviour_entries_do_nothing">do nothing</string>
 +    <string name="pref_behaviour_entries_copy">copy file to OC folder</string>
 +    <string name="pref_behaviour_entries_move">move file to OC folder</string>
 +    <string name="pref_behaviour_entries_delete">delete origin file</string>
 +    <string name="confirmation_remove_files_alert">Do you really want to remove selected items?</string>
 +    <string name="confirmation_remove_folders_alert">Do you really want to remove a folder and its content?</string>
 +    <string name="confirmation_remove_files">selected items</string>
 +    <string name="error_log_exit">Exit</string>
 +    <string name="error_log_send">Send Log</string>
 +    <string name="error_log_title">Error Log</string>
 +    <string name="action_stream_file">Stream file with external player</string>
 +    <string name="stream_expose_password">Do you want to stream this file with an external app?\n\nCAUTION: This may expose your password!</string>
+     <string name="set_picture_as">Set picture as</string>
  
  </resources>
@@@ -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");
          }