Skip to content

Commit

Permalink
refactor: Change values() to entries after kotlin 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Jan 3, 2024
1 parent d7c46a4 commit a4c54e3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Core
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ItemSettingView @JvmOverloads constructor(
init {
attrs?.getAttributes(context, R.styleable.ItemSettingView) {
with(binding) {
action = Action.values()[getInteger(R.styleable.ItemSettingView_itemAction, 0)]
action = Action.entries[getInteger(R.styleable.ItemSettingView_itemAction, 0)]

title.text = getString(R.styleable.ItemSettingView_title) ?: ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class AiPropositionFragment : Fragment() {
}

private fun onMenuItemClicked(menuItemId: Int) = with(aiViewModel) {
val shortcut = Shortcut.values().find { it.menuId == menuItemId }!!
val shortcut = Shortcut.entries.find { it.menuId == menuItemId }!!
trackAiWriterEvent(shortcut.matomoValue)

if (shortcut == Shortcut.MODIFY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AttachmentDetailsView @JvmOverloads constructor(

init {
attrs?.getAttributes(context, R.styleable.AttachmentDetailsView) {
val displayStyle = DisplayStyle.values()[getInteger(R.styleable.AttachmentDetailsView_displayStyle, 0)]
val displayStyle = DisplayStyle.entries[getInteger(R.styleable.AttachmentDetailsView_displayStyle, 0)]
val iconSize = context.resources.getDimension(displayStyle.iconSize).toInt()
val marginSize = context.resources.getDimension(displayStyle.marginSize).toInt()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ sealed class DecoratedItemView @JvmOverloads constructor(
init {
attrs?.getAttributes(context, R.styleable.DecoratedItemView) {
icon = getDrawable(R.styleable.DecoratedItemView_icon)
itemStyle = SelectionStyle.values()[getInteger(R.styleable.DecoratedItemView_itemStyle, 0)]
itemStyle = SelectionStyle.entries[getInteger(R.styleable.DecoratedItemView_itemStyle, 0)]
maxLines = getInteger(R.styleable.DecoratedItemView_maxLines, maxLines)
text = getString(R.styleable.DecoratedItemView_text)
textWeight = TextWeight.values()[getInteger(R.styleable.DecoratedItemView_textWeight, 0)]
textWeight = TextWeight.entries[getInteger(R.styleable.DecoratedItemView_textWeight, 0)]
}
}

Expand Down

0 comments on commit a4c54e3

Please sign in to comment.