diff --git a/.github/workflows/BasicSample.yaml b/.github/workflows/BasicSample.yaml index 53b1eb6..8023346 100644 --- a/.github/workflows/BasicSample.yaml +++ b/.github/workflows/BasicSample.yaml @@ -27,11 +27,11 @@ jobs: - name: Copy CI gradle.properties run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 11 + java-version: 17 - name: Generate cache key run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt @@ -68,4 +68,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: build-reports-BasicSample - path: ${{ env.SAMPLE_PATH }}/app/build/reports \ No newline at end of file + path: ${{ env.SAMPLE_PATH }}/app/build/reports diff --git a/BasicSample/app/build.gradle b/BasicSample/app/build.gradle index 5fce4ef..5e22d83 100644 --- a/BasicSample/app/build.gradle +++ b/BasicSample/app/build.gradle @@ -21,6 +21,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' android { + namespace 'com.example.android.databinding.basicsample' compileSdkVersion rootProject.compileSdkVersion defaultConfig { applicationId "com.example.android.databinding.basicsample" @@ -40,6 +41,10 @@ android { buildFeatures { dataBinding true } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } } dependencies { diff --git a/BasicSample/app/src/main/java/com/example/android/databinding/basicsample/data/ProfileObservableViewModel.kt b/BasicSample/app/src/main/java/com/example/android/databinding/basicsample/data/ProfileObservableViewModel.kt index 6b9d0e1..31e2f29 100644 --- a/BasicSample/app/src/main/java/com/example/android/databinding/basicsample/data/ProfileObservableViewModel.kt +++ b/BasicSample/app/src/main/java/com/example/android/databinding/basicsample/data/ProfileObservableViewModel.kt @@ -20,8 +20,8 @@ import androidx.databinding.Bindable import androidx.databinding.ObservableField import androidx.databinding.ObservableInt import androidx.lifecycle.LiveData +import androidx.lifecycle.map import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.Transformations import androidx.lifecycle.ViewModel import com.example.android.databinding.basicsample.BR import com.example.android.databinding.basicsample.util.ObservableViewModel @@ -41,7 +41,7 @@ class ProfileLiveDataViewModel : ViewModel() { val likes: LiveData = _likes // popularity is exposed as LiveData using a Transformation instead of a @Bindable property. - val popularity: LiveData = Transformations.map(_likes) { + val popularity: LiveData = _likes.map { when { it > 9 -> Popularity.STAR it > 4 -> Popularity.POPULAR diff --git a/BasicSample/build.gradle b/BasicSample/build.gradle index 4e7d19d..79830bc 100644 --- a/BasicSample/build.gradle +++ b/BasicSample/build.gradle @@ -27,7 +27,7 @@ buildscript { activityVersion = '1.6.1' constraintLayoutVersion = '2.1.4' espressoVersion = '3.5.1' - gradleVersion = '7.4.0' + gradleVersion = '8.3.0' junitVersion = '4.13.2' hamcrestVersion = '1.3' kotlinVersion = '1.8.0' diff --git a/BasicSample/gradle/wrapper/gradle-wrapper.properties b/BasicSample/gradle/wrapper/gradle-wrapper.properties index 8049c68..e411586 100644 --- a/BasicSample/gradle/wrapper/gradle-wrapper.properties +++ b/BasicSample/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists