diff --git a/.github/workflows/android_checkstyle.yml b/.github/workflows/android_checkstyle.yml index a3e7e42a60..d7901f9a25 100644 --- a/.github/workflows/android_checkstyle.yml +++ b/.github/workflows/android_checkstyle.yml @@ -3,6 +3,7 @@ name: Android Checkstyle CI on: pull_request: branches: [ development ] + merge_group: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} diff --git a/README.md b/README.md index e741772121..3f6d9a382a 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -# Navi Super App Android +# Navi Super App Android [![Contributors][contributors-shield]][contributors-url] ## About The Project -This is the android super app for Navi. This project contains various modules for each business unit like - +This is the android super app for Navi. This project contains various modules for each business unit like - 1. Cash Loan 2. Home Loan -3. Health Insurance +3. Health Insurance 4. Mutual Funds 5. Gold 6. Referral and Rewards 7. UPI -Some of the in-house built SDKs are hosted on other github locations and imported as .aar like UiTron. We will be moving more of these in-house SDKs to other github locations +Some of the in-house built SDKs are hosted on other github locations and imported as .aar like UiTron. We will be moving more of these in-house SDKs to other github locations to reduce build time and have code separation. diff --git a/application-platform/app/build.gradle b/application-platform/app/build.gradle index 42f7708733..ff642a83f9 100644 --- a/application-platform/app/build.gradle +++ b/application-platform/app/build.gradle @@ -75,4 +75,4 @@ dependencies { androidTestImplementation 'androidx.compose.ui:ui-test-junit4' debugImplementation 'androidx.compose.ui:ui-tooling' debugImplementation 'androidx.compose.ui:ui-test-manifest' -} \ No newline at end of file +} diff --git a/application-platform/build.gradle b/application-platform/build.gradle index ca69cf740e..822dc80f45 100644 --- a/application-platform/build.gradle +++ b/application-platform/build.gradle @@ -14,4 +14,4 @@ plugins { alias libs.plugins.kotlin.parcelize apply false alias libs.plugins.ksp apply false -} \ No newline at end of file +} diff --git a/application-platform/settings.gradle b/application-platform/settings.gradle index a330c7d7fa..2f8a1b811f 100644 --- a/application-platform/settings.gradle +++ b/application-platform/settings.gradle @@ -72,4 +72,4 @@ project(':navi-design').projectDir = new File(settingsDir, '../navi-design') project(':navi-analytics').projectDir = new File(settingsDir, '../navi-analytics') project(':navi-base').projectDir = new File(settingsDir, '../navi-base') project(':pulse').projectDir = new File(settingsDir, '../pulse') -project(':one-money-sdk').projectDir = new File(settingsDir, '../one-money-sdk') \ No newline at end of file +project(':one-money-sdk').projectDir = new File(settingsDir, '../one-money-sdk') diff --git a/finoramic-androidx-sdk/build.gradle b/finoramic-androidx-sdk/build.gradle index 9d9983e4d7..c4a3fedb9e 100644 --- a/finoramic-androidx-sdk/build.gradle +++ b/finoramic-androidx-sdk/build.gradle @@ -1,2 +1,2 @@ configurations.maybeCreate("default") -artifacts.add("default", file('finoramic-androidx-sdk.aar')) \ No newline at end of file +artifacts.add("default", file('finoramic-androidx-sdk.aar')) diff --git a/navi-analytics/build.gradle b/navi-analytics/build.gradle index 34ea96b500..0884c33a1c 100644 --- a/navi-analytics/build.gradle +++ b/navi-analytics/build.gradle @@ -69,4 +69,4 @@ dependencies { testImplementation libs.androidx.room.testing } -android.buildFeatures.buildConfig true \ No newline at end of file +android.buildFeatures.buildConfig true diff --git a/navi-analytics/src/main/java/com/navi/analytics/utils/NaviAnalyticsConstants.kt b/navi-analytics/src/main/java/com/navi/analytics/utils/NaviAnalyticsConstants.kt index f4e1e13350..64b6e74a92 100644 --- a/navi-analytics/src/main/java/com/navi/analytics/utils/NaviAnalyticsConstants.kt +++ b/navi-analytics/src/main/java/com/navi/analytics/utils/NaviAnalyticsConstants.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -24,4 +24,3 @@ const val CONFIG_VERSION_CAMEL_CASE = "configVersion" const val CUSTOMER_ID = "customer_id" const val CHAT_DEEPLINK_APPEARS = "chat_deeplink_appears" const val METHOD_NAME = "method_name" - diff --git a/navi-base/src/main/java/com/navi/base/awsupload/AWSFileType.kt b/navi-base/src/main/java/com/navi/base/awsupload/AWSFileType.kt index 9a452579da..c3ffa79484 100644 --- a/navi-base/src/main/java/com/navi/base/awsupload/AWSFileType.kt +++ b/navi-base/src/main/java/com/navi/base/awsupload/AWSFileType.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/navi-base/src/main/java/com/navi/base/cache/database/NaviSharedDatabase.kt b/navi-base/src/main/java/com/navi/base/cache/database/NaviSharedDatabase.kt index 804bb6cc78..221e48c663 100644 --- a/navi-base/src/main/java/com/navi/base/cache/database/NaviSharedDatabase.kt +++ b/navi-base/src/main/java/com/navi/base/cache/database/NaviSharedDatabase.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -20,18 +20,23 @@ abstract class NaviSharedDatabase : RoomDatabase() { abstract fun naviCacheDao(): NaviCacheDao /** - * This function will be used only in HL and PL dynamic modules. - * From other modules please use Hilt only + * This function will be used only in HL and PL dynamic modules. From other modules please use + * Hilt only */ companion object { - @Volatile - private var naviSharedDatabase: NaviSharedDatabase? = null + @Volatile private var naviSharedDatabase: NaviSharedDatabase? = null + fun getInstance(context: Context): NaviSharedDatabase { synchronized(this) { if (naviSharedDatabase == null) { - naviSharedDatabase = Room.databaseBuilder(context, NaviSharedDatabase::class.java, NaviSharedDBConstant.DB_NAME) - .build() + naviSharedDatabase = + Room.databaseBuilder( + context, + NaviSharedDatabase::class.java, + NaviSharedDBConstant.DB_NAME + ) + .build() } return naviSharedDatabase as NaviSharedDatabase } diff --git a/navi-base/src/main/java/com/navi/base/cache/di/NaviBaseModule.kt b/navi-base/src/main/java/com/navi/base/cache/di/NaviBaseModule.kt index 2ec2f83bbd..5c713d1752 100644 --- a/navi-base/src/main/java/com/navi/base/cache/di/NaviBaseModule.kt +++ b/navi-base/src/main/java/com/navi/base/cache/di/NaviBaseModule.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -47,7 +47,9 @@ abstract class NaviBaseBindingModule { @Singleton @Binds - abstract fun bindsNaviCacheRepository(naviCacheRepositoryImpl: NaviCacheRepositoryImpl): NaviCacheRepository + abstract fun bindsNaviCacheRepository( + naviCacheRepositoryImpl: NaviCacheRepositoryImpl + ): NaviCacheRepository @Singleton @Binds @@ -55,5 +57,7 @@ abstract class NaviBaseBindingModule { @Singleton @Binds - abstract fun bindsFirestoreDataProvider(firestoreDataProviderImpl: FirestoreDataProviderImpl): FirestoreDataProvider -} \ No newline at end of file + abstract fun bindsFirestoreDataProvider( + firestoreDataProviderImpl: FirestoreDataProviderImpl + ): FirestoreDataProvider +} diff --git a/navi-base/src/main/java/com/navi/base/cache/repository/NaviCacheRepository.kt b/navi-base/src/main/java/com/navi/base/cache/repository/NaviCacheRepository.kt index f4c452c539..05f190dd3d 100644 --- a/navi-base/src/main/java/com/navi/base/cache/repository/NaviCacheRepository.kt +++ b/navi-base/src/main/java/com/navi/base/cache/repository/NaviCacheRepository.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -10,9 +10,9 @@ package com.navi.base.cache.repository import com.navi.base.cache.dao.NaviCacheDao import com.navi.base.cache.model.NaviCacheAltSourceEntity import com.navi.base.cache.model.NaviCacheEntity +import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow -import javax.inject.Inject interface NaviCacheRepository { @@ -34,12 +34,14 @@ interface NaviCacheRepository { key: String, version: Long? = null, getDataFromAltSource: suspend () -> NaviCacheAltSourceEntity, - isCurrentAndAltDataSame: (currentData: NaviCacheEntity?, altData: NaviCacheAltSourceEntity) -> Boolean - = fun(currentData, altData): Boolean { + isCurrentAndAltDataSame: + (currentData: NaviCacheEntity?, altData: NaviCacheAltSourceEntity) -> Boolean = + fun(currentData, altData): Boolean { val currentDataValue = currentData?.value ?: return false val altDataValue = altData.value ?: return false - return currentData.version == altData.version && currentDataValue.hashCode() == altDataValue.hashCode() + return currentData.version == altData.version && + currentDataValue.hashCode() == altDataValue.hashCode() }, emitMultipleValues: Boolean = false ): Flow @@ -72,7 +74,8 @@ class NaviCacheRepositoryImpl @Inject constructor(private val naviCacheDao: Navi val currentValueInDB = get(key = key) - if (checkIfDBValueIsValidElseRemoveEntry( + if ( + checkIfDBValueIsValidElseRemoveEntry( naviCacheEntity = currentValueInDB, version = version, key = key @@ -84,21 +87,23 @@ class NaviCacheRepositoryImpl @Inject constructor(private val naviCacheDao: Navi // DB value is invalid val naviCacheValueEntityFromAltSource = getDataFromAltSource.invoke() - if (!naviCacheValueEntityFromAltSource.isSuccess || - naviCacheValueEntityFromAltSource.value == null + if ( + !naviCacheValueEntityFromAltSource.isSuccess || + naviCacheValueEntityFromAltSource.value == null ) { // alternate source data invalid return null } // Got data from alt source - val naviCacheEntity = NaviCacheEntity( - key = key, - value = naviCacheValueEntityFromAltSource.value, - version = naviCacheValueEntityFromAltSource.version ?: 1, - ttl = naviCacheValueEntityFromAltSource.ttl, - clearOnLogout = naviCacheValueEntityFromAltSource.clearOnLogout, - metaData = naviCacheValueEntityFromAltSource.metaData - ) + val naviCacheEntity = + NaviCacheEntity( + key = key, + value = naviCacheValueEntityFromAltSource.value, + version = naviCacheValueEntityFromAltSource.version ?: 1, + ttl = naviCacheValueEntityFromAltSource.ttl, + clearOnLogout = naviCacheValueEntityFromAltSource.clearOnLogout, + metaData = naviCacheValueEntityFromAltSource.metaData + ) save(naviCacheEntity = naviCacheEntity) @@ -109,15 +114,16 @@ class NaviCacheRepositoryImpl @Inject constructor(private val naviCacheDao: Navi key: String, version: Long?, getDataFromAltSource: suspend () -> NaviCacheAltSourceEntity, - isCurrentAndAltDataSame: (currentData: NaviCacheEntity?, altData: NaviCacheAltSourceEntity) -> Boolean, + isCurrentAndAltDataSame: + (currentData: NaviCacheEntity?, altData: NaviCacheAltSourceEntity) -> Boolean, emitMultipleValues: Boolean ) = flow { - var isValueEmitted = false val currentValueInDB = get(key = key) - if (checkIfDBValueIsValidElseRemoveEntry( + if ( + checkIfDBValueIsValidElseRemoveEntry( naviCacheEntity = currentValueInDB, version = version, key = key @@ -129,20 +135,22 @@ class NaviCacheRepositoryImpl @Inject constructor(private val naviCacheDao: Navi val naviCacheValueEntityFromAltSource = getDataFromAltSource.invoke() - if (!naviCacheValueEntityFromAltSource.isSuccess || - naviCacheValueEntityFromAltSource.value == null + if ( + !naviCacheValueEntityFromAltSource.isSuccess || + naviCacheValueEntityFromAltSource.value == null ) { // alternate source data invalid return@flow } - val naviCacheEntity = NaviCacheEntity( - key = key, - value = naviCacheValueEntityFromAltSource.value, - version = naviCacheValueEntityFromAltSource.version ?: 1, - ttl = naviCacheValueEntityFromAltSource.ttl, - clearOnLogout = naviCacheValueEntityFromAltSource.clearOnLogout, - metaData = naviCacheValueEntityFromAltSource.metaData - ) + val naviCacheEntity = + NaviCacheEntity( + key = key, + value = naviCacheValueEntityFromAltSource.value, + version = naviCacheValueEntityFromAltSource.version ?: 1, + ttl = naviCacheValueEntityFromAltSource.ttl, + clearOnLogout = naviCacheValueEntityFromAltSource.clearOnLogout, + metaData = naviCacheValueEntityFromAltSource.metaData + ) if (isCurrentAndAltDataSame(currentValueInDB, naviCacheValueEntityFromAltSource)) { return@flow @@ -163,15 +171,16 @@ class NaviCacheRepositoryImpl @Inject constructor(private val naviCacheDao: Navi key: String ): Boolean { if (naviCacheEntity == null) // value not present - return false + return false if (version != null && naviCacheEntity.version < version) { // outdated version clear(key = key) return false } - if (naviCacheEntity.ttl != -1L && - ((System.currentTimeMillis() - naviCacheEntity.updatedAt) > + if ( + naviCacheEntity.ttl != -1L && + ((System.currentTimeMillis() - naviCacheEntity.updatedAt) > naviCacheEntity.ttl) // ttl expired ) { clear(key = key) diff --git a/navi-base/src/main/java/com/navi/base/model/BottomSheetData.kt b/navi-base/src/main/java/com/navi/base/model/BottomSheetData.kt index bc8f08b76f..ff391b478e 100644 --- a/navi-base/src/main/java/com/navi/base/model/BottomSheetData.kt +++ b/navi-base/src/main/java/com/navi/base/model/BottomSheetData.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -37,22 +37,17 @@ data class PaddingData( @SerializedName("topDp") var topDp: Float = 0.0f, @SerializedName("bottomDp") var bottomDp: Float = 0.0f ) : Parcelable, NaviClickAction() + @Parcelize data class ActionButtonStyle( - @SerializedName("bgColor") - val bgColor: String? = null, - @SerializedName("radius") - val radius: Radius? = null + @SerializedName("bgColor") val bgColor: String? = null, + @SerializedName("radius") val radius: Radius? = null ) : Parcelable @Parcelize data class Radius( - @SerializedName("leftTop") - val leftTop: Int? = null, - @SerializedName("leftBottom") - val leftBottom: Int? = null, - @SerializedName("rightTop") - val rightTop: Int? = null, - @SerializedName("rightBottom") - val rightBottom: Int? = null + @SerializedName("leftTop") val leftTop: Int? = null, + @SerializedName("leftBottom") val leftBottom: Int? = null, + @SerializedName("rightTop") val rightTop: Int? = null, + @SerializedName("rightBottom") val rightBottom: Int? = null ) : Parcelable diff --git a/navi-base/src/main/java/com/navi/base/model/CtaData.kt b/navi-base/src/main/java/com/navi/base/model/CtaData.kt index 054c49fccc..7d9b1251f0 100644 --- a/navi-base/src/main/java/com/navi/base/model/CtaData.kt +++ b/navi-base/src/main/java/com/navi/base/model/CtaData.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2020-2023 by Navi Technologies Limited + * * Copyright © 2020-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/navi-base/src/main/java/com/navi/base/model/LineItem.kt b/navi-base/src/main/java/com/navi/base/model/LineItem.kt index de06e78b1f..432801ea3a 100644 --- a/navi-base/src/main/java/com/navi/base/model/LineItem.kt +++ b/navi-base/src/main/java/com/navi/base/model/LineItem.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2020-2023 by Navi Technologies Limited + * * Copyright © 2020-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -16,7 +16,7 @@ import kotlinx.parcelize.Parcelize open class LineItem( @SerializedName("key") val key: String? = null, @SerializedName("value") var value: String? = null, - @SerializedName("expressionValue") val expressionValue : String? = null, + @SerializedName("expressionValue") val expressionValue: String? = null, @SerializedName("subtitle") val subtitle: String? = null, @SerializedName("subValue") val subValue: String? = null, @SerializedName("iconCode") val iconCode: String? = null, diff --git a/navi-base/src/main/java/com/navi/base/model/NaviClickAction.kt b/navi-base/src/main/java/com/navi/base/model/NaviClickAction.kt index 24d7356b39..5d7a82693b 100644 --- a/navi-base/src/main/java/com/navi/base/model/NaviClickAction.kt +++ b/navi-base/src/main/java/com/navi/base/model/NaviClickAction.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2023 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -10,8 +10,8 @@ package com.navi.base.model import android.os.Bundle import android.os.Parcelable import com.google.gson.annotations.SerializedName -import kotlinx.parcelize.Parcelize import java.io.Serializable +import kotlinx.parcelize.Parcelize open class NaviClickAction diff --git a/navi-base/src/main/java/com/navi/base/network/util/ApiConstants.kt b/navi-base/src/main/java/com/navi/base/network/util/ApiConstants.kt index 0e97016f30..2e2db63451 100644 --- a/navi-base/src/main/java/com/navi/base/network/util/ApiConstants.kt +++ b/navi-base/src/main/java/com/navi/base/network/util/ApiConstants.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/navi-base/src/main/java/com/navi/base/sharedpref/PreferenceManager.kt b/navi-base/src/main/java/com/navi/base/sharedpref/PreferenceManager.kt index ceb3e23955..1da2c47cc5 100644 --- a/navi-base/src/main/java/com/navi/base/sharedpref/PreferenceManager.kt +++ b/navi-base/src/main/java/com/navi/base/sharedpref/PreferenceManager.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019-2023 by Navi Technologies Limited + * * Copyright © 2019-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -235,6 +235,7 @@ object PreferenceManager { editor.putString(key, defValue) editor.apply() } + fun getStringPreferenceApp(key: String, defValue: String? = null): String? { return sharedPreferencesForApp.getString(key, defValue) } @@ -350,7 +351,6 @@ object PreferenceManager { val editor = it.edit() keys.forEach { key -> editor.remove(key) } editor.apply() - } - ?: run { clearKeyBasedSessionPreferenceData(keys = keys) } + } ?: run { clearKeyBasedSessionPreferenceData(keys = keys) } } } diff --git a/navi-base/src/main/java/com/navi/base/utils/Constants.kt b/navi-base/src/main/java/com/navi/base/utils/Constants.kt index 266233a8c3..9c579db3f1 100644 --- a/navi-base/src/main/java/com/navi/base/utils/Constants.kt +++ b/navi-base/src/main/java/com/navi/base/utils/Constants.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -31,8 +31,8 @@ const val THOUSAND = 1000L const val INT_ZERO = 0 const val PAN_VERIFY_POLLING = "PAN_VERIFY_POLLING" const val SKIP_LOADER = "skipLoader" -const val PAN_VERIFY_POLLING_FAIL="PAN_VERIFY_POLLING_FAIL" +const val PAN_VERIFY_POLLING_FAIL = "PAN_VERIFY_POLLING_FAIL" const val APPLICATION_JSON = "application/json" const val EXCLUDE_FROM_HASH_ENCRYPTION = "excludeFromHashEncryption" const val QA_RELEASE_LOGS_FILE_NAME = "NAVI_QA_RELEASE_LOGS.txt" -const val QA_RELEASE_LOGS_FOLDER_NAME = "NAVI_QA_RELEASE_LOGS_FOLDER" \ No newline at end of file +const val QA_RELEASE_LOGS_FOLDER_NAME = "NAVI_QA_RELEASE_LOGS_FOLDER" diff --git a/navi-base/src/main/java/com/navi/base/utils/CurrencyUtil.kt b/navi-base/src/main/java/com/navi/base/utils/CurrencyUtil.kt index c07f1117a8..d55888a6af 100644 --- a/navi-base/src/main/java/com/navi/base/utils/CurrencyUtil.kt +++ b/navi-base/src/main/java/com/navi/base/utils/CurrencyUtil.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/navi-base/src/main/java/com/navi/base/utils/Ext.kt b/navi-base/src/main/java/com/navi/base/utils/Ext.kt index 598712afc8..8263e6e58f 100644 --- a/navi-base/src/main/java/com/navi/base/utils/Ext.kt +++ b/navi-base/src/main/java/com/navi/base/utils/Ext.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2023 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -13,10 +13,10 @@ import com.google.gson.Gson import com.navi.base.model.AnalyticsEvent import com.navi.base.model.CtaData import com.navi.base.utils.AppLaunchUtils.TRUE -import okhttp3.Headers -import org.json.JSONObject import kotlin.math.ceil import kotlin.math.floor +import okhttp3.Headers +import org.json.JSONObject fun String?.isNotNullAndNotEmpty(): Boolean = !this.isNullOrEmpty() diff --git a/navi-base/src/main/java/com/navi/base/utils/FirestoreDataProvider.kt b/navi-base/src/main/java/com/navi/base/utils/FirestoreDataProvider.kt index 5d48c6ec77..2cd0bee03e 100644 --- a/navi-base/src/main/java/com/navi/base/utils/FirestoreDataProvider.kt +++ b/navi-base/src/main/java/com/navi/base/utils/FirestoreDataProvider.kt @@ -10,16 +10,16 @@ package com.navi.base.utils import com.google.firebase.firestore.DocumentSnapshot import com.google.firebase.firestore.ktx.firestore import com.google.firebase.ktx.Firebase +import javax.inject.Inject import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow -import javax.inject.Inject - /** - * For any/all usages of Firestore, use this interface. - * Add methods as needed in interface & attach a corresponding implementation in [FirestoreDataProviderImpl] - * attachSnapShotListenerAndGetDocumentsForCollection -> Attach listener & keep getting callbacks for any changes to a particular path of collection. Returns list of [DocumentSnapshot] + * For any/all usages of Firestore, use this interface. Add methods as needed in interface & attach + * a corresponding implementation in [FirestoreDataProviderImpl] + * attachSnapShotListenerAndGetDocumentsForCollection -> Attach listener & keep getting callbacks + * for any changes to a particular path of collection. Returns list of [DocumentSnapshot] */ interface FirestoreDataProvider { @@ -28,8 +28,7 @@ interface FirestoreDataProvider { ): Flow> } -class FirestoreDataProviderImpl @Inject constructor() : - FirestoreDataProvider { +class FirestoreDataProviderImpl @Inject constructor() : FirestoreDataProvider { val db = Firebase.firestore @@ -37,22 +36,17 @@ class FirestoreDataProviderImpl @Inject constructor() : collectionPath: String ): Flow> { return callbackFlow { - - val listener = db.collection(collectionPath) - .addSnapshotListener { querySnapshot, error -> + val listener = + db.collection(collectionPath).addSnapshotListener { querySnapshot, error -> if (error != null) { close(cause = error) return@addSnapshotListener } - querySnapshot?.let { - trySend(it.documents) - } + querySnapshot?.let { trySend(it.documents) } } - awaitClose { - listener.remove() - } + awaitClose { listener.remove() } } } -} \ No newline at end of file +} diff --git a/navi-base/src/main/java/com/navi/base/utils/QaReleaseLogUtil.kt b/navi-base/src/main/java/com/navi/base/utils/QaReleaseLogUtil.kt index 32ab419425..b5813dd888 100644 --- a/navi-base/src/main/java/com/navi/base/utils/QaReleaseLogUtil.kt +++ b/navi-base/src/main/java/com/navi/base/utils/QaReleaseLogUtil.kt @@ -1,3 +1,10 @@ +/* + * + * * Copyright © 2023-2024 by Navi Technologies Limited + * * All rights reserved. Strictly confidential + * + */ + package com.navi.base.utils import android.content.Context @@ -5,9 +12,6 @@ import com.google.gson.Gson import com.google.gson.JsonObject import com.google.gson.JsonParser import com.navi.base.BuildConfig -import kotlinx.coroutines.asCoroutineDispatcher -import okhttp3.Request -import okhttp3.Response import java.io.File import java.io.FileOutputStream import java.io.OutputStreamWriter @@ -16,6 +20,9 @@ import java.text.SimpleDateFormat import java.util.Date import java.util.Locale import java.util.concurrent.Executors +import kotlinx.coroutines.asCoroutineDispatcher +import okhttp3.Request +import okhttp3.Response object QaReleaseLogUtil { @@ -43,7 +50,8 @@ object QaReleaseLogUtil { coroutineDispatcher.executor.execute { val logData = hashMapOf() val timestamp = - SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(Date()) + SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()) + .format(Date()) .toString() var endPoint = "" when (logType) { @@ -51,80 +59,87 @@ object QaReleaseLogUtil { val networkData: HashMap = hashMapOf() endPoint = URL(request?.url.toString()).path - val responseJsonString = try { - Gson().toJson(responseData) - } catch (e: Exception) { - "" - } - val responseObject = try { - JsonParser.parseString(responseJsonString).asJsonObject - } catch (e: Exception) { - JsonObject() - } + val responseJsonString = + try { + Gson().toJson(responseData) + } catch (e: Exception) { + "" + } + val responseObject = + try { + JsonParser.parseString(responseJsonString).asJsonObject + } catch (e: Exception) { + JsonObject() + } networkData["RESPONSE_BODY"] = responseObject networkData["RESPONSE_CODE"] = statusCode.toString() - val requestJsonString = try { - Gson().toJson(responseData) - } catch (e: Exception) { - "" - } - val requestObject = try { - JsonParser.parseString(requestJsonString).asJsonObject - } catch (e: Exception) { - JsonObject() - } + val requestJsonString = + try { + Gson().toJson(responseData) + } catch (e: Exception) { + "" + } + val requestObject = + try { + JsonParser.parseString(requestJsonString).asJsonObject + } catch (e: Exception) { + JsonObject() + } networkData["REQUEST_BODY"] = requestObject networkData["URL"] = request?.url.toString() val requestHeaderMap: HashMap = hashMapOf() - request?.headers?.forEach { - requestHeaderMap[it.first] = it.second - } + request?.headers?.forEach { requestHeaderMap[it.first] = it.second } - val requestHeaderJsonString = try { - Gson().toJson(requestHeaderMap) - } catch (e: Exception) { - EMPTY - } - val requestHeaderObject = try { - JsonParser.parseString(requestHeaderJsonString).asJsonObject - } catch (e: Exception) { - JsonObject() - } + val requestHeaderJsonString = + try { + Gson().toJson(requestHeaderMap) + } catch (e: Exception) { + EMPTY + } + val requestHeaderObject = + try { + JsonParser.parseString(requestHeaderJsonString).asJsonObject + } catch (e: Exception) { + JsonObject() + } networkData["REQUEST_HEADER"] = requestHeaderObject - val responseHeaderMap: HashMap = hashMapOf() - response?.headers?.forEach { - responseHeaderMap[it.first] = it.second - } + response?.headers?.forEach { responseHeaderMap[it.first] = it.second } - val responseHeaderJsonString = try { - Gson().toJson(responseHeaderMap) - } catch (e: Exception) { - EMPTY - } - val responseHeaderObject = try { - JsonParser.parseString(responseHeaderJsonString).asJsonObject - } catch (e: Exception) { - JsonObject() - } + val responseHeaderJsonString = + try { + Gson().toJson(responseHeaderMap) + } catch (e: Exception) { + EMPTY + } + val responseHeaderObject = + try { + JsonParser.parseString(responseHeaderJsonString).asJsonObject + } catch (e: Exception) { + JsonObject() + } networkData["RESPONSE_HEADER"] = responseHeaderObject networkData["REQUEST_METHOD"] = requestMethod.toString() logData[timestamp] = networkData } - - ReleaseLogType.ANR_LOG.name, ReleaseLogType.CRASH_LOG.name -> { + ReleaseLogType.ANR_LOG.name, + ReleaseLogType.CRASH_LOG.name -> { logData[timestamp] = data as HashMap } - else -> {} } val logMessage = Gson().toJson(logData) writeLogToFile( - logMessage = logMessage, logType, timestamp, endPoint, statusCode, requestMethod + logMessage = logMessage, + logType, + timestamp, + endPoint, + statusCode, + requestMethod ) } } @@ -171,5 +186,4 @@ object QaReleaseLogUtil { CRASH_LOG, ANR_LOG } - -} \ No newline at end of file +} diff --git a/navi-base/src/main/java/com/navi/base/utils/ResourceProvider.kt b/navi-base/src/main/java/com/navi/base/utils/ResourceProvider.kt index 7cfb867535..8ea535e10b 100644 --- a/navi-base/src/main/java/com/navi/base/utils/ResourceProvider.kt +++ b/navi-base/src/main/java/com/navi/base/utils/ResourceProvider.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -23,4 +23,4 @@ class ResourceProviderImpl @Inject constructor(@ApplicationContext val context: override fun getString(@StringRes resId: Int, vararg formatArg: Any): String { return context.getString(resId, *formatArg) } -} \ No newline at end of file +} diff --git a/navi-base/src/main/java/com/navi/base/utils/SoUtils.kt b/navi-base/src/main/java/com/navi/base/utils/SoUtils.kt index c971867ef6..8e88c07c49 100644 --- a/navi-base/src/main/java/com/navi/base/utils/SoUtils.kt +++ b/navi-base/src/main/java/com/navi/base/utils/SoUtils.kt @@ -1,3 +1,10 @@ +/* + * + * * Copyright © 2023-2024 by Navi Technologies Limited + * * All rights reserved. Strictly confidential + * + */ + package com.navi.base.utils import android.content.Context @@ -6,14 +13,18 @@ import android.os.Bundle import com.google.firebase.analytics.FirebaseAnalytics import java.io.File - object SoUtils { private const val ARM_64 = "arm64" private const val ARM_64_V8A = "arm64-v8a" private const val ARM_V7A = "armeabi-v7a" private const val ARMEABI = "armeabi" - fun getLibFileFromPath(context: Context, library: String, path: String? = null, firebaseAnalytics: FirebaseAnalytics? = null): File? { + fun getLibFileFromPath( + context: Context, + library: String, + path: String? = null, + firebaseAnalytics: FirebaseAnalytics? = null + ): File? { val libName = System.mapLibraryName(library) var file: File? = null val bundle = Bundle() @@ -21,9 +32,7 @@ object SoUtils { bundle.putString("libName", libName) bundle.putString("path_to_load", path) firebaseAnalytics?.logEvent("NaviLibSOFileOpeningFromPath", bundle) - file = File( - path ?: context.applicationInfo.nativeLibraryDir, libName - ) + file = File(path ?: context.applicationInfo.nativeLibraryDir, libName) } catch (e: Exception) { bundle.putString( "FILE_NOT_FOUND_PATH", diff --git a/navi-common/src/main/java/com/navi/common/utils/EmiCalculator.java b/navi-common/src/main/java/com/navi/common/utils/EmiCalculator.java index 68318354b3..771c11ab20 100644 --- a/navi-common/src/main/java/com/navi/common/utils/EmiCalculator.java +++ b/navi-common/src/main/java/com/navi/common/utils/EmiCalculator.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2020-2022 by Navi Technologies Limited + * * Copyright © 2020-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -8,9 +8,6 @@ package com.navi.common.utils; import androidx.annotation.Nullable; - -import com.navi.analytics.utils.NaviTrackEvent; - import java.math.BigDecimal; import java.math.RoundingMode; import org.joda.money.BigMoney; @@ -40,10 +37,14 @@ public class EmiCalculator { amount = principalLoanAmount .getAmount() - .divide(BigDecimal.valueOf(loanTenureInMonths), 0, RoundingMode.FLOOR); + .divide( + BigDecimal.valueOf(loanTenureInMonths), + 0, + RoundingMode.FLOOR); } else { BigDecimal monthlyInterestRate = monthlyInterestRate(); - BigDecimal numerator = BigDecimal.ONE.add(monthlyInterestRate).pow(loanTenureInMonths); + BigDecimal numerator = + BigDecimal.ONE.add(monthlyInterestRate).pow(loanTenureInMonths); BigDecimal denominator = numerator.subtract(BigDecimal.ONE); amount = principalLoanAmount diff --git a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarItemView.kt b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarItemView.kt index 924060e1be..5acdff501c 100644 --- a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarItemView.kt +++ b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarItemView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -112,9 +112,14 @@ constructor( } ?: kotlin.run { setTextColor(ResourcesCompat.getColor(resources, R.color.white, null)) - typeface = ResourcesCompat.getFont(context, getFontStyle(FontWeightEnum.TT_MEDIUM)) + typeface = + ResourcesCompat.getFont(context, getFontStyle(FontWeightEnum.TT_MEDIUM)) background = - ResourcesCompat.getDrawable(resources, R.drawable.circular_purple_16dp, null) + ResourcesCompat.getDrawable( + resources, + R.drawable.circular_purple_16dp, + null + ) } } } diff --git a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarListView.kt b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarListView.kt index a099b72e9a..82e13c8f1b 100644 --- a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarListView.kt +++ b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarListView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -24,7 +24,6 @@ import com.navi.design.calendar.model.ViewPaddingParams import com.navi.design.databinding.NaviCalendarListViewBinding import com.navi.design.utils.Constants.DATE_FORMAT_YYYY_MM_DD import com.navi.design.utils.getTotalNumberOfDayInMonth -import com.navi.design.utils.parseDateFromOneToAnother import com.navi.design.utils.parseDateToString import java.util.* import kotlinx.coroutines.* @@ -195,26 +194,32 @@ constructor(context: Context, attrs: AttributeSet? = null) : ConstraintLayout(co date = currentDate isViewSelected = currentDate.equals(defaultDate) isViewHighlighted = currentDate.equals(highlightedDate) - isDateAvailable = selectableDates?.let { - it.firstOrNull { it == currentDateString }?.let { true } ?: false - } ?: run { - if (noSelectDates?.contains(it).orFalse()) false - else - (currentDate.after(startDate) || currentDate.equals(startDate)) && - (currentDate.before(endDate) || currentDate.equals(endDate)) - } - selectableDates ?: run { - if ( - isDateAvailable && - skipDateConfig?.startDate != null && - skipDateConfig.endDate != null && selectableDates.isNullOrEmpty() - ) { - isDateAvailable = !((currentDate.after(skipDateConfig.startDate) || - currentDate.equals(skipDateConfig.startDate)) && - (currentDate.before(skipDateConfig.endDate) || - currentDate.equals(skipDateConfig.endDate))) + isDateAvailable = + selectableDates?.let { + it.firstOrNull { it == currentDateString }?.let { true } ?: false + } + ?: run { + if (noSelectDates?.contains(it).orFalse()) false + else + (currentDate.after(startDate) || + currentDate.equals(startDate)) && + (currentDate.before(endDate) || currentDate.equals(endDate)) + } + selectableDates + ?: run { + if ( + isDateAvailable && + skipDateConfig?.startDate != null && + skipDateConfig.endDate != null && + selectableDates.isNullOrEmpty() + ) { + isDateAvailable = + !((currentDate.after(skipDateConfig.startDate) || + currentDate.equals(skipDateConfig.startDate)) && + (currentDate.before(skipDateConfig.endDate) || + currentDate.equals(skipDateConfig.endDate))) + } } - } } listData.add(dateData) currentDate = incrementDayByOne(currentDate) diff --git a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarToolTip.kt b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarToolTip.kt index add7195ba7..47ff54cdbf 100644 --- a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarToolTip.kt +++ b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarToolTip.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -9,7 +9,10 @@ package com.navi.design.calendar.view interface NaviCalendarToolTip { fun showCurrentDateToolTip(drawPosition: Int): Unit + fun showSelectedDateToolTip(drawPosition: Int): Unit + fun removeCurrentDateToolTip(drawPosition: Int): Unit + fun removeToolTipsOfCurrentRv(): Unit } diff --git a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarView.kt b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarView.kt index d128128278..540cd34bc0 100644 --- a/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarView.kt +++ b/navi-design/src/main/java/com/navi/design/calendar/view/NaviCalendarView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/navi-design/src/main/java/com/navi/design/common/CommonViewProperty.kt b/navi-design/src/main/java/com/navi/design/common/CommonViewProperty.kt index ba52d2530a..1b00cdcdf6 100644 --- a/navi-design/src/main/java/com/navi/design/common/CommonViewProperty.kt +++ b/navi-design/src/main/java/com/navi/design/common/CommonViewProperty.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -9,8 +9,8 @@ package com.navi.design.common import android.os.Parcelable import com.google.gson.annotations.SerializedName -import kotlinx.parcelize.Parcelize import java.io.Serializable +import kotlinx.parcelize.Parcelize open class CommonViewProperty( var layoutId: String? = null, diff --git a/navi-design/src/main/java/com/navi/design/common/ComposeCommonView.kt b/navi-design/src/main/java/com/navi/design/common/ComposeCommonView.kt index b157e45d69..b27b8b5d6c 100644 --- a/navi-design/src/main/java/com/navi/design/common/ComposeCommonView.kt +++ b/navi-design/src/main/java/com/navi/design/common/ComposeCommonView.kt @@ -1,3 +1,10 @@ +/* + * + * * Copyright © 2023-2024 by Navi Technologies Limited + * * All rights reserved. Strictly confidential + * + */ + package com.navi.design.common import androidx.compose.animation.animateContentSize @@ -28,9 +35,9 @@ fun ExpandableText( modifier: Modifier, textModifier: Modifier, text: String, - isExpanded : Boolean, - onTextClicked : () -> Unit, - lineHeight : TextUnit = 22.sp, + isExpanded: Boolean, + onTextClicked: () -> Unit, + lineHeight: TextUnit = 22.sp, textFontSize: TextUnit = 12.sp, textColor: Color = FF444444, textFontWeight: FontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR), @@ -42,12 +49,7 @@ fun ExpandableText( ) { var clickable by remember { mutableStateOf(false) } var lastCharIndex by remember { mutableStateOf(0) } - Box(modifier = Modifier - .clickable(clickable) { - onTextClicked() - } - .then(modifier) - ) { + Box(modifier = Modifier.clickable(clickable) { onTextClicked() }.then(modifier)) { Text( modifier = textModifier.animateContentSize(), fontSize = textFontSize, @@ -55,22 +57,25 @@ fun ExpandableText( fontFamily = ttComposeFontFamily, color = textColor, fontWeight = textFontWeight, - text = buildAnnotatedString { - if (clickable) { - if (isExpanded) { - append(text) - withStyle(style = showLessStyle) { append(showLessText) } + text = + buildAnnotatedString { + if (clickable) { + if (isExpanded) { + append(text) + withStyle(style = showLessStyle) { append(showLessText) } + } else { + val adjustText = + text + .substring(startIndex = 0, endIndex = lastCharIndex) + .dropLast(showMoreText.length) + .dropLastWhile { Character.isWhitespace(it) || it == '.' } + append(adjustText) + withStyle(style = showMoreStyle) { append(showMoreText) } + } } else { - val adjustText = text.substring(startIndex = 0, endIndex = lastCharIndex) - .dropLast(showMoreText.length) - .dropLastWhile { Character.isWhitespace(it) || it == '.' } - append(adjustText) - withStyle(style = showMoreStyle) { append(showMoreText) } + append(text) } - } else { - append(text) - } - }, + }, maxLines = if (isExpanded) Int.MAX_VALUE else collapsedMaxLine, onTextLayout = { textLayoutResult -> if (!isExpanded && textLayoutResult.hasVisualOverflow) { @@ -80,4 +85,4 @@ fun ExpandableText( } ) } -} \ No newline at end of file +} diff --git a/navi-design/src/main/java/com/navi/design/common/TextViewBindingAdapter.kt b/navi-design/src/main/java/com/navi/design/common/TextViewBindingAdapter.kt index f999b2779e..29b264f7f1 100644 --- a/navi-design/src/main/java/com/navi/design/common/TextViewBindingAdapter.kt +++ b/navi-design/src/main/java/com/navi/design/common/TextViewBindingAdapter.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -89,7 +89,8 @@ fun TextView.setStyleDetails(textStyle: TextStyle) { // Retrieve values from typography and set on text view apply { textSize = typography.fontSize.value - typeface = ResourcesCompat.getFont(context, typography.fontWeight.getFont(typography.fontFamily)) + typeface = + ResourcesCompat.getFont(context, typography.fontWeight.getFont(typography.fontFamily)) letterSpacing = context.spToPx(typography.letterSpacing.value) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { diff --git a/navi-design/src/main/java/com/navi/design/customview/DashedDivider.kt b/navi-design/src/main/java/com/navi/design/customview/DashedDivider.kt index b9f6ba33af..016a8996fb 100644 --- a/navi-design/src/main/java/com/navi/design/customview/DashedDivider.kt +++ b/navi-design/src/main/java/com/navi/design/customview/DashedDivider.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/navi-design/src/main/java/com/navi/design/customview/LoadingButtonView.kt b/navi-design/src/main/java/com/navi/design/customview/LoadingButtonView.kt index 8b1dfb6e41..0623c8695d 100644 --- a/navi-design/src/main/java/com/navi/design/customview/LoadingButtonView.kt +++ b/navi-design/src/main/java/com/navi/design/customview/LoadingButtonView.kt @@ -1,13 +1,12 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ package com.navi.design.customview - import android.animation.ValueAnimator import android.content.Context import android.content.res.ColorStateList @@ -24,19 +23,17 @@ import com.google.android.material.chip.Chip import com.navi.design.R import kotlin.math.abs - -open class LoadingButtonView @JvmOverloads constructor( - context: Context, - attributeSet: AttributeSet? = null, - defStyleAttr: Int = 0 -) : Chip(context, attributeSet, defStyleAttr) { +open class LoadingButtonView +@JvmOverloads +constructor(context: Context, attributeSet: AttributeSet? = null, defStyleAttr: Int = 0) : + Chip(context, attributeSet, defStyleAttr) { private lateinit var borderPath: Path private lateinit var pathMeasure: PathMeasure private lateinit var loaderAnimator: ValueAnimator private var badScroll = 0f var lapDuration = 2000L var loaderWidth = 5f - var loaderColor = ContextCompat.getColor(context,R.color.noticeOrangeColor) + var loaderColor = ContextCompat.getColor(context, R.color.noticeOrangeColor) var loadingTextColor: Int? = null private var originalText = "" private var originalTextColor: ColorStateList? = null @@ -54,11 +51,12 @@ open class LoadingButtonView @JvmOverloads constructor( private var reversed = false private var wrappedClickListener: OnClickListener? = null var shouldStartLoadingOnClick = true - private val loaderPaint = Paint().apply { - isAntiAlias = true - style = Paint.Style.STROKE - textAlign = Paint.Align.CENTER - } + private val loaderPaint = + Paint().apply { + isAntiAlias = true + style = Paint.Style.STROKE + textAlign = Paint.Align.CENTER + } inner class ReverseDecelerateInterpolator : DecelerateInterpolator() { override fun getInterpolation(input: Float): Float { @@ -104,15 +102,15 @@ open class LoadingButtonView @JvmOverloads constructor( } } - init { if (attributeSet != null) { - val ta = context.obtainStyledAttributes( - attributeSet, - R.styleable.LoaderButton, - defStyleAttr, - 0 - ) + val ta = + context.obtainStyledAttributes( + attributeSet, + R.styleable.LoaderButton, + defStyleAttr, + 0 + ) reverseEffectEnabled = ta.getBoolean(R.styleable.LoaderButton_reverseEffect, false) when (ta.getInt(R.styleable.LoaderButton_loaderStyle, 7)) { @@ -153,7 +151,10 @@ open class LoadingButtonView @JvmOverloads constructor( shouldStartLoadingOnClick = ta.getBoolean(R.styleable.LoaderButton_loadOnClick, true) loadingText = ta.getString(R.styleable.LoaderButton_loadingText) loadingTextColor = ta.getColor(R.styleable.LoaderButton_loadingTextColor, Color.GRAY) - if (ta.hasValue(R.styleable.LoaderButton_loaderColorStart) && ta.hasValue(R.styleable.LoaderButton_loaderColorEnd)) { + if ( + ta.hasValue(R.styleable.LoaderButton_loaderColorStart) && + ta.hasValue(R.styleable.LoaderButton_loaderColorEnd) + ) { loaderStartColor = ta.getColor(R.styleable.LoaderButton_loaderColorStart, Color.WHITE) loaderEndColor = ta.getColor(R.styleable.LoaderButton_loaderColorEnd, Color.WHITE) @@ -201,7 +202,6 @@ open class LoadingButtonView @JvmOverloads constructor( loaderAnimator.end() } - fun startLoading() { if (!shouldLoad) { shouldLoad = true @@ -224,39 +224,39 @@ open class LoadingButtonView @JvmOverloads constructor( } private fun setupPaths() { - borderPath = Path().apply { - val halfStrokeWidth = loaderPaint.strokeWidth / 2f - addRoundRect( - chipDrawable.bounds.left.toFloat() + halfStrokeWidth, - chipDrawable.bounds.top.toFloat() + halfStrokeWidth, - chipDrawable.bounds.right.toFloat() - halfStrokeWidth, - chipDrawable.bounds.bottom.toFloat() - halfStrokeWidth, - chipCornerRadius, - chipCornerRadius, - Path.Direction.CW - ) - } + borderPath = + Path().apply { + val halfStrokeWidth = loaderPaint.strokeWidth / 2f + addRoundRect( + chipDrawable.bounds.left.toFloat() + halfStrokeWidth, + chipDrawable.bounds.top.toFloat() + halfStrokeWidth, + chipDrawable.bounds.right.toFloat() - halfStrokeWidth, + chipDrawable.bounds.bottom.toFloat() - halfStrokeWidth, + chipCornerRadius, + chipCornerRadius, + Path.Direction.CW + ) + } pathMeasure = PathMeasure(borderPath, true) } private fun setupAnimator() { - loaderAnimator = ValueAnimator.ofFloat(0f, 1f).apply { - duration = lapDuration - this.interpolator = this@LoadingButtonView.interpolator - addUpdateListener { - val animatedValue = it.animatedValue as Float - loaderEnd = animatedValue * pathMeasure.length - loaderStart = loaderEnd - ((0.5f - abs(animatedValue - 0.5f)) * pathMeasure.length) - invalidate() + loaderAnimator = + ValueAnimator.ofFloat(0f, 1f).apply { + duration = lapDuration + this.interpolator = this@LoadingButtonView.interpolator + addUpdateListener { + val animatedValue = it.animatedValue as Float + loaderEnd = animatedValue * pathMeasure.length + loaderStart = + loaderEnd - ((0.5f - abs(animatedValue - 0.5f)) * pathMeasure.length) + invalidate() + } } - } - loaderAnimator.doOnStart { - reversed = !reversed - } + loaderAnimator.doOnStart { reversed = !reversed } loaderAnimator.doOnEnd { if (reverseEffectEnabled) { - loaderAnimator.interpolator = - if (reversed) interpolator else reverseInterpolator + loaderAnimator.interpolator = if (reversed) interpolator else reverseInterpolator } loaderAnimator.start() } @@ -265,15 +265,16 @@ open class LoadingButtonView @JvmOverloads constructor( private fun handleGradient() { if (drawingGradient) { - loaderPaint.shader = LinearGradient( - 0f, - 0f, - pathMeasure.length / 3f, - loaderWidth, - loaderStartColor, - loaderEndColor, - Shader.TileMode.CLAMP - ) + loaderPaint.shader = + LinearGradient( + 0f, + 0f, + pathMeasure.length / 3f, + loaderWidth, + loaderStartColor, + loaderEndColor, + Shader.TileMode.CLAMP + ) } else { loaderPaint.color = loaderColor } diff --git a/navi-design/src/main/java/com/navi/design/customview/ParallelogramView.kt b/navi-design/src/main/java/com/navi/design/customview/ParallelogramView.kt index 07161119d9..161dc654b8 100644 --- a/navi-design/src/main/java/com/navi/design/customview/ParallelogramView.kt +++ b/navi-design/src/main/java/com/navi/design/customview/ParallelogramView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -102,7 +102,7 @@ class ParallelogramView(context: Context?, attrs: AttributeSet?) : View(context, override fun onAttachedToWindow() { super.onAttachedToWindow() - if(isReset) { + if (isReset) { initView() requestLayout() } diff --git a/navi-design/src/main/java/com/navi/design/customview/TooltipView.kt b/navi-design/src/main/java/com/navi/design/customview/TooltipView.kt index 6beef8957d..bc4f961a9e 100644 --- a/navi-design/src/main/java/com/navi/design/customview/TooltipView.kt +++ b/navi-design/src/main/java/com/navi/design/customview/TooltipView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -40,7 +40,7 @@ class TooltipView @JvmOverloads constructor(context: Context, attrs: AttributeSe binding.tooltipTv.text = tooltipTitle } - fun setTooltipColor(colorId : Int){ + fun setTooltipColor(colorId: Int) { binding.triangleView.setColorWithColorId(colorId) binding.tooltipTv.setBgColor(colorId) } @@ -52,6 +52,7 @@ class TooltipView @JvmOverloads constructor(context: Context, attrs: AttributeSe fun getTriangleView(): TriangleView { return binding.triangleView } + fun setProperties(style: Int? = null, textAllignment: Int? = null, padding: Padding? = null) { textAllignment?.let { try { diff --git a/navi-design/src/main/java/com/navi/design/customview/TriangleView.kt b/navi-design/src/main/java/com/navi/design/customview/TriangleView.kt index ae686b9630..be8d310519 100644 --- a/navi-design/src/main/java/com/navi/design/customview/TriangleView.kt +++ b/navi-design/src/main/java/com/navi/design/customview/TriangleView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -36,7 +36,8 @@ class TriangleView @JvmOverloads constructor(context: Context?, attrs: Attribute paint.color = ResourcesCompat.getColor(resources, colorId, null) invalidate() } - fun setColorWithColorId(colorId : Int){ + + fun setColorWithColorId(colorId: Int) { paint.color = colorId invalidate() } diff --git a/navi-design/src/main/java/com/navi/design/customview/WaveDividerView.kt b/navi-design/src/main/java/com/navi/design/customview/WaveDividerView.kt index 7093215556..e306bc3e6d 100644 --- a/navi-design/src/main/java/com/navi/design/customview/WaveDividerView.kt +++ b/navi-design/src/main/java/com/navi/design/customview/WaveDividerView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -48,6 +48,7 @@ class WaveDividerView @JvmOverloads constructor(context: Context?, attrs: Attrib endY = 0F SPACING = (viewWidth - NUMBER_OF_BARS) / (NUMBER_OF_BARS - 1) } + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { viewWidth = MeasureSpec.getSize(widthMeasureSpec).toFloat() viewHeight = MeasureSpec.getSize(heightMeasureSpec).toFloat() diff --git a/navi-design/src/main/java/com/navi/design/decorator/GridSpacingItemDecoration.kt b/navi-design/src/main/java/com/navi/design/decorator/GridSpacingItemDecoration.kt index ad4c401e9a..b9d47d8bad 100644 --- a/navi-design/src/main/java/com/navi/design/decorator/GridSpacingItemDecoration.kt +++ b/navi-design/src/main/java/com/navi/design/decorator/GridSpacingItemDecoration.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -15,8 +15,7 @@ class GridSpacingItemDecoration( private val spanCount: Int, private val spacing: Int, private val includeEdge: Boolean -) : - RecyclerView.ItemDecoration() { +) : RecyclerView.ItemDecoration() { override fun getItemOffsets( outRect: Rect, @@ -28,7 +27,8 @@ class GridSpacingItemDecoration( val column = position % spanCount // item column if (includeEdge) { outRect.left = - spacing - column * spacing / spanCount // spacing - column * ((1f / spanCount) * spacing) + spacing - + column * spacing / spanCount // spacing - column * ((1f / spanCount) * spacing) outRect.right = (column + 1) * spacing / spanCount // (column + 1) * ((1f / spanCount) * spacing) if (position < spanCount) { // top edge @@ -38,11 +38,12 @@ class GridSpacingItemDecoration( } else { outRect.left = column * spacing / spanCount // column * ((1f / spanCount) * spacing) outRect.right = - spacing - (column + 1) * spacing / spanCount // spacing - (column + 1) * ((1f / spanCount) * spacing) + spacing - + (column + 1) * spacing / + spanCount // spacing - (column + 1) * ((1f / spanCount) * spacing) if (position >= spanCount) { outRect.top = spacing // item top } } } - } diff --git a/navi-design/src/main/java/com/navi/design/editview/NaviEditText.kt b/navi-design/src/main/java/com/navi/design/editview/NaviEditText.kt index 376fab64d2..00846313ef 100644 --- a/navi-design/src/main/java/com/navi/design/editview/NaviEditText.kt +++ b/navi-design/src/main/java/com/navi/design/editview/NaviEditText.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2020-2023 by Navi Technologies Limited + * * Copyright © 2020-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -81,7 +81,6 @@ class NaviEditText(context: Context, attrs: AttributeSet) : AppCompatEditText(co typeface = ResourcesCompat.getFont(context, getFontStyle(fontName)) } - fun setTextStyle(textStyle: Int) { setTypeface(typeface, textStyle) } diff --git a/navi-design/src/main/java/com/navi/design/font/FontWeightEnum.kt b/navi-design/src/main/java/com/navi/design/font/FontWeightEnum.kt index 6ef33f6160..eb61daf1a0 100644 --- a/navi-design/src/main/java/com/navi/design/font/FontWeightEnum.kt +++ b/navi-design/src/main/java/com/navi/design/font/FontWeightEnum.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -20,89 +20,45 @@ enum class FontWeightEnum { /** Navi Headline - Bold (700) */ TT_BOLD, - /** For Navi Pay usage only **/ + /** For Navi Pay usage only * */ NAVI_HEADLINE_REGULAR, NAVI_HEADLINE_BOLD, NAVI_BODY_REGULAR, NAVI_BODY_DEMI_BOLD, - - @Deprecated( - "Use 'TT_REGULAR' instead.", - ReplaceWith("TT_REGULAR"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_REGULAR' instead.", ReplaceWith("TT_REGULAR"), DeprecationLevel.WARNING) ROBOTO_REGULAR, - - @Deprecated( - "Use 'TT_MEDIUM' instead.", - ReplaceWith("TT_MEDIUM"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_MEDIUM' instead.", ReplaceWith("TT_MEDIUM"), DeprecationLevel.WARNING) ROBOTO_MEDIUM, - @Deprecated( "Use 'TT_SEMI_BOLD' instead.", ReplaceWith("TT_SEMI_BOLD"), DeprecationLevel.WARNING ) ROBOTO_BOLD, - - @Deprecated( - "Use 'TT_REGULAR' instead.", - ReplaceWith("TT_REGULAR"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_REGULAR' instead.", ReplaceWith("TT_REGULAR"), DeprecationLevel.WARNING) REGULAR, - - @Deprecated( - "Use 'TT_REGULAR' instead.", - ReplaceWith("TT_REGULAR"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_REGULAR' instead.", ReplaceWith("TT_REGULAR"), DeprecationLevel.WARNING) SEMI_BOLD, - - @Deprecated( - "Use 'TT_MEDIUM' instead.", - ReplaceWith("TT_MEDIUM"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_MEDIUM' instead.", ReplaceWith("TT_MEDIUM"), DeprecationLevel.WARNING) BOLD, - @Deprecated( "Use 'TT_SEMI_BOLD' instead.", ReplaceWith("TT_SEMI_BOLD"), DeprecationLevel.WARNING ) EXTRA_BOLD, - - @Deprecated( - "Use 'TT_REGULAR' instead.", - ReplaceWith("TT_REGULAR"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_REGULAR' instead.", ReplaceWith("TT_REGULAR"), DeprecationLevel.WARNING) NAVI_REGULAR, - - @Deprecated( - "Use 'TT_REGULAR' instead.", - ReplaceWith("TT_REGULAR"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_REGULAR' instead.", ReplaceWith("TT_REGULAR"), DeprecationLevel.WARNING) NAVI_SEMI_BOLD, - - @Deprecated( - "Use 'TT_MEDIUM' instead.", - ReplaceWith("TT_MEDIUM"), - DeprecationLevel.WARNING - ) + @Deprecated("Use 'TT_MEDIUM' instead.", ReplaceWith("TT_MEDIUM"), DeprecationLevel.WARNING) NAVI_BOLD, - @Deprecated( "Use 'TT_SEMI_BOLD' instead.", ReplaceWith("TT_SEMI_BOLD"), DeprecationLevel.WARNING ) NAVI_EXTRA_BOLD, - @Deprecated( "Use 'TT_SEMI_BOLD' instead.", ReplaceWith("TT_SEMI_BOLD"), diff --git a/navi-design/src/main/java/com/navi/design/recyclerview/ScrollAwareRecyclerView.kt b/navi-design/src/main/java/com/navi/design/recyclerview/ScrollAwareRecyclerView.kt index 80d3de3dac..3cf44c755e 100644 --- a/navi-design/src/main/java/com/navi/design/recyclerview/ScrollAwareRecyclerView.kt +++ b/navi-design/src/main/java/com/navi/design/recyclerview/ScrollAwareRecyclerView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -25,6 +25,7 @@ class ScrollAwareRecyclerView( private var scrolling = false constructor(@NonNull context: Context) : this(context, null) {} + constructor( @NonNull context: Context, @Nullable attrs: AttributeSet? diff --git a/navi-design/src/main/java/com/navi/design/snackbar/NaviSnackbar.kt b/navi-design/src/main/java/com/navi/design/snackbar/NaviSnackbar.kt index a9fcb89a4a..40d2f20eea 100644 --- a/navi-design/src/main/java/com/navi/design/snackbar/NaviSnackbar.kt +++ b/navi-design/src/main/java/com/navi/design/snackbar/NaviSnackbar.kt @@ -1,3 +1,10 @@ +/* + * + * * Copyright © 2023-2024 by Navi Technologies Limited + * * All rights reserved. Strictly confidential + * + */ + package com.navi.design.snackbar import androidx.annotation.DrawableRes @@ -64,15 +71,11 @@ fun NaviSnackBar( val snackScope = rememberCoroutineScope() val dismissSnackBar = { - snackScope.launch { - snackState.currentSnackbarData?.dismiss() - } + snackScope.launch { snackState.currentSnackbarData?.dismiss() } Unit } - SnackbarHost( - modifier = modifier, hostState = snackState - ) { + SnackbarHost(modifier = modifier, hostState = snackState) { Snackbar( backgroundColor = backgroundColor, elevation = 0.dp, @@ -86,18 +89,15 @@ fun NaviSnackBar( Image( painter = painterResource(id = snackBarConfig.iconResId), contentDescription = null, - modifier = Modifier - .align(alignment = Alignment.CenterVertically) - .clickable { + modifier = + Modifier.align(alignment = Alignment.CenterVertically).clickable { onIconClick?.invoke() } ) Spacer(modifier = Modifier.width(16.dp)) } Column( - modifier = Modifier - .height(IntrinsicSize.Min) - .weight(1f), + modifier = Modifier.height(IntrinsicSize.Min).weight(1f), verticalArrangement = Arrangement.Center ) { Text( @@ -120,8 +120,8 @@ fun NaviSnackBar( if (snackBarConfig.actionIconResId != null) { Spacer(modifier = Modifier.width(16.dp)) Image( - modifier = Modifier - .clickable { + modifier = + Modifier.clickable { dismissSnackBar() onActionClick?.invoke() }, @@ -136,9 +136,7 @@ fun NaviSnackBar( if (show) { LaunchedEffect(Unit) { - val result = snackState.showSnackbar( - snackBarConfig.title, duration = snackbarDuration - ) + val result = snackState.showSnackbar(snackBarConfig.title, duration = snackbarDuration) if (result == SnackbarResult.Dismissed) { onDismissed?.invoke() } @@ -189,4 +187,4 @@ fun ErrorSnackBar( onDismissed = onDismissed, onIconClick = onIconClick ) -} \ No newline at end of file +} diff --git a/navi-design/src/main/java/com/navi/design/tab/NaviScrollableTabRow.kt b/navi-design/src/main/java/com/navi/design/tab/NaviScrollableTabRow.kt index d73212f4f7..f7d4081a3c 100644 --- a/navi-design/src/main/java/com/navi/design/tab/NaviScrollableTabRow.kt +++ b/navi-design/src/main/java/com/navi/design/tab/NaviScrollableTabRow.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -179,8 +179,8 @@ private class ScrollableTabData( /** * @return the offset required to horizontally center the tab inside this TabRow. If the tab is - * at the start / end, and there is not enough space to fully centre the tab, this will just - * clamp to the min / max position given the max width. + * at the start / end, and there is not enough space to fully centre the tab, this will just + * clamp to the min / max position given the max width. */ private fun TabPosition.calculateTabOffset( density: Density, diff --git a/navi-design/src/main/java/com/navi/design/tab/NaviTab.kt b/navi-design/src/main/java/com/navi/design/tab/NaviTab.kt index 5964ab7c37..a1898161be 100644 --- a/navi-design/src/main/java/com/navi/design/tab/NaviTab.kt +++ b/navi-design/src/main/java/com/navi/design/tab/NaviTab.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019-2022 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -87,8 +87,9 @@ private fun TabBaselineLayout( val tabWidth = max(textPlaceable?.width ?: 0, iconPlaceable?.width ?: 0) val tabHeight = - (iconPlaceable?.height - ?: 0) + (textPlaceable?.height ?: 0) + iconDistanceFromBaseline.roundToPx() + (iconPlaceable?.height ?: 0) + + (textPlaceable?.height ?: 0) + + iconDistanceFromBaseline.roundToPx() val firstBaseline = textPlaceable?.get(FirstBaseline) val lastBaseline = textPlaceable?.get(LastBaseline) diff --git a/navi-design/src/main/java/com/navi/design/textview/NaviTextView.kt b/navi-design/src/main/java/com/navi/design/textview/NaviTextView.kt index 8d332e71cb..bd5d22363a 100644 --- a/navi-design/src/main/java/com/navi/design/textview/NaviTextView.kt +++ b/navi-design/src/main/java/com/navi/design/textview/NaviTextView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -23,9 +23,9 @@ import com.navi.design.R import com.navi.design.utils.dpToPxInInt import com.navi.design.utils.getStyle import com.navi.design.utils.setViewBackground -import timber.log.Timber -class NaviTextView(context: Context, attrs: AttributeSet? = null) : AppCompatTextView(context, attrs) { +class NaviTextView(context: Context, attrs: AttributeSet? = null) : + AppCompatTextView(context, attrs) { init { context.theme.obtainStyledAttributes(attrs, R.styleable.NaviView, 0, 0).apply { try { @@ -97,7 +97,7 @@ class NaviTextView(context: Context, attrs: AttributeSet? = null) : AppCompatTex } } - fun setBgColor(colorId : Int){ + fun setBgColor(colorId: Int) { setBackgroundColor(colorId) } diff --git a/navi-design/src/main/java/com/navi/design/textview/VerticalTextView.kt b/navi-design/src/main/java/com/navi/design/textview/VerticalTextView.kt index 925f83a711..f33291c929 100644 --- a/navi-design/src/main/java/com/navi/design/textview/VerticalTextView.kt +++ b/navi-design/src/main/java/com/navi/design/textview/VerticalTextView.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -14,11 +14,10 @@ import android.text.SpannableString import android.util.AttributeSet import androidx.appcompat.widget.AppCompatTextView -class VerticalTextView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyle: Int = 0 -) : AppCompatTextView(context, attrs, defStyle) { +class VerticalTextView +@JvmOverloads +constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : + AppCompatTextView(context, attrs, defStyle) { private var _measuredWidth: Int = 0 private var _measuredHeight: Int = 0 diff --git a/navi-design/src/main/java/com/navi/design/textview/model/NaviSpan.kt b/navi-design/src/main/java/com/navi/design/textview/model/NaviSpan.kt index 1dfa8907b9..7bc32c4e44 100644 --- a/navi-design/src/main/java/com/navi/design/textview/model/NaviSpan.kt +++ b/navi-design/src/main/java/com/navi/design/textview/model/NaviSpan.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -56,14 +56,24 @@ data class NaviSpan( interface SpanInterface { fun endSpan(): Int? + fun startSpan(): Int? + fun spanColor(): String? + fun spanBgColor(): String? + fun fontName(): String? + fun fontSize(): Double? + fun lineSpacing(): Float? + fun style(): String? + fun gravity(): String? + fun underLine(): Boolean? + fun cta(): ActionData? } diff --git a/navi-design/src/main/java/com/navi/design/textview/model/TextWithStyle.kt b/navi-design/src/main/java/com/navi/design/textview/model/TextWithStyle.kt index a0780a0df5..6580b0cfe4 100644 --- a/navi-design/src/main/java/com/navi/design/textview/model/TextWithStyle.kt +++ b/navi-design/src/main/java/com/navi/design/textview/model/TextWithStyle.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -9,8 +9,8 @@ package com.navi.design.textview.model import android.os.Parcelable import com.google.gson.annotations.SerializedName -import kotlinx.parcelize.Parcelize import java.io.Serializable +import kotlinx.parcelize.Parcelize @Parcelize data class TextWithStyle( diff --git a/navi-design/src/main/java/com/navi/design/theme/ComposeFontUtil.kt b/navi-design/src/main/java/com/navi/design/theme/ComposeFontUtil.kt index c1ac81b5bd..6daf7ed55b 100644 --- a/navi-design/src/main/java/com/navi/design/theme/ComposeFontUtil.kt +++ b/navi-design/src/main/java/com/navi/design/theme/ComposeFontUtil.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -39,26 +39,22 @@ fun getFontWeight(fontWeight: FontWeightEnum): FontWeight { FontWeightEnum.REGULAR, FontWeightEnum.TT_REGULAR, FontWeightEnum.NAVI_BODY_REGULAR -> FontWeight.Normal - FontWeightEnum.SEMI_BOLD, FontWeightEnum.TT_SEMI_BOLD, FontWeightEnum.NAVI_BODY_DEMI_BOLD -> FontWeight.SemiBold - FontWeightEnum.ROBOTO_MEDIUM, FontWeightEnum.TT_MEDIUM, FontWeightEnum.NAVI_HEADLINE_REGULAR -> FontWeight.Medium - FontWeightEnum.ROBOTO_BOLD, FontWeightEnum.TT_BOLD, FontWeightEnum.BOLD, FontWeightEnum.NAVI_HEADLINE_BOLD -> FontWeight.Bold FontWeightEnum.EXTRA_BOLD -> FontWeight.ExtraBold - else -> FontWeight.Normal } } -fun getFontFamily(fontFamily:String?): FontFamily { +fun getFontFamily(fontFamily: String?): FontFamily { return when (fontFamily) { TT_FONT_FAMILY -> ttComposeFontFamily else -> composeFontFamily @@ -69,14 +65,14 @@ fun getFontWeight(fontWeight: String?): FontWeight { return when (fontWeight) { FontWeightEnum.TT_REGULAR.name, FontWeightEnum.ROBOTO_REGULAR.name, - FontWeightEnum.REGULAR.name , - FontWeightEnum.NAVI_REGULAR.name-> FontWeight.Normal + FontWeightEnum.REGULAR.name, + FontWeightEnum.NAVI_REGULAR.name -> FontWeight.Normal FontWeightEnum.TT_SEMI_BOLD.name, - FontWeightEnum.SEMI_BOLD.name , - FontWeightEnum.NAVI_EXTRA_BOLD.name-> FontWeight.SemiBold + FontWeightEnum.SEMI_BOLD.name, + FontWeightEnum.NAVI_EXTRA_BOLD.name -> FontWeight.SemiBold FontWeightEnum.ROBOTO_MEDIUM.name, FontWeightEnum.TT_MEDIUM.name, - FontWeightEnum.NAVI_BOLD.name-> FontWeight.Medium + FontWeightEnum.NAVI_BOLD.name -> FontWeight.Medium FontWeightEnum.ROBOTO_BOLD.name, FontWeightEnum.TT_BOLD.name, FontWeightEnum.BOLD.name -> FontWeight.Bold diff --git a/navi-design/src/main/java/com/navi/design/theme/Type.kt b/navi-design/src/main/java/com/navi/design/theme/Type.kt index 234699ec6d..f7772ff0ff 100644 --- a/navi-design/src/main/java/com/navi/design/theme/Type.kt +++ b/navi-design/src/main/java/com/navi/design/theme/Type.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -15,61 +15,61 @@ import androidx.compose.ui.unit.sp val typography = Typography( h1 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.Bold, - fontSize = 32.sp, - letterSpacing = 0.6.sp, - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.Bold, + fontSize = 32.sp, + letterSpacing = 0.6.sp, + ), h2 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.Bold, - fontSize = 28.sp, - letterSpacing = 0.3.sp - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.Bold, + fontSize = 28.sp, + letterSpacing = 0.3.sp + ), h3 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.SemiBold, - fontSize = 24.sp, - letterSpacing = 0.2.sp - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.SemiBold, + fontSize = 24.sp, + letterSpacing = 0.2.sp + ), h4 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.Medium, - fontSize = 20.sp, - letterSpacing = 0.2.sp - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.Medium, + fontSize = 20.sp, + letterSpacing = 0.2.sp + ), subtitle1 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.Medium, - fontSize = 16.sp, - letterSpacing = 0.3.sp - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.Medium, + fontSize = 16.sp, + letterSpacing = 0.3.sp + ), subtitle2 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.Normal, - fontSize = 14.sp, - letterSpacing = 0.3.sp - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.Normal, + fontSize = 14.sp, + letterSpacing = 0.3.sp + ), body1 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.Normal, - fontSize = 16.sp, - letterSpacing = 0.2.sp - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + letterSpacing = 0.2.sp + ), body2 = - TextStyle( - fontFamily = composeFontFamily, - fontWeight = FontWeight.Normal, - fontSize = 14.sp, - letterSpacing = 0.3.sp - ), + TextStyle( + fontFamily = composeFontFamily, + fontWeight = FontWeight.Normal, + fontSize = 14.sp, + letterSpacing = 0.3.sp + ), ) val Typography.title1: TextStyle diff --git a/navi-design/src/main/java/com/navi/design/utils/AnimationUtils.kt b/navi-design/src/main/java/com/navi/design/utils/AnimationUtils.kt index 84a894d6c3..c3ac6cd5ba 100644 --- a/navi-design/src/main/java/com/navi/design/utils/AnimationUtils.kt +++ b/navi-design/src/main/java/com/navi/design/utils/AnimationUtils.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -40,6 +40,7 @@ fun moveViewWithDistance( } .start() } + fun moveViewWithDistanceAnimator( view: View?, distance: Int, @@ -47,23 +48,22 @@ fun moveViewWithDistanceAnimator( isRepeatable: Boolean = true, repeatDelay: Long? = null ): ObjectAnimator { - return ObjectAnimator.ofFloat(view, "translationX", distance.toFloat()) - .apply { - duration = animDuration - if (isRepeatable) { - repeatCount = ObjectAnimator.INFINITE - repeatMode = ObjectAnimator.RESTART - } else { - repeatDelay?.let { - doOnEnd { - startDelay = repeatDelay - start() - } + return ObjectAnimator.ofFloat(view, "translationX", distance.toFloat()).apply { + duration = animDuration + if (isRepeatable) { + repeatCount = ObjectAnimator.INFINITE + repeatMode = ObjectAnimator.RESTART + } else { + repeatDelay?.let { + doOnEnd { + startDelay = repeatDelay + start() } } - doOnStart { view?.isVisible = true } - start() } + doOnStart { view?.isVisible = true } + start() + } } fun setShakeAnimation(vararg views: View) { @@ -76,5 +76,5 @@ fun setShakeAnimation(vararg views: View) { } views.forEach { it.animation = animation } animation.start() - } catch (_: Exception) { } + } catch (_: Exception) {} } diff --git a/navi-design/src/main/java/com/navi/design/utils/ComposeExt.kt b/navi-design/src/main/java/com/navi/design/utils/ComposeExt.kt index 18ccc7a533..185952f51a 100644 --- a/navi-design/src/main/java/com/navi/design/utils/ComposeExt.kt +++ b/navi-design/src/main/java/com/navi/design/utils/ComposeExt.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/navi-design/src/main/java/com/navi/design/utils/Ext.kt b/navi-design/src/main/java/com/navi/design/utils/Ext.kt index a16ccfd741..10c512ee8a 100644 --- a/navi-design/src/main/java/com/navi/design/utils/Ext.kt +++ b/navi-design/src/main/java/com/navi/design/utils/Ext.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -58,7 +58,7 @@ fun TextView.setIconifiedText(textComponent: TextWithStyle?, @DrawableRes iconRe val strLen = textComponent?.text?.length ?: 0 var startInd = 0 var endInd = 0 - if(strLen > 0) { + if (strLen > 0) { startInd = strLen - 1 endInd = strLen } @@ -89,10 +89,7 @@ fun String?.parseColorSafe( Color.parseColor(default) } -fun String?.parseColorSafe( - default: Int = R.color.outrageous_orange, - context: Context -): Int = +fun String?.parseColorSafe(default: Int = R.color.outrageous_orange, context: Context): Int = try { when { this == null -> ContextCompat.getColor(context, default) @@ -127,9 +124,9 @@ fun String?.spannedText( span?.forEach { if ( it.isNotNull() && - it.spanColor().isNotNullAndNotEmpty() && - it.startSpan().isNotNull() && - it.endSpan().isNotNull() + it.spanColor().isNotNullAndNotEmpty() && + it.startSpan().isNotNull() && + it.endSpan().isNotNull() ) { val startSpan = kotlin.math.max(it.startSpan()!!, 0) val endSpan = kotlin.math.min(it.endSpan()!!, this.length) @@ -202,9 +199,10 @@ fun TextView.setSpannableString( styleVariation: String? = null, clickListener: ((ActionData) -> Unit)? = null ) { - val selectedVariation = if (styleVariation != null) { - textData?.styleVariations?.get(styleVariation) ?: textData?.style - } else textData?.style + val selectedVariation = + if (styleVariation != null) { + textData?.styleVariations?.get(styleVariation) ?: textData?.style + } else textData?.style setSpannableString(textData?.text, selectedVariation, clickListener) } @@ -215,9 +213,10 @@ fun TextView.setSpannableString( invokeListenerOnlyOnUpdate: Boolean? = null, clickListener: ((ActionData) -> Unit)? = null ) { - val selectedVariation = if (styleVariation != null) { - textData?.styleVariations?.get(styleVariation) ?: textData?.style - } else textData?.style + val selectedVariation = + if (styleVariation != null) { + textData?.styleVariations?.get(styleVariation) ?: textData?.style + } else textData?.style setSpannableString(textData?.text, selectedVariation, clickListener, invokeListenerOnlyOnUpdate) } @@ -395,9 +394,7 @@ fun ViewGroup.replaceLayout(layoutId: Int): ViewDataBinding? { } fun updateFontToTTMedium(style: List?) { - style?.forEach { - it.fontName = FontWeightEnum.TT_MEDIUM.name - } + style?.forEach { it.fontName = FontWeightEnum.TT_MEDIUM.name } } fun hexColorCodePrefix(opacity: Float): String { @@ -440,30 +437,29 @@ fun hexColorCodePrefix(opacity: Float): String { else if (opacity <= 36) return "5C" else if (opacity <= 37) return "5E" else if (opacity <= 38) return "61" - else if (opacity <= 39) return "63" - else if (opacity <= 40) return "66" - else return "" + else if (opacity <= 39) return "63" else if (opacity <= 40) return "66" else return "" } typealias onCommonClick = (CommonViewData) -> Unit fun EditText.hideCutCopyMenuPopUp() { - customSelectionActionModeCallback = object : ActionMode.Callback { - override fun onCreateActionMode(mode: ActionMode?, menu: Menu?): Boolean { - return true - } + customSelectionActionModeCallback = + object : ActionMode.Callback { + override fun onCreateActionMode(mode: ActionMode?, menu: Menu?): Boolean { + return true + } - override fun onPrepareActionMode(mode: ActionMode?, menu: Menu): Boolean { - menu.clear() - return false - } + override fun onPrepareActionMode(mode: ActionMode?, menu: Menu): Boolean { + menu.clear() + return false + } - override fun onActionItemClicked(mode: ActionMode?, item: MenuItem?): Boolean { - return false - } + override fun onActionItemClicked(mode: ActionMode?, item: MenuItem?): Boolean { + return false + } - override fun onDestroyActionMode(mode: ActionMode?) {} - } + override fun onDestroyActionMode(mode: ActionMode?) {} + } } fun isValidHexColor(colorCode: String?): Boolean { diff --git a/navi-design/src/main/java/com/navi/design/utils/FontUtils.kt b/navi-design/src/main/java/com/navi/design/utils/FontUtils.kt index 62fd78ca05..7391a19554 100644 --- a/navi-design/src/main/java/com/navi/design/utils/FontUtils.kt +++ b/navi-design/src/main/java/com/navi/design/utils/FontUtils.kt @@ -1,13 +1,12 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ package com.navi.design.utils -import android.graphics.Color import android.text.SpannableString import android.text.SpannableStringBuilder import android.text.style.ForegroundColorSpan @@ -16,34 +15,31 @@ import androidx.core.content.res.ResourcesCompat import com.navi.design.R import com.navi.design.font.FontWeightEnum -fun getFontStyle(fontWeightName: String?) = when (fontWeightName) { - FontWeightEnum.TT_REGULAR.name, - FontWeightEnum.ROBOTO_REGULAR.name, - FontWeightEnum.SEMI_BOLD.name, - FontWeightEnum.NAVI_SEMI_BOLD.name, - FontWeightEnum.REGULAR.name, - FontWeightEnum.NAVI_REGULAR.name, - FontWeightEnum.NAVI_BODY_REGULAR.name -> R.font.tt_regular - - FontWeightEnum.TT_MEDIUM.name, - FontWeightEnum.ROBOTO_MEDIUM.name, - FontWeightEnum.BOLD.name, - FontWeightEnum.NAVI_BOLD.name, - FontWeightEnum.TT_MEDIUM.name, - FontWeightEnum.NAVI_HEADLINE_REGULAR.name -> R.font.tt_medium - - FontWeightEnum.TT_SEMI_BOLD.name, - FontWeightEnum.ROBOTO_BOLD.name, - FontWeightEnum.EXTRA_BOLD.name, - FontWeightEnum.NAVI_EXTRA_BOLD.name, - FontWeightEnum.NAVI_BLACK.name, - FontWeightEnum.NAVI_BODY_DEMI_BOLD.name -> R.font.tt_semi_bold - - FontWeightEnum.TT_BOLD.name, - FontWeightEnum.NAVI_HEADLINE_BOLD.name -> R.font.tt_bold - - else -> R.font.tt_regular -} +fun getFontStyle(fontWeightName: String?) = + when (fontWeightName) { + FontWeightEnum.TT_REGULAR.name, + FontWeightEnum.ROBOTO_REGULAR.name, + FontWeightEnum.SEMI_BOLD.name, + FontWeightEnum.NAVI_SEMI_BOLD.name, + FontWeightEnum.REGULAR.name, + FontWeightEnum.NAVI_REGULAR.name, + FontWeightEnum.NAVI_BODY_REGULAR.name -> R.font.tt_regular + FontWeightEnum.TT_MEDIUM.name, + FontWeightEnum.ROBOTO_MEDIUM.name, + FontWeightEnum.BOLD.name, + FontWeightEnum.NAVI_BOLD.name, + FontWeightEnum.TT_MEDIUM.name, + FontWeightEnum.NAVI_HEADLINE_REGULAR.name -> R.font.tt_medium + FontWeightEnum.TT_SEMI_BOLD.name, + FontWeightEnum.ROBOTO_BOLD.name, + FontWeightEnum.EXTRA_BOLD.name, + FontWeightEnum.NAVI_EXTRA_BOLD.name, + FontWeightEnum.NAVI_BLACK.name, + FontWeightEnum.NAVI_BODY_DEMI_BOLD.name -> R.font.tt_semi_bold + FontWeightEnum.TT_BOLD.name, + FontWeightEnum.NAVI_HEADLINE_BOLD.name -> R.font.tt_bold + else -> R.font.tt_regular + } fun getFontStyle(fontWeight: FontWeightEnum?): Int = getFontStyle(fontWeight?.name) diff --git a/navi-design/src/main/java/com/navi/design/utils/NaviDrawable.kt b/navi-design/src/main/java/com/navi/design/utils/NaviDrawable.kt index 8c82c373f7..8d6ea3834d 100644 --- a/navi-design/src/main/java/com/navi/design/utils/NaviDrawable.kt +++ b/navi-design/src/main/java/com/navi/design/utils/NaviDrawable.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2022-2023 by Navi Technologies Limited + * * Copyright © 2022-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -108,7 +108,9 @@ fun getNaviDrawableFromBackend( } } -fun getNaviDrawableFromDrawableData(backgroundDrawableData: BackgroundDrawableData?): GradientDrawable { +fun getNaviDrawableFromDrawableData( + backgroundDrawableData: BackgroundDrawableData? +): GradientDrawable { return backgroundDrawableData?.let { getNaviDrawable( shape = getDrawableShapeFromString(it.shape), @@ -122,7 +124,9 @@ fun getNaviDrawableFromDrawableData(backgroundDrawableData: BackgroundDrawableDa } ?: getNaviDrawable() } -private fun getDrawableShapeFromString(string: String? = DrawableShape.RECTANGLE.name): DrawableShape { +private fun getDrawableShapeFromString( + string: String? = DrawableShape.RECTANGLE.name +): DrawableShape { return when (string) { DrawableShape.RECTANGLE.name -> DrawableShape.RECTANGLE DrawableShape.LINE.name -> DrawableShape.LINE @@ -195,10 +199,12 @@ data class BackgroundDrawableData( @SerializedName("strokeColor") val strokeColor: String? = null, @SerializedName("gradientColors") val gradientColors: List? = null, @SerializedName("gradientOrientation") val gradientOrientation: String? = null, - @SerializedName("radii") val radii: CornerRadius = CornerRadius( - R.integer.zero.toFloat(), - R.integer.zero.toFloat(), - R.integer.zero.toFloat(), - R.integer.zero.toFloat() - ) + @SerializedName("radii") + val radii: CornerRadius = + CornerRadius( + R.integer.zero.toFloat(), + R.integer.zero.toFloat(), + R.integer.zero.toFloat(), + R.integer.zero.toFloat() + ) ) : Parcelable diff --git a/navi-design/src/main/java/com/navi/design/utils/ScrollSpeedFlingBehaviour.kt b/navi-design/src/main/java/com/navi/design/utils/ScrollSpeedFlingBehaviour.kt index 13850aacb5..0950f1b093 100644 --- a/navi-design/src/main/java/com/navi/design/utils/ScrollSpeedFlingBehaviour.kt +++ b/navi-design/src/main/java/com/navi/design/utils/ScrollSpeedFlingBehaviour.kt @@ -1,3 +1,10 @@ +/* + * + * * Copyright © 2023-2024 by Navi Technologies Limited + * * All rights reserved. Strictly confidential + * + */ + package com.navi.design.utils import androidx.compose.animation.core.AnimationState @@ -7,7 +14,6 @@ import androidx.compose.foundation.gestures.FlingBehavior import androidx.compose.foundation.gestures.ScrollScope import kotlin.math.abs - class ScrollSpeedFlingBehavior( private val flingDecay: DecayAnimationSpec, private val maxVelocity: Float, @@ -23,16 +29,17 @@ class ScrollSpeedFlingBehavior( var velocityLeft = newVelocity var lastValue = 0f AnimationState( - initialValue = 0f, - initialVelocity = newVelocity, - ).animateDecay(flingDecay) { - val delta = value - lastValue - val consumed = scrollBy(delta) - lastValue = value - velocityLeft = this.velocity - // avoid rounding errors and stop if anything is unconsumed - if (abs(delta - consumed) > 0.5f) this.cancelAnimation() - } + initialValue = 0f, + initialVelocity = newVelocity, + ) + .animateDecay(flingDecay) { + val delta = value - lastValue + val consumed = scrollBy(delta) + lastValue = value + velocityLeft = this.velocity + // avoid rounding errors and stop if anything is unconsumed + if (abs(delta - consumed) > 0.5f) this.cancelAnimation() + } velocityLeft } else newVelocity } diff --git a/navi-design/src/main/java/com/navi/design/utils/Utils.kt b/navi-design/src/main/java/com/navi/design/utils/Utils.kt index 16f4183469..10f0be93be 100644 --- a/navi-design/src/main/java/com/navi/design/utils/Utils.kt +++ b/navi-design/src/main/java/com/navi/design/utils/Utils.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2023 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -94,6 +94,7 @@ fun parseDateFromOneToAnother(dateInString: String?, formatString: String): Date return null } } + @SuppressLint("SimpleDateFormat") fun parseDateToString(dateInString: Date?, formatString: String): String? { if (dateInString.isNull()) return null diff --git a/navi-design/src/test/java/com/navi/design/utils/ExtKtTest.kt b/navi-design/src/test/java/com/navi/design/utils/ExtKtTest.kt index 735260ba47..36301ef40d 100644 --- a/navi-design/src/test/java/com/navi/design/utils/ExtKtTest.kt +++ b/navi-design/src/test/java/com/navi/design/utils/ExtKtTest.kt @@ -1,17 +1,16 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ package com.navi.design.utils -import com.navi.design.R as DesignR import android.content.Context import android.graphics.Color -import android.view.View import androidx.core.content.ContextCompat +import com.navi.design.R as DesignR import io.mockk.* import org.junit.Assert.* import org.junit.Test @@ -26,7 +25,7 @@ class ExtKtTest { assertEquals(1001, "#FF5732".parseColorSafe()) assertEquals(1001, "FF5732".parseColorSafe()) assertEquals(1000, "#asdfgh".parseColorSafe()) - val nullColor:String? = null + val nullColor: String? = null assertEquals(1000, nullColor.parseColorSafe()) } @@ -40,98 +39,96 @@ class ExtKtTest { assertEquals(1000, "#000000".parseColorSafe(context = context)) assertEquals(1000, "000000".parseColorSafe(context = context)) assertEquals(1001, "#asdfgh".parseColorSafe(context = context)) - val nullColor:String? = null + val nullColor: String? = null assertEquals(1001, nullColor.parseColorSafe(context = context)) } @Test fun testHexColorCodePrefix() { - assertEquals("00",hexColorCodePrefix(-0.5f)) - assertEquals("00",hexColorCodePrefix(0f)) - assertEquals("03",hexColorCodePrefix(1f)) - assertEquals("03",hexColorCodePrefix(0.5f)) - assertEquals("05",hexColorCodePrefix(2f)) - assertEquals("05",hexColorCodePrefix(1.5f)) - assertEquals("08",hexColorCodePrefix(3f)) - assertEquals("08",hexColorCodePrefix(2.5f)) - assertEquals("0A",hexColorCodePrefix(4f)) - assertEquals("0A",hexColorCodePrefix(3.5f)) - assertEquals("0D",hexColorCodePrefix(5f)) - assertEquals("0D",hexColorCodePrefix(4.5f)) - assertEquals("0F",hexColorCodePrefix(6f)) - assertEquals("0F",hexColorCodePrefix(5.5f)) - assertEquals("12",hexColorCodePrefix(7f)) - assertEquals("12",hexColorCodePrefix(6.5f)) - assertEquals("14",hexColorCodePrefix(8f)) - assertEquals("14",hexColorCodePrefix(7.5f)) - assertEquals("17",hexColorCodePrefix(9f)) - assertEquals("17",hexColorCodePrefix(8.5f)) - assertEquals("1A",hexColorCodePrefix(10f)) - assertEquals("1A",hexColorCodePrefix(9.5f)) - assertEquals("1C",hexColorCodePrefix(11f)) - assertEquals("1C",hexColorCodePrefix(10.5f)) - assertEquals("1F",hexColorCodePrefix(12f)) - assertEquals("1F",hexColorCodePrefix(11.5f)) - assertEquals("21",hexColorCodePrefix(13f)) - assertEquals("21",hexColorCodePrefix(12.5f)) - assertEquals("24",hexColorCodePrefix(14f)) - assertEquals("24",hexColorCodePrefix(13.5f)) - assertEquals("26",hexColorCodePrefix(15f)) - assertEquals("26",hexColorCodePrefix(14.5f)) - assertEquals("29",hexColorCodePrefix(16f)) - assertEquals("29",hexColorCodePrefix(15.5f)) - assertEquals("2B",hexColorCodePrefix(17f)) - assertEquals("2B",hexColorCodePrefix(16.5f)) - assertEquals("2E",hexColorCodePrefix(18f)) - assertEquals("2E",hexColorCodePrefix(17.5f)) - assertEquals("30",hexColorCodePrefix(19f)) - assertEquals("30",hexColorCodePrefix(18.5f)) - assertEquals("33",hexColorCodePrefix(20f)) - assertEquals("33",hexColorCodePrefix(19.5f)) - assertEquals("36",hexColorCodePrefix(21f)) - assertEquals("36",hexColorCodePrefix(20.5f)) - assertEquals("38",hexColorCodePrefix(22f)) - assertEquals("38",hexColorCodePrefix(21.5f)) - assertEquals("3B",hexColorCodePrefix(23f)) - assertEquals("3B",hexColorCodePrefix(22.5f)) - assertEquals("3D",hexColorCodePrefix(24f)) - assertEquals("3D",hexColorCodePrefix(23.5f)) - assertEquals("40",hexColorCodePrefix(25f)) - assertEquals("40",hexColorCodePrefix(24.5f)) - assertEquals("42",hexColorCodePrefix(26f)) - assertEquals("42",hexColorCodePrefix(25.5f)) - assertEquals("45",hexColorCodePrefix(27f)) - assertEquals("45",hexColorCodePrefix(26.5f)) - assertEquals("47",hexColorCodePrefix(28f)) - assertEquals("47",hexColorCodePrefix(27.5f)) - assertEquals("4A",hexColorCodePrefix(29f)) - assertEquals("4A",hexColorCodePrefix(28.5f)) - assertEquals("4D",hexColorCodePrefix(30f)) - assertEquals("4D",hexColorCodePrefix(29.5f)) - assertEquals("4F",hexColorCodePrefix(31f)) - assertEquals("4F",hexColorCodePrefix(30.5f)) - assertEquals("52",hexColorCodePrefix(32f)) - assertEquals("52",hexColorCodePrefix(31.5f)) - assertEquals("54",hexColorCodePrefix(33f)) - assertEquals("54",hexColorCodePrefix(32.5f)) - assertEquals("57",hexColorCodePrefix(34f)) - assertEquals("57",hexColorCodePrefix(33.5f)) - assertEquals("59",hexColorCodePrefix(35f)) - assertEquals("59",hexColorCodePrefix(34.5f)) - assertEquals("5C",hexColorCodePrefix(36f)) - assertEquals("5C",hexColorCodePrefix(35.5f)) - assertEquals("5E",hexColorCodePrefix(37f)) - assertEquals("5E",hexColorCodePrefix(36.5f)) - assertEquals("61",hexColorCodePrefix(38f)) - assertEquals("61",hexColorCodePrefix(37.5f)) - assertEquals("63",hexColorCodePrefix(39f)) - assertEquals("63",hexColorCodePrefix(38.5f)) - assertEquals("66",hexColorCodePrefix(40f)) - assertEquals("66",hexColorCodePrefix(39.5f)) - assertEquals("",hexColorCodePrefix(41f)) - assertEquals("",hexColorCodePrefix(40.5f)) - - + assertEquals("00", hexColorCodePrefix(-0.5f)) + assertEquals("00", hexColorCodePrefix(0f)) + assertEquals("03", hexColorCodePrefix(1f)) + assertEquals("03", hexColorCodePrefix(0.5f)) + assertEquals("05", hexColorCodePrefix(2f)) + assertEquals("05", hexColorCodePrefix(1.5f)) + assertEquals("08", hexColorCodePrefix(3f)) + assertEquals("08", hexColorCodePrefix(2.5f)) + assertEquals("0A", hexColorCodePrefix(4f)) + assertEquals("0A", hexColorCodePrefix(3.5f)) + assertEquals("0D", hexColorCodePrefix(5f)) + assertEquals("0D", hexColorCodePrefix(4.5f)) + assertEquals("0F", hexColorCodePrefix(6f)) + assertEquals("0F", hexColorCodePrefix(5.5f)) + assertEquals("12", hexColorCodePrefix(7f)) + assertEquals("12", hexColorCodePrefix(6.5f)) + assertEquals("14", hexColorCodePrefix(8f)) + assertEquals("14", hexColorCodePrefix(7.5f)) + assertEquals("17", hexColorCodePrefix(9f)) + assertEquals("17", hexColorCodePrefix(8.5f)) + assertEquals("1A", hexColorCodePrefix(10f)) + assertEquals("1A", hexColorCodePrefix(9.5f)) + assertEquals("1C", hexColorCodePrefix(11f)) + assertEquals("1C", hexColorCodePrefix(10.5f)) + assertEquals("1F", hexColorCodePrefix(12f)) + assertEquals("1F", hexColorCodePrefix(11.5f)) + assertEquals("21", hexColorCodePrefix(13f)) + assertEquals("21", hexColorCodePrefix(12.5f)) + assertEquals("24", hexColorCodePrefix(14f)) + assertEquals("24", hexColorCodePrefix(13.5f)) + assertEquals("26", hexColorCodePrefix(15f)) + assertEquals("26", hexColorCodePrefix(14.5f)) + assertEquals("29", hexColorCodePrefix(16f)) + assertEquals("29", hexColorCodePrefix(15.5f)) + assertEquals("2B", hexColorCodePrefix(17f)) + assertEquals("2B", hexColorCodePrefix(16.5f)) + assertEquals("2E", hexColorCodePrefix(18f)) + assertEquals("2E", hexColorCodePrefix(17.5f)) + assertEquals("30", hexColorCodePrefix(19f)) + assertEquals("30", hexColorCodePrefix(18.5f)) + assertEquals("33", hexColorCodePrefix(20f)) + assertEquals("33", hexColorCodePrefix(19.5f)) + assertEquals("36", hexColorCodePrefix(21f)) + assertEquals("36", hexColorCodePrefix(20.5f)) + assertEquals("38", hexColorCodePrefix(22f)) + assertEquals("38", hexColorCodePrefix(21.5f)) + assertEquals("3B", hexColorCodePrefix(23f)) + assertEquals("3B", hexColorCodePrefix(22.5f)) + assertEquals("3D", hexColorCodePrefix(24f)) + assertEquals("3D", hexColorCodePrefix(23.5f)) + assertEquals("40", hexColorCodePrefix(25f)) + assertEquals("40", hexColorCodePrefix(24.5f)) + assertEquals("42", hexColorCodePrefix(26f)) + assertEquals("42", hexColorCodePrefix(25.5f)) + assertEquals("45", hexColorCodePrefix(27f)) + assertEquals("45", hexColorCodePrefix(26.5f)) + assertEquals("47", hexColorCodePrefix(28f)) + assertEquals("47", hexColorCodePrefix(27.5f)) + assertEquals("4A", hexColorCodePrefix(29f)) + assertEquals("4A", hexColorCodePrefix(28.5f)) + assertEquals("4D", hexColorCodePrefix(30f)) + assertEquals("4D", hexColorCodePrefix(29.5f)) + assertEquals("4F", hexColorCodePrefix(31f)) + assertEquals("4F", hexColorCodePrefix(30.5f)) + assertEquals("52", hexColorCodePrefix(32f)) + assertEquals("52", hexColorCodePrefix(31.5f)) + assertEquals("54", hexColorCodePrefix(33f)) + assertEquals("54", hexColorCodePrefix(32.5f)) + assertEquals("57", hexColorCodePrefix(34f)) + assertEquals("57", hexColorCodePrefix(33.5f)) + assertEquals("59", hexColorCodePrefix(35f)) + assertEquals("59", hexColorCodePrefix(34.5f)) + assertEquals("5C", hexColorCodePrefix(36f)) + assertEquals("5C", hexColorCodePrefix(35.5f)) + assertEquals("5E", hexColorCodePrefix(37f)) + assertEquals("5E", hexColorCodePrefix(36.5f)) + assertEquals("61", hexColorCodePrefix(38f)) + assertEquals("61", hexColorCodePrefix(37.5f)) + assertEquals("63", hexColorCodePrefix(39f)) + assertEquals("63", hexColorCodePrefix(38.5f)) + assertEquals("66", hexColorCodePrefix(40f)) + assertEquals("66", hexColorCodePrefix(39.5f)) + assertEquals("", hexColorCodePrefix(41f)) + assertEquals("", hexColorCodePrefix(40.5f)) } @Test diff --git a/navi-design/src/test/java/com/navi/design/utils/FontUtilsKtTest.kt b/navi-design/src/test/java/com/navi/design/utils/FontUtilsKtTest.kt index 1527c7d44f..b7c45122ff 100644 --- a/navi-design/src/test/java/com/navi/design/utils/FontUtilsKtTest.kt +++ b/navi-design/src/test/java/com/navi/design/utils/FontUtilsKtTest.kt @@ -1,18 +1,17 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ package com.navi.design.utils -import com.navi.design.R as DesignR -import com.navi.base.utils.EMPTY import DesignR.font.tt_bold import DesignR.font.tt_medium import DesignR.font.tt_regular import DesignR.font.tt_semi_bold +import com.navi.base.utils.EMPTY import com.navi.design.font.FontWeightEnum import org.junit.Assert.assertEquals import org.junit.Test diff --git a/navi-design/src/test/java/com/navi/design/utils/UtilsKtTest.kt b/navi-design/src/test/java/com/navi/design/utils/UtilsKtTest.kt index 933412803c..de8d8f9c66 100644 --- a/navi-design/src/test/java/com/navi/design/utils/UtilsKtTest.kt +++ b/navi-design/src/test/java/com/navi/design/utils/UtilsKtTest.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2023 by Navi Technologies Limited + * * Copyright © 2023-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -8,11 +8,9 @@ package com.navi.design.utils import com.navi.design.R as DesignR -import org.junit.Assert.* - - -import org.junit.Test import java.text.SimpleDateFormat +import org.junit.Assert.* +import org.junit.Test class UtilsKtTest { @@ -29,7 +27,6 @@ class UtilsKtTest { assertEquals(DesignR.style.Title5TextStyle, getStyle("Title5TextStyle")) assertEquals(DesignR.style.Title5BoldTextStyle, getStyle("Title5BoldTextStyle")) assertEquals(null, getStyle("NotDefinedTextStyle")) - } @Test @@ -42,18 +39,18 @@ class UtilsKtTest { @Test fun testParseDateFromOneToAnother() { val jan2nd2023 = SimpleDateFormat("yyyy-MM-dd").parse("2023-01-02") - assertEquals(jan2nd2023, parseDateFromOneToAnother("02-01-2023","dd-MM-yyyy")) + assertEquals(jan2nd2023, parseDateFromOneToAnother("02-01-2023", "dd-MM-yyyy")) - assertEquals(null, parseDateFromOneToAnother("2023-02-02","xxxx-MM-dd")) + assertEquals(null, parseDateFromOneToAnother("2023-02-02", "xxxx-MM-dd")) } @Test fun testParseDateToString() { val jan2nd2023 = SimpleDateFormat("yyyy-MM-dd").parse("2023-01-02") - assertEquals("02-01-2023", parseDateToString(jan2nd2023,"dd-MM-yyyy")) + assertEquals("02-01-2023", parseDateToString(jan2nd2023, "dd-MM-yyyy")) val feb2nd2023 = SimpleDateFormat("yyyy-MM-dd").parse("2023-02-02") - assertEquals(null, parseDateToString(feb2nd2023,"xxxx-MM-dd")) + assertEquals(null, parseDateToString(feb2nd2023, "xxxx-MM-dd")) } @Test @@ -111,5 +108,4 @@ class UtilsKtTest { assertEquals("523,123.5", decimalFormatForAmount.format(523123.50f)) assertEquals("423,342.12", decimalFormatForAmount.format(423342.12f)) } - } diff --git a/navi-insurance/src/main/java/com/navi/insurance/common/custom_view/CirclePagerIndicatorDecoration.java b/navi-insurance/src/main/java/com/navi/insurance/common/custom_view/CirclePagerIndicatorDecoration.java index a5b1b1c98c..c017b8299a 100644 --- a/navi-insurance/src/main/java/com/navi/insurance/common/custom_view/CirclePagerIndicatorDecoration.java +++ b/navi-insurance/src/main/java/com/navi/insurance/common/custom_view/CirclePagerIndicatorDecoration.java @@ -1,9 +1,10 @@ /* * - * * Copyright © 2021 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ + package com.navi.insurance.common.custom_view; import android.content.res.Resources; @@ -14,7 +15,6 @@ import android.graphics.Rect; import android.view.View; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; - import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -25,28 +25,19 @@ public class CirclePagerIndicatorDecoration extends RecyclerView.ItemDecoration private static final float DP = Resources.getSystem().getDisplayMetrics().density; - /** - * Height of the space the indicator takes up at the bottom of the view. - */ + /** Height of the space the indicator takes up at the bottom of the view. */ private final int mIndicatorHeight = (int) (DP * 20); - /** - * Indicator stroke width. - */ + /** Indicator stroke width. */ private final float mIndicatorStrokeWidth = DP * 4; - /** - * Indicator width. - */ + /** Indicator width. */ private final float mIndicatorItemLength = DP * 4; - /** - * Padding between indicators. - */ + + /** Padding between indicators. */ private final float mIndicatorItemPadding = DP * 12; - /** - * Some more natural animation interpolation - */ + /** Some more natural animation interpolation */ private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator(); private final Paint mPaint = new Paint(); @@ -61,13 +52,12 @@ public class CirclePagerIndicatorDecoration extends RecyclerView.ItemDecoration @Override public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) { super.onDrawOver(c, parent, state); - if(parent.getAdapter() == null) { + if (parent.getAdapter() == null) { return; } int itemCount = parent.getAdapter().getItemCount(); - if (itemCount <= 1) - return; + if (itemCount <= 1) return; // center horizontally, calculate width and subtract half from center float totalLength = mIndicatorItemLength * itemCount; @@ -100,7 +90,8 @@ public class CirclePagerIndicatorDecoration extends RecyclerView.ItemDecoration drawHighlights(c, indicatorStartX, indicatorPosY, activePosition, progress); } - private void drawInactiveIndicators(Canvas c, float indicatorStartX, float indicatorPosY, int itemCount) { + private void drawInactiveIndicators( + Canvas c, float indicatorStartX, float indicatorPosY, int itemCount) { mPaint.setColor(colorInactive); // width of item indicator including padding @@ -115,8 +106,12 @@ public class CirclePagerIndicatorDecoration extends RecyclerView.ItemDecoration } } - private void drawHighlights(Canvas c, float indicatorStartX, float indicatorPosY, - int highlightPosition, float progress) { + private void drawHighlights( + Canvas c, + float indicatorStartX, + float indicatorPosY, + int highlightPosition, + float progress) { mPaint.setColor(colorActive); // width of item indicator including padding @@ -131,15 +126,21 @@ public class CirclePagerIndicatorDecoration extends RecyclerView.ItemDecoration } else { float highlightStart = indicatorStartX + itemWidth * highlightPosition; // calculate partial highlight - float partialLength = mIndicatorItemLength * progress + mIndicatorItemPadding*progress; + float partialLength = + mIndicatorItemLength * progress + mIndicatorItemPadding * progress; - c.drawCircle(highlightStart + partialLength, indicatorPosY, mIndicatorItemLength / 2F, mPaint); + c.drawCircle( + highlightStart + partialLength, + indicatorPosY, + mIndicatorItemLength / 2F, + mPaint); } } @Override - public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { + public void getItemOffsets( + Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); outRect.bottom = mIndicatorHeight; } -} \ No newline at end of file +} diff --git a/navi-insurance/src/main/java/com/navi/insurance/services/NaviFireBaseMessagingService.java b/navi-insurance/src/main/java/com/navi/insurance/services/NaviFireBaseMessagingService.java index bfe69fa473..4ca7e9b36b 100644 --- a/navi-insurance/src/main/java/com/navi/insurance/services/NaviFireBaseMessagingService.java +++ b/navi-insurance/src/main/java/com/navi/insurance/services/NaviFireBaseMessagingService.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -57,5 +57,3 @@ public class NaviFireBaseMessagingService extends FirebaseMessagingService { } */ - - diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Enums/ActionEnum.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Enums/ActionEnum.java index e6ec7bfb51..46e55c0bd6 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Enums/ActionEnum.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Enums/ActionEnum.java @@ -1,15 +1,15 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ package com.travijuu.numberpicker.library.Enums; -/** - * Created by travijuu on 26/05/16. - */ +/** Created by travijuu on 26/05/16. */ public enum ActionEnum { - INCREMENT, DECREMENT, MANUAL + INCREMENT, + DECREMENT, + MANUAL } diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/LimitExceededListener.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/LimitExceededListener.java index ecc8085bd1..0db35623eb 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/LimitExceededListener.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/LimitExceededListener.java @@ -1,15 +1,13 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ package com.travijuu.numberpicker.library.Interface; -/** - * Created by travijuu on 26/05/16. - */ +/** Created by travijuu on 26/05/16. */ public interface LimitExceededListener { void limitExceeded(int limit, int exceededValue); diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/ValueChangedListener.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/ValueChangedListener.java index 630b2af0f6..28cd77c8f9 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/ValueChangedListener.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Interface/ValueChangedListener.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -9,10 +9,7 @@ package com.travijuu.numberpicker.library.Interface; import com.travijuu.numberpicker.library.Enums.ActionEnum; -/** - * Created by travijuu on 19/12/16. - */ - +/** Created by travijuu on 19/12/16. */ public interface ValueChangedListener { void valueChanged(int value, ActionEnum action); diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/ActionListener.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/ActionListener.java index f8a4579eb9..07115cf77b 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/ActionListener.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/ActionListener.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -9,13 +9,10 @@ package com.travijuu.numberpicker.library.Listener; import android.view.View; import android.widget.TextView; - import com.travijuu.numberpicker.library.Enums.ActionEnum; import com.travijuu.numberpicker.library.NumberPicker; -/** - * Created by travijuu on 26/05/16. - */ +/** Created by travijuu on 26/05/16. */ public class ActionListener implements View.OnClickListener { NumberPicker layout; @@ -51,4 +48,4 @@ public class ActionListener implements View.OnClickListener { break; } } -} \ No newline at end of file +} diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultLimitExceededListener.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultLimitExceededListener.java index 422b70eb16..9f1bf36739 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultLimitExceededListener.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultLimitExceededListener.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -8,17 +8,17 @@ package com.travijuu.numberpicker.library.Listener; import android.util.Log; - import com.travijuu.numberpicker.library.Interface.LimitExceededListener; -/** - * Created by travijuu on 26/05/16. - */ +/** Created by travijuu on 26/05/16. */ public class DefaultLimitExceededListener implements LimitExceededListener { public void limitExceeded(int limit, int exceededValue) { - String message = String.format("NumberPicker cannot set to %d because the limit is %d.", exceededValue, limit); + String message = + String.format( + "NumberPicker cannot set to %d because the limit is %d.", + exceededValue, limit); Log.v(this.getClass().getSimpleName(), message); } } diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnEditorActionListener.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnEditorActionListener.java index ee9e0f3a74..1309666290 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnEditorActionListener.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnEditorActionListener.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -10,14 +10,10 @@ package com.travijuu.numberpicker.library.Listener; import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; import android.widget.TextView; - import com.travijuu.numberpicker.library.Enums.ActionEnum; import com.travijuu.numberpicker.library.NumberPicker; -/** - * Created by travijuu on 13/04/17. - */ - +/** Created by travijuu on 13/04/17. */ public class DefaultOnEditorActionListener implements TextView.OnEditorActionListener { NumberPicker layout; diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnFocusChangeListener.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnFocusChangeListener.java index 3339d652ec..76a74f4d0d 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnFocusChangeListener.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnFocusChangeListener.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -9,14 +9,10 @@ package com.travijuu.numberpicker.library.Listener; import android.view.View; import android.widget.EditText; - import com.travijuu.numberpicker.library.Enums.ActionEnum; import com.travijuu.numberpicker.library.NumberPicker; -/** - * Created by travijuu on 03/06/17. - */ - +/** Created by travijuu on 03/06/17. */ public class DefaultOnFocusChangeListener implements View.OnFocusChangeListener { NumberPicker layout; diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultValueChangedListener.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultValueChangedListener.java index 5792b93a9a..33835d53d1 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultValueChangedListener.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/Listener/DefaultValueChangedListener.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -8,19 +8,18 @@ package com.travijuu.numberpicker.library.Listener; import android.util.Log; - import com.travijuu.numberpicker.library.Enums.ActionEnum; import com.travijuu.numberpicker.library.Interface.ValueChangedListener; -/** - * Created by travijuu on 19/12/16. - */ - +/** Created by travijuu on 19/12/16. */ public class DefaultValueChangedListener implements ValueChangedListener { public void valueChanged(int value, ActionEnum action) { - String actionText = action == ActionEnum.MANUAL ? "manually set" : (action == ActionEnum.INCREMENT ? "incremented" : "decremented"); + String actionText = + action == ActionEnum.MANUAL + ? "manually set" + : (action == ActionEnum.INCREMENT ? "incremented" : "decremented"); String message = String.format("NumberPicker is %s to %d", actionText, value); Log.v(this.getClass().getSimpleName(), message); } diff --git a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/NumberPicker.java b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/NumberPicker.java index 5fb12d7008..6372edc309 100644 --- a/navi-insurance/src/main/java/com/travijuu/numberpicker/library/NumberPicker.java +++ b/navi-insurance/src/main/java/com/travijuu/numberpicker/library/NumberPicker.java @@ -1,6 +1,6 @@ /* * - * * Copyright © 2019 by Navi Technologies Private Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ @@ -14,7 +14,6 @@ import android.view.LayoutInflater; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; - import com.navi.insurance.R; import com.travijuu.numberpicker.library.Enums.ActionEnum; import com.travijuu.numberpicker.library.Interface.LimitExceededListener; @@ -25,9 +24,7 @@ import com.travijuu.numberpicker.library.Listener.DefaultOnEditorActionListener; import com.travijuu.numberpicker.library.Listener.DefaultOnFocusChangeListener; import com.travijuu.numberpicker.library.Listener.DefaultValueChangedListener; -/** - * Created by travijuu on 26/05/16. - */ +/** Created by travijuu on 26/05/16. */ public class NumberPicker extends LinearLayout { // default values @@ -71,15 +68,20 @@ public class NumberPicker extends LinearLayout { } private void initialize(Context context, AttributeSet attrs) { - TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.NumberPicker, 0, 0); + TypedArray attributes = + context.getTheme().obtainStyledAttributes(attrs, R.styleable.NumberPicker, 0, 0); // set required variables with values of xml layout attributes or default ones this.minValue = attributes.getInteger(R.styleable.NumberPicker_min, this.DEFAULT_MIN); this.maxValue = attributes.getInteger(R.styleable.NumberPicker_max, this.DEFAULT_MAX); - this.currentValue = attributes.getInteger(R.styleable.NumberPicker_value, this.DEFAULT_VALUE); + this.currentValue = + attributes.getInteger(R.styleable.NumberPicker_value, this.DEFAULT_VALUE); this.unit = attributes.getInteger(R.styleable.NumberPicker_unit, this.DEFAULT_UNIT); - this.layout = attributes.getResourceId(R.styleable.NumberPicker_custom_layout, this.DEFAULT_LAYOUT); - this.focusable = attributes.getBoolean(R.styleable.NumberPicker_focusable, this.DEFAULT_FOCUSABLE); + this.layout = + attributes.getResourceId( + R.styleable.NumberPicker_custom_layout, this.DEFAULT_LAYOUT); + this.focusable = + attributes.getBoolean(R.styleable.NumberPicker_focusable, this.DEFAULT_FOCUSABLE); this.mContext = context; // if current value is greater than the max. value, decrement it to the max. value @@ -97,8 +99,10 @@ public class NumberPicker extends LinearLayout { this.displayTextView = (TextView) findViewById(R.id.display); // register button click and action listeners - this.incrementButton.setOnClickListener(new ActionListener(this, this.displayTextView, ActionEnum.INCREMENT)); - this.decrementButton.setOnClickListener(new ActionListener(this, this.displayTextView, ActionEnum.DECREMENT)); + this.incrementButton.setOnClickListener( + new ActionListener(this, this.displayTextView, ActionEnum.INCREMENT)); + this.decrementButton.setOnClickListener( + new ActionListener(this, this.displayTextView, ActionEnum.DECREMENT)); // init listener for exceeding upper and lower limits this.setLimitExceededListener(new DefaultLimitExceededListener()); @@ -158,7 +162,8 @@ public class NumberPicker extends LinearLayout { public void setValue(int value) { if (!this.valueIsAllowed(value)) { - this.limitExceededListener.limitExceeded(value < this.minValue ? this.minValue : this.maxValue, value); + this.limitExceededListener.limitExceeded( + value < this.minValue ? this.minValue : this.maxValue, value); return; } @@ -229,7 +234,8 @@ public class NumberPicker extends LinearLayout { this.setValue(this.currentValue + unit); if (oldValue != this.getValue()) { - this.valueChangedListener.valueChanged(this.getValue(), unit > 0 ? ActionEnum.INCREMENT : ActionEnum.DECREMENT); + this.valueChangedListener.valueChanged( + this.getValue(), unit > 0 ? ActionEnum.INCREMENT : ActionEnum.DECREMENT); } } } diff --git a/navi-payment/build.gradle b/navi-payment/build.gradle index 974bdf282f..c210a9ee9e 100644 --- a/navi-payment/build.gradle +++ b/navi-payment/build.gradle @@ -71,4 +71,4 @@ dependencies { testImplementation libs.junit } -android.buildFeatures.buildConfig true \ No newline at end of file +android.buildFeatures.buildConfig true diff --git a/npci-upi-cl/build.gradle b/npci-upi-cl/build.gradle index 79254013dc..33f42f0074 100644 --- a/npci-upi-cl/build.gradle +++ b/npci-upi-cl/build.gradle @@ -2,4 +2,4 @@ configurations.maybeCreate("uat") artifacts.add("uat", file('SecureComponent-UAT-release-signed-12072023-d57c63ce.aar')) configurations.maybeCreate("prod") -artifacts.add("prod", file('SecureComponent-PROD-release-signed-21032023-decf51b9.aar')) \ No newline at end of file +artifacts.add("prod", file('SecureComponent-PROD-release-signed-21032023-decf51b9.aar')) diff --git a/one-money-sdk/build.gradle b/one-money-sdk/build.gradle index e20072ba05..5f3bb661fd 100644 --- a/one-money-sdk/build.gradle +++ b/one-money-sdk/build.gradle @@ -1,2 +1,2 @@ configurations.maybeCreate("default") -artifacts.add("default", file('onemoneysdk_custom.aar')) \ No newline at end of file +artifacts.add("default", file('onemoneysdk_custom.aar')) diff --git a/pulse/src/androidTest/java/com/navi/pulse/ExampleInstrumentedTest.kt b/pulse/src/androidTest/java/com/navi/pulse/ExampleInstrumentedTest.kt index 8d7542ae48..261677ffeb 100644 --- a/pulse/src/androidTest/java/com/navi/pulse/ExampleInstrumentedTest.kt +++ b/pulse/src/androidTest/java/com/navi/pulse/ExampleInstrumentedTest.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/db/PulseDatabase.kt b/pulse/src/main/java/com/navi/pulse/db/PulseDatabase.kt index a346e299ab..d2c599560f 100644 --- a/pulse/src/main/java/com/navi/pulse/db/PulseDatabase.kt +++ b/pulse/src/main/java/com/navi/pulse/db/PulseDatabase.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/db/dao/PulseDAO.kt b/pulse/src/main/java/com/navi/pulse/db/dao/PulseDAO.kt index 3b4f179b68..7879a9d148 100644 --- a/pulse/src/main/java/com/navi/pulse/db/dao/PulseDAO.kt +++ b/pulse/src/main/java/com/navi/pulse/db/dao/PulseDAO.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/db/model/PulseEvent.kt b/pulse/src/main/java/com/navi/pulse/db/model/PulseEvent.kt index a8d0d3facb..25e3258e10 100644 --- a/pulse/src/main/java/com/navi/pulse/db/model/PulseEvent.kt +++ b/pulse/src/main/java/com/navi/pulse/db/model/PulseEvent.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/dispatcher/PulseDispatcher.kt b/pulse/src/main/java/com/navi/pulse/dispatcher/PulseDispatcher.kt index b3b3296d5a..d6ead5c18d 100644 --- a/pulse/src/main/java/com/navi/pulse/dispatcher/PulseDispatcher.kt +++ b/pulse/src/main/java/com/navi/pulse/dispatcher/PulseDispatcher.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/network/PulseNetworkRepository.kt b/pulse/src/main/java/com/navi/pulse/network/PulseNetworkRepository.kt index ceaf59eb8f..c43615b1ab 100644 --- a/pulse/src/main/java/com/navi/pulse/network/PulseNetworkRepository.kt +++ b/pulse/src/main/java/com/navi/pulse/network/PulseNetworkRepository.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/network/PulseResponse.kt b/pulse/src/main/java/com/navi/pulse/network/PulseResponse.kt index cb792e1970..7bbc31b199 100644 --- a/pulse/src/main/java/com/navi/pulse/network/PulseResponse.kt +++ b/pulse/src/main/java/com/navi/pulse/network/PulseResponse.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitProvider.kt b/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitProvider.kt index 78b1e38135..e0fe6d8810 100644 --- a/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitProvider.kt +++ b/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitProvider.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2023 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitService.kt b/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitService.kt index 5ee56eaada..1058835c03 100644 --- a/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitService.kt +++ b/pulse/src/main/java/com/navi/pulse/network/PulseRetrofitService.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/task/PulseTask.kt b/pulse/src/main/java/com/navi/pulse/task/PulseTask.kt index 3cd1c78c66..52638bce34 100644 --- a/pulse/src/main/java/com/navi/pulse/task/PulseTask.kt +++ b/pulse/src/main/java/com/navi/pulse/task/PulseTask.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/task/PulseTaskProcessor.kt b/pulse/src/main/java/com/navi/pulse/task/PulseTaskProcessor.kt index 615c29b691..fe2131845d 100644 --- a/pulse/src/main/java/com/navi/pulse/task/PulseTaskProcessor.kt +++ b/pulse/src/main/java/com/navi/pulse/task/PulseTaskProcessor.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/task/SyncEventTask.kt b/pulse/src/main/java/com/navi/pulse/task/SyncEventTask.kt index 8d55bd67fc..60f9789d2b 100644 --- a/pulse/src/main/java/com/navi/pulse/task/SyncEventTask.kt +++ b/pulse/src/main/java/com/navi/pulse/task/SyncEventTask.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/util/PulseConstants.kt b/pulse/src/main/java/com/navi/pulse/util/PulseConstants.kt index 67252de71e..af188d5793 100644 --- a/pulse/src/main/java/com/navi/pulse/util/PulseConstants.kt +++ b/pulse/src/main/java/com/navi/pulse/util/PulseConstants.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/main/java/com/navi/pulse/util/PulseDeviceUtils.kt b/pulse/src/main/java/com/navi/pulse/util/PulseDeviceUtils.kt index fdf59342a3..bdb45947de 100644 --- a/pulse/src/main/java/com/navi/pulse/util/PulseDeviceUtils.kt +++ b/pulse/src/main/java/com/navi/pulse/util/PulseDeviceUtils.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021-2022 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/pulse/src/test/java/com/navi/pulse/ExampleUnitTest.kt b/pulse/src/test/java/com/navi/pulse/ExampleUnitTest.kt index a0dab18baf..d37900a3d3 100644 --- a/pulse/src/test/java/com/navi/pulse/ExampleUnitTest.kt +++ b/pulse/src/test/java/com/navi/pulse/ExampleUnitTest.kt @@ -1,6 +1,6 @@ /* * - * * Copyright © 2021 by Navi Technologies Limited + * * Copyright © 2021-2024 by Navi Technologies Limited * * All rights reserved. Strictly confidential * */ diff --git a/spotless.gradle b/spotless.gradle index 0ea3421cf0..f47b43942f 100644 --- a/spotless.gradle +++ b/spotless.gradle @@ -10,7 +10,7 @@ spotless { } kotlin { - target '**/*.kt' + target '**/navi-base/**/*.kt', '**/navi-design/**/*.kt', '**/pulse/**/*.kt', '**/navi-analytics/**/*.kt' licenseHeaderFile rootProject.file('spotless.license') trimTrailingWhitespace()