50ButtonsEach / fliclib-android

Creative Commons Zero v1.0 Universal
33 stars 22 forks source link

Flic button click tone disable setting via fliclib API #23

Closed prashant-indexnine closed 6 years ago

prashant-indexnine commented 6 years ago

I am using flic in one of my application.

Every time I do click or double click there are notification sounds played. My application also has some tones so now two different tones getting played flic button click tone and my applications tone.

How this can be avoided, Do we have any settings in fliclib API to disable the button click tones?

Just for your information, I have followed steps mentioned here., Button grab and click event detection happen smoothly for now.

Emill commented 6 years ago

Please check out the grab exclusively functionality.

prashant-indexnine commented 6 years ago

@Emill, Any official link where I can get information about "grab exclusively" functionality?, Thanks for the response.

Emill commented 6 years ago

Sure. See the documentation at https://github.com/50ButtonsEach/fliclib-android/blob/ddfbfebfd5090bb2cc80a7e66c613134ffc4071a/fliclib/src/main/java/io/flic/lib/FlicButton.java#L146.

prashant-indexnine commented 6 years ago

Hey Emill,

Your suggestion worked after calling grabExclusivity() we need to define FlicButtonCallback of our application and add it using addFlicButtonCallback().

Then all the button click event callbacks are received directly to my application.

Now my code looks like below :

@Override
    public void onInitialized(FlicManager manager) {
        FlicButton button = manager.completeGrabButton(requestCode, resultCode, data);
        boolean flag = button.grabExclusivity();
        if (flag) {
            Log.v(TAG, "Grabbed flic with exclusivity");
        } else {
            Log.w(TAG, "Failed to grab flic with exclusivity");
        }
        button.addFlicButtonCallback(new MyFlicCallback());
    }

Hence closing the issue.

Thanks & Regards, _Prashant