-
Notifications
You must be signed in to change notification settings - Fork 200
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
Crop image to square #952
base: main
Are you sure you want to change the base?
Crop image to square #952
Conversation
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (other == null || this::class != other::class) return false | ||
|
||
other as ProfileImage | ||
|
||
return bytes.contentEquals(other.bytes) | ||
} | ||
|
||
override fun hashCode(): Int { | ||
return bytes.contentHashCode() | ||
} |
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.
It is necessary to resolve the warning.
|
||
@Composable | ||
internal fun cropImageScreenPresenter( | ||
onConfirm: () -> Unit, |
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.
It seems there are no arguments like this in other screens, but I added it because I wanted to transition after event processing.
(Is there another way to achieve this?)
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.
Thank you for asking this. I recommend using this pattern.
Line 73 in 04df9da
shouldGoToFavoriteList = true |
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.
Thanks! refactored at e9e04d2.
withContext(Dispatchers.Default) { | ||
croppedProfileImage = requireNotNull(profileImageCandidate).crop(event.rect) | ||
} |
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.
Because it can take time to process
This dispatcher might need to be injected...
val cardUiState: ProfileCardUiState.Card? by rememberUpdatedState(profileCard.toCardUiState()) | ||
var cardError by remember { mutableStateOf(ProfileCardError()) } | ||
var uiType: ProfileCardUiType by remember { mutableStateOf(ProfileCardUiType.Loading) } | ||
var uiType: ProfileCardUiType by rememberSaveable { mutableStateOf(ProfileCardUiType.Loading) } |
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.
To maintain the editing state when backing from CropImageScreen
val strokeOuterColor = MaterialTheme.colorScheme.onSurface | ||
val strokeInnerColor = MaterialTheme.colorScheme.surface |
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.
To ensure the border is not difficult to see if there are images with similar colors to surface/onSurface
@warahiko |
@takahirom
|
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
internal fun CropImageScreen( |
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.
It is vital to test this method as we don't want to rely on manual testing. Could you try creating it? I think it is sufficient to check the launch for the first time.
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.
Added at e22abae.
9b0728c
to
e22abae
Compare
Snapshot diff report
|
Thank you for sharing this. I also tried to solve the problem, but we haven't been able to resolve it so far. Although I mentioned creating a test, I think we might not have enough time to ship this by the DroidKaigi. 😭 We might have to solve the problem first |
Issue
#413
Overview (Required)
Links
Screenshot (Optional if screenshot test is present or unrelated to UI)
see videos
Movie (Optional)
android_before.mp4
android.mp4
for various images
various_images.mp4
in landscape screen
landscape.mp4
cropping in iOS (currently unavailable due to the above issue)
iOS_crop.mp4