migrate remaining inflated layouts to viewbinding
This commit is contained in:
parent
c1b972998f
commit
27e054e023
|
@ -4,10 +4,10 @@ import android.view.ContextThemeWrapper
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.RadioButton
|
|
||||||
import android.widget.RadioGroup
|
import android.widget.RadioGroup
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import com.simplemobiletools.commons.databinding.DialogRadioGroupBinding
|
import com.simplemobiletools.commons.databinding.DialogRadioGroupBinding
|
||||||
|
import com.simplemobiletools.commons.databinding.RadioButtonBinding
|
||||||
import com.simplemobiletools.commons.extensions.onGlobalLayout
|
import com.simplemobiletools.commons.extensions.onGlobalLayout
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.keyboard.R
|
import com.simplemobiletools.keyboard.R
|
||||||
|
@ -34,7 +34,7 @@ class KeyboardRadioGroupDialog(
|
||||||
val binding = DialogRadioGroupBinding.inflate(layoutInflater)
|
val binding = DialogRadioGroupBinding.inflate(layoutInflater)
|
||||||
binding.dialogRadioGroup.apply {
|
binding.dialogRadioGroup.apply {
|
||||||
for (i in 0 until items.size) {
|
for (i in 0 until items.size) {
|
||||||
val radioButton = (layoutInflater.inflate(R.layout.radio_button, null) as RadioButton).apply {
|
val radioButton = RadioButtonBinding.inflate(layoutInflater).dialogRadioButton.apply {
|
||||||
text = items[i].title
|
text = items[i].title
|
||||||
isChecked = items[i].id == checkedItemId
|
isChecked = items[i].id == checkedItemId
|
||||||
id = i
|
id = i
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.widget.TextView
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import com.simplemobiletools.commons.databinding.DialogTitleBinding
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.isNougatPlus
|
import com.simplemobiletools.commons.helpers.isNougatPlus
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
|
@ -120,8 +121,7 @@ fun Context.setupKeyboardDialogStuff(
|
||||||
} else {
|
} else {
|
||||||
var title: TextView? = null
|
var title: TextView? = null
|
||||||
if (titleId != 0 || titleText.isNotEmpty()) {
|
if (titleId != 0 || titleText.isNotEmpty()) {
|
||||||
title = LayoutInflater.from(this).inflate(R.layout.dialog_title, null) as TextView
|
title = DialogTitleBinding.inflate(LayoutInflater.from(this)).dialogTitleTextview.apply {
|
||||||
title.apply {
|
|
||||||
if (titleText.isNotEmpty()) {
|
if (titleText.isNotEmpty()) {
|
||||||
text = titleText
|
text = titleText
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import com.simplemobiletools.keyboard.activities.ManageClipboardItemsActivity
|
||||||
import com.simplemobiletools.keyboard.activities.SettingsActivity
|
import com.simplemobiletools.keyboard.activities.SettingsActivity
|
||||||
import com.simplemobiletools.keyboard.adapters.ClipsKeyboardAdapter
|
import com.simplemobiletools.keyboard.adapters.ClipsKeyboardAdapter
|
||||||
import com.simplemobiletools.keyboard.adapters.EmojisAdapter
|
import com.simplemobiletools.keyboard.adapters.EmojisAdapter
|
||||||
|
import com.simplemobiletools.keyboard.databinding.KeyboardKeyPreviewBinding
|
||||||
import com.simplemobiletools.keyboard.databinding.KeyboardPopupKeyboardBinding
|
import com.simplemobiletools.keyboard.databinding.KeyboardPopupKeyboardBinding
|
||||||
import com.simplemobiletools.keyboard.databinding.KeyboardViewKeyboardBinding
|
import com.simplemobiletools.keyboard.databinding.KeyboardViewKeyboardBinding
|
||||||
import com.simplemobiletools.keyboard.dialogs.ChangeLanguagePopup
|
import com.simplemobiletools.keyboard.dialogs.ChangeLanguagePopup
|
||||||
|
@ -206,7 +207,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||||
}
|
}
|
||||||
|
|
||||||
mPreviewPopup = PopupWindow(context)
|
mPreviewPopup = PopupWindow(context)
|
||||||
mPreviewText = inflater.inflate(resources.getLayout(R.layout.keyboard_key_preview), null) as TextView
|
mPreviewText = KeyboardKeyPreviewBinding.inflate(inflater).root
|
||||||
mPreviewTextSizeLarge = context.resources.getDimension(R.dimen.preview_text_size).toInt()
|
mPreviewTextSizeLarge = context.resources.getDimension(R.dimen.preview_text_size).toInt()
|
||||||
mPreviewPopup.contentView = mPreviewText
|
mPreviewPopup.contentView = mPreviewText
|
||||||
mPreviewPopup.setBackgroundDrawable(null)
|
mPreviewPopup.setBackgroundDrawable(null)
|
||||||
|
|
Loading…
Reference in New Issue