Skip to content

Update dependencies #234

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

Open
wants to merge 1 commit into
base: main
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
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

.idea/workspace.xml
advanced/start/.idea/compiler.xml
advanced/start/.idea/gradle.xml
advanced/start/.idea/jarRepositories.xml
advanced/start/.idea/ktfmt.xml
advanced/start/.idea/misc.xml
advanced/start/.idea/vcs.xml
advanced/end/.idea/vcs.xml
advanced/end/.idea/misc.xml
advanced/end/.idea/ktfmt.xml
advanced/end/.idea/jarRepositories.xml
advanced/end/.idea/gradle.xml
advanced/end/.idea/compiler.xml
advanced/end/.idea/workspace.xml
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added advanced/end/.idea/.gitignore
Empty file.
7 changes: 6 additions & 1 deletion advanced/end/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ android {
buildFeatures {
viewBinding = true
}
namespace 'com.example.android.codelabs.paging'
}

dependencies {
Expand All @@ -65,11 +66,15 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycleVersion"

implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
implementation "androidx.paging:paging-runtime-ktx:$pagingVersion"
kapt "androidx.room:room-compiler:$roomVersion"

implementation "androidx.room:room-paging:$roomVersion"
implementation "androidx.paging:paging-runtime-ktx:$pagingVersion"


// retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
Expand Down
3 changes: 1 addition & 2 deletions advanced/end/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.codelabs.paging">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ReposAdapter : PagingDataAdapter<UiModel, ViewHolder>(UIMODEL_COMPARATOR)
when (uiModel) {
is UiModel.RepoItem -> (holder as RepoViewHolder).bind(uiModel.repo)
is UiModel.SeparatorItem -> (holder as SeparatorViewHolder).bind(uiModel.description)
else -> {throw UnsupportedOperationException("Unknown view")}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,18 @@ class SearchRepositoriesActivity : AppCompatActivity() {
?.takeIf { it is LoadState.Error && repoAdapter.itemCount > 0 }
?: loadState.prepend

val isListEmpty = loadState.refresh is LoadState.NotLoading && repoAdapter.itemCount == 0
val isListEmpty =
loadState.refresh is LoadState.NotLoading && repoAdapter.itemCount == 0
// show empty list
emptyList.isVisible = isListEmpty
// Only show the list if refresh succeeds, either from the the local db or the remote.
list.isVisible = loadState.source.refresh is LoadState.NotLoading || loadState.mediator?.refresh is LoadState.NotLoading
list.isVisible =
loadState.source.refresh is LoadState.NotLoading || loadState.mediator?.refresh is LoadState.NotLoading
// Show loading spinner during initial load or refresh.
progressBar.isVisible = loadState.mediator?.refresh is LoadState.Loading
// Show the retry state if initial load or refresh fails.
retryButton.isVisible = loadState.mediator?.refresh is LoadState.Error && repoAdapter.itemCount == 0
retryButton.isVisible =
loadState.mediator?.refresh is LoadState.Error && repoAdapter.itemCount == 0
// Toast on any error, regardless of whether it came from RemoteMediator or PagingSource
val errorState = loadState.source.append as? LoadState.Error
?: loadState.source.prepend as? LoadState.Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.paging.insertSeparators
import androidx.paging.map
import com.example.android.codelabs.paging.data.GithubRepository
import com.example.android.codelabs.paging.model.Repo
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharingStarted
Expand All @@ -43,6 +44,7 @@ import kotlinx.coroutines.launch
* ViewModel for the [SearchRepositoriesActivity] screen.
* The ViewModel works with the [GithubRepository] to get the data.
*/
@OptIn(ExperimentalCoroutinesApi::class)
class SearchRepositoriesViewModel(
private val repository: GithubRepository,
private val savedStateHandle: SavedStateHandle
Expand All @@ -61,8 +63,8 @@ class SearchRepositoriesViewModel(
val accept: (UiAction) -> Unit

init {
val initialQuery: String = savedStateHandle.get(LAST_SEARCH_QUERY) ?: DEFAULT_QUERY
val lastQueryScrolled: String = savedStateHandle.get(LAST_QUERY_SCROLLED) ?: DEFAULT_QUERY
val initialQuery: String = savedStateHandle[LAST_SEARCH_QUERY] ?: DEFAULT_QUERY
val lastQueryScrolled: String = savedStateHandle[LAST_QUERY_SCROLLED] ?: DEFAULT_QUERY
val actionStateFlow = MutableSharedFlow<UiAction>()
val searches = actionStateFlow
.filterIsInstance<UiAction.Search>()
Expand Down Expand Up @@ -163,4 +165,4 @@ private val UiModel.RepoItem.roundedStarCount: Int

private const val LAST_QUERY_SCROLLED: String = "last_query_scrolled"
private const val LAST_SEARCH_QUERY: String = "last_search_query"
private const val DEFAULT_QUERY = "Android"
private const val DEFAULT_QUERY = "Android"
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ViewModelFactory(
private val repository: GithubRepository
) : AbstractSavedStateViewModelFactory(owner, null) {

override fun <T : ViewModel?> create(
override fun <T : ViewModel> create(
key: String,
modelClass: Class<T>,
handle: SavedStateHandle
Expand Down
28 changes: 14 additions & 14 deletions advanced/end/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.6.0'
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -40,18 +40,18 @@ task clean(type: Delete) {
}

ext {
compileSdkVersion = 31
minSdkVersion = 15
targetSdkVersion = 31
supportLibVersion = '1.4.0'
coreVersion = '1.7.0'
compileSdkVersion = 33
minSdkVersion = 24
targetSdkVersion = 33
supportLibVersion = '1.5.1'
coreVersion = '1.9.0'
recyclerViewVersion = '1.2.1'
constraintLayoutVersion = '2.1.2'
materialVersion = '1.4.0'
lifecycleVersion = '2.4.0'
roomVersion = '2.3.0'
pagingVersion = '3.1.0'
constraintLayoutVersion = '2.1.4'
materialVersion = '1.7.0'
lifecycleVersion = '2.5.1'
roomVersion = '2.4.3'
pagingVersion = '3.1.1'
retrofitVersion = '2.9.0'
okhttpLoggingInterceptorVersion = '4.9.0'
coroutines = '1.5.2'
okhttpLoggingInterceptorVersion = '5.0.0-alpha.11'
coroutines = '1.6.4'
}
15 changes: 15 additions & 0 deletions advanced/end/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed Oct 19 12:06:15 EDT 2022
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion advanced/end/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 02 16:17:32 GMT 2020
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
8 changes: 8 additions & 0 deletions advanced/end/local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Dec 26 13:24:16 EST 2022
sdk.dir=/Users/johndelacruz/Library/Android/sdk
3 changes: 3 additions & 0 deletions advanced/start/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions advanced/start/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ android {
buildFeatures {
viewBinding = true
}
namespace 'com.example.android.codelabs.paging'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions advanced/start/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.codelabs.paging">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ViewModelFactory(
private val repository: GithubRepository
) : AbstractSavedStateViewModelFactory(owner, null) {

override fun <T : ViewModel?> create(
override fun <T : ViewModel> create(
key: String,
modelClass: Class<T>,
handle: SavedStateHandle
Expand Down
28 changes: 14 additions & 14 deletions advanced/start/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.6.0'
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -40,18 +40,18 @@ task clean(type: Delete) {
}

ext {
compileSdkVersion = 31
minSdkVersion = 15
targetSdkVersion = 31
supportLibVersion = '1.4.0'
coreVersion = '1.7.0'
compileSdkVersion = 33
minSdkVersion = 24
targetSdkVersion = 33
supportLibVersion = '1.5.1'
coreVersion = '1.9.0'
recyclerViewVersion = '1.2.1'
constraintLayoutVersion = '2.1.2'
materialVersion = '1.4.0'
lifecycleVersion = '2.4.0'
roomVersion = '2.3.0'
pagingVersion = '3.1.0'
constraintLayoutVersion = '2.1.4'
materialVersion = '1.7.0'
lifecycleVersion = '2.5.1'
roomVersion = '2.4.3'
pagingVersion = '3.1.1'
retrofitVersion = '2.9.0'
okhttpLoggingInterceptorVersion = '4.9.0'
coroutines = '1.5.2'
okhttpLoggingInterceptorVersion = '5.0.0-alpha.11'
coroutines = '1.6.4'
}
2 changes: 1 addition & 1 deletion advanced/start/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 02 16:17:32 GMT 2020
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
8 changes: 8 additions & 0 deletions advanced/start/local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Dec 26 13:14:04 EST 2022
sdk.dir=/Users/johndelacruz/Library/Android/sdk
1 change: 1 addition & 0 deletions basic/end/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ android {
buildFeatures {
viewBinding = true
}
namespace 'com.example.android.codelabs.paging'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions basic/end/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.codelabs.paging">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
Expand Down
6 changes: 3 additions & 3 deletions basic/end/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
buildscript {

ext.buildConfig = [
'compileSdk': 31,
'minSdk' : 21,
'targetSdk' : 31,
'compileSdk': 33,
'minSdk' : 24,
'targetSdk' : 33,
]

repositories {
Expand Down
2 changes: 1 addition & 1 deletion basic/end/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
androidDesugarJdkLibs = "1.1.5"
androidGradlePlugin = "7.0.4"
androidGradlePlugin = "7.3.1"
androidxActivity = "1.4.0"
androidxAppCompat = "1.3.0"
androidxCore = "1.7.0"
Expand Down
2 changes: 1 addition & 1 deletion basic/end/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 02 16:17:32 GMT 2020
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
1 change: 1 addition & 0 deletions basic/start/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ android {
buildFeatures {
viewBinding = true
}
namespace 'com.example.android.codelabs.paging'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions basic/start/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.codelabs.paging">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
Expand Down
6 changes: 3 additions & 3 deletions basic/start/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
buildscript {

ext.buildConfig = [
'compileSdk': 31,
'minSdk' : 21,
'targetSdk' : 31,
'compileSdk': 33,
'minSdk' : 24,
'targetSdk' : 33,
]

repositories {
Expand Down
2 changes: 1 addition & 1 deletion basic/start/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
androidDesugarJdkLibs = "1.1.5"
androidGradlePlugin = "7.0.4"
androidGradlePlugin = "7.3.1"
androidxActivity = "1.4.0"
androidxAppCompat = "1.3.0"
androidxCore = "1.7.0"
Expand Down
2 changes: 1 addition & 1 deletion basic/start/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 02 16:17:32 GMT 2020
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME