🐛 fix year issue

This commit is contained in:
theapache64
2021-06-10 00:32:02 +05:30
parent 7c4cf8381d
commit df05ea7645
11 changed files with 12 additions and 24 deletions

3
.idea/compiler.xml generated
View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel>
<module name="TopCorn.app" target="1.8" />
<bytecodeTargetLevel target="15">
<module name="topcorn.TopCorn.app" target="1.8" />
</bytecodeTargetLevel>
</component>

4
.idea/gradle.xml generated
View File

@@ -4,10 +4,10 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="gradleJvm" value="azul-15" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

2
.idea/misc.xml generated
View File

@@ -5,7 +5,7 @@
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15_PREVIEW" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@@ -15,8 +15,8 @@ android {
applicationId "com.theapache64.topcorn"
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
versionCode 10403
versionName "1.0.4-alpha03"
versionCode 10404
versionName "1.0.4-alpha04"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

View File

@@ -6,7 +6,7 @@ import androidx.room.TypeConverters
import com.theapache64.topcorn.data.local.daos.MoviesDao
import com.theapache64.topcorn.data.remote.Movie
@Database(entities = [Movie::class], version = 1)
@Database(entities = [Movie::class], version = 2)
@TypeConverters(Converters::class)
abstract class AppDatabase : RoomDatabase() {
abstract fun movieDao(): MoviesDao

View File

@@ -34,7 +34,7 @@ data class Movie(
@Json(name = "rating")
val rating: Float, // 8.2
@Json(name = "year")
val year: Int
val year: Int?
) : Serializable {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id")

View File

@@ -13,6 +13,7 @@ class DatabaseModule {
@Provides
fun provideAppDatabase(context: Context): AppDatabase {
return Room.databaseBuilder(context, AppDatabase::class.java, "com.theapache64.topcorn_db")
.fallbackToDestructiveMigration()
.build()
}

View File

@@ -47,7 +47,7 @@ class FeedViewModel @Inject constructor(
.sortedByDescending {
when (sortOrder) {
SORT_ORDER_RATING -> it.rating
SORT_ORDER_YEAR -> it.year.toFloat()
SORT_ORDER_YEAR -> it.year?.toFloat() ?: 0f
else -> {
throw IllegalArgumentException("TSH : sort order '$sortOrder' not managed")
}

View File

@@ -29,7 +29,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-beta05'
classpath 'com.android.tools.build:gradle:7.0.0-beta03'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module app.build.gradle files

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip