migrate activities to view binding
This commit is contained in:
parent
d06913c8d0
commit
adfae7e131
8 changed files with 203 additions and 159 deletions
|
@ -13,8 +13,6 @@ import com.simplemobiletools.commons.helpers.*
|
|||
import com.simplemobiletools.commons.models.MyTheme
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.models.SharedTheme
|
||||
import com.simplemobiletools.commons.views.MyTextView
|
||||
import kotlinx.android.synthetic.main.activity_customization.*
|
||||
|
||||
class CustomizationActivity : BaseSimpleActivity() {
|
||||
private val THEME_LIGHT = 0
|
||||
|
@ -51,12 +49,12 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_customization)
|
||||
setContentView(binding.root)
|
||||
|
||||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
|
||||
updateMaterialActivityViews(customization_coordinator, customization_holder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
updateMaterialActivityViews(binding.customizationCoordinator, binding.customizationHolder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
|
||||
isThankYou = packageName.removeSuffix(".debug") == "com.simplemobiletools.thankyou"
|
||||
initColorVariables()
|
||||
|
@ -75,7 +73,7 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
runOnUiThread {
|
||||
setupThemes()
|
||||
val hideGoogleRelations = resources.getBoolean(R.bool.hide_google_relations) && !isThankYou
|
||||
apply_to_all_holder.beVisibleIf(
|
||||
binding.applyToAllHolder.beVisibleIf(
|
||||
storedSharedTheme == null && curSelectedThemeId != THEME_AUTO && curSelectedThemeId != THEME_SYSTEM && !hideGoogleRelations
|
||||
)
|
||||
}
|
||||
|
@ -99,7 +97,7 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
originalAppIconColor = baseConfig.appIconColor
|
||||
|
||||
if (resources.getBoolean(R.bool.hide_google_relations) && !isThankYou) {
|
||||
apply_to_all_holder.beGone()
|
||||
binding.applyToAllHolder.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,20 +115,21 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
setTheme(getThemeId(this))
|
||||
}
|
||||
|
||||
setupToolbar(customization_toolbar, NavigationIcon.Cross, getColoredMaterialStatusBarColor())
|
||||
setupToolbar(binding.customizationToolbar, NavigationIcon.Cross, getColoredMaterialStatusBarColor())
|
||||
}
|
||||
|
||||
private fun refreshMenuItems() {
|
||||
customization_toolbar.menu.findItem(R.id.save).isVisible = hasUnsavedChanges
|
||||
binding.customizationToolbar.menu.findItem(R.id.save).isVisible = hasUnsavedChanges
|
||||
}
|
||||
|
||||
private fun setupOptionsMenu() {
|
||||
customization_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
binding.customizationToolbar.setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.save -> {
|
||||
saveChanges(true)
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
@ -198,10 +197,10 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
|
||||
private fun setupThemePicker() {
|
||||
curSelectedThemeId = getCurrentThemeId()
|
||||
customization_theme.text = getThemeText()
|
||||
binding.customizationTheme.text = getThemeText()
|
||||
updateAutoThemeFields()
|
||||
handleAccentColorLayout()
|
||||
customization_theme_holder.setOnClickListener {
|
||||
binding.customizationThemeHolder.setOnClickListener {
|
||||
if (baseConfig.wasAppIconCustomizationWarningShown) {
|
||||
themePickerClicked()
|
||||
} else {
|
||||
|
@ -212,8 +211,8 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
if (customization_theme.value == getMaterialYouString()) {
|
||||
apply_to_all_holder.beGone()
|
||||
if (binding.customizationTheme.value == getMaterialYouString()) {
|
||||
binding.applyToAllHolder.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,18 +235,18 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
}
|
||||
|
||||
val hideGoogleRelations = resources.getBoolean(R.bool.hide_google_relations) && !isThankYou
|
||||
apply_to_all_holder.beVisibleIf(
|
||||
binding.applyToAllHolder.beVisibleIf(
|
||||
curSelectedThemeId != THEME_AUTO && curSelectedThemeId != THEME_SYSTEM && curSelectedThemeId != THEME_SHARED && !hideGoogleRelations
|
||||
)
|
||||
|
||||
updateMenuItemColors(customization_toolbar.menu, getCurrentStatusBarColor())
|
||||
setupToolbar(customization_toolbar, NavigationIcon.Cross, getCurrentStatusBarColor())
|
||||
updateMenuItemColors(binding.customizationToolbar.menu, getCurrentStatusBarColor())
|
||||
setupToolbar(binding.customizationToolbar, NavigationIcon.Cross, getCurrentStatusBarColor())
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateColorTheme(themeId: Int, useStored: Boolean = false) {
|
||||
curSelectedThemeId = themeId
|
||||
customization_theme.text = getThemeText()
|
||||
binding.customizationTheme.text = getThemeText()
|
||||
|
||||
resources.apply {
|
||||
if (curSelectedThemeId == THEME_CUSTOM) {
|
||||
|
@ -258,8 +257,8 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
curAccentColor = baseConfig.customAccentColor
|
||||
curAppIconColor = baseConfig.customAppIconColor
|
||||
setTheme(getThemeId(curPrimaryColor))
|
||||
updateMenuItemColors(customization_toolbar.menu, curPrimaryColor)
|
||||
setupToolbar(customization_toolbar, NavigationIcon.Cross, curPrimaryColor)
|
||||
updateMenuItemColors(binding.customizationToolbar.menu, curPrimaryColor)
|
||||
setupToolbar(binding.customizationToolbar, NavigationIcon.Cross, curPrimaryColor)
|
||||
setupColorsPickers()
|
||||
} else {
|
||||
baseConfig.customPrimaryColor = curPrimaryColor
|
||||
|
@ -279,8 +278,8 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
}
|
||||
setTheme(getThemeId(curPrimaryColor))
|
||||
setupColorsPickers()
|
||||
updateMenuItemColors(customization_toolbar.menu, curPrimaryColor)
|
||||
setupToolbar(customization_toolbar, NavigationIcon.Cross, curPrimaryColor)
|
||||
updateMenuItemColors(binding.customizationToolbar.menu, curPrimaryColor)
|
||||
setupToolbar(binding.customizationToolbar, NavigationIcon.Cross, curPrimaryColor)
|
||||
}
|
||||
} else {
|
||||
val theme = predefinedThemes[curSelectedThemeId]!!
|
||||
|
@ -295,8 +294,8 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
|
||||
setTheme(getThemeId(getCurrentPrimaryColor()))
|
||||
colorChanged()
|
||||
updateMenuItemColors(customization_toolbar.menu, getCurrentStatusBarColor())
|
||||
setupToolbar(customization_toolbar, NavigationIcon.Cross, getCurrentStatusBarColor())
|
||||
updateMenuItemColors(binding.customizationToolbar.menu, getCurrentStatusBarColor())
|
||||
setupToolbar(binding.customizationToolbar, NavigationIcon.Cross, getCurrentStatusBarColor())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,11 +363,11 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
}
|
||||
|
||||
private fun updateAutoThemeFields() {
|
||||
arrayOf(customization_text_color_holder, customization_background_color_holder).forEach {
|
||||
arrayOf(binding.customizationTextColorHolder, binding.customizationBackgroundColorHolder).forEach {
|
||||
it.beVisibleIf(curSelectedThemeId != THEME_AUTO && curSelectedThemeId != THEME_SYSTEM)
|
||||
}
|
||||
|
||||
customization_primary_color_holder.beVisibleIf(curSelectedThemeId != THEME_SYSTEM)
|
||||
binding.customizationPrimaryColorHolder.beVisibleIf(curSelectedThemeId != THEME_SYSTEM)
|
||||
}
|
||||
|
||||
private fun promptSaveDiscard() {
|
||||
|
@ -441,24 +440,24 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
val textColor = getCurrentTextColor()
|
||||
val backgroundColor = getCurrentBackgroundColor()
|
||||
val primaryColor = getCurrentPrimaryColor()
|
||||
customization_text_color.setFillWithStroke(textColor, backgroundColor)
|
||||
customization_primary_color.setFillWithStroke(primaryColor, backgroundColor)
|
||||
customization_accent_color.setFillWithStroke(curAccentColor, backgroundColor)
|
||||
customization_background_color.setFillWithStroke(backgroundColor, backgroundColor)
|
||||
customization_app_icon_color.setFillWithStroke(curAppIconColor, backgroundColor)
|
||||
apply_to_all.setTextColor(primaryColor.getContrastColor())
|
||||
binding.customizationTextColor.setFillWithStroke(textColor, backgroundColor)
|
||||
binding.customizationPrimaryColor.setFillWithStroke(primaryColor, backgroundColor)
|
||||
binding.customizationAccentColor.setFillWithStroke(curAccentColor, backgroundColor)
|
||||
binding.customizationBackgroundColor.setFillWithStroke(backgroundColor, backgroundColor)
|
||||
binding.customizationAppIconColor.setFillWithStroke(curAppIconColor, backgroundColor)
|
||||
binding.applyToAll.setTextColor(primaryColor.getContrastColor())
|
||||
|
||||
customization_text_color_holder.setOnClickListener { pickTextColor() }
|
||||
customization_background_color_holder.setOnClickListener { pickBackgroundColor() }
|
||||
customization_primary_color_holder.setOnClickListener { pickPrimaryColor() }
|
||||
customization_accent_color_holder.setOnClickListener { pickAccentColor() }
|
||||
binding.customizationTextColorHolder.setOnClickListener { pickTextColor() }
|
||||
binding.customizationBackgroundColorHolder.setOnClickListener { pickBackgroundColor() }
|
||||
binding.customizationPrimaryColorHolder.setOnClickListener { pickPrimaryColor() }
|
||||
binding.customizationAccentColorHolder.setOnClickListener { pickAccentColor() }
|
||||
|
||||
handleAccentColorLayout()
|
||||
apply_to_all.setOnClickListener {
|
||||
binding.applyToAll.setOnClickListener {
|
||||
applyToAll()
|
||||
}
|
||||
|
||||
customization_app_icon_color_holder.setOnClickListener {
|
||||
binding.customizationAppIconColorHolder.setOnClickListener {
|
||||
if (baseConfig.wasAppIconCustomizationWarningShown) {
|
||||
pickAppIconColor()
|
||||
} else {
|
||||
|
@ -496,17 +495,17 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
|
||||
private fun updateApplyToAllColors(newColor: Int) {
|
||||
if (newColor == baseConfig.primaryColor && !baseConfig.isUsingSystemTheme) {
|
||||
apply_to_all.setBackgroundResource(R.drawable.button_background_rounded)
|
||||
binding.applyToAll.setBackgroundResource(R.drawable.button_background_rounded)
|
||||
} else {
|
||||
val applyBackground = resources.getDrawable(R.drawable.button_background_rounded, theme) as RippleDrawable
|
||||
(applyBackground as LayerDrawable).findDrawableByLayerId(R.id.button_background_holder).applyColorFilter(newColor)
|
||||
apply_to_all.background = applyBackground
|
||||
binding.applyToAll.background = applyBackground
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleAccentColorLayout() {
|
||||
customization_accent_color_holder.beVisibleIf(curSelectedThemeId == THEME_WHITE || isCurrentWhiteTheme() || curSelectedThemeId == THEME_BLACK_WHITE || isCurrentBlackAndWhiteTheme())
|
||||
customization_accent_color_label.text = getString(
|
||||
binding.customizationAccentColorHolder.beVisibleIf(curSelectedThemeId == THEME_WHITE || isCurrentWhiteTheme() || curSelectedThemeId == THEME_BLACK_WHITE || isCurrentBlackAndWhiteTheme())
|
||||
binding.customizationAccentColorLabel.text = getString(
|
||||
if (curSelectedThemeId == THEME_WHITE || isCurrentWhiteTheme()) {
|
||||
R.string.accent_color_white
|
||||
} else {
|
||||
|
@ -549,7 +548,7 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
return
|
||||
}
|
||||
|
||||
curPrimaryLineColorPicker = LineColorPickerDialog(this, curPrimaryColor, true, toolbar = customization_toolbar) { wasPositivePressed, color ->
|
||||
curPrimaryLineColorPicker = LineColorPickerDialog(this, curPrimaryColor, true, toolbar = binding.customizationToolbar) { wasPositivePressed, color ->
|
||||
curPrimaryLineColorPicker = null
|
||||
if (wasPositivePressed) {
|
||||
if (hasColorChanged(curPrimaryColor, color)) {
|
||||
|
@ -558,14 +557,14 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
updateColorTheme(getUpdatedTheme())
|
||||
setTheme(getThemeId(color))
|
||||
}
|
||||
updateMenuItemColors(customization_toolbar.menu, color)
|
||||
setupToolbar(customization_toolbar, NavigationIcon.Cross, color)
|
||||
updateMenuItemColors(binding.customizationToolbar.menu, color)
|
||||
setupToolbar(binding.customizationToolbar, NavigationIcon.Cross, color)
|
||||
} else {
|
||||
updateActionbarColor(curPrimaryColor)
|
||||
setTheme(getThemeId(curPrimaryColor))
|
||||
updateMenuItemColors(customization_toolbar.menu, curPrimaryColor)
|
||||
setupToolbar(customization_toolbar, NavigationIcon.Cross, curPrimaryColor)
|
||||
updateTopBarColors(customization_toolbar, curPrimaryColor)
|
||||
updateMenuItemColors(binding.customizationToolbar.menu, curPrimaryColor)
|
||||
setupToolbar(binding.customizationToolbar, NavigationIcon.Cross, curPrimaryColor)
|
||||
updateTopBarColors(binding.customizationToolbar, curPrimaryColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -612,7 +611,7 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
}
|
||||
|
||||
baseConfig.wasSharedThemeEverActivated = true
|
||||
apply_to_all_holder.beGone()
|
||||
binding.applyToAllHolder.beGone()
|
||||
updateColorTheme(THEME_SHARED)
|
||||
saveChanges(false)
|
||||
}
|
||||
|
@ -622,42 +621,42 @@ class CustomizationActivity : BaseSimpleActivity() {
|
|||
}
|
||||
|
||||
private fun updateLabelColors(textColor: Int) {
|
||||
arrayListOf<MyTextView>(
|
||||
customization_theme_label,
|
||||
customization_theme,
|
||||
customization_text_color_label,
|
||||
customization_background_color_label,
|
||||
customization_primary_color_label,
|
||||
customization_accent_color_label,
|
||||
customization_app_icon_color_label
|
||||
arrayListOf(
|
||||
binding.customizationThemeLabel,
|
||||
binding.customizationTheme,
|
||||
binding.customizationTextColorLabel,
|
||||
binding.customizationBackgroundColorLabel,
|
||||
binding.customizationPrimaryColorLabel,
|
||||
binding.customizationAccentColorLabel,
|
||||
binding.customizationAppIconColorLabel
|
||||
).forEach {
|
||||
it.setTextColor(textColor)
|
||||
}
|
||||
|
||||
val primaryColor = getCurrentPrimaryColor()
|
||||
apply_to_all.setTextColor(primaryColor.getContrastColor())
|
||||
binding.applyToAll.setTextColor(primaryColor.getContrastColor())
|
||||
updateApplyToAllColors(primaryColor)
|
||||
}
|
||||
|
||||
private fun getCurrentTextColor() = if (customization_theme.value == getMaterialYouString()) {
|
||||
private fun getCurrentTextColor() = if (binding.customizationTheme.value == getMaterialYouString()) {
|
||||
resources.getColor(R.color.you_neutral_text_color)
|
||||
} else {
|
||||
curTextColor
|
||||
}
|
||||
|
||||
private fun getCurrentBackgroundColor() = if (customization_theme.value == getMaterialYouString()) {
|
||||
private fun getCurrentBackgroundColor() = if (binding.customizationTheme.value == getMaterialYouString()) {
|
||||
resources.getColor(R.color.you_background_color)
|
||||
} else {
|
||||
curBackgroundColor
|
||||
}
|
||||
|
||||
private fun getCurrentPrimaryColor() = if (customization_theme.value == getMaterialYouString()) {
|
||||
private fun getCurrentPrimaryColor() = if (binding.customizationTheme.value == getMaterialYouString()) {
|
||||
resources.getColor(R.color.you_primary_color)
|
||||
} else {
|
||||
curPrimaryColor
|
||||
}
|
||||
|
||||
private fun getCurrentStatusBarColor() = if (customization_theme.value == getMaterialYouString()) {
|
||||
private fun getCurrentStatusBarColor() = if (binding.customizationTheme.value == getMaterialYouString()) {
|
||||
resources.getColor(R.color.you_status_bar_color)
|
||||
} else {
|
||||
curPrimaryColor
|
||||
|
|
|
@ -4,31 +4,28 @@ import android.os.Bundle
|
|||
import android.text.Html
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.LayoutInflater
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.extensions.removeUnderlines
|
||||
import com.simplemobiletools.commons.databinding.ActivityFaqBinding
|
||||
import com.simplemobiletools.commons.databinding.ItemFaqBinding
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.APP_FAQ
|
||||
import com.simplemobiletools.commons.helpers.APP_ICON_IDS
|
||||
import com.simplemobiletools.commons.helpers.APP_LAUNCHER_NAME
|
||||
import com.simplemobiletools.commons.helpers.NavigationIcon
|
||||
import com.simplemobiletools.commons.models.FAQItem
|
||||
import kotlinx.android.synthetic.main.activity_faq.*
|
||||
import kotlinx.android.synthetic.main.item_faq.view.*
|
||||
|
||||
class FAQActivity : BaseSimpleActivity() {
|
||||
override fun getAppIconIDs() = intent.getIntegerArrayListExtra(APP_ICON_IDS) ?: ArrayList()
|
||||
|
||||
override fun getAppLauncherName() = intent.getStringExtra(APP_LAUNCHER_NAME) ?: ""
|
||||
|
||||
private val binding by viewBinding(ActivityFaqBinding::inflate)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_faq)
|
||||
setContentView(binding.root)
|
||||
|
||||
updateMaterialActivityViews(faq_coordinator, faq_holder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(faq_nested_scrollview, faq_toolbar)
|
||||
updateMaterialActivityViews(binding.faqCoordinator, binding.faqHolder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(binding.faqNestedScrollview, binding.faqToolbar)
|
||||
|
||||
val textColor = getProperTextColor()
|
||||
val backgroundColor = getProperBackgroundColor()
|
||||
|
@ -38,14 +35,15 @@ class FAQActivity : BaseSimpleActivity() {
|
|||
val faqItems = intent.getSerializableExtra(APP_FAQ) as ArrayList<FAQItem>
|
||||
faqItems.forEach {
|
||||
val faqItem = it
|
||||
inflater.inflate(R.layout.item_faq, null).apply {
|
||||
faq_card.setCardBackgroundColor(backgroundColor)
|
||||
faq_title.apply {
|
||||
|
||||
ItemFaqBinding.inflate(inflater, null, false).apply {
|
||||
faqCard.setCardBackgroundColor(backgroundColor)
|
||||
faqTitle.apply {
|
||||
text = if (faqItem.title is Int) getString(faqItem.title) else faqItem.title as String
|
||||
setTextColor(primaryColor)
|
||||
}
|
||||
|
||||
faq_text.apply {
|
||||
faqText.apply {
|
||||
text = if (faqItem.text is Int) Html.fromHtml(getString(faqItem.text)) else faqItem.text as String
|
||||
setTextColor(textColor)
|
||||
setLinkTextColor(primaryColor)
|
||||
|
@ -54,13 +52,13 @@ class FAQActivity : BaseSimpleActivity() {
|
|||
removeUnderlines()
|
||||
}
|
||||
|
||||
faq_holder.addView(this)
|
||||
binding.faqHolder.addView(root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(faq_toolbar, NavigationIcon.Arrow)
|
||||
setupToolbar(binding.faqToolbar, NavigationIcon.Arrow)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,25 +3,69 @@ package com.simplemobiletools.commons.activities
|
|||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.databinding.ActivityLicenseBinding
|
||||
import com.simplemobiletools.commons.databinding.ItemLicenseBinding
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.extensions.launchViewIntent
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.commons.extensions.viewBinding
|
||||
import com.simplemobiletools.commons.helpers.APP_ICON_IDS
|
||||
import com.simplemobiletools.commons.helpers.APP_LAUNCHER_NAME
|
||||
import com.simplemobiletools.commons.helpers.APP_LICENSES
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_ANDROID_LAME
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_APNG
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_AUDIO_RECORD_VIEW
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_AUTOFITTEXTVIEW
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_CROPPER
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_ESPRESSO
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_EVENT_BUS
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_EXOPLAYER
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_FILTERS
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_GESTURE_VIEWS
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_GIF_DRAWABLE
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_GLIDE
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_GSON
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_INDICATOR_FAST_SCROLL
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_JODA
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_LEAK_CANARY
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_M3U_PARSER
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_NUMBER_PICKER
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_OTTO
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_PANORAMA_VIEW
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_PATTERN
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_PDF_VIEWER
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_PDF_VIEW_PAGER
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_PHOTOVIEW
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_PICASSO
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_REPRINT
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_ROBOLECTRIC
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_RTL
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_SANSELAN
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_SMS_MMS
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_STETHO
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_SUBSAMPLING
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_ZIP4J
|
||||
import com.simplemobiletools.commons.helpers.NavigationIcon
|
||||
import com.simplemobiletools.commons.models.License
|
||||
import kotlinx.android.synthetic.main.activity_license.*
|
||||
import kotlinx.android.synthetic.main.item_license.view.*
|
||||
|
||||
class LicenseActivity : BaseSimpleActivity() {
|
||||
override fun getAppIconIDs() = intent.getIntegerArrayListExtra(APP_ICON_IDS) ?: ArrayList()
|
||||
|
||||
override fun getAppLauncherName() = intent.getStringExtra(APP_LAUNCHER_NAME) ?: ""
|
||||
|
||||
private val binding by viewBinding(ActivityLicenseBinding::inflate)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_license)
|
||||
updateTextColors(licenses_holder)
|
||||
setContentView(binding.root)
|
||||
updateTextColors(binding.licensesHolder)
|
||||
|
||||
updateMaterialActivityViews(licenses_coordinator, licenses_holder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(licenses_nested_scrollview, licenses_toolbar)
|
||||
updateMaterialActivityViews(binding.licensesCoordinator, binding.licensesHolder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(binding.licensesNestedScrollview, binding.licensesToolbar)
|
||||
|
||||
val textColor = getProperTextColor()
|
||||
val backgroundColor = getProperBackgroundColor()
|
||||
|
@ -32,9 +76,10 @@ class LicenseActivity : BaseSimpleActivity() {
|
|||
val licenseMask = intent.getLongExtra(APP_LICENSES, 0) or LICENSE_KOTLIN
|
||||
licenses.filter { licenseMask and it.id != 0L }.forEach {
|
||||
val license = it
|
||||
inflater.inflate(R.layout.item_license, null).apply {
|
||||
license_card.setCardBackgroundColor(backgroundColor)
|
||||
license_title.apply {
|
||||
|
||||
ItemLicenseBinding.inflate(inflater, null, false).apply {
|
||||
licenseCard.setCardBackgroundColor(backgroundColor)
|
||||
licenseTitle.apply {
|
||||
text = getString(license.titleId)
|
||||
setTextColor(primaryColor)
|
||||
setOnClickListener {
|
||||
|
@ -42,19 +87,19 @@ class LicenseActivity : BaseSimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
license_text.apply {
|
||||
licenseText.apply {
|
||||
text = getString(license.textId)
|
||||
setTextColor(textColor)
|
||||
}
|
||||
|
||||
licenses_holder.addView(this)
|
||||
binding.licensesHolder.addView(root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(licenses_toolbar, NavigationIcon.Arrow)
|
||||
setupToolbar(binding.licensesToolbar, NavigationIcon.Arrow)
|
||||
}
|
||||
|
||||
private fun initLicenses() = arrayOf(
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.os.Bundle
|
|||
import android.widget.Toast
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.adapters.ManageBlockedNumbersAdapter
|
||||
import com.simplemobiletools.commons.databinding.ActivityManageBlockedNumbersBinding
|
||||
import com.simplemobiletools.commons.dialogs.AddBlockedNumberDialog
|
||||
import com.simplemobiletools.commons.dialogs.ExportBlockedNumbersDialog
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
|
@ -15,7 +16,6 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
||||
import com.simplemobiletools.commons.models.BlockedNumber
|
||||
import kotlinx.android.synthetic.main.activity_manage_blocked_numbers.*
|
||||
import java.io.FileOutputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
|
@ -27,22 +27,29 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
|
||||
override fun getAppLauncherName() = intent.getStringExtra(APP_LAUNCHER_NAME) ?: ""
|
||||
|
||||
private val binding by viewBinding(ActivityManageBlockedNumbersBinding::inflate)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_manage_blocked_numbers)
|
||||
setContentView(binding.root)
|
||||
updateBlockedNumbers()
|
||||
setupOptionsMenu()
|
||||
|
||||
updateMaterialActivityViews(block_numbers_coordinator, manage_blocked_numbers_list, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(manage_blocked_numbers_list, block_numbers_toolbar)
|
||||
updateTextColors(manage_blocked_numbers_wrapper)
|
||||
updateMaterialActivityViews(
|
||||
binding.blockNumbersCoordinator,
|
||||
binding.manageBlockedNumbersList,
|
||||
useTransparentNavigation = true,
|
||||
useTopSearchMenu = false
|
||||
)
|
||||
setupMaterialScrollListener(binding.manageBlockedNumbersList, binding.blockNumbersToolbar)
|
||||
updateTextColors(binding.manageBlockedNumbersWrapper)
|
||||
updatePlaceholderTexts()
|
||||
|
||||
setupBlockUnknown()
|
||||
setupBlockHidden()
|
||||
|
||||
manage_blocked_numbers_placeholder_2.apply {
|
||||
binding.manageBlockedNumbersPlaceholder2.apply {
|
||||
underlineText()
|
||||
setTextColor(getProperPrimaryColor())
|
||||
setOnClickListener {
|
||||
|
@ -59,7 +66,7 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
val blockHiddenTitleRes =
|
||||
if (baseConfig.appId.startsWith("com.simplemobiletools.dialer")) R.string.block_hidden_calls else R.string.block_hidden_messages
|
||||
|
||||
block_hidden.apply {
|
||||
binding.blockHidden.apply {
|
||||
setText(blockHiddenTitleRes)
|
||||
isChecked = baseConfig.blockHiddenNumbers
|
||||
if (isChecked) {
|
||||
|
@ -67,10 +74,10 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
}
|
||||
}
|
||||
|
||||
block_hidden_holder.setOnClickListener {
|
||||
block_hidden.toggle()
|
||||
baseConfig.blockHiddenNumbers = block_hidden.isChecked
|
||||
if (block_hidden.isChecked) {
|
||||
binding.blockHiddenHolder.setOnClickListener {
|
||||
binding.blockHidden.toggle()
|
||||
baseConfig.blockHiddenNumbers = binding.blockHidden.isChecked
|
||||
if (binding.blockHidden.isChecked) {
|
||||
maybeSetDefaultCallerIdApp()
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +87,7 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
val blockUnknownTitleRes =
|
||||
if (baseConfig.appId.startsWith("com.simplemobiletools.dialer")) R.string.block_not_stored_calls else R.string.block_not_stored_messages
|
||||
|
||||
block_unknown.apply {
|
||||
binding.blockUnknown.apply {
|
||||
setText(blockUnknownTitleRes)
|
||||
isChecked = baseConfig.blockUnknownNumbers
|
||||
if (isChecked) {
|
||||
|
@ -88,10 +95,10 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
}
|
||||
}
|
||||
|
||||
block_unknown_holder.setOnClickListener {
|
||||
block_unknown.toggle()
|
||||
baseConfig.blockUnknownNumbers = block_unknown.isChecked
|
||||
if (block_unknown.isChecked) {
|
||||
binding.blockUnknownHolder.setOnClickListener {
|
||||
binding.blockUnknown.toggle()
|
||||
baseConfig.blockUnknownNumbers = binding.blockUnknown.isChecked
|
||||
if (binding.blockUnknown.isChecked) {
|
||||
maybeSetDefaultCallerIdApp()
|
||||
}
|
||||
}
|
||||
|
@ -99,11 +106,11 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(block_numbers_toolbar, NavigationIcon.Arrow)
|
||||
setupToolbar(binding.blockNumbersToolbar, NavigationIcon.Arrow)
|
||||
}
|
||||
|
||||
private fun setupOptionsMenu() {
|
||||
block_numbers_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
binding.blockNumbersToolbar.setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.add_blocked_number -> {
|
||||
addOrEditBlockedNumber()
|
||||
|
@ -139,8 +146,8 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
toast(R.string.must_make_default_caller_id_app, length = Toast.LENGTH_LONG)
|
||||
baseConfig.blockUnknownNumbers = false
|
||||
baseConfig.blockHiddenNumbers = false
|
||||
block_unknown.isChecked = false
|
||||
block_hidden.isChecked = false
|
||||
binding.blockUnknown.isChecked = false
|
||||
binding.blockHidden.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,22 +156,22 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity(), RefreshRecyclerViewLi
|
|||
}
|
||||
|
||||
private fun updatePlaceholderTexts() {
|
||||
manage_blocked_numbers_placeholder.text = getString(if (isDefaultDialer()) R.string.not_blocking_anyone else R.string.must_make_default_dialer)
|
||||
manage_blocked_numbers_placeholder_2.text = getString(if (isDefaultDialer()) R.string.add_a_blocked_number else R.string.set_as_default)
|
||||
binding.manageBlockedNumbersPlaceholder.text = getString(if (isDefaultDialer()) R.string.not_blocking_anyone else R.string.must_make_default_dialer)
|
||||
binding.manageBlockedNumbersPlaceholder2.text = getString(if (isDefaultDialer()) R.string.add_a_blocked_number else R.string.set_as_default)
|
||||
}
|
||||
|
||||
private fun updateBlockedNumbers() {
|
||||
ensureBackgroundThread {
|
||||
val blockedNumbers = getBlockedNumbers()
|
||||
runOnUiThread {
|
||||
ManageBlockedNumbersAdapter(this, blockedNumbers, this, manage_blocked_numbers_list) {
|
||||
ManageBlockedNumbersAdapter(this, blockedNumbers, this, binding.manageBlockedNumbersList) {
|
||||
addOrEditBlockedNumber(it as BlockedNumber)
|
||||
}.apply {
|
||||
manage_blocked_numbers_list.adapter = this
|
||||
binding.manageBlockedNumbersList.adapter = this
|
||||
}
|
||||
|
||||
manage_blocked_numbers_placeholder.beVisibleIf(blockedNumbers.isEmpty())
|
||||
manage_blocked_numbers_placeholder_2.beVisibleIf(blockedNumbers.isEmpty())
|
||||
binding.manageBlockedNumbersPlaceholder.beVisibleIf(blockedNumbers.isEmpty())
|
||||
binding.manageBlockedNumbersPlaceholder2.beVisibleIf(blockedNumbers.isEmpty())
|
||||
|
||||
if (blockedNumbers.any { it.number.isBlockedNumberPattern() }) {
|
||||
maybeSetDefaultCallerIdApp()
|
||||
|
|
|
@ -91,7 +91,7 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc
|
|||
|
||||
if (baseConfig.isUsingSystemTheme) {
|
||||
actBarTextView?.onGlobalLayout {
|
||||
val backArrow = activity.findViewById<ImageView>(R.id.action_mode_close_button)
|
||||
val backArrow = activity.findViewById<ImageView>(androidx.appcompat.R.id.action_mode_close_button)
|
||||
backArrow?.applyColorFilter(bgColor.getContrastColor())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
plugins {
|
||||
alias(libs.plugins.android)
|
||||
alias(libs.plugins.kotlinAndroid)
|
||||
alias(libs.plugins.kotlinAndroidExtensions) //todo remove
|
||||
}
|
||||
android {
|
||||
compileSdk = libs.versions.app.build.compileSDKVersion.get().toInt()
|
||||
|
@ -26,6 +25,11 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("main").java.srcDirs("src/main/kotlin")
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
|||
import com.simplemobiletools.commons.dialogs.BottomSheetChooserDialog
|
||||
import com.simplemobiletools.commons.extensions.appLaunched
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.extensions.viewBinding
|
||||
import com.simplemobiletools.commons.models.SimpleListItem
|
||||
import com.simplemobiletools.commons.samples.BuildConfig
|
||||
import com.simplemobiletools.commons.samples.R
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import com.simplemobiletools.commons.samples.databinding.ActivityMainBinding
|
||||
|
||||
class MainActivity : BaseSimpleActivity() {
|
||||
override fun getAppLauncherName() = getString(R.string.smtco_app_name)
|
||||
|
@ -19,42 +20,34 @@ class MainActivity : BaseSimpleActivity() {
|
|||
return ids
|
||||
}
|
||||
|
||||
private val binding by viewBinding(ActivityMainBinding::inflate)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
setContentView(binding.root)
|
||||
appLaunched(BuildConfig.APPLICATION_ID)
|
||||
|
||||
updateMaterialActivityViews(main_coordinator, main_holder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(main_nested_scrollview, main_toolbar)
|
||||
updateMaterialActivityViews(binding.mainCoordinator, binding.mainHolder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
setupMaterialScrollListener(binding.mainNestedScrollview, binding.mainToolbar)
|
||||
|
||||
main_color_customization.setOnClickListener {
|
||||
binding.mainColorCustomization.setOnClickListener {
|
||||
startCustomizationActivity()
|
||||
}
|
||||
|
||||
//startCustomizationActivity()
|
||||
//startAboutActivity(R.string.smtco_app_name, 3, "0.2", arrayListOf(FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons)), false)
|
||||
|
||||
/*val letters = arrayListOf("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q")
|
||||
StringsAdapter(this, letters, media_grid, media_refresh_layout) {
|
||||
}.apply {
|
||||
media_grid.adapter = this
|
||||
}
|
||||
|
||||
media_refresh_layout.setOnRefreshListener {
|
||||
Handler().postDelayed({
|
||||
media_refresh_layout.isRefreshing = false
|
||||
}, 1000L)
|
||||
}*/
|
||||
}
|
||||
|
||||
private fun launchBottomSheetDemo() {
|
||||
BottomSheetChooserDialog.createChooser(
|
||||
fragmentManager = supportFragmentManager,
|
||||
title = R.string.please_select_destination,
|
||||
title = com.simplemobiletools.commons.R.string.please_select_destination,
|
||||
items = arrayOf(
|
||||
SimpleListItem(1, R.string.record_video, R.drawable.ic_camera_vector),
|
||||
SimpleListItem(2, R.string.record_audio, R.drawable.ic_microphone_vector, selected = true),
|
||||
SimpleListItem(4, R.string.choose_contact, R.drawable.ic_add_person_vector)
|
||||
SimpleListItem(1, com.simplemobiletools.commons.R.string.record_video, com.simplemobiletools.commons.R.drawable.ic_camera_vector),
|
||||
SimpleListItem(
|
||||
2,
|
||||
com.simplemobiletools.commons.R.string.record_audio,
|
||||
com.simplemobiletools.commons.R.drawable.ic_microphone_vector,
|
||||
selected = true
|
||||
),
|
||||
SimpleListItem(4, com.simplemobiletools.commons.R.string.choose_contact, com.simplemobiletools.commons.R.drawable.ic_add_person_vector)
|
||||
)
|
||||
) {
|
||||
toast("Clicked ${it.id}")
|
||||
|
@ -63,6 +56,6 @@ class MainActivity : BaseSimpleActivity() {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupToolbar(main_toolbar)
|
||||
setupToolbar(binding.mainToolbar)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.simplemobiletools.commons.samples.activities
|
||||
|
||||
import android.view.Menu
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.*
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
|
@ -13,9 +11,8 @@ import com.simplemobiletools.commons.extensions.beVisibleIf
|
|||
import com.simplemobiletools.commons.interfaces.ItemMoveCallback
|
||||
import com.simplemobiletools.commons.interfaces.ItemTouchHelperContract
|
||||
import com.simplemobiletools.commons.interfaces.StartReorderDragListener
|
||||
import com.simplemobiletools.commons.samples.R
|
||||
import com.simplemobiletools.commons.samples.databinding.ListItemBinding
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import kotlinx.android.synthetic.main.list_item.view.*
|
||||
import java.util.*
|
||||
|
||||
class StringsAdapter(
|
||||
|
@ -39,7 +36,7 @@ class StringsAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
override fun getActionMenuId() = R.menu.cab_delete_only
|
||||
override fun getActionMenuId() = com.simplemobiletools.commons.R.menu.cab_delete_only
|
||||
|
||||
override fun prepareActionMode(menu: Menu) {}
|
||||
|
||||
|
@ -49,7 +46,7 @@ class StringsAdapter(
|
|||
}
|
||||
|
||||
when (id) {
|
||||
R.id.cab_delete -> changeOrder()
|
||||
com.simplemobiletools.commons.R.id.cab_delete -> changeOrder()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +58,7 @@ class StringsAdapter(
|
|||
|
||||
override fun getItemKeyPosition(key: Int) = strings.indexOfFirst { it.hashCode() == key }
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.list_item, parent)
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false).run { ViewHolder(root) }
|
||||
|
||||
override fun onActionModeCreated() {}
|
||||
|
||||
|
@ -76,7 +73,7 @@ class StringsAdapter(
|
|||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
||||
val item = strings[position]
|
||||
holder.bindView(item, true, true) { itemView, layoutPosition ->
|
||||
setupView(itemView, item, holder)
|
||||
setupView(ListItemBinding.bind(itemView), item, holder)
|
||||
}
|
||||
bindViewHolder(holder)
|
||||
}
|
||||
|
@ -88,16 +85,17 @@ class StringsAdapter(
|
|||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun setupView(view: View, string: String, holder: ViewHolder) {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun setupView(view: ListItemBinding, string: String, holder: ViewHolder) {
|
||||
val isSelected = selectedKeys.contains(string.hashCode())
|
||||
view.apply {
|
||||
item_frame.isSelected = isSelected
|
||||
item_name.text = string
|
||||
itemFrame.isSelected = isSelected
|
||||
itemName.text = string
|
||||
|
||||
drag_handle.beVisibleIf(isChangingOrder)
|
||||
dragHandle.beVisibleIf(isChangingOrder)
|
||||
|
||||
if (isChangingOrder) {
|
||||
drag_handle.setOnTouchListener { v, event ->
|
||||
dragHandle.setOnTouchListener { v, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
startReorderDragListener.requestDrag(holder)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue