Skip to content

Commit

Permalink
bug fix onClickListener 2
Browse files Browse the repository at this point in the history
  • Loading branch information
rasoulmiri committed Sep 6, 2017
1 parent 3b53b5f commit d291cc3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void init(Context context, @Nullable AttributeSet attrs) {

skeletonAttribute.setShowSkeleton(typedArray.getBoolean(R.styleable.Skeleton_SK_isShowSkeleton, true));
skeletonAttribute.setAutoStartAnimation(typedArray.getBoolean(R.styleable.Skeleton_SK_autoStartAnimation, true));
skeletonAttribute.setHoldTouchEventsFromChildren(typedArray.getBoolean(R.styleable.Skeleton_SK_isHoldTouchEventsFromChildren, true));
skeletonAttribute.setHoldTouchEventsFromChildren(typedArray.getBoolean(R.styleable.Skeleton_SK_isHoldTouchEventsFromChildren, false));
skeletonAttribute.setColorBackgroundMain(typedArray.getColor(R.styleable.Skeleton_SK_backgroundMainColor, SkeletonAttribute.DEFAULT_COLOR_BACKGROUND_MAIN));
skeletonAttribute.setColorHighLight(typedArray.getColor(R.styleable.Skeleton_SK_highLightColor, SkeletonAttribute.DEFAULT_COLOR_HIGHLIGHT_GRADIENT));
skeletonAttribute.setColorBackgroundViews(typedArray.getColor(R.styleable.Skeleton_SK_BackgroundViewsColor, SkeletonAttribute.DEFAULT_COLOR_BACKGROUND_VIEWS));
Expand Down
11 changes: 3 additions & 8 deletions library/src/main/java/io/rmiri/skeleton/SkeletonGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);

CLog.i("SkeletonGroup onLayout " + position);
//add all children extend from SkeletonGradient
//add all children extend from SkeletonView
if (skeletonAttributesChildren == null && skeletonAttribute.isShowSkeleton()) {
CLog.i("SkeletonGroup onLayout and skeletonAttributesChildren == null ... " + position);
skeletonAttributesChildren = new ArrayList<>();
Expand Down Expand Up @@ -427,8 +427,9 @@ private void setupInitialAnimation() {
if (skeletonAttributesChildren != null && skeletonAttributesChildren.size() > 0) {
isCanDraw = true;
isAnimationPlay = true;
setHoldTouchEventsFromChildren(true); // enable Hold touchEvents from this and children
} else {
// skeletonGroup no child extend from skeletonGradient
// skeletonGroup no child extend from skeletonView
return;
}

Expand Down Expand Up @@ -526,7 +527,6 @@ private void setupFinishingAnimation() {
isLastLoopAnimation = false;
isCanDrawFinishState = false;

skeletonAttribute.setHoldTouchEventsFromChildren(false);

//remove animation listener
valueAnimator.removeAllListeners();
Expand All @@ -536,11 +536,6 @@ private void setupFinishingAnimation() {

// disable Hold touchEvents from this and children
setHoldTouchEventsFromChildren(false);
for (View child : getAllChildren(getChildAt(0))) {
if (child != null && child instanceof SkeletonView) {
((SkeletonView) child).setHoldTouchEventsFromChildren(false);
}
}

//fire finish state for listener
if (skeletonListener != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void onBindViewHolder(ViewHolder holder, int position) {

holder.cardView.setPreventCornerOverlap(false);

// holder.skeletonGroup.setPosition(position);//just for debug log
holder.skeletonGroup.setPosition(position);//just for debug log

if (skeletonDetail.isSkeletonIsOn()) {
//need show s for 2 cards
Expand All @@ -104,6 +104,31 @@ public void onBindViewHolder(ViewHolder holder, int position) {
//set photo by Picasso lib
Picasso.with(context).load(cardObj.getPhoto()).into(holder.photoACImgV);


// holder.addToParkingImgBtn.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Log.i("setOnClickListener", "addToParkingImgBtn");
// }
// });
// holder.compareImgBtn.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Log.i("setOnClickListener", "compareImgBtn");
// }
// });
// holder.cardView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Log.i("setOnClickListener", "cardView");
// }
// }); holder.titleTv.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Log.i("setOnClickListener", "titleTv");
// }
// });

}

@Override
Expand Down

0 comments on commit d291cc3

Please sign in to comment.