Skip to content
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

onCompltion Listener added #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MudssirAhmed
Copy link

Competition listener added.
I added this for some progress in UI, Developers will use this to show the progress.

Issue resolved: #54

@MudssirAhmed
Copy link
Author

MudssirAhmed commented Feb 5, 2023

@massoudss Issue resolved.

#54

@@ -0,0 +1,5 @@
package com.masoudss.lib

interface CompletionListener {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to rename this interface to DrawCompletionListener

@@ -248,6 +249,8 @@ open class WaveformSeekBar @JvmOverloads constructor(
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
sample?.let { waveSample ->
onCompletionListener?.onComplete()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this call to end of onDraw method.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@MudssirAhmed
Copy link
Author

Hey @massoudss, I pushed the changes

  1. The name of the listener changed.
  2. The position also changed.
@massoudss
Copy link
Owner

Another point is the listener inside onDraw method will be called hundreds of times. Is it OK for your purpose?

@MudssirAhmed
Copy link
Author

No!
We have to set it only once.

@massoudss
Copy link
Owner

massoudss commented Feb 7, 2023

So we have to find another way.
A general way to determinate view is drawn is using post method.
wavefrom.post( new Runnable() { @Override public void run() { // your code here } });

@MudssirAhmed
Copy link
Author

Let me test and finalize it.
Thanks!

@MudssirAhmed
Copy link
Author

So we have to find another way. A general way to determinate view is drawn is using post method. wavefrom.post( new Runnable() { @Override public void run() { // your code here } });

I test this but it neither gives the result we want. Now I add a flag to indicate whether onComplete is called or not.

@MudssirAhmed
Copy link
Author

Hey, @massoudss is the code safe for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants