Fix empty license dialogs (#1182)

This commit is contained in:
Rafał Borcz 2021-03-06 13:01:17 +01:00 committed by GitHub
parent b20b8fb243
commit 6f590eb194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 10 deletions

View File

@ -4,9 +4,9 @@ import android.os.Bundle
import android.view.View import android.view.View
import android.view.View.GONE import android.view.View.GONE
import android.view.View.VISIBLE import android.view.View.VISIBLE
import androidx.appcompat.app.AlertDialog
import androidx.core.text.parseAsHtml import androidx.core.text.parseAsHtml
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.entity.Library import com.mikepenz.aboutlibraries.entity.Library
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@ -26,14 +26,9 @@ class LicenseFragment : BaseFragment<FragmentLicenseBinding>(R.layout.fragment_l
@Inject @Inject
lateinit var licenseAdapter: LicenseAdapter lateinit var licenseAdapter: LicenseAdapter
private val libs by lazy { Libs(requireContext()) }
override val titleStringId get() = R.string.license_title override val titleStringId get() = R.string.license_title
override val appLibraries: ArrayList<Library>? override val appLibraries by lazy { Libs(requireContext()).libraries }
get() = context?.let {
libs.prepareLibraries(it, emptyArray(), emptyArray(), autoDetect = true, checkCachedDetection = true, sort = true)
}
companion object { companion object {
fun newInstance() = LicenseFragment() fun newInstance() = LicenseFragment()
@ -63,7 +58,7 @@ class LicenseFragment : BaseFragment<FragmentLicenseBinding>(R.layout.fragment_l
override fun openLicense(licenseHtml: String) { override fun openLicense(licenseHtml: String) {
context?.let { context?.let {
AlertDialog.Builder(it).apply { MaterialAlertDialogBuilder(it).apply {
setTitle(R.string.license_dialog_title) setTitle(R.string.license_dialog_title)
setMessage(licenseHtml.parseAsHtml()) setMessage(licenseHtml.parseAsHtml())
setPositiveButton(android.R.string.ok) { _, _ -> } setPositiveButton(android.R.string.ok) { _, _ -> }

View File

@ -5,7 +5,7 @@ import io.github.wulkanowy.ui.base.BaseView
interface LicenseView : BaseView { interface LicenseView : BaseView {
val appLibraries: ArrayList<Library>? val appLibraries: List<Library>
fun initView() fun initView()

View File

@ -1,7 +1,7 @@
buildscript { buildscript {
ext { ext {
kotlin_version = '1.4.31' kotlin_version = '1.4.31'
about_libraries = '8.8.3' about_libraries = '8.8.4'
hilt_version = "2.33-beta" hilt_version = "2.33-beta"
} }
repositories { repositories {