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

OnClick behaviour not working #8

Open
Thomas-Vos opened this issue Jul 25, 2017 · 0 comments
Open

OnClick behaviour not working #8

Thomas-Vos opened this issue Jul 25, 2017 · 0 comments

Comments

@Thomas-Vos
Copy link
Contributor

The new click behaviour will come in very handy for me. Unfortunately, I cannot get it working for my knob configuration. Here is the Knob style I'm using:

<style name="KnobStyle">
    <item name="kNumberOfStates">21</item>
    <item name="kSwipe">circular</item>
    <item name="kMinAngle">-120</item>
    <item name="kMaxAngle">120</item>
    <item name="kKnobColor">?attr/colorAccent</item>
    <item name="kKnobRelativeRadius">0.75</item>
    <item name="kKnobCenterRelativeRadius">0.75</item>
    <item name="kIndicatorRelativeLength">0.35</item>
    <item name="kStateMarkersAccentWidth">2dp</item>
    <item name="kStateMarkersWidth">2dp</item>
    <item name="kFreeRotation">false</item>
    <item name="kBorderWidth">0dp</item>
    <item name="kStateMarkersAccentPeriodicity">5</item>
    <item name="kStateMarkersAccentColor">?android:attr/textColorPrimary</item>
    <item name="kSelectedStateMarkerContinuous">true</item>
    <item name="kSelectedStateMarkerColor">?attr/colorAccent</item>
    <item name="kStateMarkersColor">?android:attr/textColorSecondary</item>
    <item name="kClickBehaviour">user</item>
</style>

Here is the Java code:

knob.setUserBehaviour(new Runnable() {
    @Override
    public void run() {
        Toast.makeText(getContext(), "Knob clicked!", Toast.LENGTH_SHORT).show();
    }
});

The Toast message does not show when I click the Knob. If I change kSwipe to horizontal it does work, but I really want to keep it on circular. Any suggestions?

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

No branches or pull requests

1 participant