Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5e7c4ed

Browse files
Migrate to AndroidX.
1 parent 7720af7 commit 5e7c4ed

File tree

15 files changed

+48
-46
lines changed

15 files changed

+48
-46
lines changed
146 KB
Binary file not shown.

‎app/build.gradle‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ apply plugin: 'kotlin-android'
55
apply plugin: 'kotlin-android-extensions'
66

77
android {
8-
compileSdkVersion 27
8+
compileSdkVersion 28
99
defaultConfig {
1010
applicationId "com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide"
1111
minSdkVersion 16
1212
//noinspection OldTargetApi
13-
targetSdkVersion 27
13+
targetSdkVersion 28
1414
versionCode 1
1515
versionName "1.0"
16-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
}
1818
buildTypes {
1919
release {
@@ -30,20 +30,20 @@ dependencies {
3030
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3131

3232
//Support
33-
implementation 'com.android.support:appcompat-v7:27.1.1'
34-
implementation 'com.android.support:design:27.1.1'
35-
implementation 'com.android.support:recyclerview-v7:27.1.1'
36-
implementation 'com.android.support:cardview-v7:27.1.1'
33+
implementation 'androidx.appcompat:appcompat:1.0.2'
34+
implementation 'com.google.android.material:material:1.0.0'
35+
implementation 'androidx.recyclerview:recyclerview:1.0.0'
36+
implementation 'androidx.cardview:cardview:1.0.0'
3737

3838
//Architecture Components
39-
implementation "android.arch.lifecycle:extensions:1.1.1"
39+
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
4040

4141
//Paging
42-
implementation "android.arch.paging:runtime:1.0.1"
42+
implementation 'androidx.paging:paging-runtime:2.1.0'
4343

4444
//Networking
45-
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
46-
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
45+
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
46+
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
4747
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
4848

4949
//Rx
@@ -55,6 +55,6 @@ dependencies {
5555

5656
//Testing
5757
testImplementation 'junit:junit:4.12'
58-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
59-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
58+
androidTestImplementation 'androidx.test:runner:1.2.0'
59+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
6060
}

‎app/src/androidTest/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/ExampleInstrumentedTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.support.test.InstrumentationRegistry
4-
import android.support.test.runner.AndroidJUnit4
3+
import androidx.test.InstrumentationRegistry
4+
import androidx.test.runner.AndroidJUnit4
55

66
import org.junit.Test
77
import org.junit.runner.RunWith

‎app/src/main/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/ListFooterViewHolder.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.support.v7.widget.RecyclerView
3+
import androidx.recyclerview.widget.RecyclerView
44
import android.view.LayoutInflater
55
import android.view.View
66
import android.view.View.VISIBLE
77
import android.view.ViewGroup
88
import kotlinx.android.synthetic.main.item_list_footer.view.*
99

10-
class ListFooterViewHolder(view: View) : RecyclerView.ViewHolder(view) {
10+
class ListFooterViewHolder(view: View) : androidx.recyclerview.widget.RecyclerView.ViewHolder(view) {
1111

1212
fun bind(status: State?) {
1313
itemView.progress_bar.visibility = if (status == State.LOADING) VISIBLE else View.INVISIBLE

‎app/src/main/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/NewsDataSource.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.arch.lifecycle.MutableLiveData
4-
import android.arch.paging.PageKeyedDataSource
3+
import androidx.lifecycle.MutableLiveData
4+
import androidx.paging.PageKeyedDataSource
55
import io.reactivex.Completable
66
import io.reactivex.android.schedulers.AndroidSchedulers
77
import io.reactivex.disposables.CompositeDisposable

‎app/src/main/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/NewsDataSourceFactory.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.arch.lifecycle.MutableLiveData
4-
import android.arch.paging.DataSource
3+
import androidx.lifecycle.MutableLiveData
4+
import androidx.paging.DataSource
55
import io.reactivex.disposables.CompositeDisposable
66

77
class NewsDataSourceFactory(

‎app/src/main/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/NewsListActivity.kt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.arch.lifecycle.Observer
4-
import android.arch.lifecycle.ViewModelProviders
3+
import androidx.lifecycle.Observer
4+
import androidx.lifecycle.ViewModelProviders
55
import android.os.Bundle
6-
import android.support.v7.app.AppCompatActivity
7-
import android.support.v7.widget.LinearLayoutManager
6+
import androidx.appcompat.app.AppCompatActivity
7+
import androidx.recyclerview.widget.LinearLayoutManager
88
import android.view.View
99
import android.widget.LinearLayout
1010
import kotlinx.android.synthetic.main.activity_news_list.*
@@ -26,7 +26,7 @@ class NewsListActivity : AppCompatActivity() {
2626

2727
private fun initAdapter() {
2828
newsListAdapter = NewsListAdapter { viewModel.retry() }
29-
recycler_view.layoutManager = LinearLayoutManager(this, LinearLayout.VERTICAL, false)
29+
recycler_view.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this, LinearLayout.VERTICAL, false)
3030
recycler_view.adapter = newsListAdapter
3131
viewModel.newsList.observe(this, Observer {
3232
newsListAdapter.submitList(it)

‎app/src/main/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/NewsListAdapter.kt‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.arch.paging.PagedListAdapter
4-
import android.support.v7.util.DiffUtil
5-
import android.support.v7.widget.RecyclerView
3+
import androidx.paging.PagedListAdapter
4+
import androidx.recyclerview.widget.DiffUtil
5+
import androidx.recyclerview.widget.RecyclerView
66
import android.view.ViewGroup
77

88
class NewsListAdapter(private val retry: () -> Unit)
9-
: PagedListAdapter<News, RecyclerView.ViewHolder>(NewsDiffCallback) {
9+
: PagedListAdapter<News, androidx.recyclerview.widget.RecyclerView.ViewHolder>(NewsDiffCallback) {
1010

1111
private val DATA_VIEW_TYPE = 1
1212
private val FOOTER_VIEW_TYPE = 2
1313

1414
private var state = State.LOADING
1515

16-
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
16+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): androidx.recyclerview.widget.RecyclerView.ViewHolder {
1717
return if (viewType == DATA_VIEW_TYPE) NewsViewHolder.create(parent) else ListFooterViewHolder.create(retry, parent)
1818
}
1919

20-
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
20+
override fun onBindViewHolder(holder: androidx.recyclerview.widget.RecyclerView.ViewHolder, position: Int) {
2121
if (getItemViewType(position) == DATA_VIEW_TYPE)
2222
(holder as NewsViewHolder).bind(getItem(position))
2323
else (holder as ListFooterViewHolder).bind(state)

‎app/src/main/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/NewsListViewModel.kt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.arch.lifecycle.LiveData
4-
import android.arch.lifecycle.Transformations
5-
import android.arch.lifecycle.ViewModel
6-
import android.arch.paging.LivePagedListBuilder
7-
import android.arch.paging.PagedList
3+
import androidx.lifecycle.LiveData
4+
import androidx.lifecycle.Transformations
5+
import androidx.lifecycle.ViewModel
6+
import androidx.paging.LivePagedListBuilder
7+
import androidx.paging.PagedList
88
import io.reactivex.disposables.CompositeDisposable
99

1010
class NewsListViewModel : ViewModel() {

‎app/src/main/java/com/sharmadhiraj/androidpaginglibrarystepbystepimplementationguide/NewsViewHolder.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.sharmadhiraj.androidpaginglibrarystepbystepimplementationguide
22

3-
import android.support.v7.widget.RecyclerView
3+
import androidx.recyclerview.widget.RecyclerView
44
import android.view.LayoutInflater
55
import android.view.View
66
import android.view.ViewGroup
77
import com.squareup.picasso.Picasso
88
import kotlinx.android.synthetic.main.item_news.view.*
99

10-
class NewsViewHolder(view: View) : RecyclerView.ViewHolder(view) {
10+
class NewsViewHolder(view: View) : androidx.recyclerview.widget.RecyclerView.ViewHolder(view) {
1111

1212
fun bind(news: News?) {
1313
if (news != null) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /