Commit 5a2b9adc authored by LuK1337's avatar LuK1337

Migrate to AndroidX

Change-Id: Ic9503cffe10a91a9aa07cc9e1537d883ee38c556
parent d0cde76f
......@@ -9,16 +9,13 @@ LOCAL_SRC_FILES += $(call all-java-files-under, src_aosp)
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, res)
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-v8-renderscript \
android-common
LOCAL_STATIC_ANDROID_LIBRARIES := \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-cardview \
android-support-v7-palette \
android-support-v7-recyclerview
androidx.appcompat_appcompat \
androidx.cardview_cardview \
androidx.core_core \
androidx.legacy_legacy-support-v4 \
androidx.palette_palette \
androidx.recyclerview_recyclerview
LOCAL_USE_AAPT2 := true
......
......@@ -31,7 +31,7 @@ task updateGradleWrapper(type: Wrapper) {
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
compileSdkVersion 29
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
......@@ -42,7 +42,7 @@ android {
applicationId "org.lineageos.eleven"
minSdkVersion 26
targetSdkVersion 28
targetSdkVersion 29
versionCode 3
versionName '3.0'
......@@ -121,10 +121,11 @@ android {
}
dependencies {
// see https://developer.android.com/topic/libraries/support-library/revisions.html
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:palette-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.core:core:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
......@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="156dp"
......@@ -78,4 +78,4 @@
</RelativeLayout>
</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
......@@ -21,7 +21,7 @@
android:textSize="@dimen/text_size_medium"
android:text="@string/header_albums" />
<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/albums"
android:scrollbars="none"
android:layout_width="match_parent"
......
......@@ -31,7 +31,7 @@
android:elevation="@dimen/action_bar_elevation"
style="@style/HeaderTabTextStyle" />
<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/fragment_home_phone_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
......@@ -74,4 +74,4 @@
</LinearLayout>
</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
......@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
......@@ -141,4 +141,4 @@
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
......@@ -14,10 +14,11 @@ package org.lineageos.eleven;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import android.view.KeyEvent;
import androidx.legacy.content.WakefulBroadcastReceiver;
public class MediaButtonIntentReceiver extends WakefulBroadcastReceiver {
private static final boolean DEBUG = false;
private static final String TAG = "MediaButtonIntentReceiver";
......
......@@ -56,13 +56,14 @@ import android.os.SystemClock;
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.AlbumColumns;
import android.provider.MediaStore.Audio.AudioColumns;
import android.support.annotation.NonNull;
import android.support.v4.os.BuildCompat;
import android.text.TextUtils;
import android.util.Log;
import android.util.LongSparseArray;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.core.os.BuildCompat;
import org.lineageos.eleven.Config.IdType;
import org.lineageos.eleven.appwidgets.AppWidgetLarge;
import org.lineageos.eleven.appwidgets.AppWidgetLargeAlternate;
......
......@@ -19,14 +19,15 @@ package org.lineageos.eleven.adapters;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import org.lineageos.eleven.BuildConstants;
import org.lineageos.eleven.MusicPlaybackService;
import org.lineageos.eleven.R;
......@@ -41,7 +42,7 @@ import java.util.Iterator;
import java.util.LinkedList;
/**
* A {@link android.support.v4.app.FragmentStatePagerAdapter} class for swiping between album art
* A {@link androidx.fragment.app.FragmentStatePagerAdapter} class for swiping between album art
*/
public class AlbumArtPagerAdapter extends FragmentStatePagerAdapter {
private static boolean DEBUG = false;
......
......@@ -18,10 +18,11 @@ package org.lineageos.eleven.adapters;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.view.View;
import android.widget.TextView;
import androidx.loader.content.Loader;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.cache.ImageFetcher;
......
......@@ -17,15 +17,16 @@ package org.lineageos.eleven.adapters;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import androidx.recyclerview.widget.RecyclerView;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.cache.ImageFetcher;
......@@ -41,7 +42,7 @@ import java.util.List;
public class ArtistDetailAlbumAdapter
extends RecyclerView.Adapter<ArtistDetailAlbumAdapter.ViewHolder>
implements LoaderCallbacks<List<Album>>, IPopupMenuCallback {
implements LoaderManager.LoaderCallbacks<List<Album>>, IPopupMenuCallback {
private static final int TYPE_FIRST = 1;
private static final int TYPE_MIDDLE = 2;
private static final int TYPE_LAST = 3;
......
......@@ -18,11 +18,12 @@ package org.lineageos.eleven.adapters;
import android.app.Activity;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.content.Loader;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.loader.content.Loader;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.cache.ImageFetcher;
......
package org.lineageos.eleven.adapters;
import android.app.Activity;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -12,6 +10,9 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.cache.ImageFetcher;
......@@ -25,8 +26,8 @@ import org.lineageos.eleven.widgets.PopupMenuButton;
import java.util.Collections;
import java.util.List;
public abstract class DetailSongAdapter extends BaseAdapter
implements LoaderCallbacks<List<Song>>, OnItemClickListener, IPopupMenuCallback {
public abstract class DetailSongAdapter extends BaseAdapter implements
LoaderManager.LoaderCallbacks<List<Song>>, OnItemClickListener, IPopupMenuCallback {
protected final Activity mActivity;
private final ImageFetcher mImageFetcher;
private final LayoutInflater mInflater;
......
......@@ -15,12 +15,13 @@ package org.lineageos.eleven.adapters;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.SparseArray;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import org.lineageos.eleven.R;
import org.lineageos.eleven.ui.fragments.AlbumFragment;
import org.lineageos.eleven.ui.fragments.ArtistFragment;
......
......@@ -19,10 +19,10 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.Element;
import android.support.v8.renderscript.RenderScript;
import android.support.v8.renderscript.ScriptIntrinsicBlur;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.util.Log;
import android.widget.ImageView;
......
......@@ -21,7 +21,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.support.v8.renderscript.RenderScript;
import android.renderscript.RenderScript;
import android.view.View;
import android.widget.ImageView;
......
......@@ -2,7 +2,8 @@
package org.lineageos.eleven.loaders;
import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
import androidx.loader.content.AsyncTaskLoader;
/**
* <a href="http://code.google.com/p/android/issues/detail?id=14944">Issue
......
......@@ -16,8 +16,10 @@
package org.lineageos.eleven.locale;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import androidx.annotation.VisibleForTesting;
import java.util.Locale;
public class LocaleSet {
......
......@@ -17,11 +17,12 @@
package org.lineageos.eleven.locale;
import android.content.Context;
import android.support.annotation.VisibleForTesting;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import org.lineageos.eleven.provider.PropertiesStore;
import java.util.Locale;
......
......@@ -17,9 +17,10 @@
package org.lineageos.eleven.locale;
import android.icu.text.AlphabeticIndex;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
......
......@@ -18,7 +18,6 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
......@@ -26,6 +25,8 @@ import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import androidx.fragment.app.DialogFragment;
import org.lineageos.eleven.R;
import org.lineageos.eleven.utils.MusicUtils;
......
......@@ -21,8 +21,9 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import org.lineageos.eleven.R;
......
......@@ -18,7 +18,8 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import androidx.fragment.app.DialogFragment;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
......
......@@ -17,10 +17,11 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import androidx.fragment.app.DialogFragment;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.ui.activities.HomeActivity;
......
......@@ -18,9 +18,10 @@
package org.lineageos.eleven.model;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import java.util.Comparator;
/**
......
......@@ -10,14 +10,16 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.ViewCompat;
import org.lineageos.eleven.R;
public class SlidingUpPanelLayout extends ViewGroup {
......
......@@ -20,10 +20,6 @@ package org.lineageos.eleven.slidinguppanel;
import java.util.Arrays;
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ScrollerCompat;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
......@@ -31,6 +27,11 @@ import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.VelocityTrackerCompat;
import androidx.core.view.ViewCompat;
import androidx.core.widget.ScrollerCompat;
/**
* ViewDragHelper is a utility class for writing custom ViewGroups. It offers a number
* of useful operations and state tracking for allowing a user to drag and reposition
......
......@@ -16,7 +16,6 @@
package org.lineageos.eleven.ui;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.MenuInflater;
......@@ -27,6 +26,8 @@ import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import org.lineageos.eleven.R;
import org.lineageos.eleven.loaders.NowPlayingCursor;
import org.lineageos.eleven.loaders.QueueLoader;
......
......@@ -13,8 +13,6 @@
package org.lineageos.eleven.ui.activities;
import static org.lineageos.eleven.utils.MusicUtils.mService;
import android.app.ActionBar;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
......@@ -27,7 +25,6 @@ import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.app.FragmentActivity;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
......@@ -37,6 +34,8 @@ import android.widget.TextView;
import android.widget.Toast;
import android.widget.Toolbar;
import androidx.fragment.app.FragmentActivity;
import org.lineageos.eleven.IElevenService;
import org.lineageos.eleven.MusicPlaybackService;
import org.lineageos.eleven.MusicStateListener;
......@@ -53,6 +52,8 @@ import org.lineageos.eleven.widgets.PlayPauseProgressButton;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import static org.lineageos.eleven.utils.MusicUtils.mService;
/**
* A base {@link FragmentActivity} used to update the bottom bar and
* bind to Eleven's service.
......
......@@ -24,18 +24,18 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
import android.util.Log;
import android.view.MenuItem;
import android.view.Window;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.cache.ImageFetcher;
......
......@@ -26,9 +26,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.provider.BaseColumns;
import android.provider.MediaStore;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
......@@ -46,6 +43,10 @@ import android.widget.ListView;
import android.widget.SearchView;
import android.widget.SearchView.OnQueryTextListener;
import androidx.fragment.app.FragmentActivity;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.IElevenService;
import org.lineageos.eleven.R;
......@@ -86,7 +87,7 @@ import static org.lineageos.eleven.utils.MusicUtils.mService;
* @author Andrew Neal (andrewdneal@gmail.com)
*/
public class SearchActivity extends FragmentActivity implements
LoaderCallbacks<SectionListContainer<SearchResult>>,
LoaderManager.LoaderCallbacks<SectionListContainer<SearchResult>>,
OnScrollListener, OnQueryTextListener, OnItemClickListener, ServiceConnection,
OnTouchListener {
/**
......@@ -940,7 +941,7 @@ public class SearchActivity extends FragmentActivity implements
/**
* This handles the Loader callbacks for the search history
*/
public class SearchHistoryCallback implements LoaderCallbacks<ArrayAdapter<String>> {
public class SearchHistoryCallback implements LoaderManager.LoaderCallbacks<ArrayAdapter<String>> {
@Override
public Loader<ArrayAdapter<String>> onCreateLoader(int i, Bundle bundle) {
// prep the loader in case the query takes a long time
......
......@@ -15,11 +15,12 @@ package org.lineageos.eleven.ui.activities;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.LinearLayout;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import org.lineageos.eleven.R;
import org.lineageos.eleven.slidinguppanel.SlidingUpPanelLayout;
import org.lineageos.eleven.slidinguppanel.SlidingUpPanelLayout.SimplePanelSlideListener;
......
......@@ -16,11 +16,13 @@
package org.lineageos.eleven.ui.fragments;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import androidx.loader.app.LoaderManager;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.adapters.AlbumDetailSongAdapter;
......
......@@ -15,8 +15,6 @@ package org.lineageos.eleven.ui.fragments;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -26,6 +24,9 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import org.lineageos.eleven.MusicStateListener;
import org.lineageos.eleven.R;
import org.lineageos.eleven.adapters.AlbumAdapter;
......@@ -51,7 +52,7 @@ import org.lineageos.eleven.widgets.LoadingEmptyContainer;
* @author Andrew Neal (andrewdneal@gmail.com)
*/
public class AlbumFragment extends MusicBrowserFragment implements
LoaderCallbacks<SectionListContainer<Album>>, OnScrollListener,
LoaderManager.LoaderCallbacks<SectionListContainer<Album>>, OnScrollListener,
OnItemClickListener, MusicStateListener {
/**
......
......@@ -16,14 +16,16 @@
package org.lineageos.eleven.ui.fragments;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.ListView;
import androidx.loader.app.LoaderManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
import org.lineageos.eleven.adapters.ArtistDetailAlbumAdapter;
......
......@@ -16,9 +16,6 @@ package org.lineageos.eleven.ui.fragments;
import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -28,6 +25,10 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import androidx.fragment.app.Fragment;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import org.lineageos.eleven.MusicStateListener;
import org.lineageos.eleven.R;
import org.lineageos.eleven.adapters.ArtistAdapter;
......@@ -55,7 +56,7 @@ import org.lineageos.eleven.widgets.LoadingEmptyContainer;
* @author Andrew Neal (andrewdneal@gmail.com)
*/
public class ArtistFragment extends MusicBrowserFragment implements
LoaderCallbacks<SectionListContainer<Artist>>,
LoaderManager.LoaderCallbacks<SectionListContainer<Artist>>,
OnScrollListener, OnItemClickListener, MusicStateListener {