mirror of
https://github.com/yogeshpaliyal/KeyPass.git
synced 2026-05-04 19:29:38 -05:00
Improve modular (#221)
* Improving module * refactor: modules * refactor: modules * bump sdk v * minor fixes * fix spotless
This commit is contained in:
committed by
GitHub
parent
7a9bea1524
commit
efaa85cb49
+3
-24
@@ -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"
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.yogeshpaliyal.common.utils
|
||||
|
||||
/**
|
||||
* Coerce the receiving Float between inputMin and inputMax and linearly interpolate to the
|
||||
* outputMin to outputMax scale. This function is able to handle ranges which span negative and
|
||||
* positive numbers.
|
||||
*
|
||||
* This differs from [lerp] as the input values are not required to be between 0 and 1.
|
||||
*/
|
||||
fun Float.normalize(
|
||||
inputMin: Float,
|
||||
inputMax: Float,
|
||||
outputMin: Float,
|
||||
outputMax: Float
|
||||
): Float {
|
||||
val result: Float? = if (this < inputMin) {
|
||||
outputMin
|
||||
} else if (this > inputMax) {
|
||||
outputMax
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
return result ?: (
|
||||
outputMin * (1 - (this - inputMin) / (inputMax - inputMin)) +
|
||||
outputMax * ((this - inputMin) / (inputMax - inputMin))
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yogeshpaliyal.keypass.utils
|
||||
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
|
||||
/**
|
||||
* Alias to represent a folder (a String title) into which emails can be placed.
|
||||
*/
|
||||
|
||||
object StringDiffUtil : DiffUtil.ItemCallback<String>() {
|
||||
override fun areItemsTheSame(oldItem: String, newItem: String) = oldItem == newItem
|
||||
override fun areContentsTheSame(oldItem: String, newItem: String) = oldItem == newItem
|
||||
}
|
||||
Reference in New Issue
Block a user