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

Enable lower sdk version #3

Open
wants to merge 1 commit into
base: master
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
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
compileSdkVersion 28
defaultConfig {
applicationId "net.simplifiedcoding.mvvmsampleapp"
minSdkVersion 26
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
Expand Down Expand Up @@ -69,6 +69,8 @@ dependencies {
implementation "androidx.navigation:navigation-fragment-ktx:2.1.0-alpha05"
implementation "androidx.navigation:navigation-ui-ktx:2.1.0-alpha05"

implementation 'com.jakewharton.threetenabp:threetenabp:1.0.3'

implementation 'com.xwray:groupie:2.3.0'
implementation 'com.xwray:groupie-kotlin-android-extensions:2.3.0'
implementation 'com.xwray:groupie-databinding:2.3.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.simplifiedcoding.mvvmsampleapp

import android.app.Application
import com.jakewharton.threetenabp.AndroidThreeTen
import net.simplifiedcoding.mvvmsampleapp.data.db.AppDatabase
import net.simplifiedcoding.mvvmsampleapp.data.network.MyApi
import net.simplifiedcoding.mvvmsampleapp.data.network.NetworkConnectionInterceptor
Expand All @@ -20,6 +21,11 @@ import org.kodein.di.generic.singleton

class MVVMApplication : Application(), KodeinAware {

override fun onCreate() {
super.onCreate()
AndroidThreeTen.init(this)
}

override val kodein = Kodein.lazy {
import(androidXModule(this@MVVMApplication))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import net.simplifiedcoding.mvvmsampleapp.data.network.MyApi
import net.simplifiedcoding.mvvmsampleapp.data.network.SafeApiRequest
import net.simplifiedcoding.mvvmsampleapp.data.preferences.PreferenceProvider
import net.simplifiedcoding.mvvmsampleapp.util.Coroutines
import java.time.LocalDateTime
import java.time.temporal.ChronoUnit
import org.threeten.bp.LocalDateTime
import org.threeten.bp.temporal.ChronoUnit


private val MINIMUM_INTERVAL = 6

Expand All @@ -29,8 +30,8 @@ class QuotesRepository(
}
}

suspend fun getQuotes(): LiveData<List<Quote>>{
return withContext(Dispatchers.IO){
suspend fun getQuotes(): LiveData<List<Quote>> {
return withContext(Dispatchers.IO) {
fetchQuotes()
db.getQuoteDao().getQuotes()
}
Expand Down