Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. /**
  2. * class for handling spannable text click
  3. */
  4. private class PrivacyClickableSpan extends ClickableSpan {
  5.  
  6. static final int TYPE_TERMS_SPAN = 1;
  7. static final int TYPE_PRIVACY_SPAN = 2;
  8. static final int TYPE_END = 3; //Need for fixing issue with click below first line span
  9. private int type;
  10.  
  11. PrivacyClickableSpan(int type) {
  12. this.type = type;
  13. }
  14.  
  15. @Override
  16. public void onClick(View widget) {
  17. switch (type) {
  18. case TYPE_PRIVACY_SPAN: {
  19. signUpPresenter.showPrivacyPolicy();
  20. }
  21. break;
  22. case TYPE_TERMS_SPAN: {
  23. signUpPresenter.showTermsOfUse();
  24. }
  25. break;
  26. default:
  27. break;
  28. }
  29. }
  30.  
  31. @Override
  32. public void updateDrawState(TextPaint ds) {
  33. super.updateDrawState(ds);
  34. if (type != TYPE_END) {
  35. ds.setColor(ContextCompat.getColor(SignUpActivity.this, R.color.color_grey_959595));
  36. } else {
  37. ds.setColor(ContextCompat.getColor(SignUpActivity.this, android.R.color.transparent));
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement