소스 검색

run migration script

Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
parneet-guraya 1 년 전
부모
커밋
33e3053edc

+ 3 - 2
app/build.gradle

@@ -299,8 +299,9 @@ dependencies {
 
     implementation 'org.conscrypt:conscrypt-android:2.5.2'
 
-    implementation "com.google.android.exoplayer:exoplayer:$exoplayerVersion"
-    implementation "com.google.android.exoplayer:extension-okhttp:$exoplayerVersion"
+    implementation "androidx.media3:media3-ui:1.1.1"
+    implementation "androidx.media3:media3-exoplayer:1.1.1"
+    implementation "androidx.media3:media3-datasource-okhttp:1.1.1"
 
     implementation 'me.zhanghai.android.fastscroll:library:1.2.0'
 

+ 1 - 1
app/src/main/java/com/nextcloud/client/media/ErrorFormat.kt

@@ -25,7 +25,7 @@ package com.nextcloud.client.media
 
 import android.content.Context
 import android.media.MediaPlayer
-import com.google.android.exoplayer2.PlaybackException
+import androidx.media3.common.PlaybackException
 import com.owncloud.android.R
 
 /**

+ 3 - 3
app/src/main/java/com/nextcloud/client/media/ExoplayerListener.kt

@@ -25,9 +25,9 @@ package com.nextcloud.client.media
 import android.content.Context
 import android.content.DialogInterface
 import android.view.View
-import com.google.android.exoplayer2.ExoPlayer
-import com.google.android.exoplayer2.PlaybackException
-import com.google.android.exoplayer2.Player
+import androidx.media3.common.PlaybackException
+import androidx.media3.common.Player
+import androidx.media3.exoplayer.ExoPlayer
 import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import com.owncloud.android.R
 import com.owncloud.android.lib.common.utils.Log_OC

+ 6 - 4
app/src/main/java/com/nextcloud/client/media/NextcloudExoPlayer.kt

@@ -22,10 +22,11 @@
 package com.nextcloud.client.media
 
 import android.content.Context
-import com.google.android.exoplayer2.ExoPlayer
-import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource
-import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
-import com.google.android.exoplayer2.upstream.DefaultDataSource
+import androidx.media3.common.util.UnstableApi
+import androidx.media3.datasource.DefaultDataSource
+import androidx.media3.datasource.okhttp.OkHttpDataSource
+import androidx.media3.exoplayer.ExoPlayer
+import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
 import com.nextcloud.common.NextcloudClient
 import com.owncloud.android.MainApp
 
@@ -37,6 +38,7 @@ object NextcloudExoPlayer {
      * IP versions and certificates.
      *
      */
+    @UnstableApi
     @JvmStatic
     fun createNextcloudExoplayer(context: Context, nextcloudClient: NextcloudClient): ExoPlayer {
         val okHttpDataSourceFactory = OkHttpDataSource.Factory(nextcloudClient.client)

+ 7 - 1
app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -151,6 +151,7 @@ import java.util.Stack;
 import javax.inject.Inject;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.OptIn;
 import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
 import androidx.appcompat.widget.SearchView;
@@ -159,6 +160,7 @@ import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
 import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+import androidx.media3.common.util.UnstableApi;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import kotlin.Unit;
 
@@ -168,7 +170,11 @@ import static com.owncloud.android.utils.PermissionUtil.PERMISSION_CHOICE_DIALOG
 /**
  * Displays, what files the user has available in his ownCloud. This is the main view.
  */
-public class FileDisplayActivity extends FileActivity implements FileFragment.ContainerActivity, OnEnforceableRefreshListener, SortingOrderDialogFragment.OnSortingOrderListener, SendShareDialog.SendShareDialogDownloader, Injectable {
+@OptIn(markerClass = UnstableApi.class)
+public class FileDisplayActivity extends FileActivity
+    implements FileFragment.ContainerActivity,
+    OnEnforceableRefreshListener, SortingOrderDialogFragment.OnSortingOrderListener,
+    SendShareDialog.SendShareDialogDownloader, Injectable {
 
     public static final String RESTART = "RESTART";
     public static final String ALL_FILES = "ALL_FILES";

+ 5 - 3
app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -139,6 +139,7 @@ import javax.inject.Inject;
 import androidx.annotation.IdRes;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.annotation.OptIn;
 import androidx.annotation.StringRes;
 import androidx.appcompat.app.ActionBar;
 import androidx.coordinatorlayout.widget.CoordinatorLayout;
@@ -146,6 +147,7 @@ import androidx.core.content.ContextCompat;
 import androidx.drawerlayout.widget.DrawerLayout;
 import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
+import androidx.media3.common.util.UnstableApi;
 import androidx.recyclerview.widget.GridLayoutManager;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
@@ -977,6 +979,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
     }
 
     @Override
+    @OptIn(markerClass = UnstableApi.class)
     public void onItemClicked(OCFile file) {
         ((FileActivity) mContainerActivity).checkInternetConnection();
 
@@ -1822,8 +1825,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
     }
 
     /**
-     * Theme default action bar according to provided parameters.
-     * Replaces back arrow with hamburger menu icon.
+     * Theme default action bar according to provided parameters. Replaces back arrow with hamburger menu icon.
      *
      * @param title string res id of title to be shown in action bar
      */
@@ -1834,7 +1836,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
     /**
      * Theme default action bar according to provided parameters.
      *
-     * @param title title to be shown in action bar
+     * @param title          title to be shown in action bar
      * @param showBackAsMenu iff true replace back arrow with hamburger menu icon
      */
     protected void setTitle(final String title, Boolean showBackAsMenu) {

+ 11 - 8
app/src/main/java/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java

@@ -38,9 +38,11 @@ import java.util.Set;
 import javax.annotation.Nullable;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.OptIn;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentStatePagerAdapter;
+import androidx.media3.common.util.UnstableApi;
 
 /**
  * Adapter class that provides Fragment instances
@@ -59,10 +61,10 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
     /**
      * Constructor
      *
-     * @param fragmentManager   {@link FragmentManager} instance that will handle
-     *                          the {@link Fragment}s provided by the adapter.
-     * @param parentFolder      Folder where images will be searched for.
-     * @param storageManager    Bridge to database.
+     * @param fragmentManager {@link FragmentManager} instance that will handle the {@link Fragment}s provided by the
+     *                        adapter.
+     * @param parentFolder    Folder where images will be searched for.
+     * @param storageManager  Bridge to database.
      */
     public PreviewImagePagerAdapter(FragmentManager fragmentManager,
                                     OCFile selectedFile,
@@ -96,8 +98,8 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
     /**
      * Constructor
      *
-     * @param fragmentManager {@link FragmentManager} instance that will handle
-     *                        the {@link Fragment}s provided by the adapter.
+     * @param fragmentManager {@link FragmentManager} instance that will handle the {@link Fragment}s provided by the
+     *                        adapter.
      * @param type            Type of virtual folder, e.g. favorite or photos
      * @param storageManager  Bridge to database.
      */
@@ -113,7 +115,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
         if (type == null) {
             throw new IllegalArgumentException("NULL parent folder");
         }
-        if(type == VirtualFolderType.NONE){
+        if (type == VirtualFolderType.NONE) {
             throw new IllegalArgumentException("NONE virtual folder type");
         }
         if (storageManager == null) {
@@ -155,6 +157,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
     }
 
     @NonNull
+    @OptIn(markerClass = UnstableApi.class)
     public Fragment getItem(int i) {
         OCFile file = getFileAt(i);
         Fragment fragment;
@@ -242,7 +245,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
     @Override
     public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
         mCachedFragments.remove(position);
-       super.destroyItem(container, position, object);
+        super.destroyItem(container, position, object);
     }
 
 

+ 7 - 4
app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java

@@ -50,9 +50,7 @@ import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 
-import com.google.android.exoplayer2.ExoPlayer;
-import com.google.android.exoplayer2.MediaItem;
-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;
@@ -95,7 +93,12 @@ import androidx.core.graphics.drawable.DrawableCompat;
 import androidx.drawerlayout.widget.DrawerLayout;
 import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
+import androidx.media3.common.MediaItem;
+import androidx.media3.common.util.UnstableApi;
+import androidx.media3.exoplayer.ExoPlayer;
+import androidx.media3.ui.PlayerControlView;
 
+@UnstableApi
 /**
  * This fragment shows a preview of a downloaded media file (audio or video).
  * <p>
@@ -106,7 +109,7 @@ import androidx.fragment.app.FragmentManager;
  * instantiation too.
  */
 public class PreviewMediaFragment extends FileFragment implements OnTouchListener,
-    Injectable, StyledPlayerControlView.OnFullScreenModeChangedListener {
+    Injectable, PlayerControlView.OnFullScreenModeChangedListener {
 
     private static final String TAG = PreviewMediaFragment.class.getSimpleName();
 

+ 8 - 7
app/src/main/java/com/owncloud/android/ui/preview/PreviewVideoFullscreenDialog.kt

@@ -31,9 +31,10 @@ import android.view.Window
 import androidx.core.view.WindowCompat
 import androidx.core.view.WindowInsetsCompat
 import androidx.core.view.WindowInsetsControllerCompat
-import com.google.android.exoplayer2.ExoPlayer
-import com.google.android.exoplayer2.Player
-import com.google.android.exoplayer2.ui.StyledPlayerView
+import androidx.media3.common.Player
+import androidx.media3.common.util.UnstableApi
+import androidx.media3.exoplayer.ExoPlayer
+import androidx.media3.ui.PlayerView
 import com.nextcloud.client.media.ExoplayerListener
 import com.nextcloud.client.media.NextcloudExoPlayer
 import com.nextcloud.common.NextcloudClient
@@ -41,7 +42,7 @@ import com.owncloud.android.R
 import com.owncloud.android.databinding.DialogPreviewVideoBinding
 import com.owncloud.android.lib.common.utils.Log_OC
 
-/**
+@UnstableApi /**
  * Transfers a previously playing video to a fullscreen dialog, and handles the switch back to the previous player
  * when closed
  *
@@ -53,7 +54,7 @@ class PreviewVideoFullscreenDialog(
     private val activity: Activity,
     nextcloudClient: NextcloudClient,
     private val sourceExoPlayer: ExoPlayer,
-    private val sourceView: StyledPlayerView
+    private val sourceView: PlayerView
 ) : Dialog(sourceView.context, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
 
     private val binding: DialogPreviewVideoBinding = DialogPreviewVideoBinding.inflate(layoutInflater)
@@ -125,7 +126,7 @@ class PreviewVideoFullscreenDialog(
         if (shouldUseRotatedVideoWorkaround) {
             mExoPlayer.seekTo(sourceExoPlayer.currentPosition)
         } else {
-            StyledPlayerView.switchTargetView(sourceExoPlayer, sourceView, binding.videoPlayer)
+            PlayerView.switchTargetView(sourceExoPlayer, sourceView, binding.videoPlayer)
         }
     }
 
@@ -178,7 +179,7 @@ class PreviewVideoFullscreenDialog(
         if (shouldUseRotatedVideoWorkaround) {
             sourceExoPlayer.seekTo(mExoPlayer.currentPosition)
         } else {
-            StyledPlayerView.switchTargetView(sourceExoPlayer, binding.videoPlayer, sourceView)
+            PlayerView.switchTargetView(sourceExoPlayer, binding.videoPlayer, sourceView)
         }
     }
 

+ 1 - 1
app/src/main/res/layout/dialog_preview_video.xml

@@ -18,7 +18,7 @@
   You should have received a copy of the GNU Affero General Public License
   along with this program. If not, see <https://www.gnu.org/licenses/>.
 -->
-<com.google.android.exoplayer2.ui.StyledPlayerView xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.media3.ui.PlayerView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/videoPlayer"
     android:layout_width="match_parent"

+ 1 - 1
app/src/main/res/layout/fragment_preview_media.xml

@@ -38,7 +38,7 @@
         android:src="@drawable/logo" />
 
 
-    <com.google.android.exoplayer2.ui.StyledPlayerView
+    <androidx.media3.ui.PlayerView
         android:id="@+id/exoplayer_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"