|
|
@ -2,14 +2,15 @@ package io.legado.app.ui.widget.font |
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint |
|
|
|
import android.annotation.SuppressLint |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.content.DialogInterface |
|
|
|
|
|
|
|
import android.os.Environment |
|
|
|
import android.os.Environment |
|
|
|
import android.view.LayoutInflater |
|
|
|
import android.view.LayoutInflater |
|
|
|
import android.view.View |
|
|
|
import android.view.View |
|
|
|
|
|
|
|
import androidx.appcompat.app.AlertDialog |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.lib.dialogs.AlertBuilder |
|
|
|
import io.legado.app.lib.dialogs.AlertBuilder |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
|
|
|
|
import io.legado.app.utils.applyTint |
|
|
|
import io.legado.app.utils.invisible |
|
|
|
import io.legado.app.utils.invisible |
|
|
|
import io.legado.app.utils.visible |
|
|
|
import io.legado.app.utils.visible |
|
|
|
import kotlinx.android.synthetic.main.dialog_font_select.view.* |
|
|
|
import kotlinx.android.synthetic.main.dialog_font_select.view.* |
|
|
@ -20,8 +21,8 @@ class FontSelectDialog(context: Context) : FontAdapter.CallBack { |
|
|
|
private val defaultFolder = |
|
|
|
private val defaultFolder = |
|
|
|
Environment.getExternalStorageDirectory().absolutePath + File.separator + "Fonts" |
|
|
|
Environment.getExternalStorageDirectory().absolutePath + File.separator + "Fonts" |
|
|
|
private lateinit var adapter: FontAdapter |
|
|
|
private lateinit var adapter: FontAdapter |
|
|
|
private var builder: AlertBuilder<DialogInterface> |
|
|
|
private var builder: AlertBuilder<AlertDialog> |
|
|
|
private var dialog: DialogInterface? = null |
|
|
|
private var dialog: AlertDialog? = null |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
@SuppressLint("InflateParams") |
|
|
|
private var view: View = LayoutInflater.from(context).inflate(R.layout.dialog_font_select, null) |
|
|
|
private var view: View = LayoutInflater.from(context).inflate(R.layout.dialog_font_select, null) |
|
|
|
var curPath: String? = null |
|
|
|
var curPath: String? = null |
|
|
@ -39,7 +40,7 @@ class FontSelectDialog(context: Context) : FontAdapter.CallBack { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun show() { |
|
|
|
fun show() { |
|
|
|
dialog = builder.show() |
|
|
|
dialog = builder.show().applyTint() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initData() = with(view) { |
|
|
|
private fun initData() = with(view) { |
|
|
|