Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidX and AppCompatActivity migration #947

Merged
merged 3 commits into from
Jul 28, 2020
Merged
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
5 changes: 5 additions & 0 deletions app/assets/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
</head>
<body>
<h1>What's new</h1>
<h2>v2.1.0.1</h2>
<p>
<ul>
<li>#947 AndroidX and AppCompatActivity migration</li>
</ul>
<h2>v2.1.0.0</h2>
<p>
<ul>
Expand Down
4 changes: 1 addition & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ dependencies {
latestWearApp project(':wear')
}

//noinspection GradleCompatible
latestImplementation "com.android.support:design:${rootProject.ext.supportLibrary}"
latestImplementation "com.android.support:cardview-v7:${rootProject.ext.supportLibrary}"
latestImplementation "com.google.android.material:material:1.1.0"
if (rootProject.ext.enableWear) {
//noinspection GradleDependency
latestImplementation "com.google.android.gms:play-services-wearable:${rootProject.ext.googlePlayServicesVersion}"
Expand Down
3 changes: 2 additions & 1 deletion app/proguard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,5 @@
-dontwarn org.xmlpull.v1.**
-dontnote org.xmlpull.v1.**
-keep class org.xmlpull.** { *; }
-keepclassmembers class org.xmlpull.** { *; }
-keepclassmembers class org.xmlpull.** { *; }
-keep class androidx.core.app.CoreComponentFactory { *; }
3 changes: 2 additions & 1 deletion app/res/layout-v14/feed_widget.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -10,7 +11,7 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:id="@+id/widget_app_icon"
android:src="@drawable/ic_feed_widget"
app:srcCompat="@drawable/ic_feed_widget"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
Expand Down
4 changes: 2 additions & 2 deletions app/res/layout-v15/feed_row_activity.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp">

<include layout="@layout/feed_row_contents" />

</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
4 changes: 2 additions & 2 deletions app/res/layout-v15/history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/feed_actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -48,7 +48,7 @@

</LinearLayout>

<android.support.design.widget.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/history_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/res/layout-v15/start_fab.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.FloatingActionButton xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.floatingactionbutton.FloatingActionButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/start_button"
android:layout_width="wrap_content"
Expand Down
7 changes: 4 additions & 3 deletions app/res/layout/account_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
Expand Down Expand Up @@ -42,7 +43,7 @@

<ImageView
android:id="@+id/account_list_icon"
android:src="@drawable/circle_40dp"
app:srcCompat="@drawable/circle_40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
Expand Down Expand Up @@ -70,7 +71,7 @@
android:minWidth="48dp"
android:minHeight="48dp" />

<android.support.v7.widget.SwitchCompat
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/account_list_feed"
android:layout_width="wrap_content"
android:layout_height="match_parent"
Expand All @@ -80,7 +81,7 @@
android:minHeight="48dp"
android:contentDescription="@string/feed" />

<android.support.v7.widget.SwitchCompat
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/account_list_upload"
android:layout_width="wrap_content"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/res/layout/detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
android:orientation="vertical"
tools:ignore="UnusedAttribute">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Expand Down
2 changes: 1 addition & 1 deletion app/res/layout/detail_nomap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
android:orientation="vertical"
tools:ignore="UnusedAttribute">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Expand Down
2 changes: 1 addition & 1 deletion app/res/layout/feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:layout_height="fill_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/feed_actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/res/layout/history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/feed_actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
4 changes: 2 additions & 2 deletions app/res/layout/start.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:orientation="vertical"
tools:context=".view.StartActivity">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/start_actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -41,7 +41,7 @@
android:minHeight="48dp"
android:spinnerMode="dropdown" />

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

<TabHost
android:id="@+id/tabhost_start"
Expand Down
6 changes: 3 additions & 3 deletions app/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<item name="android:ellipsize">marquee</item>
<item name="android:singleLine">true</item>
<item name="android:tabStripEnabled">false</item>
<item name="android:divider">@null</item>
<item name="divider">@null</item>
<item name="android:gravity">fill_horizontal|center_vertical</item>
</style>

Expand All @@ -73,7 +73,7 @@
</style>

<style name="AppBarStatisticsText">
<item name="android:fontFamily" tools:ignore="NewApi">@string/fontFamily_medium</item>
<item name="fontFamily" tools:ignore="NewApi">@string/fontFamily_medium</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@android:color/white</item>
</style>
Expand All @@ -89,7 +89,7 @@
</style>

<style name="ListCategoryHeading">
<item name="android:fontFamily" tools:ignore="NewApi">@string/fontFamily_medium</item>
<item name="fontFamily" tools:ignore="NewApi">@string/fontFamily_medium</item>
<item name="android:textColor">@color/colorAccent</item>
<item name="android:textSize">14sp</item>
</style>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/org/runnerup/content/ActivityProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;
import android.util.Pair;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/org/runnerup/content/WorkoutFileProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import android.database.Cursor;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

import org.runnerup.BuildConfig;
import org.runnerup.workout.WorkoutSerializer;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/org/runnerup/db/DBHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.runnerup.db;

import androidx.appcompat.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Context;
Expand All @@ -25,7 +26,6 @@
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.AsyncTask;
import android.support.v7.app.AlertDialog;
import android.util.Log;

import org.json.JSONException;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/org/runnerup/db/entities/LocationEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

import org.runnerup.common.util.Constants;

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/org/runnerup/export/DefaultSynchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

package org.runnerup.export;

import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import android.util.Pair;

import androidx.appcompat.app.AppCompatActivity;

import org.runnerup.R;
import org.runnerup.common.util.Constants;
import org.runnerup.db.DBHelper;
Expand Down Expand Up @@ -87,7 +88,8 @@ public String getAuthConfig() {
return null;
}

public Intent getAuthIntent(Activity a) {
@Override
public Intent getAuthIntent(AppCompatActivity a) {
return null;
}

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/org/runnerup/export/DropboxSynchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.runnerup.export;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import org.json.JSONException;
import org.json.JSONObject;
import org.runnerup.BuildConfig;
Expand Down Expand Up @@ -155,13 +156,13 @@ public String getAuthConfig() {
}

@Override
public Intent getAuthIntent(Activity activity) {
public Intent getAuthIntent(AppCompatActivity activity) {
return OAuth2Activity.getIntent(activity, this);
}

@Override
public Status getAuthResult(int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (resultCode == AppCompatActivity.RESULT_OK) {
try {
String authConfig = data.getStringExtra(DB.ACCOUNT.AUTH_CONFIG);
JSONObject obj = new JSONObject(authConfig);
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/org/runnerup/export/FacebookSynchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

package org.runnerup.export;

import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import org.json.JSONException;
import org.json.JSONObject;
import org.runnerup.R;
Expand Down Expand Up @@ -188,13 +189,13 @@ public String getAuthConfig() {
}

@Override
public Intent getAuthIntent(Activity activity) {
public Intent getAuthIntent(AppCompatActivity activity) {
return OAuth2Activity.getIntent(activity, this);
}

@Override
public Status getAuthResult(int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (resultCode == AppCompatActivity.RESULT_OK) {
try {
String authConfig = data.getStringExtra(DB.ACCOUNT.AUTH_CONFIG);
Uri uri = Uri.parse("https://keso?" + authConfig);
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/org/runnerup/export/RunKeeperSynchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.runnerup.export;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
Expand All @@ -30,6 +29,8 @@
import android.text.TextUtils;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -220,13 +221,13 @@ public String getAuthConfig() {
}

@Override
public Intent getAuthIntent(Activity activity) {
public Intent getAuthIntent(AppCompatActivity activity) {
return OAuth2Activity.getIntent(activity, this);
}

@Override
public Status getAuthResult(int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (resultCode == AppCompatActivity.RESULT_OK) {
String authConfig = data.getStringExtra(DB.ACCOUNT.AUTH_CONFIG);
try {
JSONObject obj = new JSONObject(authConfig);
Expand Down
Loading