vikramkakkar / SublimePicker

A material-styled android view that provisions picking of a date, time & recurrence option, all from a single user-interface.
Apache License 2.0
2.31k stars 407 forks source link

onTouchListener Not Working #18

Closed Teja-Konjeti closed 8 years ago

Teja-Konjeti commented 8 years ago

@vikramkakkar Using setOntouchListener on SubLimePicker Class.

vikramkakkar commented 8 years ago

Could you please provide more information about what isn't working. Can you also include:

Teja-Konjeti commented 8 years ago

@vikramkakkar I'm using the picker in nested Scroll View nd can't scroll when scrolling in the white area in radial time picker.

Teja-Konjeti commented 8 years ago

Can you guide me on how to do that

Teja-Konjeti commented 8 years ago

nd onTouch is not even called. I thought of passing the event to Nested Scroll View.

vikramkakkar commented 8 years ago

RadialTimePickerView sets its own OnTouchListener: Link

And it captures all touch events by returing true: Link

To solve your problem, RadialTimePickerView's onTouch(MotionEvent) will have to conditionally return false. The condition will be this:

private int getDegreesFromXY(float x, float y) { // defined in `RadialTimePickerView`
    final double hypotenuse = Math.sqrt(
            (y - mYCenter) * (y - mYCenter) + (x - mXCenter) * (x - mXCenter));

    // Basic check if we're outside the range of the disk
    if (hypotenuse > mCircleRadius[HOURS]) {

        // If we are outside the range of the disk && action == MotionEvent.ACTION_DOWN,
        // return `false` from `onTouch(MotionEvent)`.
        return -1;
    }
    ....
    ....
}

This may just be the beginning of a solution, and additional changes may be required. But, you can definitely give it a try.

Teja-Konjeti commented 8 years ago

@vikramkakkar I tried it before raising the issue itself. Making it return false in each and every case also wouldn't help. Plz Reply ASAP.