Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
updated version
  • Loading branch information
shrewduser committed Jan 6, 2016
1 parent c2dcd34 commit d5bfe04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In your dependencies section add this parameter:

```groovy
dependencies {
compile 'com.daprlabs.aaron:cardstack:0.0.7'
compile 'com.daprlabs.aaron:cardstack:0.1.0'
}
```
Sync Gradle and import Swipe-Deck into your project
Expand Down Expand Up @@ -140,30 +140,33 @@ Now we simply give our card deck an adapter and perhaps a callback from our Acti
setContentView(R.layout.activity_swipe_deck);
cardStack = (SwipeDeck) findViewById(R.id.swipe_deck);

ArrayList<String> testData = new ArrayList<>();
final ArrayList<String> testData = new ArrayList<>();
testData.add("0");
testData.add("1");
testData.add("2");
testData.add("3");
testData.add("4");
testData.add("5");

SwipeDeckAdapter adapter = new SwipeDeckAdapter(testData, this);
final SwipeDeckAdapter adapter = new SwipeDeckAdapter(testData, this);
cardStack.setAdapter(adapter);

cardStack.setEventCallback(new SwipeDeck.SwipeEventCallback() {
@Override
public void cardSwipedLeft() {
Log.i("MainActivity", "card was swiped left");
public void cardSwipedLeft(int position) {
Log.i("MainActivity", "card was swiped left, position in adapter: " + position);
}

@Override
public void cardSwipedRight() {
Log.i("MainActivity", "card was swiped right");
public void cardSwipedRight(int position) {
Log.i("MainActivity", "card was swiped right, position in adapter: " + position);
}

@Override
public void cardClicked() {
Log.i("MainActivity", "card was clicked");
public void cardClicked(int position) {
Log.i("MainActivity", "card was clicked, position in adapter: " + position);
//example of how to get the item that was clicked / swiped / etc
String item = (String)adapter.getItem(position);
Log.i("MainActivity", item);
}

@Override
Expand All @@ -172,7 +175,6 @@ Now we simply give our card deck an adapter and perhaps a callback from our Acti
}
});

}
```

# Deck XML Attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public void cardSwipedRight(int position) {
public void cardClicked(int position) {
Log.i("MainActivity", "card was clicked, position in adapter: " + position);
//example of how to get the item that was clicked / swiped / etc
Log.i("MainActivity", (String)adapter.getItem(position));
String item = (String)adapter.getItem(position);
Log.i("MainActivity", item);
}

@Override
Expand Down

0 comments on commit d5bfe04

Please sign in to comment.