|
@@ -46,6 +46,7 @@ import com.nextcloud.client.network.ClientFactory;
|
|
import com.nextcloud.common.NextcloudClient;
|
|
import com.nextcloud.common.NextcloudClient;
|
|
import com.nextcloud.ui.fileactions.FileActionsBottomSheet;
|
|
import com.nextcloud.ui.fileactions.FileActionsBottomSheet;
|
|
import com.nextcloud.utils.extensions.BundleExtensionsKt;
|
|
import com.nextcloud.utils.extensions.BundleExtensionsKt;
|
|
|
|
+import com.owncloud.android.MainApp;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.databinding.FragmentPreviewMediaBinding;
|
|
import com.owncloud.android.databinding.FragmentPreviewMediaBinding;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
@@ -324,6 +325,15 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
|
public void onStart() {
|
|
public void onStart() {
|
|
super.onStart();
|
|
super.onStart();
|
|
Log_OC.v(TAG, "onStart");
|
|
Log_OC.v(TAG, "onStart");
|
|
|
|
+
|
|
|
|
+ @NonNull Context context;
|
|
|
|
+ if (getContext() != null) {
|
|
|
|
+ context = getContext();
|
|
|
|
+ } else {
|
|
|
|
+ context = MainApp.getAppContext();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
OCFile file = getFile();
|
|
OCFile file = getFile();
|
|
if (file != null) {
|
|
if (file != null) {
|
|
// bind to any existing player
|
|
// bind to any existing player
|
|
@@ -348,9 +358,9 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
|
try {
|
|
try {
|
|
nextcloudClient = clientFactory.createNextcloudClient(accountManager.getUser());
|
|
nextcloudClient = clientFactory.createNextcloudClient(accountManager.getUser());
|
|
handler.post(() -> {
|
|
handler.post(() -> {
|
|
- exoPlayer = NextcloudExoPlayer.createNextcloudExoplayer(requireContext(), nextcloudClient);
|
|
|
|
|
|
+ exoPlayer = NextcloudExoPlayer.createNextcloudExoplayer(context, nextcloudClient);
|
|
|
|
|
|
- exoPlayer.addListener(new ExoplayerListener(requireContext(), binding.exoplayerView, exoPlayer, () -> {
|
|
|
|
|
|
+ exoPlayer.addListener(new ExoplayerListener(context, binding.exoplayerView, exoPlayer, () -> {
|
|
goBackToLivePhoto();
|
|
goBackToLivePhoto();
|
|
return null;
|
|
return null;
|
|
}));
|
|
}));
|