Merge branch 'setAsWallpaper' into beta
authortobiasKaminsky <tobias@kaminsky.me>
Fri, 6 Nov 2015 16:35:52 +0000 (17:35 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Fri, 6 Nov 2015 16:35:52 +0000 (17:35 +0100)
1  2 
src/com/owncloud/android/files/FileMenuFilter.java

@@@ -29,7 -29,6 +29,7 @@@ import android.view.Menu
  import android.view.MenuItem;
  
  import com.owncloud.android.R;
 +import com.owncloud.android.authentication.AccountUtils;
  import com.owncloud.android.datamodel.OCFile;
  import com.owncloud.android.files.services.FileDownloader;
  import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
@@@ -58,8 -57,7 +58,8 @@@ public class FileMenuFilter 
       *                          {@link FileUploader} and {@link FileDownloader} services
       * @param context           Android {@link Context}, needed to access build setup resources.
       */
 -    public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg, Context context) {
 +    public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg,
 +                          Context context) {
          mFile = targetFile;
          mAccount = account;
          mComponentsGetter = cg;
              toShow.add(R.id.action_sync_file);
          }
  
 -        // SHARE FILE 
 +        // SHARE FILE
          // TODO add check on SHARE available on server side?
          boolean shareAllowed = (mContext != null  &&
                  mContext.getString(R.string.share_feature).equalsIgnoreCase("on"));
              toShow.add(R.id.action_share_file);
          }
  
 -        // UNSHARE FILE  
 +        // UNSHARE FILE
          // TODO add check on SHARE available on server side?
 -        if ( !shareAllowed || (mFile == null || !mFile.isShareByLink())) {
 +        if ( !shareAllowed || (mFile == null || !mFile.isSharedViaLink())) {
              toHide.add(R.id.action_unshare_file);
          } else {
              toShow.add(R.id.action_unshare_file);
          }
  
 +        // SHARE FILE, with Users
 +        if (!shareAllowed ||  mFile == null) {
 +            toHide.add(R.id.action_share_with_users);
 +        } else {
 +            toShow.add(R.id.action_share_with_users);
 +        }
 +
 +
          // SEE DETAILS
          if (mFile == null || mFile.isFolder()) {
              toHide.add(R.id.action_see_details);
              toShow.add(R.id.action_unfavorite_file);
          }
  
 +        // STREAM
 +        if (mFile != null && !mFile.isDown() && (mFile.isAudio() || mFile.isVideo())){
 +            toShow.add(R.id.action_stream_file);
 +        } else {
 +            toHide.add(R.id.action_stream_file);
 +        }
 +
+         // SET PICTURE AS
+         if (mFile == null || !mFile.isImage()){
+             toHide.add(R.id.action_set_as_wallpaper);
+         } else {
+             toShow.add(R.id.action_set_as_wallpaper);
+         }
      }
  
  }