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;
* {@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);
+ }
+
}
}