All Products
Search
Document Center

Operation bar component

Last Updated: May 25, 2021

AUCardOptionView is a combined view providing functions such as giving likes, commenting, and rewarding. It is inherited from AULinearLayout and support the XML layout.

Sample image

Dependency

See Quick start.

API description

 
  1. /**
  2. * Set the information for the entire view.
  3. * @param itemArrayList
  4. * @param textVisible
  5. */
  6. public void setViewInfo(ArrayList<CardOptionItem> itemArrayList, boolean textVisible)
  7. /**
  8. * Set the information for the entire view.
  9. * @param itemArrayList
  10. * @param textType = CardOptionView. TEXT_NOT_CHANGE will always display text without changing to numbers.
  11. */
  12. public void setViewInfo(ArrayList<CardOptionItem> itemArrayList, String textType)
  13. /**
  14. * Set the information for the entire view.
  15. * @param itemArrayList
  16. */
  17. public void setViewInfo(ArrayList<CardOptionItem> itemArrayList)
  18. /**
  19. * Set the information for the entire view.
  20. * @param itemArrayList
  21. * @param height
  22. * @param textVisible
  23. */
  24. public void setViewInfo(ArrayList<CardOptionItem> itemArrayList, int height, boolean textVisible)
  25. /**
  26. * Set the information for the entire view.
  27. * @param itemArrayList
  28. * @param height
  29. */
  30. public void setViewInfo(ArrayList<CardOptionItem> itemArrayList, int height)
  31. /**
  32. * Increase the sub view count.
  33. * @param childView
  34. */
  35. public void unitIncrease(View childView)
  36. /**
  37. * Decrease the sub view count.
  38. * @param childView
  39. */
  40. public void unitDecrease(View childView)
  41. /**
  42. * Obtain the count.
  43. * @param position
  44. * @return
  45. */
  46. public int getCount(int position)
  47. /**
  48. * Return type view.
  49. * @param type
  50. * @return
  51. */
  52. public View getChildView(String type)
  53. /**
  54. * Set listening.
  55. * @param cardOptionListner
  56. */
  57. public void setCardOptionListner(CardOptionClickListner cardOptionListner) {
  58. this.mListner = cardOptionListner;
  59. }

Custom properties

It is a common ViewGroup without new custom properties.

Code sample

 
  1. AUCardOptionView.CardOptionItem optionItem1 = new AUCardOptionView.CardOptionItem();
  2. optionItem1.type = AUCardOptionView.TYPE_PRAISE;
  3. optionItem1.hasClicked = false;
  4. AUCardOptionView.CardOptionItem optionItem2 = new AUCardOptionView.CardOptionItem();
  5. optionItem2.type = AUCardOptionView.TYPE_REWARD;
  6. optionItem2.hasClicked = false;
  7. AUCardOptionView.CardOptionItem optionItem3 = new AUCardOptionView.CardOptionItem();
  8. optionItem3.type = AUCardOptionView.TYPE_COMMENT;
  9. optionItem3.hasClicked = false;
  10. ArrayList<AUCardOptionView.CardOptionItem> optionItems = new ArrayList<AUCardOptionView.CardOptionItem>();
  11. optionItems.add(optionItem1);
  12. optionItems.add(optionItem2);
  13. optionItems.add(optionItem3);
  14. mAUCardOptionView.setViewInfo(optionItems,AUCardOptionView.TEXT_NOT_CHANGE);
  15. mAUCardOptionView.setCardOptionListner(new AUCardOptionView.CardOptionClickListner() {
  16. @Override
  17. public void onCardOptionClick(View v, AUCardOptionView.CardOptionItem optionItem, int position) {
  18. mAUCardOptionView.unitIncrease(v);
  19. }
  20. });