-
-
Notifications
You must be signed in to change notification settings - Fork 26
Removed copy toast, replaced it with animation on the copy icon. #58
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
Removed copy toast, replaced it with animation on the copy icon. #58
Conversation
…icon showing that the field has been copied.
| Handler().postDelayed({ | ||
| animateImageChange(context, icon, R.drawable.ic_copy) | ||
| }, 1250) | ||
| /*val myToast = Toast.makeText(context, "Copied!", Toast.LENGTH_SHORT) |
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.
Maybe delete this commented code?
|
LGTM! @valeryhime Could you have a look, please? |
|
|
||
| view.findViewById<ConstraintLayout>(R.id.copy_block).setOnClickListener { | ||
| setClipboard(context, findViewById<TextView>(R.id.block_label).text.toString()) | ||
| setClipboard(context, findViewById<TextView>(R.id.block_label).text.toString(), it.findViewById<ImageView>(R.id.copy_icon)) |
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 now we need entire copyblock component in this method, and the call looks too long =) Maybe it'll be better just to send "it" here and get icon and text inside the setClipboard?
setClipboard(context, it)
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 possible to reuse textBlock here?
setClipboard(context, textBlock.text, it.findViewById(R.id.copy_icon))and change setClipboard signature to private fun setClipboard(context: Context, text: CharSequence, icon: ImageView)
| animateImageChange(context, icon, R.drawable.ic_done) | ||
| Handler().postDelayed({ | ||
| animateImageChange(context, icon, R.drawable.ic_copy) | ||
| }, 1250) |
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.
How do you feel about making it a bit faster? Maybe 1000?
|
Looks good 👍 Thank you ^_^ |
Change resolving #50 by removing toast and replacing it with an animation on the copy icon to show that the field has been copied.
Possible alternative could be checking android version to see if it's 12 or higher and displaying the toast depending on that. Decided against it because the "copied to clipboard" OS Toast can be disabled in settings by user.
App cannot disable OS Toast due to it being OS level and automatic.