diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index 3d66573da1a..caa0b29982e 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifos.android.library) alias(libs.plugins.mifos.android.hilt) diff --git a/core/common/src/main/AndroidManifest.xml b/core/common/src/main/AndroidManifest.xml index cbb96c15613..2b37ae3a2d5 100644 --- a/core/common/src/main/AndroidManifest.xml +++ b/core/common/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + diff --git a/core/common/src/main/java/com/mifos/core/common/enums/MifosAppLanguage.kt b/core/common/src/main/java/com/mifos/core/common/enums/MifosAppLanguage.kt index b3d0ec8c580..600c788746a 100644 --- a/core/common/src/main/java/com/mifos/core/common/enums/MifosAppLanguage.kt +++ b/core/common/src/main/java/com/mifos/core/common/enums/MifosAppLanguage.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.enums enum class MifosAppLanguage(val code: String, val displayName: String) { @@ -19,7 +28,8 @@ enum class MifosAppLanguage(val code: String, val displayName: String) { PORTUGUESE("pt", "Português"), RUSSIAN("ru", "русский"), SWAHILI("sw", "Kiswahili"), - FARSI("fa", "فارسی"); + FARSI("fa", "فارسی"), + ; companion object { fun fromCode(code: String): MifosAppLanguage { @@ -30,4 +40,4 @@ enum class MifosAppLanguage(val code: String, val displayName: String) { override fun toString(): String { return displayName } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/model/user/Role.kt b/core/common/src/main/java/com/mifos/core/common/model/user/Role.kt index 8f2568b8be5..904d8897a99 100644 --- a/core/common/src/main/java/com/mifos/core/common/model/user/Role.kt +++ b/core/common/src/main/java/com/mifos/core/common/model/user/Role.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.common.model.user @@ -12,5 +17,5 @@ data class Role( var name: String? = null, - var description: String? = null -) \ No newline at end of file + var description: String? = null, +) diff --git a/core/common/src/main/java/com/mifos/core/common/model/user/User.kt b/core/common/src/main/java/com/mifos/core/common/model/user/User.kt index e8af2ff6c7c..1af685c7ea7 100644 --- a/core/common/src/main/java/com/mifos/core/common/model/user/User.kt +++ b/core/common/src/main/java/com/mifos/core/common/model/user/User.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.common.model.user @@ -20,4 +25,4 @@ class User { var roles: List = ArrayList() var permissions: List = ArrayList() -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/network/MifosDispatchers.kt b/core/common/src/main/java/com/mifos/core/common/network/MifosDispatchers.kt index 98c73dbb7ca..7f959f1bcfe 100644 --- a/core/common/src/main/java/com/mifos/core/common/network/MifosDispatchers.kt +++ b/core/common/src/main/java/com/mifos/core/common/network/MifosDispatchers.kt @@ -1,4 +1,12 @@ - +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.network import javax.inject.Qualifier diff --git a/core/common/src/main/java/com/mifos/core/common/network/di/CoroutineScopesModule.kt b/core/common/src/main/java/com/mifos/core/common/network/di/CoroutineScopesModule.kt index 0131df6a3c0..dc26b6db49d 100644 --- a/core/common/src/main/java/com/mifos/core/common/network/di/CoroutineScopesModule.kt +++ b/core/common/src/main/java/com/mifos/core/common/network/di/CoroutineScopesModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.network.di import com.mifos.core.common.network.Dispatcher diff --git a/core/common/src/main/java/com/mifos/core/common/network/di/DispatchersModule.kt b/core/common/src/main/java/com/mifos/core/common/network/di/DispatchersModule.kt index 5a201355ddd..06df95872a5 100644 --- a/core/common/src/main/java/com/mifos/core/common/network/di/DispatchersModule.kt +++ b/core/common/src/main/java/com/mifos/core/common/network/di/DispatchersModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.network.di import com.mifos.core.common.network.Dispatcher diff --git a/core/common/src/main/java/com/mifos/core/common/utils/AndroidVersionUtil.kt b/core/common/src/main/java/com/mifos/core/common/utils/AndroidVersionUtil.kt index 7954a867aae..cdd4aad20b6 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/AndroidVersionUtil.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/AndroidVersionUtil.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils import android.os.Build @@ -14,4 +23,4 @@ object AndroidVersionUtil { fun isApiVersionGreaterOrEqual(thisVersion: Int): Boolean { return Build.VERSION.SDK_INT >= thisVersion } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/BaseUrl.kt b/core/common/src/main/java/com/mifos/core/common/utils/BaseUrl.kt index 4074f9d7569..8729031c87f 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/BaseUrl.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/BaseUrl.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils import com.mifos.core.common.BuildConfig @@ -17,4 +26,4 @@ object BaseUrl { val PORT = configs.port val TENANT = configs.tenant -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/Constants.kt b/core/common/src/main/java/com/mifos/core/common/utils/Constants.kt index 1609b69c966..59abd3626c3 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/Constants.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/Constants.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.common.utils @@ -26,7 +31,7 @@ object Constants { const val ENTITY_TYPE_STAFF = "staff" const val ENTITY_TYPE_CLIENT_IDENTIFIERS = "client_identifiers" - //Search Entities + // Search Entities const val SEARCH_ENTITY_CLIENT = "CLIENT" const val SEARCH_ENTITY_GROUP = "GROUP" const val SEARCH_ENTITY_LOAN = "LOAN" @@ -94,7 +99,7 @@ object Constants { const val SAVED = "SAVED" const val FILLNOW = "FillNow" - //This needs to be 8 bits because validateRequestPermissionsRequestCode + // This needs to be 8 bits because validateRequestPermissionsRequestCode // in FragmentActivity requires requestCode to be of 8 bits, meaning the range is from 0 to 255. const val REQUEST_PERMISSION_SETTING = 254 @@ -206,7 +211,6 @@ object Constants { const val IS_TO_UPDATE_PASS_CODE = "updatePassCode" const val HAS_SETTING_CHANGED = "hasSettingsChanged" - const val TENANT = "tenant" const val BASE_URL = "base_url" const val PASSCODE = "preferences_mifos_passcode_string" @@ -221,4 +225,4 @@ object Constants { const val DATA_TABLE_NAV_DATA = "data_table_nav_data" const val DATA_TABLE_DATA_NAV_DATA = "data_table_data_nav_data" const val DATA_TABLE_LIST_NAV_DATA = "data_table_list_nav_data" -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/DateHelper.kt b/core/common/src/main/java/com/mifos/core/common/utils/DateHelper.kt index 5b5dac92e15..cf94c15a0c9 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/DateHelper.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/DateHelper.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.common.utils @@ -66,7 +71,7 @@ object DateHelper { builder.append(splittedDate[2]) } return builder.toString() - //Return as dd-mmm-yyyy + // Return as dd-mmm-yyyy } /** @@ -87,7 +92,7 @@ object DateHelper { builder.append(splittedDate[2]) } return builder.toString() - //Return as dd-mmm-yyyy + // Return as dd-mmm-yyyy } /** @@ -155,7 +160,6 @@ object DateHelper { * and negative int if date1 < date2 */ fun dateComparator(date1: List, date2: List): Int { - /* * Each List contains 3 items * index 0 = Year @@ -163,15 +167,13 @@ object DateHelper { * index 2 = Day * * Format is YYYY - MM - DD - */ + */ - //comparing years + // comparing years return if (date1[0] == date2[0]) { - - //now that years are equal lets compare months + // now that years are equal lets compare months if (date1[1] == date2[1]) { - - //now that months are also equal lets compare days + // now that months are also equal lets compare days if (date1[2] == date2[2]) { 0 } else if (date1[2] > date2[2]) { @@ -280,4 +282,4 @@ object DateHelper { else -> -1 } } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/FileUtils.kt b/core/common/src/main/java/com/mifos/core/common/utils/FileUtils.kt index fba1539cb92..89fbbbd820d 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/FileUtils.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/FileUtils.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.common.utils @@ -40,9 +45,9 @@ object FileUtils { var cursor: Cursor? = null try { cursor = context.contentResolver.query(uri, projection, null, null, null) - val column_index = cursor!!.getColumnIndexOrThrow("_data") + val columnindex = cursor!!.getColumnIndexOrThrow("_data") if (cursor.moveToFirst()) { - return cursor.getString(column_index) + return cursor.getString(columnindex) } } catch (e: Exception) { // Eat it @@ -56,78 +61,70 @@ object FileUtils { @TargetApi(Build.VERSION_CODES.KITKAT) fun getPathRealOnKitkatAboveVersion(context: Context, uri: Uri): String? { val isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT + var resultPath: String? = null - // DocumentProvider if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { - // ExternalStorageProvider - if (isExternalStorageDocument(uri)) { - val docId = DocumentsContract.getDocumentId(uri) - val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - val type = split[0] - if ("primary".equals(type, ignoreCase = true)) { - return Environment.getExternalStorageDirectory().toString() + "/" + split[1] + when { + isExternalStorageDocument(uri) -> { + val docId = DocumentsContract.getDocumentId(uri) + val split = docId.split(":") + val type = split[0] + if ("primary".equals(type, ignoreCase = true)) { + resultPath = "${Environment.getExternalStorageDirectory()}/${split[1]}" + } + // Handle non-primary volumes if necessary } - // TODO handle non-primary volumes - - // DownloadsProvider - } else if (isDownloadsDocument(uri)) { - val id = DocumentsContract.getDocumentId(uri) - val contentUri = ContentUris.withAppendedId( - Uri.parse("content://downloads/public_downloads"), id.toLong() - ) - return getDataColumn(context, contentUri, null, null) - - // MediaProvider - } else if (isMediaDocument(uri)) { - val docId = DocumentsContract.getDocumentId(uri) - val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - val type = split[0] - var contentUri: Uri? = null - if ("image" == type) { - contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI - } else if ("video" == type) { - contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI - } else if ("audio" == type) { - contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + isDownloadsDocument(uri) -> { + val id = DocumentsContract.getDocumentId(uri) + val contentUri = ContentUris.withAppendedId( + Uri.parse("content://downloads/public_downloads"), + id.toLong(), + ) + resultPath = getDataColumn(context, contentUri, null, null) + } + isMediaDocument(uri) -> { + val docId = DocumentsContract.getDocumentId(uri) + val split = docId.split(":") + val type = split[0] + val contentUri = when (type) { + "image" -> MediaStore.Images.Media.EXTERNAL_CONTENT_URI + "video" -> MediaStore.Video.Media.EXTERNAL_CONTENT_URI + "audio" -> MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + else -> null + } + val selection = "_id=?" + val selectionArgs = arrayOf(split[1]) + resultPath = getDataColumn(context, contentUri, selection, selectionArgs) } - val selection = "_id=?" - val selectionArgs = arrayOf( - split[1] - ) - return getDataColumn(context, contentUri, selection, selectionArgs) } - - // MediaStore (and general) } else if ("content".equals(uri.scheme, ignoreCase = true)) { - - // Return the remote address - return if (isGooglePhotosUri(uri)) uri.lastPathSegment else getDataColumn( - context, - uri, - null, - null - ) - - // File + resultPath = if (isGooglePhotosUri(uri)) { + uri.lastPathSegment + } else { + getDataColumn(context, uri, null, null) + } } else if ("file".equals(uri.scheme, ignoreCase = true)) { - return uri.path + resultPath = uri.path } - return null + + return resultPath } fun getDataColumn( - context: Context, uri: Uri?, selection: String?, - selectionArgs: Array? + context: Context, + uri: Uri?, + selection: String?, + selectionArgs: Array?, ): String? { var cursor: Cursor? = null val column = "_data" val projection = arrayOf( - column + column, ) try { cursor = context.contentResolver.query( uri!!, projection, selection, selectionArgs, - null + null, ) if (cursor != null && cursor.moveToFirst()) { val index = cursor.getColumnIndexOrThrow(column) @@ -192,18 +189,18 @@ object FileUtils { * @param in InputStream * @param file File */ - fun writeInputStreamDataToFile(`in`: InputStream, file: File?) { + fun writeInputStreamDataToFile(inputStream: InputStream, file: File?) { try { val out: OutputStream = FileOutputStream(file) val buf = ByteArray(1024) var len: Int - while (`in`.read(buf).also { len = it } > 0) { + while (inputStream.read(buf).also { len = it } > 0) { out.write(buf, 0, len) } out.close() - `in`.close() + inputStream.close() } catch (e: Exception) { Log.d(LOG_TAG, e.localizedMessage) } } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/JsonExtension.kt b/core/common/src/main/java/com/mifos/core/common/utils/JsonExtension.kt index 0d3b7696449..1e5598377e5 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/JsonExtension.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/JsonExtension.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils import com.google.gson.Gson @@ -6,4 +15,4 @@ import com.mifos.core.model.ServerConfig fun String.asServerConfig(): ServerConfig { val jsonString = this.replace("'", "\"") return Gson().fromJson(jsonString, ServerConfig::class.java) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/LanguageHelper.kt b/core/common/src/main/java/com/mifos/core/common/utils/LanguageHelper.kt index 9c757e5fc3a..523f4f971e2 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/LanguageHelper.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/LanguageHelper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils import android.content.Context @@ -12,7 +21,7 @@ object LanguageHelper { val preferences = PreferenceManager.getDefaultSharedPreferences(context) return if (preferences.getBoolean( context.getString(R.string.core_common_default_system_language), - true + true, ) ) { if (!context.resources.getStringArray(R.array.core_common_languages_value) @@ -46,7 +55,7 @@ object LanguageHelper { val preferences = PreferenceManager.getDefaultSharedPreferences(context) return preferences.getString( context.getString(R.string.core_common_language_type), - defaultLanguage + defaultLanguage, ) } @@ -69,4 +78,4 @@ object LanguageHelper { resources?.updateConfiguration(configuration, resources.displayMetrics) return context } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/MapDeserializer.kt b/core/common/src/main/java/com/mifos/core/common/utils/MapDeserializer.kt index aef4671dbb8..2f741f88241 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/MapDeserializer.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/MapDeserializer.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils import com.google.gson.JsonDeserializationContext @@ -9,46 +18,35 @@ import java.lang.reflect.Type class MapDeserializer : JsonDeserializer?> { @Throws(JsonParseException::class) override fun deserialize( - json: JsonElement, typeOfT: Type, - context: JsonDeserializationContext + json: JsonElement, + typeOfT: Type, + context: JsonDeserializationContext, ): Map? { return read(json) as Map? } - fun read(`in`: JsonElement): Any? { - if (`in`.isJsonArray) { - val list: MutableList = ArrayList() - val arr = `in`.asJsonArray - for (anArr in arr) { - list.add(read(anArr)) + fun read(jsonElement: JsonElement): Any? { + return when { + jsonElement.isJsonArray -> { + val list = jsonElement.asJsonArray.map { read(it) } + list } - return list - } else if (`in`.isJsonObject) { - val map: MutableMap = HashMap() - val obj = `in`.asJsonObject - val entitySet = obj.entrySet() - for ((key, value) in entitySet) { - map[key] = read(value) + jsonElement.isJsonObject -> { + jsonElement.asJsonObject.entrySet().associate { (key, value) -> key to read(value) } } - return map - } else if (`in`.isJsonPrimitive) { - val prim = `in`.asJsonPrimitive - if (prim.isBoolean) { - return prim.asBoolean - } else if (prim.isString) { - return prim.asString - } else if (prim.isNumber) { - val num = prim.asNumber - // here you can handle double int/long values - // and return any type you want - // this solution will transform 3.0 float to long values - return if (Math.ceil(num.toDouble()) == num.toLong().toDouble()) { - num.toLong() - } else { - num.toDouble() + jsonElement.isJsonPrimitive -> { + val prim = jsonElement.asJsonPrimitive + when { + prim.isBoolean -> prim.asBoolean + prim.isString -> prim.asString + prim.isNumber -> { + val num = prim.asNumber + if (Math.ceil(num.toDouble()) == num.toLong().toDouble()) num.toLong() else num.toDouble() + } + else -> null } } + else -> null } - return null } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/Network.kt b/core/common/src/main/java/com/mifos/core/common/utils/Network.kt index e88dd2cb796..b828c50589d 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/Network.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/Network.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.common.utils @@ -30,4 +35,4 @@ object Network { } return false } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/NetworkUtilsWrapper.kt b/core/common/src/main/java/com/mifos/core/common/utils/NetworkUtilsWrapper.kt index 7b723a416d6..95dce34211c 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/NetworkUtilsWrapper.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/NetworkUtilsWrapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils import android.content.Context @@ -10,7 +19,7 @@ import javax.inject.Singleton @Singleton class NetworkUtilsWrapper @Inject constructor( - @ApplicationContext private val context: Context + @ApplicationContext private val context: Context, ) { @MainThread @@ -23,4 +32,4 @@ class NetworkUtilsWrapper @Inject constructor( return networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) } -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/Page.kt b/core/common/src/main/java/com/mifos/core/common/utils/Page.kt index 3bc98920ef8..3a4ff42ab24 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/Page.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/Page.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.common.utils @@ -10,5 +15,5 @@ package com.mifos.core.common.utils data class Page( var totalFilteredRecords: Int = 0, - var pageItems: List = ArrayList() -) \ No newline at end of file + var pageItems: List = ArrayList(), +) diff --git a/core/common/src/main/java/com/mifos/core/common/utils/Resource.kt b/core/common/src/main/java/com/mifos/core/common/utils/Resource.kt index 0e63c6d1111..4cd27ed0318 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/Resource.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/Resource.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils /** @@ -11,4 +20,4 @@ sealed class Resource(val data: T? = null, val message: String? = null) { class Error(message: String, data: T? = null) : Resource(data, message) class Loading(data: T? = null) : Resource(data) -} \ No newline at end of file +} diff --git a/core/common/src/main/java/com/mifos/core/common/utils/Utils.kt b/core/common/src/main/java/com/mifos/core/common/utils/Utils.kt index c8d04e7698d..ece73b26978 100644 --- a/core/common/src/main/java/com/mifos/core/common/utils/Utils.kt +++ b/core/common/src/main/java/com/mifos/core/common/utils/Utils.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common.utils import java.text.DateFormat @@ -19,4 +28,4 @@ object Utils { val dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM) return dateFormat.format(calendar.time) } -} \ No newline at end of file +} diff --git a/core/common/src/main/res/values/strings.xml b/core/common/src/main/res/values/strings.xml index b77f01ecbdb..de641b85d18 100644 --- a/core/common/src/main/res/values/strings.xml +++ b/core/common/src/main/res/values/strings.xml @@ -1,4 +1,13 @@ + default_system_language diff --git a/core/common/src/test/java/com/mifos/core/common/ExampleUnitTest.kt b/core/common/src/test/java/com/mifos/core/common/ExampleUnitTest.kt index 1b4a27e44df..36df58de9cd 100644 --- a/core/common/src/test/java/com/mifos/core/common/ExampleUnitTest.kt +++ b/core/common/src/test/java/com/mifos/core/common/ExampleUnitTest.kt @@ -1,9 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.common +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +22,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +}