Skip to content

Commit

Permalink
Add color property
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuwu committed Dec 7, 2024
1 parent 55f59ff commit fd93371
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ import timber.log.Timber
import java.util.Stack
import kotlin.system.measureTimeMillis

class EditManager {
class ArkColorPalette(
val primary: Color
)
class EditManager(
val colorProperties: ArkColorPalette = ArkColorPalette(primary = Color.Green)
) {
private val drawPaint: MutableState<Paint> = mutableStateOf(defaultPaint())

private val _paintColor: MutableState<Color> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private fun Menus(
},
imageVector = ImageVector
.vectorResource(R.drawable.ic_rotate_left),
tint = MaterialTheme.colors.primary,
tint = viewModel.editManager.colorProperties.primary,
contentDescription = null
)
Icon(
Expand All @@ -217,7 +217,7 @@ private fun Menus(
},
imageVector = ImageVector
.vectorResource(R.drawable.ic_rotate_right),
tint = MaterialTheme.colors.primary,
tint = viewModel.editManager.colorProperties.primary,
contentDescription = null
)
}
Expand Down Expand Up @@ -350,7 +350,7 @@ private fun BoxScope.TopMenu(
}
},
imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_back),
tint = MaterialTheme.colors.primary,
tint = viewModel.editManager.colorProperties.primary,
contentDescription = null
)

Expand All @@ -373,7 +373,7 @@ private fun BoxScope.TopMenu(
imageVector = if (viewModel.editManager.shouldApplyOperation())
ImageVector.vectorResource(R.drawable.ic_check)
else ImageVector.vectorResource(R.drawable.ic_more_vert),
tint = MaterialTheme.colors.primary,
tint = viewModel.editManager.colorProperties.primary,
contentDescription = null
)
}
Expand Down Expand Up @@ -511,7 +511,7 @@ private fun EditMenuContent(
imageVector = ImageVector.vectorResource(R.drawable.ic_undo),
tint = if (
editManager.canUndo.value && (editManager.isEligibleForUndoOrRedo())
) MaterialTheme.colors.primary else Color.Black,
) viewModel.editManager.colorProperties.primary else Color.Black,
contentDescription = null
)
Icon(
Expand All @@ -526,7 +526,7 @@ private fun EditMenuContent(
tint = if (
editManager.canRedo.value &&
(editManager.isEligibleForUndoOrRedo())
) MaterialTheme.colors.primary else Color.Black,
) viewModel.editManager.colorProperties.primary else Color.Black,
contentDescription = null
)
Box(
Expand Down Expand Up @@ -585,7 +585,7 @@ private fun EditMenuContent(
tint = if (
editManager.isEraseMode.value
)
MaterialTheme.colors.primary
viewModel.editManager.colorProperties.primary
else
Color.Black,
contentDescription = null
Expand All @@ -602,7 +602,7 @@ private fun EditMenuContent(
tint = if (
editManager.isZoomMode.value
)
MaterialTheme.colors.primary
viewModel.editManager.colorProperties.primary
else
Color.Black,
contentDescription = null
Expand All @@ -619,7 +619,7 @@ private fun EditMenuContent(
tint = if (
editManager.isPanMode.value
)
MaterialTheme.colors.primary
viewModel.editManager.colorProperties.primary
else
Color.Black,
contentDescription = null
Expand All @@ -637,7 +637,7 @@ private fun EditMenuContent(
imageVector = ImageVector.vectorResource(R.drawable.ic_crop),
tint = if (
editManager.isCropMode.value
) MaterialTheme.colors.primary
) viewModel.editManager.colorProperties.primary
else
Color.Black,
contentDescription = null
Expand All @@ -655,7 +655,7 @@ private fun EditMenuContent(
imageVector = ImageVector
.vectorResource(R.drawable.ic_rotate_90_degrees_ccw),
tint = if (editManager.isRotateMode.value)
MaterialTheme.colors.primary
viewModel.editManager.colorProperties.primary
else
Color.Black,
contentDescription = null
Expand All @@ -672,7 +672,7 @@ private fun EditMenuContent(
imageVector = ImageVector
.vectorResource(R.drawable.ic_aspect_ratio),
tint = if (editManager.isResizeMode.value)
MaterialTheme.colors.primary
viewModel.editManager.colorProperties.primary
else
Color.Black,
contentDescription = null
Expand All @@ -688,7 +688,7 @@ private fun EditMenuContent(
imageVector = ImageVector
.vectorResource(R.drawable.ic_blur_on),
tint = if (editManager.isBlurMode.value)
MaterialTheme.colors.primary
editManager.colorProperties.primary
else
Color.Black,
contentDescription = null
Expand Down

0 comments on commit fd93371

Please sign in to comment.