From 6f590eb194cd58d7b8cb87d6e4fbb4c8c6b36646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Sat, 6 Mar 2021 13:01:17 +0100 Subject: [PATCH] Fix empty license dialogs (#1182) --- .../ui/modules/about/license/LicenseFragment.kt | 11 +++-------- .../wulkanowy/ui/modules/about/license/LicenseView.kt | 2 +- build.gradle | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseFragment.kt index cdd29b41..4c3b608a 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseFragment.kt @@ -4,9 +4,9 @@ import android.os.Bundle import android.view.View import android.view.View.GONE import android.view.View.VISIBLE -import androidx.appcompat.app.AlertDialog import androidx.core.text.parseAsHtml import androidx.recyclerview.widget.LinearLayoutManager +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.entity.Library import dagger.hilt.android.AndroidEntryPoint @@ -26,14 +26,9 @@ class LicenseFragment : BaseFragment(R.layout.fragment_l @Inject lateinit var licenseAdapter: LicenseAdapter - private val libs by lazy { Libs(requireContext()) } - override val titleStringId get() = R.string.license_title - override val appLibraries: ArrayList? - get() = context?.let { - libs.prepareLibraries(it, emptyArray(), emptyArray(), autoDetect = true, checkCachedDetection = true, sort = true) - } + override val appLibraries by lazy { Libs(requireContext()).libraries } companion object { fun newInstance() = LicenseFragment() @@ -63,7 +58,7 @@ class LicenseFragment : BaseFragment(R.layout.fragment_l override fun openLicense(licenseHtml: String) { context?.let { - AlertDialog.Builder(it).apply { + MaterialAlertDialogBuilder(it).apply { setTitle(R.string.license_dialog_title) setMessage(licenseHtml.parseAsHtml()) setPositiveButton(android.R.string.ok) { _, _ -> } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseView.kt index 0680dbb7..6c97d875 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseView.kt @@ -5,7 +5,7 @@ import io.github.wulkanowy.ui.base.BaseView interface LicenseView : BaseView { - val appLibraries: ArrayList? + val appLibraries: List fun initView() diff --git a/build.gradle b/build.gradle index cf962014..8a10f65b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ buildscript { ext { kotlin_version = '1.4.31' - about_libraries = '8.8.3' + about_libraries = '8.8.4' hilt_version = "2.33-beta" } repositories {