Skip to content
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

Updated master branch code #43

Merged
merged 1 commit into from
Jun 29, 2024
Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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

Expand Down
18 changes: 8 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'kotlin-parcelize'

android {
compileSdkVersion 31
compileSdk 34
buildFeatures {
dataBinding true
}
defaultConfig {
applicationId "com.example.android.marsrealestate"
minSdkVersion 19
targetSdkVersion 31
minSdkVersion 21
targetSdkVersion 34
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand All @@ -40,13 +40,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace = "com.example.android.marsrealestate"

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fun bindStatus(statusImageView: ImageView, status: MarsApiStatus?) {
statusImageView.visibility = View.VISIBLE
statusImageView.setImageResource(R.drawable.loading_animation)
}
MarsApiStatus.ERROR -> {
MarsApiStatus.ERROR, null -> {
statusImageView.visibility = View.VISIBLE
statusImageView.setImageResource(R.drawable.ic_connection_error)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import androidx.lifecycle.map
import com.example.android.marsrealestate.R
import com.example.android.marsrealestate.network.MarsProperty

Expand All @@ -43,7 +43,7 @@ class DetailViewModel(marsProperty: MarsProperty, app: Application) : AndroidVie

// The displayPropertyPrice formatted Transformation Map LiveData, which displays the sale
// or rental price.
val displayPropertyPrice = Transformations.map(selectedProperty) {
val displayPropertyPrice = selectedProperty.map() {
app.applicationContext.getString(
when (it.isRental) {
true -> R.string.display_price_monthly_rental
Expand All @@ -53,7 +53,7 @@ class DetailViewModel(marsProperty: MarsProperty, app: Application) : AndroidVie

// The displayPropertyType formatted Transformation Map LiveData, which displays the
// "For Rent/Sale" String
val displayPropertyType = Transformations.map(selectedProperty) {
val displayPropertyType = selectedProperty.map() {
app.applicationContext.getString(R.string.display_type,
app.applicationContext.getString(
when(it.isRental) {
Expand Down
23 changes: 12 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@ buildscript {
// Versions for all the dependencies we plan to use. It's particularly useful for kotlin and
// navigation where the versions of the plugin needs to be the same as the version of the
// library defined in the app Gradle file
version_core = "1.3.1"
version_constraint_layout = "2.0.0-rc1"
version_glide = "4.8.0"
version_gradle = '7.1.0'
version_kotlin = '1.4.10'
version_kotlin_coroutines = "1.3.7"
version_lifecycle = '2.4.1'
version_moshi = "1.13.0"
version_navigation = '2.4.1'
version_android_gradle_plugin = '8.4.2'
version_core = "1.13.1"
version_constraint_layout = "2.1.4"
version_glide = "4.16.0"
version_gradle = '8.4.2'
version_kotlin = '1.9.24'
version_kotlin_coroutines = "1.8.1"
version_lifecycle = '2.8.2'
version_moshi = "1.15.1"
version_navigation = '2.7.7'
version_retrofit = "2.9.0"
version_retrofit_coroutines_adapter = "0.9.2"
version_recyclerview = "1.2.0-alpha05"
version_recyclerview = "1.3.2"
}

repositories {
mavenCentral()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:$version_gradle"
classpath "com.android.tools.build:gradle:$version_android_gradle_plugin"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
android.databinding.enableV2=true
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
Loading