Merge pull request #10579 from nextcloud/exportAlsoFromVideoImage

Also handle export from video/image correctly
This commit is contained in:
Álvaro Brey 2022-08-04 11:28:37 +02:00 committed by GitHub
commit cad6992121
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -55,6 +55,7 @@ import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.jobs.BackgroundJobManager;
import com.nextcloud.client.network.ConnectivityService;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
@ -75,6 +76,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import javax.annotation.Nullable;
import javax.inject.Inject;
@ -122,6 +124,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
@Inject ConnectivityService connectivityService;
@Inject UserAccountManager accountManager;
@Inject BackgroundJobManager backgroundJobManager;
private PreviewImageFragmentBinding binding;
/**
@ -430,6 +433,14 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
} else if (itemId == R.id.action_set_as_wallpaper) {
containerActivity.getFileOperationsHelper().setPictureAs(getFile(), getImageView());
return true;
} else if (itemId == R.id.action_export_file) {
ArrayList<OCFile> list = new ArrayList<>();
list.add(getFile());
containerActivity.getFileOperationsHelper().exportFiles(list,
getContext(),
getView(),
backgroundJobManager);
return true;
}
return super.onOptionsItemSelected(item);
}

View file

@ -52,6 +52,7 @@ import com.google.android.exoplayer2.ui.StyledPlayerControlView;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.jobs.BackgroundJobManager;
import com.nextcloud.client.media.NextcloudExoPlayer;
import com.nextcloud.client.media.PlayerServiceConnection;
import com.nextcloud.client.network.ClientFactory;
@ -74,6 +75,7 @@ import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.MimeTypeUtil;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.concurrent.Executors;
import javax.inject.Inject;
@ -118,6 +120,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
private Uri videoUri;
@Inject ClientFactory clientFactory;
@Inject UserAccountManager accountManager;
@Inject BackgroundJobManager backgroundJobManager;
FragmentPreviewMediaBinding binding;
private ViewGroup emptyListView;
private ExoPlayer exoPlayer;
@ -459,6 +462,14 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
return true;
} else if (itemId == R.id.action_stream_media) {
containerActivity.getFileOperationsHelper().streamMediaFile(getFile());
} else if (itemId == R.id.action_export_file) {
ArrayList<OCFile> list = new ArrayList<>();
list.add(getFile());
containerActivity.getFileOperationsHelper().exportFiles(list,
getContext(),
getView(),
backgroundJobManager);
return true;
}
return super.onOptionsItemSelected(item);
}