@@ -953,20 +953,39 @@ private void bindViewClickListener(final BaseViewHolder baseViewHolder) {
953
953
view .setOnClickListener (new View .OnClickListener () {
954
954
@ Override
955
955
public void onClick (View v ) {
956
- getOnItemClickListener (). onItemClick ( BaseQuickAdapter . this , v , baseViewHolder .getLayoutPosition () - getHeaderLayoutCount ());
956
+ setOnItemClick ( v , baseViewHolder .getLayoutPosition () - getHeaderLayoutCount ());
957
957
}
958
958
});
959
959
}
960
960
if (getOnItemLongClickListener () != null ) {
961
961
view .setOnLongClickListener (new View .OnLongClickListener () {
962
962
@ Override
963
963
public boolean onLongClick (View v ) {
964
- return getOnItemLongClickListener (). onItemLongClick ( BaseQuickAdapter . this , v , baseViewHolder .getLayoutPosition () - getHeaderLayoutCount ());
964
+ return setOnItemLongClick ( v , baseViewHolder .getLayoutPosition () - getHeaderLayoutCount ());
965
965
}
966
966
});
967
967
}
968
968
}
969
969
970
+ /**
971
+ * override this method if you want to override click event logic
972
+ * @param v
973
+ * @param position
974
+ */
975
+ public void setOnItemClick (View v , int position ) {
976
+ getOnItemClickListener ().onItemClick (BaseQuickAdapter .this , v , position );
977
+ }
978
+
979
+ /**
980
+ * override this method if you want to override longClick event logic
981
+ * @param v
982
+ * @param position
983
+ * @return
984
+ */
985
+ public boolean setOnItemLongClick (View v , int position ) {
986
+ return getOnItemLongClickListener ().onItemLongClick (BaseQuickAdapter .this , v , position );
987
+ }
988
+
970
989
private MultiTypeDelegate <T > mMultiTypeDelegate ;
971
990
972
991
public void setMultiTypeDelegate (MultiTypeDelegate <T > multiTypeDelegate ) {
@@ -1687,7 +1706,7 @@ public int expandAll(int position, boolean animate, boolean notify) {
1687
1706
return 0 ;
1688
1707
}
1689
1708
1690
- if (!hasSubItems (expandable )){
1709
+ if (!hasSubItems (expandable )) {
1691
1710
expandable .setExpanded (true );
1692
1711
notifyItemChanged (position );
1693
1712
return 0 ;
@@ -1744,7 +1763,7 @@ private int recursiveCollapse(@IntRange(from = 0) int position) {
1744
1763
int subItemCount = 0 ;
1745
1764
if (expandable .isExpanded ()) {
1746
1765
List <T > subItems = expandable .getSubItems ();
1747
- if (null == subItems ) return 0 ;
1766
+ if (null == subItems ) return 0 ;
1748
1767
1749
1768
for (int i = subItems .size () - 1 ; i >= 0 ; i --) {
1750
1769
T subItem = subItems .get (i );
0 commit comments