# SwipeDeck2 **Repository Path**: OrganizationStudy/SwipeDeck2 ## Basic Information - **Project Name**: SwipeDeck2 - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-12 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SwipeDeck2 ## A Tinder style Swipeable deck view for Android ![Screenshot](https://fat.gfycat.com/PartialBitterHermitcrab.gif) ## A Message To Developers This is an almost complete re write of the first swipe deck, hopefully this one will be less bug prone and easier to update. this is a very early release so i'm relying on your bug reports and feature suggestions to get this ready for prime time. ## Installation In your repositories and dependencies section add these parameters: ```groovy dependencies { compile 'com.daprlabs.aaron:swipedeck:2.0.3' } ``` Sync Gradle and import Swipe-Deck into your project ```java import com.daprlabs.aaron.swipedeck.SwipeDeck; ``` ## Example Start by defining a card view. Note that you can use any view type of your choice, cardviews provide you with access to shadows plus they look good. If you decide to use another view I recommend adding a drop shadow and perhaps a border. Here we have a pretty ordinary card view defined in XML: ```xml ``` Next Swipe Deck takes an adapter in much the same way as other adapter views: ```java public class SwipeDeckAdapter extends BaseAdapter { private List data; private Context context; public SwipeDeckAdapter(List data, Context context) { this.data = data; this.context = context; } @Override public int getCount() { return data.size(); } @Override public Object getItem(int position) { return data.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater inflater = getLayoutInflater(); // normally use a viewholder v = inflater.inflate(R.layout.test_card2, parent, false); } ImageView imageView = (ImageView) v.findViewById(R.id.offer_image); Picasso.with(context).load(R.drawable.food).fit().centerCrop().into(imageView); TextView textView = (TextView) v.findViewById(R.id.sample_text); String item = (String)getItem(position); textView.setText(item); v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("Layer type: ", Integer.toString(v.getLayerType())); Log.i("Hardware Accel type:", Integer.toString(View.LAYER_TYPE_HARDWARE)); } }); return v; } } ``` Now we add a swipe deck to our layout: ```xml