Skip to content

Conversation

@rorokamari
Copy link
Contributor

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.

…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)
Copy link
Member

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?

@ortex
Copy link
Member

ortex commented Feb 8, 2023

LGTM!
Thanks

@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))
Copy link
Contributor

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)

Copy link
Member

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)
Copy link
Contributor

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?

@valeryhime
Copy link
Contributor

Looks good 👍

Thank you ^_^

@ortex ortex merged commit 1797d91 into roc-streaming:main Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants