Commit 57a41aba authored by Geoffrey Métais's avatar Geoffrey Métais

Migration to AndroidX libraries

parent e21efa45
......@@ -58,7 +58,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api "com.android.support:appcompat-v7:$rootProject.ext.appCompatVersion"
api "androidx.appcompat:appcompat:$rootProject.ext.androidxVersion"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
}
......
......@@ -32,8 +32,8 @@ import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.List;
......
......@@ -28,9 +28,9 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import org.videolan.vlc.plugin.api.R;
......
......@@ -24,21 +24,22 @@ allprojects {
}
ext {
appCompatVersion = '28.0.0'
constraintLayoutVersion = '1.1.3'
archVersion = '1.1.1'
roomVersion = '1.1.1'
versionName = '3.0.13'
versionCode = 3001300
minSdkVersion = 17
targetSdkVersion = 28
compileSdkVersion = 28
androidxVersion = '1.0.0'
constraintLayoutVersion = '2.0.0-alpha2'
archVersion = '2.0.0'
roomVersion = '2.1.0-alpha01'
pagingVersion = '2.1.0-alpha01'
junitVersion = '4.12'
mockito = '2.8.9'
powerMock = '1.7.4'
retrofit = '2.4.0'
espressoVersion = '3.0.1'
supportTest = '1.0.2'
minSdkVersion = 17
targetSdkVersion = 28
versionName = '3.0.13'
versionCode = 3001300
espressoVersion = '3.1.0-beta02'
supportTest = '1.1.0-beta02'
// versionCode scheme is T M NN RR AA
// T: Target/Flavour (1 for Android, 2 for Chrome?)
// M: Major version from 0 to 9
......
......@@ -14,7 +14,7 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.appcompat">
package="androidx.appcompat.appcompat">
<uses-sdk android:minSdkVersion="7"/>
<application />
</manifest>
......@@ -14,7 +14,7 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.cardview">
package="androidx.appcompat.cardview">
<uses-sdk android:minSdkVersion="7"/>
<application />
</manifest>
......@@ -95,6 +95,6 @@ clean {
}
dependencies {
api "com.android.support:support-annotations:$rootProject.ext.appCompatVersion"
api "com.android.support:support-v4:$rootProject.ext.appCompatVersion"
api "androidx.annotation:annotation:$rootProject.ext.androidxVersion"
api "androidx.legacy:legacy-support-v4:$rootProject.ext.androidxVersion"
}
......@@ -25,7 +25,7 @@ import android.graphics.SurfaceTexture;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.MainThread;
import androidx.annotation.MainThread;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
......
......@@ -22,7 +22,7 @@ package org.videolan.libvlc;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.MainThread;
import androidx.annotation.MainThread;
@SuppressWarnings("unused, JniMissingFunction")
public abstract class Dialog {
......
......@@ -23,7 +23,7 @@ package org.videolan.libvlc;
import android.annotation.TargetApi;
import android.graphics.SurfaceTexture;
import android.os.Build;
import android.support.annotation.MainThread;
import androidx.annotation.MainThread;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
......
......@@ -22,7 +22,7 @@ package org.videolan.libvlc;
import android.content.res.AssetFileDescriptor;
import android.net.Uri;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.libvlc.util.HWDecoderUtil;
......
......@@ -20,7 +20,7 @@
package org.videolan.libvlc;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
@SuppressWarnings("unused, JniMissingFunction")
public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
......
......@@ -33,7 +33,7 @@ import android.media.AudioFormat;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.RequiresApi;
import androidx.annotation.RequiresApi;
import android.util.SparseArray;
import org.videolan.libvlc.util.AndroidUtil;
......
......@@ -20,7 +20,7 @@
package org.videolan.libvlc;
import android.support.v4.util.LongSparseArray;
import androidx.collection.LongSparseArray;
public class RendererDiscoverer extends VLCObject<RendererDiscoverer.Event> {
private final static String TAG = "LibVLC/RendererDiscoverer";
......
......@@ -21,7 +21,7 @@
package org.videolan.libvlc.util;
import android.net.Uri;
import android.support.annotation.MainThread;
import androidx.annotation.MainThread;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
......
......@@ -22,7 +22,7 @@ package org.videolan.libvlc.util;
import android.net.Uri;
import android.os.Handler;
import android.support.annotation.MainThread;
import androidx.annotation.MainThread;
import android.util.Log;
import org.videolan.libvlc.LibVLC;
......
......@@ -25,7 +25,7 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;
import org.videolan.libvlc.LibVLC;
......
......@@ -69,9 +69,9 @@ clean {
dependencies {
implementation project(':libvlc')
api "com.android.support:support-v4:$rootProject.ext.appCompatVersion"
api "com.android.support:support-compat:$rootProject.ext.appCompatVersion"
api "com.android.support:support-fragment:$rootProject.ext.appCompatVersion"
api "androidx.legacy:legacy-support-v4:$rootProject.ext.androidxVersion"
api "androidx.core:core:$rootProject.ext.androidxVersion"
api "androidx.fragment:fragment:$rootProject.ext.androidxVersion"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
implementation project(':tools')
}
\ No newline at end of file
package org.videolan.medialibrary;
import android.Manifest;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.text.TextUtils;
import org.videolan.libvlc.LibVLC;
......
......@@ -3,7 +3,7 @@ package org.videolan.medialibrary;
import android.net.Uri;
import android.os.Environment;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import org.videolan.medialibrary.media.MediaLibraryItem;
......
......@@ -2,7 +2,7 @@ package org.videolan.medialibrary.media;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.Medialibrary;
......
......@@ -2,7 +2,7 @@ package org.videolan.medialibrary.media;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import org.videolan.medialibrary.Medialibrary;
......
......@@ -24,7 +24,7 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import org.videolan.libvlc.Media;
......
......@@ -13,7 +13,7 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......@@ -27,16 +27,16 @@ android {
}
dependencies {
api "com.android.support:appcompat-v7:$rootProject.ext.appCompatVersion"
api "com.android.support:support-tv-provider:$rootProject.ext.appCompatVersion"
api "androidx.appcompat:appcompat:$rootProject.ext.androidxVersion"
api "androidx.tvprovider:tvprovider:$rootProject.ext.androidxVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.ext.kotlinx_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.ext.kotlinx_version"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
androidTestImplementation "com.android.support.test:runner:$rootProject.ext.supportTest"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
androidTestImplementation "androidx.test:runner:$rootProject.ext.supportTest"
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
......
package videolan.org.commontools;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
......
......@@ -3,5 +3,5 @@
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk
tools:overrideLibrary="android.support.media.tv" />
tools:overrideLibrary="android.support.media.tv,androidx.tvprovider" />
</manifest>
\ No newline at end of file
package org.videolan.tools
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.LifecycleOwner
import androidx.lifecycle.GenericLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
......
package org.videolan.tools
import android.support.annotation.MainThread
import androidx.annotation.MainThread
import android.util.SparseBooleanArray
......
package videolan.org.commontools
import android.arch.lifecycle.LifecycleOwner
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.Observer
import android.support.annotation.MainThread
import android.support.annotation.Nullable
import android.util.Log
import androidx.annotation.MainThread
import androidx.annotation.Nullable
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import java.util.concurrent.atomic.AtomicBoolean
private const val TAG = "VLC/LiveEvent"
......@@ -13,7 +13,7 @@ private const val TAG = "VLC/LiveEvent"
class LiveEvent<T> : MutableLiveData<T>() {
private val pending = AtomicBoolean(false)
@MainThread
override fun observe(owner: LifecycleOwner, observer: Observer<T>) {
override fun observe(owner: LifecycleOwner, observer: Observer<in T>) {
if (hasActiveObservers()) Log.w(TAG, "Multiple observers registered but only one will be notified of changes.")
// Observe the internal MutableLiveData
super.observe(owner, Observer<T> { t ->
......@@ -21,7 +21,7 @@ class LiveEvent<T> : MutableLiveData<T>() {
})
}
override fun observeForever(observer: Observer<T>) {
override fun observeForever(observer: Observer<in T>) {
super.observeForever { if (pending.compareAndSet(true, false)) observer.onChanged(it) }
}
......
......@@ -27,9 +27,9 @@ import android.content.SharedPreferences
import android.database.Cursor
import android.net.Uri
import android.os.Build
import android.support.annotation.RequiresApi
import android.support.annotation.WorkerThread
import android.support.media.tv.*
import androidx.annotation.RequiresApi
import androidx.annotation.WorkerThread
import androidx.tvprovider.media.tv.*
import android.util.Log
typealias ProgramsList = MutableList<TvPreviewProgram>
......
......@@ -5,7 +5,7 @@
android:installLocation="auto">
<uses-sdk
tools:overrideLibrary="android.support.media.tv" />
tools:overrideLibrary="android.support.media.tv, androidx.tvprovider" />
<uses-permission android:name="android.permission.READ_LOGS"
android:maxSdkVersion="18" /> <!-- android:maxSdkVersion="15" -->
......@@ -542,7 +542,7 @@
android:name="android.appwidget.provider"
android:resource="@xml/widget_provider_b" />
</receiver>
<receiver android:name="android.support.v4.media.session.MediaButtonReceiver" >
<receiver android:name="androidx.media.session.MediaButtonReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
......
......@@ -20,7 +20,7 @@
package org.videolan.vlc.database
import android.support.test.runner.AndroidJUnit4
import androidx.test.runner.AndroidJUnit4
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.*
import org.junit.Test
......
......@@ -21,7 +21,7 @@
package org.videolan.vlc.database
import android.net.Uri
import android.support.test.runner.AndroidJUnit4
import androidx.test.runner.AndroidJUnit4
import junit.framework.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
......
package org.videolan.vlc.database
import android.support.test.runner.AndroidJUnit4
import androidx.test.runner.AndroidJUnit4
import org.hamcrest.CoreMatchers.hasItem
import org.hamcrest.core.Is.`is`
import org.junit.Assert.assertThat
......
......@@ -20,9 +20,9 @@
package org.videolan.vlc.database
import android.arch.core.executor.testing.CountingTaskExecutorRule
import android.arch.persistence.room.Room
import android.support.test.InstrumentationRegistry
import androidx.arch.core.executor.testing.CountingTaskExecutorRule
import androidx.room.Room
import androidx.test.InstrumentationRegistry
import org.junit.After
import org.junit.Before
import org.junit.Rule
......
......@@ -20,7 +20,7 @@
package org.videolan.vlc.database
import android.support.test.runner.AndroidJUnit4
import androidx.test.runner.AndroidJUnit4
import org.hamcrest.Matchers.*
import org.junit.Assert.assertThat
import org.junit.Test
......
......@@ -20,13 +20,13 @@
package org.videolan.vlc.database
import android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory
import android.arch.persistence.room.Room
import android.arch.persistence.room.migration.Migration
import android.arch.persistence.room.testing.MigrationTestHelper
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import androidx.room.Room
import androidx.room.migration.Migration
import androidx.room.testing.MigrationTestHelper
import android.net.Uri
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.hasItem
import org.junit.Assert.*
......
......@@ -20,7 +20,7 @@
package org.videolan.vlc.database
import android.support.test.runner.AndroidJUnit4
import androidx.test.runner.AndroidJUnit4
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.*
import org.junit.Test
......
......@@ -46,7 +46,7 @@ android {
resValue "string", "build_revision", revision()
resValue "string", "build_vlc_revision", vlcRevision()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
......@@ -73,7 +73,7 @@ android {
}
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
execution 'ANDROIDX_TEST_ORCHESTRATOR'
unitTests {
includeAndroidResources = true
}
......@@ -196,42 +196,41 @@ task generateSources (type: Jar) {
}
dependencies {
def paging_version = "1.0.1"
implementation project(':libvlc')
implementation project(':medialibrary')
implementation project(':api')
// AppCompat
implementation "com.android.support:recyclerview-v7:$rootProject.ext.appCompatVersion"
implementation "com.android.support:design:$rootProject.ext.appCompatVersion"
implementation "com.android.support:support-annotations:$rootProject.ext.appCompatVersion"
implementation "com.android.support:preference-v7:$rootProject.ext.appCompatVersion"
implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
implementation "androidx.recyclerview:recyclerview:$rootProject.ext.androidxVersion"
implementation "com.google.android.material:material:$rootProject.ext.androidxVersion"
implementation "androidx.annotation:annotation:$rootProject.ext.androidxVersion"
implementation "androidx.preference:preference:$rootProject.ext.androidxVersion"
implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion"
//TV
implementation "com.android.support:leanback-v17:$rootProject.ext.appCompatVersion"
implementation "com.android.support:preference-leanback-v17:$rootProject.ext.appCompatVersion"
implementation "com.android.support:support-tv-provider:$rootProject.ext.appCompatVersion"
implementation "androidx.leanback:leanback:$rootProject.ext.androidxVersion"
implementation "androidx.leanback:leanback-preference:$rootProject.ext.androidxVersion"
implementation "androidx.tvprovider:tvprovider:$rootProject.ext.androidxVersion"
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.ext.kotlinx_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.ext.kotlinx_version"
implementation "android.arch.lifecycle:extensions:$rootProject.ext.archVersion"
kapt "android.arch.lifecycle:compiler:$rootProject.ext.archVersion"
implementation "android.arch.persistence.room:runtime:$rootProject.ext.roomVersion"
kapt "android.arch.persistence.room:compiler:$rootProject.ext.roomVersion"
implementation "android.arch.paging:runtime:$paging_version"
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.ext.archVersion"
kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.ext.archVersion"
implementation "androidx.room:room-runtime:$rootProject.ext.roomVersion"
kapt "androidx.room:room-compiler:$rootProject.ext.roomVersion"
implementation "androidx.paging:paging-runtime:$rootProject.ext.pagingVersion"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofit"
implementation "com.squareup.retrofit2:converter-moshi:$rootProject.ext.retrofit"
implementation project(':tools')
implementation project(":tools")
// Test
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$rootProject.espressoVersion"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$rootProject.espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
androidTestImplementation "android.arch.persistence.room:testing:$rootProject.ext.roomVersion"
testImplementation "android.arch.core:core-testing:$rootProject.ext.archVersion"
androidTestImplementation "android.arch.core:core-testing:$rootProject.ext.archVersion"
androidTestImplementation "com.android.support.test:runner:$rootProject.ext.supportTest"
androidTestUtil "com.android.support.test:orchestrator:$rootProject.ext.supportTest"
androidTestImplementation "androidx.room:room-testing:$rootProject.ext.roomVersion"
testImplementation "androidx.arch.core:core-testing:$rootProject.ext.archVersion"
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.ext.archVersion"
androidTestImplementation "androidx.test:runner:$rootProject.ext.supportTest"
androidTestUtil "androidx.test:orchestrator:$rootProject.ext.supportTest"
testImplementation "org.mockito:mockito-core:$rootProject.ext.mockito"
testImplementation "org.powermock:powermock-api-mockito2:$rootProject.ext.powerMock"
testImplementation "org.powermock:powermock-module-junit4:$rootProject.ext.powerMock"
......
......@@ -11,7 +11,7 @@
name="showCover"
type="boolean" />
</data>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -47,7 +47,7 @@