Skip to content

Instantly share code, notes, and snippets.

@kevalpatel2106
Last active November 24, 2016 06:09
Show Gist options
  • Save kevalpatel2106/924b1b95aac4fe8ecb9ed92def5f6c48 to your computer and use it in GitHub Desktop.
Save kevalpatel2106/924b1b95aac4fe8ecb9ed92def5f6c48 to your computer and use it in GitHub Desktop.
case MotionEvent.ACTION_UP:
int Xdiff = (int) (event.getRawX() - initialTouchX);
int Ydiff = (int) (event.getRawY() - initialTouchY);
//The check for Xdiff <10 && YDiff< 10 because sometime elements moves a little while clicking.
//So that is click event.
if (Xdiff < 10 && Ydiff < 10) {
if (isViewCollapsed()) {
//When user clicks on the image view of the collapsed layout,
//visibility of the collapsed layout will be changed to "View.GONE"
//and expanded view will become visible.
collapsedView.setVisibility(View.GONE);
expandedView.setVisibility(View.VISIBLE);
}
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment