From 4614c991e6377476fa46e0071e8bf609dfa63a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Latorre=20Asensio?= Date: Thu, 22 Dec 2022 17:13:54 +0100 Subject: [PATCH] ANDROID-11177 Enable Lint and fix issues (#9) --- library/build.gradle | 4 ++++ library/lint-custom.xml | 13 +++++++++++++ library/lint.xml | 6 ------ .../androidlogger/ui/AppLoggerActivity.kt | 2 +- .../ui/viewmodel/AppLoggerViewModels.kt | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 library/lint-custom.xml delete mode 100644 library/lint.xml diff --git a/library/build.gradle b/library/build.gradle index ad9d009..bd24c25 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -19,6 +19,10 @@ android { dimension "loggerMode" } } + lintOptions { + warningsAsErrors true + lintConfig file("lint-custom.xml") + } } dependencies { diff --git a/library/lint-custom.xml b/library/lint-custom.xml new file mode 100644 index 0000000..e088ff6 --- /dev/null +++ b/library/lint-custom.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/library/lint.xml b/library/lint.xml deleted file mode 100644 index adf385b..0000000 --- a/library/lint.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/library/src/enabled/java/com/telefonica/androidlogger/ui/AppLoggerActivity.kt b/library/src/enabled/java/com/telefonica/androidlogger/ui/AppLoggerActivity.kt index 6d1be30..f8a6a06 100644 --- a/library/src/enabled/java/com/telefonica/androidlogger/ui/AppLoggerActivity.kt +++ b/library/src/enabled/java/com/telefonica/androidlogger/ui/AppLoggerActivity.kt @@ -239,7 +239,7 @@ class AppLoggerActivity : AppCompatActivity() { ): Chip = LayoutInflater .from(context) - .inflate(R.layout.log_category_chip, null) + .inflate(R.layout.log_category_chip, this, false) .let { it as Chip } .let { @ColorInt val chipUncheckedBackgroundColor: Int = diff --git a/library/src/enabled/java/com/telefonica/androidlogger/ui/viewmodel/AppLoggerViewModels.kt b/library/src/enabled/java/com/telefonica/androidlogger/ui/viewmodel/AppLoggerViewModels.kt index a377cc2..d6e1729 100644 --- a/library/src/enabled/java/com/telefonica/androidlogger/ui/viewmodel/AppLoggerViewModels.kt +++ b/library/src/enabled/java/com/telefonica/androidlogger/ui/viewmodel/AppLoggerViewModels.kt @@ -110,7 +110,7 @@ internal class AppLoggerViewModel : ViewModel() { } ?: this private fun String.lowerCaseContains(anotherString: String) = - toLowerCase().contains(anotherString.toLowerCase()) + toLowerCase(Locale.ROOT).contains(anotherString.toLowerCase(Locale.ROOT)) private fun List.filterBySelectedCategories(): List { val isEmptyCategoriesSelection = selectedCategories.isEmpty()