File tree 15 files changed +273
-235
lines changed
java/net/chineseguide/jukuu
15 files changed +273
-235
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ plugins {
9
9
}
10
10
11
11
android {
12
+ namespace = " net.chineseguide.jukuu"
12
13
compileSdkVersion(Application .maxApi)
13
14
defaultConfig {
14
15
applicationId = Application .id
@@ -19,7 +20,7 @@ android {
19
20
}
20
21
viewBinding.isEnabled = true
21
22
lintOptions {
22
- setLintConfig (file(" lint.xml" ))
23
+ lintConfig = (file(" lint.xml" ))
23
24
isCheckDependencies = true
24
25
isCheckGeneratedSources = true
25
26
isWarningsAsErrors = true
@@ -42,7 +43,6 @@ dependencies {
42
43
implementation(Libraries .kotlinStdlib)
43
44
44
45
implementation(Libraries .daggerHiltCore)
45
- implementation(Libraries .hiltLifecycleViewModel)
46
46
kapt(Libraries .daggerHiltAnnotationProcessor)
47
47
kapt(Libraries .hiltAndroidxCompiler)
48
48
Original file line number Diff line number Diff line change 7
7
8
8
<application
9
9
android : name =" net.chineseguide.jukuu.ui.App"
10
- android : allowBackup =" false"
11
10
android : icon =" @mipmap/ic_launcher"
12
11
android : label =" @string/app_name"
13
12
android : networkSecurityConfig =" @xml/jukuu_http_protocol_workaround"
18
17
19
18
<activity
20
19
android : name =" net.chineseguide.jukuu.ui.main.MainActivity"
21
- android : label = " @string/app_name "
22
- android : windowSoftInputMode = " adjustPan|stateHidden " >
20
+ android : windowSoftInputMode = " adjustPan|stateHidden "
21
+ android : exported = " true " >
23
22
<intent-filter >
24
23
<action android : name =" android.intent.action.MAIN" />
25
24
Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ import dagger.Binds
5
5
import dagger.Module
6
6
import dagger.Provides
7
7
import dagger.hilt.InstallIn
8
- import dagger.hilt.android.components.ApplicationComponent
9
8
import dagger.hilt.android.qualifiers.ApplicationContext
9
+ import dagger.hilt.components.SingletonComponent
10
10
import net.chineseguide.jukuu.ui.App
11
11
import javax.inject.Singleton
12
12
13
13
@Module
14
- @InstallIn(ApplicationComponent ::class )
14
+ @InstallIn(SingletonComponent ::class )
15
15
interface AppModule {
16
16
17
17
companion object {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package net.chineseguide.jukuu.di
3
3
import dagger.Binds
4
4
import dagger.Module
5
5
import dagger.hilt.InstallIn
6
- import dagger.hilt.android. components.ApplicationComponent
6
+ import dagger.hilt.components.SingletonComponent
7
7
import net.chineseguide.jukuu.data.api.SentenceApi
8
8
import net.chineseguide.jukuu.data.api.SentenceApiImpl
9
9
import net.chineseguide.jukuu.data.datasource.SentenceRemoteDataSource
@@ -13,7 +13,7 @@ import net.chineseguide.jukuu.domain.repository.SentenceRepository
13
13
import javax.inject.Singleton
14
14
15
15
@Module
16
- @InstallIn(ApplicationComponent ::class )
16
+ @InstallIn(SingletonComponent ::class )
17
17
interface DataModule {
18
18
19
19
@Singleton
Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ package net.chineseguide.jukuu.di
3
3
import dagger.Binds
4
4
import dagger.Module
5
5
import dagger.hilt.InstallIn
6
- import dagger.hilt.android. components.ApplicationComponent
6
+ import dagger.hilt.components.SingletonComponent
7
7
import net.chineseguide.jukuu.presentation.ErrorLogger
8
8
import net.chineseguide.jukuu.presentation.ErrorLoggerImpl
9
9
import javax.inject.Singleton
10
10
11
11
@Module
12
- @InstallIn(ApplicationComponent ::class )
12
+ @InstallIn(SingletonComponent ::class )
13
13
interface LoggerModule {
14
14
15
15
@Singleton
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ package net.chineseguide.jukuu.navigation
2
2
3
3
import net.chineseguide.jukuu.R
4
4
5
- const val homeScreen = R .id.homeFragment
6
- const val settingsScreen = R .id.settingsFragment
5
+ val homeScreen = R .id.homeFragment
6
+ val settingsScreen = R .id.settingsFragment
Original file line number Diff line number Diff line change 1
1
package net.chineseguide.jukuu.presentation.home
2
2
3
- import androidx.hilt.lifecycle.ViewModelInject
4
3
import androidx.lifecycle.LiveData
5
4
import androidx.lifecycle.MutableLiveData
6
5
import androidx.lifecycle.ViewModel
7
6
import androidx.lifecycle.viewModelScope
7
+ import dagger.hilt.android.lifecycle.HiltViewModel
8
8
import kotlinx.coroutines.Dispatchers.IO
9
9
import kotlinx.coroutines.Dispatchers.Main
10
10
import kotlinx.coroutines.launch
@@ -13,8 +13,10 @@ import net.chineseguide.jukuu.domain.entity.Sentence
13
13
import net.chineseguide.jukuu.domain.usecase.GetNextSentencesUseCase
14
14
import net.chineseguide.jukuu.domain.usecase.GetSentenceCollectionUseCase
15
15
import net.chineseguide.jukuu.presentation.ErrorLogger
16
+ import javax.inject.Inject
16
17
17
- class HomeViewModel @ViewModelInject constructor(
18
+ @HiltViewModel
19
+ class HomeViewModel @Inject constructor(
18
20
private val getSentenceCollectionUseCase : GetSentenceCollectionUseCase ,
19
21
private val getNextSentencesUseCase : GetNextSentencesUseCase ,
20
22
private val errorLogger : ErrorLogger
Original file line number Diff line number Diff line change 1
1
package net.chineseguide.jukuu.presentation.home.sentence.dialog
2
2
3
- import androidx.hilt.Assisted
4
- import androidx.hilt.lifecycle.ViewModelInject
5
3
import androidx.lifecycle.LiveData
6
4
import androidx.lifecycle.MutableLiveData
7
5
import androidx.lifecycle.SavedStateHandle
8
6
import androidx.lifecycle.ViewModel
7
+ import dagger.hilt.android.lifecycle.HiltViewModel
9
8
import net.chineseguide.jukuu.domain.entity.Sentence
9
+ import javax.inject.Inject
10
10
11
- class SentencesViewModel @ViewModelInject constructor(
12
- @Assisted private val savedStateHandle : SavedStateHandle
11
+ @HiltViewModel
12
+ class SentencesViewModel @Inject constructor(
13
+ savedStateHandle : SavedStateHandle
13
14
) : ViewModel() {
14
15
15
16
private val _clipboardText = MutableLiveData <String >()
Original file line number Diff line number Diff line change 1
1
package net.chineseguide.jukuu.presentation.main
2
2
3
- import androidx.hilt.lifecycle.ViewModelInject
4
3
import androidx.lifecycle.ViewModel
4
+ import dagger.hilt.android.lifecycle.HiltViewModel
5
5
import net.chineseguide.jukuu.navigation.Router
6
6
import net.chineseguide.jukuu.navigation.homeScreen
7
7
import net.chineseguide.jukuu.navigation.settingsScreen
8
+ import javax.inject.Inject
8
9
9
- class MainViewModel @ViewModelInject constructor(
10
+ @HiltViewModel
11
+ class MainViewModel @Inject constructor(
10
12
private val router : Router
11
13
) : ViewModel() {
12
14
Original file line number Diff line number Diff line change 1
1
object Application {
2
2
const val id = " net.chineseguide.jukuu"
3
3
const val minApi = 19
4
- const val maxApi = 30
4
+ const val maxApi = 34
5
5
const val versionCode = 1
6
6
const val versionName = " 0.9.0"
7
7
}
Original file line number Diff line number Diff line change 1
1
object Versions {
2
- const val gradleAndroidPlugin = " 3.6 .0"
3
- const val kotlin = " 1.3.61 "
4
- const val daggerHilt = " 2.28-alpha "
2
+ const val gradleAndroidPlugin = " 8.0 .0"
3
+ const val kotlin = " 1.9.22 "
4
+ const val daggerHilt = " 2.48 "
5
5
const val hiltLifecycleViewModel = " 1.0.0-alpha01"
6
6
7
7
const val jsoup = " 1.13.1"
@@ -12,7 +12,7 @@ object Versions {
12
12
const val coordinatorLayout = " 1.1.0"
13
13
const val fragment = " 1.2.2"
14
14
const val lifecycle = " 2.2.0"
15
- const val navigation = " 2.3.0-alpha04 "
15
+ const val navigation = " 2.5.0 "
16
16
17
17
const val googleServices = " 4.3.4"
18
18
const val crashlyticsGradle = " 2.4.1"
@@ -36,7 +36,6 @@ object Libraries {
36
36
37
37
const val daggerHiltCore = " com.google.dagger:hilt-android:${Versions .daggerHilt} "
38
38
const val daggerHiltAnnotationProcessor = " com.google.dagger:hilt-android-compiler:${Versions .daggerHilt} "
39
- const val hiltLifecycleViewModel = " androidx.hilt:hilt-lifecycle-viewmodel:${Versions .hiltLifecycleViewModel} "
40
39
const val hiltAndroidxCompiler = " androidx.hilt:hilt-compiler:${Versions .hiltLifecycleViewModel} "
41
40
42
41
const val jsoup = " org.jsoup:jsoup:${Versions .jsoup} "
Original file line number Diff line number Diff line change 1
1
distributionBase =GRADLE_USER_HOME
2
2
distributionPath =wrapper/dists
3
- distributionUrl =https\://services.gradle.org/distributions/gradle-5.6 .4-bin.zip
3
+ distributionUrl =https\://services.gradle.org/distributions/gradle-8 .4-bin.zip
4
4
zipStoreBase =GRADLE_USER_HOME
5
5
zipStorePath =wrapper/dists
You can’t perform that action at this time.
0 commit comments