apps-android-commons/app/src/main/java/fr/free/nrw/commons/utils
Akshay Komar d4ababc0a5
Refactor: Rename Constants to Follow CamelCase Naming Convention (#6126)
* Rename Constants to Follow Kotlin Naming Conventions

>This PR refactors constant names in the project to adhere to Kotlin's UPPERCASE_SNAKE_CASE naming convention, improving code readability and maintaining consistency across the codebase.

>Renamed the following constants in LoginActivity:
>saveProgressDialog → SAVE_PROGRESS_DIALOG
>saveErrorMessage → SAVE_ERROR_MESSAGE
>saveUsername → SAVE_USERNAME
>savePassword → SAVE_PASSWORD

>Updated all references to these constants throughout the project.

* Update Project_Default.xml

* Refactor variable names to adhere to naming conventions

Renamed variables to use camel case:
-UPLOAD_COUNT_THRESHOLD → uploadCountThreshold
-REVERT_PERCENTAGE_FOR_MESSAGE → revertPercentageForMessage
-REVERT_SHARED_PREFERENCE → revertSharedPreference
-UPLOAD_SHARED_PREFERENCE → uploadSharedPreference

Renamed variables with uppercase initials to lowercase for alignment with Kotlin conventions:
-Latitude → latitude
-Longitude → longitude
-Accuracy → accuracy

Refactored the following variable names:
-NUMBER_OF_QUESTIONS → numberOfQuestions
-MULTIPLIER_TO_GET_PERCENTAGE → multiplierToGetPercentage

* Refactor Dialog View Initialization with Null-Safe Calls

This PR refactors the dialog setup code in CustomSelectorActivity to improve safety and readability by replacing explicit casts with null-safe generic calls for findViewById.

>Replaced explicit casting (as Button and as TextView) with the generic findViewById<T>() method for improved type safety.
>Added null-safety (?.) to avoid potential crashes if a view is not found in the dialog layout.

why changed:-
>Prevents runtime crashes caused by NullPointerException when a view is missing in the layout.

* Refactor Unit Test: Replace Unsafe Casting with Type-Safe Mocking for findViewById

>PR refactors the unit test for NearbyParentFragment by replacing unsafe casting in the findViewById mocking statements with type-safe

>Ensured all findViewById mocks now use a consistent, type-safe format (findViewById<View>(...)) to reduce verbosity and potential casting errors.

>Verified the functionality of prepareViewsForSheetPosition remains unchanged, ensuring no regression in test behavior.

* Update NearbyParentFragmentUnitTest.kt

* Refactor: Rename Constants to Follow CamelCase Naming Convention

>Updated all constant variable names to follow the camelCase naming convention, removing underscores in the middle or end.

>Ensured variable names remain descriptive and align with code readability best practices.

* Replace private val with const val for URL constants in QuizController

* Renaming the constant to use UPPER_SNAKE_CASE

* Renaming the constant to use UPPER_SNAKE_CASE

* Update Done

* **Refactor: Convert `minimumThresholdForSwipe` to a compile-time constant**

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
2025-01-18 23:06:52 +09:00
..
model Issue-5662-kotlinstyle (#5833) 2024-09-19 13:56:45 +09:00
AbstractTextWatcher.kt Convert auth package to kotlin (#5966) 2024-11-28 17:09:25 +09:00
ActivityUtils.kt Migrated util module files from java to kotlin (#5935) 2024-11-17 22:35:25 +09:00
CommonsDateUtil.kt Migrated util module files from java to kotlin (#5935) 2024-11-17 22:35:25 +09:00
ConfigUtils.kt Convert upload to kotlin (part 1) (#6024) 2024-12-13 23:15:13 +09:00
CustomSelectorUtils.kt Fixed the migrations warning under Kotlin header #13282 (#6060) 2024-12-22 23:14:20 +09:00
DateUtil.kt Migrated util module files from java to kotlin (#5935) 2024-11-17 22:35:25 +09:00
DeviceInfoUtil.kt Migrated util module files from java to kotlin (#5935) 2024-11-17 22:35:25 +09:00
DialogUtil.kt make dialog modal (#6015) 2024-12-11 15:08:39 +09:00
DownloadUtils.kt Fixed the migrations warning under Kotlin header #13282 (#6060) 2024-12-22 23:14:20 +09:00
ExecutorUtils.kt Migrated util module files from java to kotlin (#5935) 2024-11-17 22:35:25 +09:00
FragmentUtils.kt Migrated util module files from java to kotlin (#5935) 2024-11-17 22:35:25 +09:00
ImageUtils.kt make dialog modal (#6015) 2024-12-11 15:08:39 +09:00
ImageUtilsWrapper.kt Fix unit tests (#5947) 2024-11-23 08:35:34 +09:00
LangCodeUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
LayoutUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
LengthUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
LocationUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
MapUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
MediaDataExtractorUtil.kt Fix unit tests (#5947) 2024-11-23 08:35:34 +09:00
NearbyFABUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
NetworkUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
PermissionUtils.kt Fix crash when opening in-app Camera for the very first time (#6139) 2025-01-17 15:37:07 +09:00
PlaceUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
StringSortingUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
StringUtil.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
SwipableCardView.kt Refactor: Rename Constants to Follow CamelCase Naming Convention (#6126) 2025-01-18 23:06:52 +09:00
SystemThemeUtils.kt Migrate kvstore to kotlin (#5973) 2024-11-29 14:01:29 +09:00
TimeProvider.kt Convert upload to kotlin (part 1) (#6024) 2024-12-13 23:15:13 +09:00
UiUtils.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
ViewUtil.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00
ViewUtilWrapper.kt Migrated util module from Java to Kotlin (#5938) 2024-11-18 22:40:35 +09:00