Skip to content

Commit

Permalink
debug中
Browse files Browse the repository at this point in the history
  • Loading branch information
huxq17 committed May 27, 2016
1 parent 410f7bd commit 192e1bd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ dependencies {
compile 'com.android.support:cardview-v7:23.0.1'
compile 'io.realm:realm-android:0.81.1'
compile 'org.jsoup:jsoup:1.8.2'
compile 'com.huxq17.android:SwipeCardsView:1.0.0'
// compile 'com.huxq17.android:SwipeCardsView:1.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
// compile project(':library')
compile project(':library')
compile project(':okhttp')
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.huxq17.example.R;
import com.huxq17.example.bean.ContentBean;
import com.huxq17.swipecardsview.BaseCardAdapter;
import com.huxq17.swipecardsview.LogUtil;
import com.squareup.picasso.Picasso;

import java.util.List;
Expand Down Expand Up @@ -43,6 +44,7 @@ public void onBindData(int position, View cardview) {
if (datas == null || datas.size() == 0) {
return;
}
LogUtil.d("onBindData position="+position);
ImageView imageView = (ImageView) cardview.findViewById(R.id.iv_meizi);
ContentBean meizi = datas.get(position);
String url = meizi.getUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.view.View;
import android.view.ViewGroup;

import com.andbase.tractor.utils.LogUtils;
import com.huxq17.example.MainActivity;
import com.huxq17.example.R;
import com.huxq17.example.adapter.MeiziAdapter;
Expand Down Expand Up @@ -81,7 +80,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
@Override
public void onShow(int index) {
curIndex = index;
LogUtils.i("test showing index = " + index);
// LogUtils.i("test showing index = " + index);
}

@Override
Expand Down
29 changes: 19 additions & 10 deletions library/src/main/java/com/huxq17/swipecardsview/SwipeCardsView.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public void onClick(View view) {
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
mMaxVelocity = ViewConfiguration.get(getContext()).getScaledMaximumFlingVelocity();
mMinVelocity = ViewConfiguration.get(getContext()).getScaledMinimumFlingVelocity();

}

/**
Expand Down Expand Up @@ -133,8 +132,10 @@ private void bindCardData(int position, View cardview) {
*/
public void notifyDatasetChanged(int index) {
if (canResetView()) {
LogUtil.d("test notifyDatasetChanged canResetView="+index);
refreshUI(index);
} else {
LogUtil.d("test notifyDatasetChanged can not Reset View="+index);
mWaitRefresh = true;
tempShowingIndex = index;
}
Expand Down Expand Up @@ -281,10 +282,12 @@ public boolean dispatchTouchEventSupper(MotionEvent e) {
}

private void releaseTopView(float xvel, float yvel) {
View TopView = getTopView();
if (TopView != null) {
onTopViewReleased(TopView, xvel, yvel);
}
View topView = getTopView();
LogUtil.i("test start releaseTopView topView="+topView);
if (topView != null) {
onTopViewReleased(topView, xvel, yvel);
} LogUtil.i("test end releaseTopView topView="+topView);

}

/**
Expand Down Expand Up @@ -402,7 +405,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (hasTouchTopView) {
if (hasTouchTopView||mScroller.computeScrollOffset()) {
return;
}
int size = viewList.size();
Expand All @@ -417,6 +420,8 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
initLeft = viewList.get(0).getLeft();
initTop = viewList.get(0).getTop();
mCardWidth = viewList.get(0).getMeasuredWidth();
View topView = getTopView();
LogUtil.i("test onLayout initLeft="+initLeft+"; topView="+topView);
}

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
Expand Down Expand Up @@ -474,6 +479,7 @@ private void layoutChild(View child, int index) {

@Override
public void computeScroll() {
LogUtil.d("test computeScroll mScroller.computeScrollOffset()="+mScroller.computeScrollOffset());
if (mScroller.computeScrollOffset()) {
View topView = getTopView();
if (topView == null) {
Expand Down Expand Up @@ -522,10 +528,11 @@ private void resetViewGroup() {
}
} else {
View changedView = releasedViewList.get(0);
// if (changedView.getLeft() == initLeft) {
// releasedViewList.remove(0);
// return;
// }
if (changedView.getLeft() == initLeft) {
LogUtil.i("test changedView="+changedView+";changedView.getLeft() == initLeft left="+initLeft+";scalex="+changedView.getScaleX());
releasedViewList.remove(0);
return;
}
int viewSize = viewList.size();
removeViewInLayout(changedView);
addViewInLayout(changedView, 0, changedView.getLayoutParams(), true);
Expand Down Expand Up @@ -622,10 +629,12 @@ private void onTopViewReleased(View changedView, float xvel, float yvel) {
finalX = mWidth;
finalY = dy * (mCardWidth + initLeft) / dx + initTop;
flyType = SlideType.RIGHT;
LogUtil.i("test 向右边滑出");
} else if (dx < -X_DISTANCE_THRESHOLD || (xvel < -X_VEL_THRESHOLD && dx < 0)) {//向左边滑出
finalX = -mCardWidth;
finalY = dy * (mCardWidth + initLeft) / (-dx) + dy + initTop;
flyType = SlideType.LEFT;
LogUtil.i("test 向左边滑出");
}

if (finalY > mHeight) {
Expand Down

0 comments on commit 192e1bd

Please sign in to comment.