-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/421 add color customisations for crop image activity #422
Feature/421 add color customisations for crop image activity #422
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! just some small details ^^
/** Crop Image background color **/ | ||
@JvmField | ||
var activityBackgroundColor: Int = -1 | ||
|
||
/** Toolbar color **/ | ||
@JvmField | ||
var toolbarColor: Int = -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a default value, so we can avoid the logic to check -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is if we add a default value it's going to ignore the color taken from styles. Like Primary Color will always be ignored. For toolbar at least. Would that be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally valid point.
Can we get these values here? as default? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked this.
We can set default Color WHITE to activity background.
But for toolbar I'm not sure how to fetch the primaryColor from the app themes file.
I found 2 solutions here.
Solution 1
Solution 2
Unfortunately they both require context
which is not available in CropImageOptions
.
I also tried Resources.getSystem().getColor()
method. It has 2 parameters. The first one takes only an id of a color we have defined. So we cannot fetch the colorPrimary
attribute using this.
We could also manually set the toolbar color to the primary color stated in the themes file which is currently purpleDark
but if in the future this attribute is updated in the themes file it might not be updated for the toolbar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will let you decide what makes more sense here. Any solution is good for me
just think about what is easy for our users and for maintenance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok to keep a default value of -1 only for toolbar here? I can't think of any other option that can fetch the primaryColor from the theme file.
So if they don't set the toolbar color it will use the default primary color set in the theme file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
One more, we need to add the features here https://github.com/CanHub/Android-Image-Cropper/blob/main/.documentation/features.md |
Alright I'll update that too |
Updated features.md
I noticed the background suddenly being white. I had to set it to transparent to get the original theme color back. Why not setting it to transparent by default? |
Add the issue linked to this PR
close #421
New Feature
Description:
Added options to customize toolbar color and activity background color of CropImageActivity
Check list for the Code Reviewer:
@Canato I'm a bit rusty with the code. let me know if I need to do anything