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.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<FragmentLicenseBinding>(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<Library>?
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<FragmentLicenseBinding>(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) { _, _ -> }

View File

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

View File

@ -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 {