Skip to content

Commit

Permalink
Fix centering issue in dumb actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nain57 committed Aug 25, 2024
1 parent 9d30452 commit 528fc25
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.buzbuz.smartautoclicker.feature.dumb.config.ui.actions.copy
import android.content.Context

import androidx.annotation.DrawableRes
import androidx.recyclerview.widget.DiffUtil

import com.buzbuz.smartautoclicker.core.dumb.domain.model.DumbAction
import com.buzbuz.smartautoclicker.core.dumb.domain.model.Repeatable
Expand All @@ -42,20 +41,6 @@ data class DumbActionDetails (
val action: DumbAction,
)

/** DiffUtil Callback comparing two ActionItem when updating the [DumbActionListAdapter] list. */
object DumbActionDiffUtilCallback: DiffUtil.ItemCallback<DumbActionDetails>() {

override fun areItemsTheSame(
oldItem: DumbActionDetails,
newItem: DumbActionDetails,
): Boolean = oldItem.action.id == newItem.action.id

override fun areContentsTheSame(
oldItem: DumbActionDetails,
newItem: DumbActionDetails,
): Boolean = oldItem == newItem
}

/** @return the [DumbActionDetails] corresponding to this action. */
fun DumbAction.toDumbActionDetails(
context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ class DumbActionBriefViewHolder(
icon.setImageResource(details.icon)
name.text = details.name
duration.text = details.detailsText
repeat.text = details.repeatCountText

if (details.repeatCountText != null) {
repeat.text = details.repeatCountText
repeat.visibility = View.VISIBLE
} else {
repeat.visibility = View.GONE
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ class DumbScenarioBriefViewModel @Inject constructor(
.filter { !it.second }
.map { (action, _) -> action?.toBriefDescription() }

val canCopyAction: Flow<Boolean> = dumbEditionRepository.actionsToCopy
.map { it.isNotEmpty() }


fun startGestureCaptureState() {
briefVisualizationState.value = briefVisualizationState.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_card_dumb_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginHorizontal="@dimen/margin_horizontal_small"
android:layout_marginVertical="@dimen/margin_vertical_default">
Expand Down

0 comments on commit 528fc25

Please sign in to comment.