Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Migrate to AndroidX #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 35 additions & 23 deletions XYZReader/build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
apply plugin: 'com.android.application'

repositories {
mavenCentral()
}

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 29
buildToolsVersion "29.0.3"

buildFeatures {
viewBinding true
}

compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "android.ivo.xyzreader"
minSdkVersion 19
targetSdkVersion 25
targetSdkVersion 29
versionCode 1
versionName "1.0"

vectorDrawables{
useSupportLibrary true
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile "com.android.support:support-v4:$androidSupportVersion"
compile "com.android.support:support-v13:$androidSupportVersion"
compile "com.android.support:appcompat-v7:$androidSupportVersion"
compile "com.android.support:palette-v7:$androidSupportVersion"
compile "com.android.support:recyclerview-v7:$androidSupportVersion"
compile "com.android.support:cardview-v7:$androidSupportVersion"
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile files('libs/volley.jar')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation files('libs/volley.jar')
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.support.v13.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.legacy.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;

import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -23,7 +25,7 @@
/**
* An activity representing a single Article detail screen, letting you swipe between articles.
*/
public class ArticleDetailActivity extends ActionBarActivity
public class ArticleDetailActivity extends AppCompatActivity
implements LoaderManager.LoaderCallbacks<Cursor> {

private Cursor mCursor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import java.util.GregorianCalendar;

import android.os.Bundle;
import android.support.v4.app.ShareCompat;
import android.support.v7.graphics.Palette;
import androidx.core.app.ShareCompat;
import androidx.palette.graphics.Palette;
import android.text.Html;
import android.text.format.DateUtils;
import android.text.method.LinkMovementMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
import android.content.Loader;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import androidx.appcompat.widget.Toolbar;
import android.text.Html;
import android.text.format.DateUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
Expand All @@ -38,7 +37,7 @@
* touched, lead to a {@link ArticleDetailActivity} representing item details. On tablets, the
* activity presents a grid of items as cards.
*/
public class ArticleListActivity extends ActionBarActivity implements
public class ArticleListActivity extends AppCompatActivity implements
LoaderManager.LoaderCallbacks<Cursor> {

private static final String TAG = ArticleListActivity.class.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;

public class DividerItemDecoration extends RecyclerView.ItemDecoration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import androidx.collection.LruCache;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
Expand Down
2 changes: 1 addition & 1 deletion XYZReader/src/main/res/layout/activity_article_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Expand Down
10 changes: 5 additions & 5 deletions XYZReader/src/main/res/layout/activity_article_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v4.widget.SwipeRefreshLayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -19,7 +19,7 @@
android:paddingLeft="@dimen/list_side_margin"
android:paddingRight="@dimen/list_side_margin"
android:paddingBottom="28dp" />
</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

<FrameLayout
android:id="@+id/toolbar_container"
Expand All @@ -28,7 +28,7 @@
android:background="?colorPrimary"
android:elevation="8dp">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_marginLeft="@dimen/list_toolbar_side_margin"
Expand All @@ -43,7 +43,7 @@
android:src="@drawable/logo"
android:contentDescription="@string/app_name" />

</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>
</FrameLayout>

</FrameLayout>
4 changes: 2 additions & 2 deletions XYZReader/src/main/res/layout/list_item_article.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -48,4 +48,4 @@
android:ellipsize="end" />
</LinearLayout>

</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:4.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}

ext {
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Mar 26 16:58:07 PDT 2017
#Thu Sep 10 13:09:33 BST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip