From 26f44c8592e722e73a3c5c6c0a66575d58e4d94a Mon Sep 17 00:00:00 2001 From: jwenchao Date: Sun, 26 Jun 2016 21:23:44 +0100 Subject: [PATCH] getTopView() --- .../main/java/com/wenchao/cardstack/CardStack.java | 13 ++++++------- .../cardstack/DefaultStackEventListener.java | 1 - DemoApp/build.gradle | 10 ---------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/CardStack/src/main/java/com/wenchao/cardstack/CardStack.java b/CardStack/src/main/java/com/wenchao/cardstack/CardStack.java index 66edcdf..ffd984d 100644 --- a/CardStack/src/main/java/com/wenchao/cardstack/CardStack.java +++ b/CardStack/src/main/java/com/wenchao/cardstack/CardStack.java @@ -26,9 +26,6 @@ public class CardStack extends RelativeLayout { private ArrayAdapter mAdapter; private OnTouchListener mOnTouchListener; private CardAnimator mCardAnimator; - //private Queue mIdleStack = new Queue; - - private CardEventListener mEventListener = new DefaultStackEventListener(300); private int mContentResource = 0; @@ -54,13 +51,11 @@ public void discardTop(final int direction){ public void onAnimationEnd(Animator arg0) { mCardAnimator.initLayout(); mIndex++; - mEventListener.discarded(mIndex, direction); - - //mIndex = mIndex%mAdapter.getCount(); loadLast(); viewCollection.get(0).setOnTouchListener(null); viewCollection.get(viewCollection.size() - 1).setOnTouchListener(mOnTouchListener); + mEventListener.discarded(mIndex - 1, direction); } }); } @@ -254,6 +249,10 @@ public ArrayAdapter getAdapter() { return mAdapter; } + public View getTopView() { + return ((ViewGroup) viewCollection.get(viewCollection.size() - 1)).getChildAt(0); + } + private void loadData(){ for(int i=mNumVisible-1 ; i>=0 ; i--) { ViewGroup parent = (ViewGroup) viewCollection.get(i); @@ -287,7 +286,7 @@ private void loadLast(){ return; } - View child = mAdapter.getView( lastIndex, getContentView(), parent); + View child = mAdapter.getView(lastIndex, getContentView(), parent); parent.removeAllViews(); parent.addView(child); } diff --git a/CardStack/src/main/java/com/wenchao/cardstack/DefaultStackEventListener.java b/CardStack/src/main/java/com/wenchao/cardstack/DefaultStackEventListener.java index 7bbf9cb..b4da3ff 100644 --- a/CardStack/src/main/java/com/wenchao/cardstack/DefaultStackEventListener.java +++ b/CardStack/src/main/java/com/wenchao/cardstack/DefaultStackEventListener.java @@ -15,7 +15,6 @@ public boolean swipeEnd(int section, float distance) { @Override public boolean swipeStart(int section, float distance) { - return false; } diff --git a/DemoApp/build.gradle b/DemoApp/build.gradle index 993a5d8..0559f54 100644 --- a/DemoApp/build.gradle +++ b/DemoApp/build.gradle @@ -1,11 +1,6 @@ apply plugin: 'com.android.application' android { - signingConfigs { - config { - storeFile file("debug.keystore") - } - } compileSdkVersion 23 buildToolsVersion '23.0.2' defaultConfig { @@ -16,11 +11,6 @@ android { versionName "1.0" } buildTypes { - debug { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'