Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Not available the setOnProgressListener #11

Closed
abbasnaqdi opened this issue Feb 18, 2018 · 7 comments
Closed

Not available the setOnProgressListener #11

abbasnaqdi opened this issue Feb 18, 2018 · 7 comments

Comments

@abbasnaqdi
Copy link

Hi, thank you for your good library.
I'm having a problem, I added AudioWaveView and working properly, but unfortunately, setOnProgressListener is not found for me.

In fact, this interface does not exist. Please check and correct. Thank .

@alxrm
Copy link
Owner

alxrm commented Feb 18, 2018

Hey @okabbas, thanks for your reply, let me please check if the sample activity still works.

Whilst you may want to try to Clean+Build, if you haven't tried it yet, and check whether the issue persists or not.

@abbasnaqdi
Copy link
Author

Hello . The sample project does not work for me.
I also did the Clean + ReBuild operation, but still the problem is going wrong and I get the error below.

Error:(145, 37) Unresolved reference: setOnProgressListener

my code

        holder.itemView.wave_voice.setOnProgressListener(object : OnProgressListener {
            override fun onStartTracking(progress: Float) {
                //
            }
            override fun onStopTracking(progress: Float) {
                //
            }
            override fun onProgressChanged(progress: Float, byUser: Boolean) {
                //
            }
        });

        Observable.fromCallable {
            filebyte = getFileByte(context, voice.file)
        }.observeOn(Schedulers.newThread()).subscribeOn(AndroidSchedulers.mainThread())
                .subscribe {
                    holder.itemView.wave_voice.setRawData(filebyte)
                    holder.itemView.wave_voice.scaledData = filebyte
                }

I checked your code and found that the setOnProgressListener interface did not exist at all.

@alxrm
Copy link
Owner

alxrm commented Feb 18, 2018

@okabbas woah, that's really odd, since the repository shows it's presence, give me just a bit more time, I need to update the dependencies, since I haven't touched this in a while

@alxrm
Copy link
Owner

alxrm commented Feb 18, 2018

@okabbas you're trying to use Java API here, you see, with kotlin you need to use properties like this:

    wave.onProgressListener = object : OnProgressListener {
      override fun onProgressChanged(progress: Float, byUser: Boolean) {
        TODO()
      }

      override fun onStartTracking(progress: Float) {
        TODO()
      }

      override fun onStopTracking(progress: Float) {
        TODO()
      }
    }

@alxrm
Copy link
Owner

alxrm commented Feb 18, 2018

@okabbas or there are some properties for your convenience, check those out:

    wave.onStopTracking = {
      Log.e("wave", "Progress set: $it")
    }
    
    wave.onStartTracking = {
      Log.e("wave", "Started tracking from: $it")
    }

    wave.onProgressChanged = {progress, byUser ->
      Log.e("wave", "Progress set: $progress, and it's $byUser that user did this")
    }

@abbasnaqdi
Copy link
Author

Oh my God :) It did
I did not know that. Thank you so much
Please add this code in readme file For people who might make me wrong.
Thanks for your quick response and good support

@alxrm
Copy link
Owner

alxrm commented Feb 18, 2018

@okabbas glad to help, and I'm closing this issue since the problem's solved. Gonna update the readme in a few minutes.

@alxrm alxrm closed this as completed Feb 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants