From 60d968d367211488b8e1ec7b7a1d92df67e2d760 Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Fri, 10 May 2019 13:24:02 +0200 Subject: [PATCH] Migrate to androidx --- app/build.gradle | 28 +++++++++---------- .../readrops/app/ExampleInstrumentedTest.java | 4 +-- .../app/activities/AddFeedActivity.java | 20 ++++++------- .../readrops/app/activities/ItemActivity.java | 12 ++++---- .../readrops/app/activities/MainActivity.java | 24 ++++++++-------- .../app/activities/ManageFeedsActivity.java | 27 +++++++----------- .../com/readrops/app/database/Converters.java | 3 +- .../com/readrops/app/database/Database.java | 12 ++++---- .../app/database/ItemsListQueryBuilder.java | 6 ++-- .../readrops/app/database/dao/FeedDao.java | 10 +++---- .../readrops/app/database/dao/FolderDao.java | 10 +++---- .../readrops/app/database/dao/ItemDao.java | 18 ++++++------ .../readrops/app/database/entities/Feed.java | 8 +++--- .../app/database/entities/Folder.java | 6 ++-- .../readrops/app/database/entities/Item.java | 6 ++-- .../app/database/pojo/FeedWithFolder.java | 2 +- .../app/database/pojo/ItemWithFeed.java | 6 ++-- .../app/repositories/ARepository.java | 2 +- .../app/repositories/LocalFeedRepository.java | 4 +-- .../com/readrops/app/utils/DrawerManager.java | 10 ++----- .../app/utils/FeedInsertionResult.java | 6 ++-- .../com/readrops/app/utils/GlideModule.java | 6 +--- .../com/readrops/app/utils/ParsingResult.java | 2 +- .../java/com/readrops/app/utils/Utils.java | 5 ++-- .../app/viewmodels/AddFeedsViewModel.java | 5 ++-- .../app/viewmodels/ItemViewModel.java | 6 ++-- .../app/viewmodels/MainViewModel.java | 27 +++++++++--------- .../app/viewmodels/ManageFeedsViewModel.java | 6 ++-- .../readrops/app/views/EditFeedDialog.java | 15 ++++------ .../com/readrops/app/views/FeedsAdapter.java | 14 +++++----- .../app/views/MainItemListAdapter.java | 18 ++++++------ app/src/main/res/layout/activity_add_feed.xml | 22 +++++++-------- app/src/main/res/layout/activity_item.xml | 20 ++++++------- app/src/main/res/layout/activity_main.xml | 12 ++++---- .../main/res/layout/activity_manage_feeds.xml | 8 +++--- app/src/main/res/layout/add_feed_layout.xml | 12 ++++---- app/src/main/res/layout/app_bar_main.xml | 8 +++--- app/src/main/res/layout/edit_feed_layout.xml | 16 +++++------ app/src/main/res/layout/feed_layout.xml | 4 +-- gradle.properties | 2 ++ readropslibrary/build.gradle | 10 ++++--- .../ExampleInstrumentedTest.java | 4 +-- 42 files changed, 208 insertions(+), 238 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0b2eab87..1dc989c5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,7 +8,7 @@ android { targetSdkVersion 28 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -29,16 +29,16 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':readropslibrary') - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:design: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.0.2' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.palette:palette:1.0.0' + implementation 'androidx.recyclerview:recyclerview:1.0.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.github.bumptech.glide:glide:4.8.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' @@ -48,11 +48,11 @@ dependencies { transitive = false } - implementation 'android.arch.lifecycle:extensions:1.1.1' - implementation "android.arch.persistence.room:runtime:1.1.1" - annotationProcessor "android.arch.persistence.room:compiler:1.1.1" - implementation 'android.arch.paging:runtime:1.0.1' - implementation 'android.arch.paging:common:1.0.1' + implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' + implementation 'androidx.room:room-runtime:2.0.0' + annotationProcessor 'androidx.room:room-compiler:2.0.0' + implementation 'androidx.paging:paging-runtime:2.1.0' + implementation 'androidx.paging:paging-common:2.1.0' implementation "joda-time:joda-time:2.9.9" diff --git a/app/src/androidTest/java/com/readrops/app/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/readrops/app/ExampleInstrumentedTest.java index ff959844..22adf061 100644 --- a/app/src/androidTest/java/com/readrops/app/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/readrops/app/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package com.readrops.app; 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; diff --git a/app/src/main/java/com/readrops/app/activities/AddFeedActivity.java b/app/src/main/java/com/readrops/app/activities/AddFeedActivity.java index 1ab8e014..0c04c666 100644 --- a/app/src/main/java/com/readrops/app/activities/AddFeedActivity.java +++ b/app/src/main/java/com/readrops/app/activities/AddFeedActivity.java @@ -1,29 +1,27 @@ package com.readrops.app.activities; import android.annotation.SuppressLint; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProviders; import android.content.Intent; -import android.support.annotation.NonNull; -import android.support.design.widget.TextInputEditText; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.NonNull; +import com.google.android.material.textfield.TextInputEditText; +import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.helper.ItemTouchHelper; -import android.util.Log; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.ItemTouchHelper; + import android.util.Patterns; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.widget.Button; -import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.mikepenz.fastadapter.FastAdapter; import com.mikepenz.fastadapter.adapters.ItemAdapter; -import com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil; import com.readrops.app.R; import com.readrops.app.database.entities.Feed; import com.readrops.app.utils.FeedInsertionResult; @@ -34,9 +32,7 @@ import com.readrops.app.viewmodels.AddFeedsViewModel; import java.util.ArrayList; import java.util.List; -import io.reactivex.SingleObserver; import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.Disposable; import io.reactivex.observers.DisposableSingleObserver; import io.reactivex.schedulers.Schedulers; diff --git a/app/src/main/java/com/readrops/app/activities/ItemActivity.java b/app/src/main/java/com/readrops/app/activities/ItemActivity.java index 47e478fe..5ddd7355 100644 --- a/app/src/main/java/com/readrops/app/activities/ItemActivity.java +++ b/app/src/main/java/com/readrops/app/activities/ItemActivity.java @@ -1,16 +1,16 @@ package com.readrops.app.activities; -import android.arch.lifecycle.ViewModelProvider; +import androidx.lifecycle.ViewModelProvider; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; -import android.support.design.widget.AppBarLayout; -import android.support.design.widget.CollapsingToolbarLayout; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; diff --git a/app/src/main/java/com/readrops/app/activities/MainActivity.java b/app/src/main/java/com/readrops/app/activities/MainActivity.java index a6104f06..69ab8da5 100644 --- a/app/src/main/java/com/readrops/app/activities/MainActivity.java +++ b/app/src/main/java/com/readrops/app/activities/MainActivity.java @@ -1,21 +1,21 @@ package com.readrops.app.activities; -import android.arch.lifecycle.ViewModelProviders; -import android.arch.paging.PagedList; +import androidx.lifecycle.ViewModelProviders; +import androidx.paging.PagedList; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.widget.DrawerLayout; -import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.DividerItemDecoration; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; -import android.support.v7.widget.helper.ItemTouchHelper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.DividerItemDecoration; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.Toolbar; +import androidx.recyclerview.widget.ItemTouchHelper; import android.util.Log; import android.view.ActionMode; import android.view.Menu; diff --git a/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java b/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java index 3963948c..0ca776c5 100644 --- a/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java +++ b/app/src/main/java/com/readrops/app/activities/ManageFeedsActivity.java @@ -1,28 +1,24 @@ package com.readrops.app.activities; -import android.arch.lifecycle.ViewModelProvider; +import androidx.lifecycle.ViewModelProvider; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.Vibrator; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentTransaction; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.util.DiffUtil; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.helper.ItemTouchHelper; -import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentTransaction; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.DiffUtil; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.ItemTouchHelper; + import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; -import com.mikepenz.fastadapter.FastAdapter; -import com.mikepenz.fastadapter.adapters.ModelAdapter; -import com.mikepenz.fastadapter.commons.utils.DiffCallback; -import com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil; import com.readrops.app.database.entities.Folder; import com.readrops.app.views.EditFeedDialog; import com.readrops.app.views.FeedsAdapter; @@ -30,9 +26,6 @@ import com.readrops.app.viewmodels.ManageFeedsViewModel; import com.readrops.app.R; import com.readrops.app.database.pojo.FeedWithFolder; -import java.util.ArrayList; -import java.util.List; - import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.observers.DisposableCompletableObserver; import io.reactivex.schedulers.Schedulers; diff --git a/app/src/main/java/com/readrops/app/database/Converters.java b/app/src/main/java/com/readrops/app/database/Converters.java index e78c5f4d..496503a9 100644 --- a/app/src/main/java/com/readrops/app/database/Converters.java +++ b/app/src/main/java/com/readrops/app/database/Converters.java @@ -1,8 +1,7 @@ package com.readrops.app.database; -import android.arch.persistence.room.TypeConverter; +import androidx.room.TypeConverter; -import org.joda.time.DateTimeFieldType; import org.joda.time.LocalDateTime; public class Converters { diff --git a/app/src/main/java/com/readrops/app/database/Database.java b/app/src/main/java/com/readrops/app/database/Database.java index 35116818..c93613bc 100644 --- a/app/src/main/java/com/readrops/app/database/Database.java +++ b/app/src/main/java/com/readrops/app/database/Database.java @@ -1,11 +1,11 @@ package com.readrops.app.database; -import android.arch.persistence.db.SupportSQLiteDatabase; -import android.arch.persistence.room.Room; -import android.arch.persistence.room.RoomDatabase; -import android.arch.persistence.room.TypeConverters; +import androidx.sqlite.db.SupportSQLiteDatabase; +import androidx.room.Room; +import androidx.room.RoomDatabase; +import androidx.room.TypeConverters; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.readrops.app.database.dao.FeedDao; import com.readrops.app.database.dao.FolderDao; @@ -15,7 +15,7 @@ import com.readrops.app.database.entities.Folder; import com.readrops.app.database.entities.Item; -@android.arch.persistence.room.Database(entities = {Feed.class, Item.class, Folder.class}, version = 1, exportSchema = false) +@androidx.room.Database(entities = {Feed.class, Item.class, Folder.class}, version = 1, exportSchema = false) @TypeConverters({Converters.class}) public abstract class Database extends RoomDatabase { diff --git a/app/src/main/java/com/readrops/app/database/ItemsListQueryBuilder.java b/app/src/main/java/com/readrops/app/database/ItemsListQueryBuilder.java index 4257afb4..9194de40 100644 --- a/app/src/main/java/com/readrops/app/database/ItemsListQueryBuilder.java +++ b/app/src/main/java/com/readrops/app/database/ItemsListQueryBuilder.java @@ -1,9 +1,7 @@ package com.readrops.app.database; -import android.arch.persistence.db.SupportSQLiteQuery; -import android.arch.persistence.db.SupportSQLiteQueryBuilder; -import android.database.sqlite.SQLiteQuery; -import android.database.sqlite.SQLiteQueryBuilder; +import androidx.sqlite.db.SupportSQLiteQuery; +import androidx.sqlite.db.SupportSQLiteQueryBuilder; import com.readrops.app.activities.MainActivity; import com.readrops.app.viewmodels.MainViewModel; diff --git a/app/src/main/java/com/readrops/app/database/dao/FeedDao.java b/app/src/main/java/com/readrops/app/database/dao/FeedDao.java index 797349d5..9da989bc 100644 --- a/app/src/main/java/com/readrops/app/database/dao/FeedDao.java +++ b/app/src/main/java/com/readrops/app/database/dao/FeedDao.java @@ -1,11 +1,11 @@ package com.readrops.app.database.dao; -import android.arch.lifecycle.LiveData; -import android.arch.persistence.room.Dao; -import android.arch.persistence.room.Insert; -import android.arch.persistence.room.Query; -import android.arch.persistence.room.Update; +import androidx.lifecycle.LiveData; +import androidx.room.Dao; +import androidx.room.Insert; +import androidx.room.Query; +import androidx.room.Update; import com.readrops.app.database.entities.Feed; import com.readrops.app.database.pojo.FeedWithFolder; diff --git a/app/src/main/java/com/readrops/app/database/dao/FolderDao.java b/app/src/main/java/com/readrops/app/database/dao/FolderDao.java index eb2982b2..aa37ca74 100644 --- a/app/src/main/java/com/readrops/app/database/dao/FolderDao.java +++ b/app/src/main/java/com/readrops/app/database/dao/FolderDao.java @@ -1,10 +1,10 @@ package com.readrops.app.database.dao; -import android.arch.lifecycle.LiveData; -import android.arch.persistence.room.Dao; -import android.arch.persistence.room.Delete; -import android.arch.persistence.room.Insert; -import android.arch.persistence.room.Query; +import androidx.lifecycle.LiveData; +import androidx.room.Dao; +import androidx.room.Delete; +import androidx.room.Insert; +import androidx.room.Query; import com.readrops.app.database.entities.Folder; diff --git a/app/src/main/java/com/readrops/app/database/dao/ItemDao.java b/app/src/main/java/com/readrops/app/database/dao/ItemDao.java index 0ee1d6b1..f09f75cd 100644 --- a/app/src/main/java/com/readrops/app/database/dao/ItemDao.java +++ b/app/src/main/java/com/readrops/app/database/dao/ItemDao.java @@ -1,22 +1,20 @@ package com.readrops.app.database.dao; -import android.arch.lifecycle.LiveData; -import android.arch.paging.DataSource; -import android.arch.paging.PageKeyedDataSource; -import android.arch.persistence.db.SupportSQLiteQuery; -import android.arch.persistence.room.Dao; -import android.arch.persistence.room.Insert; -import android.arch.persistence.room.Query; -import android.arch.persistence.room.RawQuery; +import androidx.lifecycle.LiveData; +import androidx.paging.DataSource; +import androidx.paging.PageKeyedDataSource; +import androidx.sqlite.db.SupportSQLiteQuery; +import androidx.room.Dao; +import androidx.room.Insert; +import androidx.room.Query; +import androidx.room.RawQuery; import com.readrops.app.database.entities.Feed; import com.readrops.app.database.entities.Folder; import com.readrops.app.database.pojo.ItemWithFeed; import com.readrops.app.database.entities.Item; -import java.util.List; - @Dao public interface ItemDao { diff --git a/app/src/main/java/com/readrops/app/database/entities/Feed.java b/app/src/main/java/com/readrops/app/database/entities/Feed.java index 311872ee..2051f7e3 100644 --- a/app/src/main/java/com/readrops/app/database/entities/Feed.java +++ b/app/src/main/java/com/readrops/app/database/entities/Feed.java @@ -1,11 +1,11 @@ package com.readrops.app.database.entities; -import android.arch.persistence.room.*; +import androidx.room.*; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.ColorInt; -import android.support.annotation.Nullable; +import androidx.annotation.ColorInt; +import androidx.annotation.Nullable; import com.readrops.readropslibrary.localfeed.atom.ATOMFeed; import com.readrops.readropslibrary.localfeed.json.JSONFeed; @@ -14,7 +14,7 @@ import com.readrops.readropslibrary.localfeed.rss.RSSFeed; import org.jsoup.Jsoup; -import static android.arch.persistence.room.ForeignKey.NO_ACTION; +import static androidx.room.ForeignKey.NO_ACTION; @Entity(foreignKeys = @ForeignKey(entity = Folder.class, parentColumns = "id", childColumns = "folder_id", onDelete = ForeignKey.SET_NULL)) public class Feed implements Parcelable { diff --git a/app/src/main/java/com/readrops/app/database/entities/Folder.java b/app/src/main/java/com/readrops/app/database/entities/Folder.java index f954c3aa..16fe291e 100644 --- a/app/src/main/java/com/readrops/app/database/entities/Folder.java +++ b/app/src/main/java/com/readrops/app/database/entities/Folder.java @@ -1,8 +1,8 @@ package com.readrops.app.database.entities; -import android.arch.persistence.room.Entity; -import android.arch.persistence.room.Ignore; -import android.arch.persistence.room.PrimaryKey; +import androidx.room.Entity; +import androidx.room.Ignore; +import androidx.room.PrimaryKey; import android.os.Parcel; import android.os.Parcelable; diff --git a/app/src/main/java/com/readrops/app/database/entities/Item.java b/app/src/main/java/com/readrops/app/database/entities/Item.java index 917b0469..63fb3346 100644 --- a/app/src/main/java/com/readrops/app/database/entities/Item.java +++ b/app/src/main/java/com/readrops/app/database/entities/Item.java @@ -1,6 +1,6 @@ package com.readrops.app.database.entities; -import android.arch.persistence.room.*; +import androidx.room.*; import com.readrops.app.utils.DateUtils; import com.readrops.app.utils.Utils; @@ -10,17 +10,15 @@ import com.readrops.readropslibrary.localfeed.rss.RSSEnclosure; import com.readrops.readropslibrary.localfeed.rss.RSSItem; import com.readrops.readropslibrary.localfeed.rss.RSSMediaContent; -import org.joda.time.DateTime; import org.joda.time.LocalDateTime; import org.jsoup.Jsoup; import java.text.ParseException; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.regex.Pattern; -import static android.arch.persistence.room.ForeignKey.CASCADE; +import static androidx.room.ForeignKey.CASCADE; @Entity diff --git a/app/src/main/java/com/readrops/app/database/pojo/FeedWithFolder.java b/app/src/main/java/com/readrops/app/database/pojo/FeedWithFolder.java index 8cd06dc1..afbab27f 100644 --- a/app/src/main/java/com/readrops/app/database/pojo/FeedWithFolder.java +++ b/app/src/main/java/com/readrops/app/database/pojo/FeedWithFolder.java @@ -1,6 +1,6 @@ package com.readrops.app.database.pojo; -import android.arch.persistence.room.Embedded; +import androidx.room.Embedded; import android.os.Parcel; import android.os.Parcelable; diff --git a/app/src/main/java/com/readrops/app/database/pojo/ItemWithFeed.java b/app/src/main/java/com/readrops/app/database/pojo/ItemWithFeed.java index 617068db..fff6ff01 100644 --- a/app/src/main/java/com/readrops/app/database/pojo/ItemWithFeed.java +++ b/app/src/main/java/com/readrops/app/database/pojo/ItemWithFeed.java @@ -1,8 +1,8 @@ package com.readrops.app.database.pojo; -import android.arch.persistence.room.ColumnInfo; -import android.arch.persistence.room.Embedded; -import android.support.annotation.ColorInt; +import androidx.room.ColumnInfo; +import androidx.room.Embedded; +import androidx.annotation.ColorInt; import com.readrops.app.database.entities.Folder; import com.readrops.app.database.entities.Item; diff --git a/app/src/main/java/com/readrops/app/repositories/ARepository.java b/app/src/main/java/com/readrops/app/repositories/ARepository.java index 03f316f0..3679df34 100644 --- a/app/src/main/java/com/readrops/app/repositories/ARepository.java +++ b/app/src/main/java/com/readrops/app/repositories/ARepository.java @@ -2,7 +2,7 @@ package com.readrops.app.repositories; import android.app.Application; import android.graphics.Bitmap; -import android.support.v7.graphics.Palette; +import androidx.palette.graphics.Palette; import android.util.Patterns; import com.readrops.app.database.pojo.FeedWithFolder; diff --git a/app/src/main/java/com/readrops/app/repositories/LocalFeedRepository.java b/app/src/main/java/com/readrops/app/repositories/LocalFeedRepository.java index 7ba1c713..81a44ed9 100644 --- a/app/src/main/java/com/readrops/app/repositories/LocalFeedRepository.java +++ b/app/src/main/java/com/readrops/app/repositories/LocalFeedRepository.java @@ -2,8 +2,8 @@ package com.readrops.app.repositories; import android.accounts.NetworkErrorException; import android.app.Application; -import android.arch.paging.PageKeyedDataSource; -import android.support.annotation.Nullable; +import androidx.paging.PageKeyedDataSource; +import androidx.annotation.Nullable; import com.readrops.app.database.entities.Folder; import com.readrops.app.database.pojo.FeedWithFolder; diff --git a/app/src/main/java/com/readrops/app/utils/DrawerManager.java b/app/src/main/java/com/readrops/app/utils/DrawerManager.java index a1d8735c..a58e8417 100644 --- a/app/src/main/java/com/readrops/app/utils/DrawerManager.java +++ b/app/src/main/java/com/readrops/app/utils/DrawerManager.java @@ -1,14 +1,8 @@ package com.readrops.app.utils; import android.content.Context; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffColorFilter; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.GradientDrawable; -import android.graphics.drawable.ShapeDrawable; -import android.graphics.drawable.shapes.OvalShape; -import android.graphics.drawable.shapes.Shape; -import android.support.annotation.ColorInt; + +import androidx.annotation.ColorInt; import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.model.DividerDrawerItem; diff --git a/app/src/main/java/com/readrops/app/utils/FeedInsertionResult.java b/app/src/main/java/com/readrops/app/utils/FeedInsertionResult.java index b10773ec..5e0b1c93 100644 --- a/app/src/main/java/com/readrops/app/utils/FeedInsertionResult.java +++ b/app/src/main/java/com/readrops/app/utils/FeedInsertionResult.java @@ -1,8 +1,8 @@ package com.readrops.app.utils; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; + import android.view.View; import android.widget.ImageView; import android.widget.TextView; diff --git a/app/src/main/java/com/readrops/app/utils/GlideModule.java b/app/src/main/java/com/readrops/app/utils/GlideModule.java index 558bcff0..7d765a40 100644 --- a/app/src/main/java/com/readrops/app/utils/GlideModule.java +++ b/app/src/main/java/com/readrops/app/utils/GlideModule.java @@ -1,12 +1,8 @@ package com.readrops.app.utils; -import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; -import com.bumptech.glide.GlideBuilder; import com.bumptech.glide.module.AppGlideModule; -import com.bumptech.glide.request.RequestOptions; -import com.readrops.app.R; @com.bumptech.glide.annotation.GlideModule public class GlideModule extends AppGlideModule { diff --git a/app/src/main/java/com/readrops/app/utils/ParsingResult.java b/app/src/main/java/com/readrops/app/utils/ParsingResult.java index eb184c96..ee1a97bb 100644 --- a/app/src/main/java/com/readrops/app/utils/ParsingResult.java +++ b/app/src/main/java/com/readrops/app/utils/ParsingResult.java @@ -1,6 +1,6 @@ package com.readrops.app.utils; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; diff --git a/app/src/main/java/com/readrops/app/utils/Utils.java b/app/src/main/java/com/readrops/app/utils/Utils.java index 2575ff78..2630871e 100644 --- a/app/src/main/java/com/readrops/app/utils/Utils.java +++ b/app/src/main/java/com/readrops/app/utils/Utils.java @@ -1,7 +1,6 @@ package com.readrops.app.utils; import android.app.Activity; -import android.app.Application; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -13,8 +12,8 @@ import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; import android.os.Handler; import android.os.Looper; -import android.support.annotation.ColorInt; -import android.support.annotation.NonNull; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; import android.util.DisplayMetrics; import android.widget.Toast; diff --git a/app/src/main/java/com/readrops/app/viewmodels/AddFeedsViewModel.java b/app/src/main/java/com/readrops/app/viewmodels/AddFeedsViewModel.java index 084edd3a..120e2cb6 100644 --- a/app/src/main/java/com/readrops/app/viewmodels/AddFeedsViewModel.java +++ b/app/src/main/java/com/readrops/app/viewmodels/AddFeedsViewModel.java @@ -1,10 +1,9 @@ package com.readrops.app.viewmodels; import android.app.Application; -import android.arch.lifecycle.AndroidViewModel; -import android.support.annotation.NonNull; +import androidx.lifecycle.AndroidViewModel; +import androidx.annotation.NonNull; -import com.readrops.app.database.entities.Feed; import com.readrops.app.repositories.LocalFeedRepository; import com.readrops.app.utils.FeedInsertionResult; import com.readrops.app.utils.HtmlParser; diff --git a/app/src/main/java/com/readrops/app/viewmodels/ItemViewModel.java b/app/src/main/java/com/readrops/app/viewmodels/ItemViewModel.java index b89b4c44..d79e2ccd 100644 --- a/app/src/main/java/com/readrops/app/viewmodels/ItemViewModel.java +++ b/app/src/main/java/com/readrops/app/viewmodels/ItemViewModel.java @@ -1,9 +1,9 @@ package com.readrops.app.viewmodels; import android.app.Application; -import android.arch.lifecycle.AndroidViewModel; -import android.arch.lifecycle.LiveData; -import android.support.annotation.NonNull; +import androidx.lifecycle.AndroidViewModel; +import androidx.lifecycle.LiveData; +import androidx.annotation.NonNull; import com.readrops.app.database.Database; import com.readrops.app.database.dao.ItemDao; diff --git a/app/src/main/java/com/readrops/app/viewmodels/MainViewModel.java b/app/src/main/java/com/readrops/app/viewmodels/MainViewModel.java index 39daa395..7aee5a4c 100644 --- a/app/src/main/java/com/readrops/app/viewmodels/MainViewModel.java +++ b/app/src/main/java/com/readrops/app/viewmodels/MainViewModel.java @@ -1,18 +1,18 @@ package com.readrops.app.viewmodels; import android.app.Application; -import android.arch.core.util.Function; -import android.arch.lifecycle.AndroidViewModel; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.MediatorLiveData; -import android.arch.lifecycle.Observer; -import android.arch.lifecycle.Transformations; -import android.arch.paging.DataSource; -import android.arch.paging.LivePagedListBuilder; -import android.arch.paging.PagedList; -import android.arch.persistence.db.SupportSQLiteQuery; -import android.support.annotation.NonNull; +import androidx.arch.core.util.Function; +import androidx.lifecycle.AndroidViewModel; +import androidx.lifecycle.LifecycleOwner; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.MediatorLiveData; +import androidx.lifecycle.Observer; +import androidx.lifecycle.Transformations; +import androidx.paging.DataSource; +import androidx.paging.LivePagedListBuilder; +import androidx.paging.PagedList; +import androidx.sqlite.db.SupportSQLiteQuery; +import androidx.annotation.NonNull; import com.readrops.app.activities.MainActivity; import com.readrops.app.database.Database; @@ -21,6 +21,7 @@ import com.readrops.app.database.entities.Feed; import com.readrops.app.database.entities.Folder; import com.readrops.app.database.pojo.ItemWithFeed; import com.readrops.app.repositories.LocalFeedRepository; +import com.readrops.app.repositories.ARepository; import java.util.ArrayList; import java.util.List; @@ -35,7 +36,7 @@ public class MainViewModel extends AndroidViewModel { private MediatorLiveData> itemsWithFeed; private LiveData> lastFetch; - private LocalFeedRepository repository; + private ARepository repository; private Database db; private ItemsListQueryBuilder queryBuilder; diff --git a/app/src/main/java/com/readrops/app/viewmodels/ManageFeedsViewModel.java b/app/src/main/java/com/readrops/app/viewmodels/ManageFeedsViewModel.java index d2e699f2..f51edb4a 100644 --- a/app/src/main/java/com/readrops/app/viewmodels/ManageFeedsViewModel.java +++ b/app/src/main/java/com/readrops/app/viewmodels/ManageFeedsViewModel.java @@ -1,9 +1,9 @@ package com.readrops.app.viewmodels; import android.app.Application; -import android.arch.lifecycle.AndroidViewModel; -import android.arch.lifecycle.LiveData; -import android.support.annotation.NonNull; +import androidx.lifecycle.AndroidViewModel; +import androidx.lifecycle.LiveData; +import androidx.annotation.NonNull; import com.readrops.app.database.Database; import com.readrops.app.database.entities.Folder; diff --git a/app/src/main/java/com/readrops/app/views/EditFeedDialog.java b/app/src/main/java/com/readrops/app/views/EditFeedDialog.java index 15d9a64f..fd448857 100644 --- a/app/src/main/java/com/readrops/app/views/EditFeedDialog.java +++ b/app/src/main/java/com/readrops/app/views/EditFeedDialog.java @@ -2,13 +2,13 @@ package com.readrops.app.views; import android.app.AlertDialog; import android.app.Dialog; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProviders; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.design.widget.TextInputEditText; -import android.support.v4.app.DialogFragment; -import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import com.google.android.material.textfield.TextInputEditText; +import androidx.fragment.app.DialogFragment; + import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -21,11 +21,8 @@ import com.readrops.app.database.pojo.FeedWithFolder; import com.readrops.app.viewmodels.ManageFeedsViewModel; import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.TreeMap; -import java.util.concurrent.Executors; public class EditFeedDialog extends DialogFragment implements AdapterView.OnItemSelectedListener { diff --git a/app/src/main/java/com/readrops/app/views/FeedsAdapter.java b/app/src/main/java/com/readrops/app/views/FeedsAdapter.java index 004f0ff1..73e21cdf 100644 --- a/app/src/main/java/com/readrops/app/views/FeedsAdapter.java +++ b/app/src/main/java/com/readrops/app/views/FeedsAdapter.java @@ -1,13 +1,13 @@ package com.readrops.app.views; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.recyclerview.extensions.AsyncListDiffer; -import android.support.v7.recyclerview.extensions.ListAdapter; -import android.support.v7.util.DiffUtil; -import android.support.v7.widget.RecyclerView; -import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.AsyncListDiffer; +import androidx.recyclerview.widget.ListAdapter; +import androidx.recyclerview.widget.DiffUtil; +import androidx.recyclerview.widget.RecyclerView; + import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/com/readrops/app/views/MainItemListAdapter.java b/app/src/main/java/com/readrops/app/views/MainItemListAdapter.java index cd4e5323..b268089f 100644 --- a/app/src/main/java/com/readrops/app/views/MainItemListAdapter.java +++ b/app/src/main/java/com/readrops/app/views/MainItemListAdapter.java @@ -1,19 +1,17 @@ package com.readrops.app.views; -import android.arch.paging.PagedListAdapter; +import androidx.paging.PagedListAdapter; import android.content.Context; import android.content.res.Resources; -import android.content.res.TypedArray; -import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.content.ContextCompat; -import android.support.v7.content.res.AppCompatResources; -import android.support.v7.recyclerview.extensions.ListAdapter; -import android.support.v7.util.DiffUtil; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.recyclerview.widget.ListAdapter; +import androidx.recyclerview.widget.DiffUtil; +import androidx.recyclerview.widget.RecyclerView; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; diff --git a/app/src/main/res/layout/activity_add_feed.xml b/app/src/main/res/layout/activity_add_feed.xml index 1e46c61e..b9d248a1 100644 --- a/app/src/main/res/layout/activity_add_feed.xml +++ b/app/src/main/res/layout/activity_add_feed.xml @@ -1,18 +1,18 @@ - - - - - - +