From 8823cc6c6cb981a3b856adef00c73b4fb1b43497 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Sun, 25 Sep 2022 21:39:57 +0200 Subject: [PATCH] Cleaning. --- androidApp/build.gradle.kts | 2 +- .../apps/readerforselfossv2/android/AddSourceActivity.kt | 2 +- .../amine/apps/readerforselfossv2/android/LoginActivity.kt | 2 +- .../apps/readerforselfossv2/android/adapters/ItemsAdapter.kt | 4 ++-- .../amine/apps/readerforselfossv2/android/utils/LinksUtils.kt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index ed8c38c..00e1abc 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -30,7 +30,7 @@ fun gitVersion(): String { println("Tag found on current commit") execWithOutput("git -C ../ describe --contains HEAD") } - return process.replace("'", "").substring(1).replace("\\.", "").trim() + return process.replace("^0", "").replace("'", "").substring(1).replace("\\.", "").trim() } fun versionCodeFromGit(): Int { diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/AddSourceActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/AddSourceActivity.kt index 3cec99e..137764b 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/AddSourceActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/AddSourceActivity.kt @@ -84,7 +84,7 @@ class AddSourceActivity : AppCompatActivity(), DIAware { super.onResume() val baseUrl = appSettingsService.getBaseUrl() - if (baseUrl.isEmpty() || baseUrl.isBaseUrlInvalid(this@AddSourceActivity)) { + if (baseUrl.isEmpty() || baseUrl.isBaseUrlInvalid()) { mustLoginToAddSource() } else { handleSpoutsSpinner(binding.spoutsSpinner, binding.progress, binding.formContainer) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt index bc32762..657feb6 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt @@ -122,7 +122,7 @@ class LoginActivity : AppCompatActivity(), DIAware { var cancel = false var focusView: View? = null - if (url.isBaseUrlInvalid(this@LoginActivity)) { + if (url.isBaseUrlInvalid()) { binding.urlView.error = getString(R.string.login_url_problem) focusView = binding.urlView cancel = true diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt index 4c43c85..d66be45 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/adapters/ItemsAdapter.kt @@ -30,7 +30,7 @@ abstract class ItemsAdapter : RecyclerView.Adapte updateItems(this.items) } - private fun unmarkSnackbar(i: SelfossModel.Item, position: Int) { + private fun unmarkSnackbar(position: Int) { val s = Snackbar .make( app.findViewById(R.id.coordLayout), @@ -87,7 +87,7 @@ abstract class ItemsAdapter : RecyclerView.Adapte notifyItemChanged(position) } if (showSnackbar) { - unmarkSnackbar(i, position) + unmarkSnackbar(position) } } diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt index 600864b..20cc998 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/LinksUtils.kt @@ -163,7 +163,7 @@ private fun openInBrowser(linkDecoded: String, app: Activity) { fun String.isUrlValid(): Boolean = this.toHttpUrlOrNull() != null && Patterns.WEB_URL.matcher(this).matches() -fun String.isBaseUrlInvalid(ctx: Context): Boolean { +fun String.isBaseUrlInvalid(): Boolean { val baseUrl = this.toHttpUrlOrNull() var existsAndEndsWithSlash = false if (baseUrl != null) {