From edf43197592df5ab65e1c9519e127f53bb0647cf Mon Sep 17 00:00:00 2001 From: Rohan Pawar Date: Mon, 12 Aug 2019 00:04:12 +0530 Subject: [PATCH] Migrated to AndroidX Updated ExoPlayer lib replaced deprecated methods --- .idea/assetWizardSettings.xml | 35 ------ .idea/codeStyles/Project.xml | 29 ----- .idea/gradle.xml | 10 +- .idea/inspectionProfiles/Project_Default.xml | 12 -- .idea/misc.xml | 116 ++++++++++++------ .idea/vcs.xml | 2 +- app/build.gradle | 4 +- .../net/vrgsoft/videocrop/MainActivity.java | 2 +- app/src/main/res/layout/activity_main.xml | 4 +- build.gradle | 2 +- gradle.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 4 +- videcrop/build.gradle | 13 +- .../vrgsoft/videcrop/VideoCropActivity.java | 12 +- .../vrgsoft/videcrop/player/VideoPlayer.java | 11 +- .../java/net/vrgsoft/videcrop/util/Utils.java | 4 +- .../vrgsoft/videcrop/view/ProgressView.java | 2 +- .../videcrop/view/VideoSliceSeekBarH.java | 2 +- .../src/main/res/layout/activity_crop.xml | 14 +-- .../res/layout/view_aspect_ratio_menu.xml | 16 +-- 20 files changed, 129 insertions(+), 167 deletions(-) delete mode 100644 .idea/assetWizardSettings.xml delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml deleted file mode 100644 index 1750e18..0000000 --- a/.idea/assetWizardSettings.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 30aa626..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 61e83d7..2996d53 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -3,15 +3,11 @@ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 25c2334..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 7860f65..87df619 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,42 +1,86 @@ - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 981b349..b142c24 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,7 +19,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "com.android.support:appcompat-v7:27.1.1" - implementation 'com.android.support.constraint:constraint-layout:1.1.2' + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation project(":videcrop") } diff --git a/app/src/main/java/net/vrgsoft/videocrop/MainActivity.java b/app/src/main/java/net/vrgsoft/videocrop/MainActivity.java index 3a3a04a..58bdc7f 100644 --- a/app/src/main/java/net/vrgsoft/videocrop/MainActivity.java +++ b/app/src/main/java/net/vrgsoft/videocrop/MainActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import net.vrgsoft.videcrop.VideoCropActivity; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 84f1951..4fc2444 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2339731..9c3977b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0-alpha05' + classpath 'com.android.tools.build:gradle:3.4.2' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle.properties b/gradle.properties index 743d692..8de5058 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,8 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 048a156..95c939a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Aug 12 12:34:38 EEST 2018 +#Mon Aug 12 00:00:10 IST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/videcrop/build.gradle b/videcrop/build.gradle index 1d36af4..e577bad 100644 --- a/videcrop/build.gradle +++ b/videcrop/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 27 - buildToolsVersion "28.0.1" + compileSdkVersion 29 defaultConfig { minSdkVersion 17 - targetSdkVersion 27 + targetSdkVersion 29 versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true @@ -24,8 +23,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "com.android.support:appcompat-v7:27.1.1" - implementation "com.android.support.constraint:constraint-layout:1.1.2" - api "com.google.android.exoplayer:exoplayer-ui:2.8.0" - api "com.google.android.exoplayer:exoplayer-core:2.8.0" + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + api "com.google.android.exoplayer:exoplayer-ui:2.9.0" + api "com.google.android.exoplayer:exoplayer-core:2.9.0" } diff --git a/videcrop/src/main/java/net/vrgsoft/videcrop/VideoCropActivity.java b/videcrop/src/main/java/net/vrgsoft/videcrop/VideoCropActivity.java index 9859b46..9dcdf7d 100644 --- a/videcrop/src/main/java/net/vrgsoft/videcrop/VideoCropActivity.java +++ b/videcrop/src/main/java/net/vrgsoft/videcrop/VideoCropActivity.java @@ -10,12 +10,12 @@ import android.graphics.Rect; import android.media.MediaMetadataRetriever; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.AppCompatImageView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatImageView; import android.text.TextUtils; import android.util.Log; import android.view.View; diff --git a/videcrop/src/main/java/net/vrgsoft/videcrop/player/VideoPlayer.java b/videcrop/src/main/java/net/vrgsoft/videcrop/player/VideoPlayer.java index 9df63cd..2848c8e 100644 --- a/videcrop/src/main/java/net/vrgsoft/videcrop/player/VideoPlayer.java +++ b/videcrop/src/main/java/net/vrgsoft/videcrop/player/VideoPlayer.java @@ -41,13 +41,12 @@ public class VideoPlayer implements Player.EventListener, TimeBar.OnScrubListene private Runnable progressUpdater; public VideoPlayer(Context context) { - BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); - TrackSelection.Factory videoTrackSelectionFactory = - new AdaptiveTrackSelection.Factory(bandwidthMeter); + TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(); TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory); LoadControl loadControl = new DefaultLoadControl(); - player = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(context), trackSelector, loadControl); + DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(context, DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF); + player = ExoPlayerFactory.newSimpleInstance(context, renderersFactory, trackSelector, loadControl); player.setRepeatMode(Player.REPEAT_MODE_ONE); player.addListener(this); progressHandler = new Handler(); @@ -55,9 +54,7 @@ public VideoPlayer(Context context) { public void initMediaSource(Context context, String uri) { DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context, "ExoPlayer")); - ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory(); - MediaSource videoSource = new ExtractorMediaSource(Uri.parse(uri), - dataSourceFactory, extractorsFactory, null, null); + MediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(uri)); player.prepare(videoSource); player.addVideoListener(this); diff --git a/videcrop/src/main/java/net/vrgsoft/videcrop/util/Utils.java b/videcrop/src/main/java/net/vrgsoft/videcrop/util/Utils.java index 1dfeee3..785e40d 100644 --- a/videcrop/src/main/java/net/vrgsoft/videcrop/util/Utils.java +++ b/videcrop/src/main/java/net/vrgsoft/videcrop/util/Utils.java @@ -5,8 +5,8 @@ import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; public final class Utils { private Utils () {} diff --git a/videcrop/src/main/java/net/vrgsoft/videcrop/view/ProgressView.java b/videcrop/src/main/java/net/vrgsoft/videcrop/view/ProgressView.java index 326a885..d76eaee 100644 --- a/videcrop/src/main/java/net/vrgsoft/videcrop/view/ProgressView.java +++ b/videcrop/src/main/java/net/vrgsoft/videcrop/view/ProgressView.java @@ -5,7 +5,7 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.View; diff --git a/videcrop/src/main/java/net/vrgsoft/videcrop/view/VideoSliceSeekBarH.java b/videcrop/src/main/java/net/vrgsoft/videcrop/view/VideoSliceSeekBarH.java index b2e6749..7ec67ee 100644 --- a/videcrop/src/main/java/net/vrgsoft/videcrop/view/VideoSliceSeekBarH.java +++ b/videcrop/src/main/java/net/vrgsoft/videcrop/view/VideoSliceSeekBarH.java @@ -6,7 +6,7 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; -import android.support.v7.widget.AppCompatImageView; +import androidx.appcompat.widget.AppCompatImageView; import android.util.AttributeSet; import android.view.MotionEvent; diff --git a/videcrop/src/main/res/layout/activity_crop.xml b/videcrop/src/main/res/layout/activity_crop.xml index 5b61b2f..4a3149e 100644 --- a/videcrop/src/main/res/layout/activity_crop.xml +++ b/videcrop/src/main/res/layout/activity_crop.xml @@ -1,5 +1,5 @@ - - - - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/videcrop/src/main/res/layout/view_aspect_ratio_menu.xml b/videcrop/src/main/res/layout/view_aspect_ratio_menu.xml index 5c2afdd..3d6e88a 100644 --- a/videcrop/src/main/res/layout/view_aspect_ratio_menu.xml +++ b/videcrop/src/main/res/layout/view_aspect_ratio_menu.xml @@ -1,5 +1,5 @@ - - - - - - - - \ No newline at end of file + \ No newline at end of file