Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swipe deck compat #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Swipe-Deck

## VERSION SUPPORTS SDK 7+ highly experimental
This version is a rough draft for gingerbread (sdk 7 and above) support i probably won't work on it but if someone needs support for very old versions of android they could probably polish this up to a decent level. at this current stage it's more of a proof of concept.

## A Tinder style Swipeable deck view for Android

![Screenshot](https://fat.gfycat.com/PartialBitterHermitcrab.gif)
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {

defaultConfig {
applicationId "com.daprlabs.swipedeck"
minSdkVersion 14
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName "1.0"
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/daprlabs/swipedeck/SwipeDeckActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
import android.widget.Button;
import android.widget.ImageView;

import com.daprlabs.cardstack.SwipeDeck;
import com.daprlabs.cardstack.SwipeDeckCompat;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.List;

public class SwipeDeckActivity extends AppCompatActivity {

private SwipeDeck cardStack;
private SwipeDeckCompat cardStack;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_swipe_deck);
cardStack = (SwipeDeck) findViewById(R.id.swipe_deck);
cardStack = (SwipeDeckCompat) findViewById(R.id.swipe_deck);

final ArrayList<String> testData = new ArrayList<>();
testData.add("0");
Expand All @@ -39,7 +39,7 @@ protected void onCreate(Bundle savedInstanceState) {
final SwipeDeckAdapter adapter = new SwipeDeckAdapter(testData, this);
cardStack.setAdapter(adapter);

cardStack.setEventCallback(new SwipeDeck.SwipeEventCallback() {
cardStack.setEventCallback(new SwipeDeckCompat.SwipeEventCallback() {
@Override
public void cardSwipedLeft(int position) {
Log.i("MainActivity", "card was swiped left, position in adapter: " + position);
Expand All @@ -57,8 +57,8 @@ public void cardsDepleted() {

});

// cardStack.setLeftImage(R.id.left_image);
// cardStack.setRightImage(R.id.right_image);
cardStack.setLeftImage(R.id.left_image);
cardStack.setRightImage(R.id.right_image);

Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_swipe_deck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:orientation="vertical">


<com.daprlabs.cardstack.SwipeDeck
<com.daprlabs.cardstack.SwipeDeckCompat
android:id="@+id/swipe_deck"
android:layout_width="match_parent"
android:layout_height="480dp"
Expand Down
3 changes: 2 additions & 1 deletion cardstack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 14
minSdkVersion 7
targetSdkVersion 23
versionCode 11
versionName "0.2.1"
Expand All @@ -46,6 +46,7 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
Expand Down
Loading