Skip to content

Commit

Permalink
getTopView()
Browse files Browse the repository at this point in the history
  • Loading branch information
jwenchao committed Jun 26, 2016
1 parent 8126f40 commit 26f44c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
13 changes: 6 additions & 7 deletions CardStack/src/main/java/com/wenchao/cardstack/CardStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public class CardStack extends RelativeLayout {
private ArrayAdapter<?> mAdapter;
private OnTouchListener mOnTouchListener;
private CardAnimator mCardAnimator;
//private Queue<View> mIdleStack = new Queue<View>;



private CardEventListener mEventListener = new DefaultStackEventListener(300);
private int mContentResource = 0;
Expand All @@ -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);
}
});
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public boolean swipeEnd(int section, float distance) {

@Override
public boolean swipeStart(int section, float distance) {

return false;
}

Expand Down
10 changes: 0 additions & 10 deletions DemoApp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
apply plugin: 'com.android.application'

android {
signingConfigs {
config {
storeFile file("debug.keystore")
}
}
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
Expand All @@ -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'
Expand Down

0 comments on commit 26f44c8

Please sign in to comment.