Skip to content

Commit

Permalink
add colors to record quick actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Dec 1, 2024
1 parent 2618968 commit c7b1411
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.util.simpletimetracker.feature_dialogs.recordQuickActions.adapter

import androidx.annotation.ColorInt
import androidx.annotation.DrawableRes
import com.example.util.simpletimetracker.feature_base_adapter.ViewHolderType
import com.example.util.simpletimetracker.feature_base_adapter.createRecyclerBindingAdapterDelegate
Expand All @@ -20,6 +21,7 @@ fun createRecordQuickActionsButtonAdapterDelegate(

tvRecordQuickActionsButton.text = item.text
ivRecordQuickActionsButton.setImageResource(item.icon)
cardRecordQuickActionsButton.setCardBackgroundColor(item.iconColor)
btnRecordQuickActionsButton.setOnClickWith(item.block, onClick)
}
}
Expand All @@ -29,6 +31,7 @@ data class RecordQuickActionsButtonViewData(
override val width: Width = Width.Small,
val text: String,
@DrawableRes val icon: Int,
@ColorInt val iconColor: Int,
) : ViewHolderType,
RecordQuickActionsBlockHolder,
RecordQuickActionsWidthHolder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,37 @@ class RecordQuickActionsViewDataInteractor @Inject constructor(
block = RecordQuickActionsButton.CONTINUE,
text = R.string.change_record_continue.let(resourceRepo::getString),
icon = R.drawable.action_continue,
iconColor = resourceRepo.getColor(R.color.red_300),
),
RecordQuickActionsButtonViewData(
block = RecordQuickActionsButton.REPEAT,
text = R.string.change_record_repeat.let(resourceRepo::getString),
icon = R.drawable.repeat,
iconColor = resourceRepo.getColor(R.color.purple_300),
),
RecordQuickActionsButtonViewData(
block = RecordQuickActionsButton.DUPLICATE,
text = R.string.change_record_duplicate.let(resourceRepo::getString),
icon = R.drawable.action_copy,
iconColor = resourceRepo.getColor(R.color.indigo_300),
),
RecordQuickActionsButtonViewData(
block = RecordQuickActionsButton.MERGE,
text = R.string.change_record_merge.let(resourceRepo::getString),
icon = R.drawable.action_merge,
iconColor = resourceRepo.getColor(R.color.light_blue_300),
),
RecordQuickActionsButtonViewData(
block = RecordQuickActionsButton.STOP,
text = R.string.notification_record_type_stop.let(resourceRepo::getString),
icon = R.drawable.action_stop,
iconColor = resourceRepo.getColor(R.color.teal_300),
),
RecordQuickActionsButtonViewData(
block = RecordQuickActionsButton.CHANGE_ACTIVITY,
text = resourceRepo.getString(R.string.data_edit_change_activity),
icon = R.drawable.action_change_item,
iconColor = resourceRepo.getColor(R.color.green_300),
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,50 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/btnRecordQuickActionsButton"
style="@style/RecordQuickActionButton"
android:layout_width="match_parent">
style="@style/EditScreenControlButton"
android:layout_width="match_parent"
android:layout_height="68dp"
app:cardBackgroundColor="?appActiveColor">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="16dp">
android:layout_height="match_parent">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivRecordQuickActionsButton"
style="@style/RecordQuickActionButtonImage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintEnd_toStartOf="@id/tvRecordQuickActionsButton"
<androidx.cardview.widget.CardView
android:id="@+id/cardRecordQuickActionsButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="12dp"
android:foreground="?selectableItemBackground"
app:cardCornerRadius="8dp"
app:cardElevation="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="ContentDescription"
tools:src="@drawable/action_continue" />
app:layout_constraintTop_toTopOf="parent"
tools:backgroundTint="@color/purple_200">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivRecordQuickActionsButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dp"
android:scaleType="centerCrop"
android:tint="?appCardBackgroundColor"
tools:ignore="ContentDescription"
tools:src="@drawable/action_continue" />

</androidx.cardview.widget.CardView>

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvRecordQuickActionsButton"
style="@style/RecordQuickActionButtonText"
android:layout_width="wrap_content"
style="@style/EditScreenControlButtonText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginHorizontal="48dp"
android:textColor="?appLightTextColor"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivRecordQuickActionsButton"
app:layout_constraintStart_toStartOf="parent"
tools:text="Button text" />

</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
13 changes: 0 additions & 13 deletions features/feature_views/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -432,19 +432,6 @@
<item name="cornerSize">@dimen/button_corner_radius</item>
</style>

<style name="RecordQuickActionButton" parent="EditScreenControlButton">
<item name="android:layout_height">68dp</item>
<item name="cardBackgroundColor">?appActiveColor</item>
</style>

<style name="RecordQuickActionButtonImage" parent="EditScreenControlButtonImage">
<item name="android:tint">?appLightTextColor</item>
</style>

<style name="RecordQuickActionButtonText" parent="EditScreenControlButtonText">
<item name="android:textColor">?appLightTextColor</item>
</style>

<style name="AlertDialogRounded" parent="@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="shapeAppearanceOverlay">@style/AlertDialogCorners</item>
<item name="buttonBarNegativeButtonStyle">@style/AlertDialogButtonStyle</item>
Expand Down

0 comments on commit c7b1411

Please sign in to comment.