Improve modular (#221)

* Improving module

* refactor: modules

* refactor: modules

* bump sdk v

* minor fixes

* fix spotless
This commit is contained in:
Yogesh Choudhary Paliyal
2022-09-04 21:36:19 +05:30
committed by GitHub
parent 7a9bea1524
commit efaa85cb49
8 changed files with 33 additions and 73 deletions

View File

@@ -13,13 +13,12 @@ def appPackageId = 'com.yogeshpaliyal.keypass'
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
compileSdkVersion 32
defaultConfig {
applicationId appPackageId
minSdkVersion 22
targetSdkVersion 31
targetSdkVersion 32
versionCode 1407
versionName "1.4.7"
@@ -74,25 +73,14 @@ android {
dependencies {
implementation project(":common")
api project(":common")
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.7.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference-ktx:1.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:core-ktx:1.4.0'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation ('androidx.appcompat:appcompat:1.4.1')
implementation "androidx.documentfile:documentfile:1.0.1"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
@@ -103,17 +91,12 @@ dependencies {
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
implementation "androidx.room:room-runtime:$room_version"
androidTestImplementation 'androidx.test:rules:1.4.0'
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation 'com.yogeshpaliyal:universal-adapter:3.0.1'
implementation "androidx.biometric:biometric:1.1.0"
// dependency injection
implementation("com.google.dagger:hilt-android:$hilt_version")
kapt("com.google.dagger:hilt-android-compiler:$hilt_version")
@@ -137,9 +120,5 @@ dependencies {
// ...with Kotlin.
kaptTest("com.google.dagger:hilt-android-compiler:$hilt_version")
implementation 'com.google.code.gson:gson:2.9.1'
implementation "androidx.datastore:datastore-preferences:1.0.0"
}

View File

@@ -7,9 +7,9 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import com.yogeshpaliyal.common.constants.AccountType
import com.yogeshpaliyal.common.data.AccountModel
@@ -35,7 +35,7 @@ class HomeFragment : Fragment() {
private lateinit var binding: FragmentHomeBinding
private val mViewModel by lazy {
requireActivity().viewModels<DashboardViewModel>().value
activityViewModels<DashboardViewModel>().value
}
private val mAdapter by lazy {

View File

@@ -3,7 +3,7 @@ package com.yogeshpaliyal.keypass.ui.nav
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.recyclerview.widget.DiffUtil
import com.yogeshpaliyal.common.data.StringDiffUtil
import com.yogeshpaliyal.keypass.utils.StringDiffUtil
/**
* A sealed class which encapsulates all objects [NavigationAdapter] is able to display.

View File

@@ -1,4 +1,4 @@
package com.yogeshpaliyal.common.data
package com.yogeshpaliyal.keypass.utils
import androidx.recyclerview.widget.DiffUtil

View File

@@ -7,11 +7,11 @@ plugins {
}
android {
compileSdk 31
compileSdk 32
defaultConfig {
minSdk 21
targetSdk 31
targetSdk 32
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -35,41 +35,44 @@ android {
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.7.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api 'androidx.core:core-ktx:1.8.0'
api 'androidx.appcompat:appcompat:1.5.0'
testApi 'junit:junit:4.13.2'
androidTestApi 'androidx.test.ext:junit:1.1.3'
androidTestApi 'androidx.test.espresso:espresso-core:3.4.0'
androidTestApi 'androidx.test:core-ktx:1.4.0'
androidTestApi 'androidx.test.ext:junit-ktx:1.1.3'
// apache common codec
implementation "commons-codec:commons-codec:1.15"
//Androidx Security
implementation "androidx.security:security-crypto:1.1.0-alpha03"
api "androidx.documentfile:documentfile:1.0.1"
implementation "androidx.room:room-runtime:$room_version"
androidTestImplementation 'androidx.test:rules:1.4.0'
api "androidx.room:room-runtime:$room_version"
androidTestApi 'androidx.test:rules:1.4.0'
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
api "androidx.room:room-ktx:$room_version"
api 'com.google.android.material:material:1.7.0-rc01'
// dependency injection
implementation("com.google.dagger:hilt-android:$hilt_version")
api("com.google.dagger:hilt-android:$hilt_version")
kapt("com.google.dagger:hilt-android-compiler:$hilt_version")
implementation("androidx.hilt:hilt-work:1.0.0")
api("androidx.hilt:hilt-work:1.0.0")
// When using Kotlin.
kapt("androidx.hilt:hilt-compiler:1.0.0")
implementation "androidx.work:work-runtime-ktx:2.7.1"
api "androidx.work:work-runtime-ktx:2.7.1"
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.google.code.gson:gson:2.9.1'
api 'com.google.code.gson:gson:2.9.0'
implementation "androidx.datastore:datastore-preferences:1.0.0"
api "androidx.datastore:datastore-preferences:1.0.0"
api "androidx.biometric:biometric:1.1.0"
}
}

View File

@@ -4,12 +4,12 @@ plugins {
}
android {
compileSdk 31
compileSdk 32
defaultConfig {
applicationId "com.yogeshpaliyal.keypasscompose"
minSdk 21
targetSdk 31
targetSdk 32
versionCode 1
versionName "1.0"
@@ -57,19 +57,13 @@ android {
}
dependencies {
implementation project(":common")
api project(":common")
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.7.0-alpha02'
implementation "androidx.compose.ui:ui:1.1.1"
implementation "androidx.compose.material:material:1.1.1"
implementation "androidx.compose.ui:ui-tooling-preview:1.1.1"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.activity:activity-compose:1.5.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.2.1"
debugImplementation "androidx.compose.ui:ui-tooling:1.1.1"

View File

@@ -1,16 +0,0 @@
package com.yogeshpaliyal.keypasscompose
import org.junit.Assert.assertEquals
import org.junit.Test
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}