diff --git a/README.md b/README.md index fdaa4335..3a610be9 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ Access all branches from this tab. The branches are also accessible from the drop-down in the "Code" tab. +## Requirements + +1. Android Studio (Jellyfish or above) +2. JDK 21 with `JAVA_HOME` environment variable set. If you don't have JDK 21 installed or `JAVA_HOME` is not set, consider using a tool like `sdkman` to simplify the process. Refer to the sdkman documentation for installation instructions: [sdkman installation](https://sdkman.io/install) ## Working with the Course Code diff --git a/app/build.gradle b/app/build.gradle index c462488c..031ac090 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,14 +19,14 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: "androidx.navigation.safeargs" -apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-parcelize' android { - compileSdkVersion 30 + compileSdk 34 defaultConfig { applicationId "com.example.android.devbyteviewer" - minSdkVersion 19 - targetSdkVersion 30 + minSdkVersion 21 + targetSdkVersion 34 versionCode 1 versionName "1.0" multiDexEnabled true @@ -43,15 +43,18 @@ android { dataBinding true } - kotlinOptions { - jvmTarget = "1.8" + namespace = "com.example.android.devbyteviewer" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_kotlin" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version_kotlin" // Support libraries implementation "androidx.appcompat:appcompat:$version_appcompat" @@ -62,8 +65,8 @@ dependencies { implementation "androidx.core:core-ktx:$version_core" // Navigation - implementation "android.arch.navigation:navigation-fragment-ktx:$version_navigation" - implementation "android.arch.navigation:navigation-ui-ktx:$version_navigation" + implementation "androidx.navigation:navigation-fragment-ktx:$version_navigation" + implementation "androidx.navigation:navigation-ui-ktx:$version_navigation" // Coroutines for getting off the UI thread implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_kotlin_coroutines" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5572a6be..252d3bf9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -31,7 +31,8 @@ android:supportsRtl="true" android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning"> - + diff --git a/app/src/main/java/com/example/android/devbyteviewer/repository/VideosRepository.kt b/app/src/main/java/com/example/android/devbyteviewer/repository/VideosRepository.kt index 864e3ae2..05ce83d5 100644 --- a/app/src/main/java/com/example/android/devbyteviewer/repository/VideosRepository.kt +++ b/app/src/main/java/com/example/android/devbyteviewer/repository/VideosRepository.kt @@ -18,7 +18,7 @@ package com.example.android.devbyteviewer.repository import androidx.lifecycle.LiveData -import androidx.lifecycle.Transformations +import androidx.lifecycle.map import com.example.android.devbyteviewer.database.VideosDatabase import com.example.android.devbyteviewer.database.asDomainModel import com.example.android.devbyteviewer.domain.Video @@ -33,7 +33,7 @@ class VideosRepository(private val database: VideosDatabase) { * A playlist of videos that can be shown on the screen. */ val videos: LiveData> = - Transformations.map(database.videoDao.getVideos()) { + database.videoDao.getVideos().map { it.asDomainModel() } diff --git a/app/src/main/java/com/example/android/devbyteviewer/viewmodels/DevByteViewModel.kt b/app/src/main/java/com/example/android/devbyteviewer/viewmodels/DevByteViewModel.kt index 24ab7016..1cd14a8c 100644 --- a/app/src/main/java/com/example/android/devbyteviewer/viewmodels/DevByteViewModel.kt +++ b/app/src/main/java/com/example/android/devbyteviewer/viewmodels/DevByteViewModel.kt @@ -70,7 +70,7 @@ class DevByteViewModel(application: Application) : AndroidViewModel(application) * Factory for constructing DevByteViewModel with parameter */ class Factory(val app: Application) : ViewModelProvider.Factory { - override fun create(modelClass: Class): T { + override fun create(modelClass: Class): T { if (modelClass.isAssignableFrom(DevByteViewModel::class.java)) { @Suppress("UNCHECKED_CAST") return DevByteViewModel(app) as T diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 6b5d7f25..93cd3cb7 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -18,7 +18,7 @@ -