Swipeable cards


Source link: https://github.com/kikoso/Swipeable-Cards

Swipeable cards: Tinder-like cards library for Android

Swipeable-cards is a native library for Android that provide a Tinder card like effect. A card can be constructed using an image and displayed with animation effects, dismiss-to-like and dismiss-to-unlike, and use different sorting mechanisms.

The library is compatible for Android versions 3.0 (API Level 11) and upwards.

A library and a sample application are provided with the code.

Usage

Download the library with git and import it into your project (right now there is only Gradle support, so you need to import it writing in your build.gradle the following:

compile project(':AndTinder')

and in your settings.gradle

include 'AndTinder'

You can also download it via MavenCentral and Gradle:

dependencies {

 compile 'com.github.kikoso:SwipeableCards:1.1-RELEASE@aar' 
}

When you have included the library in your project, you need to proceeed as follows. First, create a container to store the cards.

<com.andtinder.view.CardContainer

 xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/layoutview"

android:layout_width="fill_parent"

android:layout_height="fill_parent" />

From your Activity, inflate into a CardContainer the container you declared in your XML

mCardContainer = (CardContainer) findViewById(R.id.layoutview);

The card container can sort the cards either ordered or disordered:

mCardContainer.setOrientation(Orientation.Ordered);
 mCardContainer.setOrientation(Orientation.Disordered);

Now you need to create your cards. The procedure is quite simple: you just need to create an object CardView and provide the image resource you want to add:

CardModel card = new CardModel("Title1", "Description goes here", r.getDrawable(R.drawable.picture1);

Additionally, you can set up a Delegate to be notified when the image is being liked or disliked:

card.setOnCardDimissedListener(new CardModel.OnCardDismissedListener() {

@Override

public void onLike() {

  Log.d("Swipeable Card", "I liked it");

}

 @Override

public void onDislike() {

  Log.d("Swipeable Card", "I did not liked it");

}
 
}
);

Or when it is clicked:

card.setOnClickListener(new CardModel.OnClickListener() {

@Override

public void OnClickListener() {

  Log.i("Swipeable Cards","I am pressing the card");

}
 
}
);

Finally, use an adapter to link the cards and the container:

SimpleCardStackAdapter adapter = new SimpleCardStackAdapter(this);
 adapter.add(new CardModel("Title1", "Description goes here", r.getDrawable(R.drawable.picture1)));
 mCardContainer.setAdapter(adapter);

Version history

  • 14.02.2015: Version 0.3: Fixed bugs with the cards locations and updated to the latest build tools
  • 4.06.2014: Published the version 0.2 with several improvements thanks to Dr-Emann
  • 13.05.2014: Published the first version 0.1

Next steps

There are many things that can be done with this library.

  • Allow custom templates
  • Extend image personalization options
  • Recreate the container when it has been emptied

If you want to colaborate with the project or have any idea to be implemented feel free to submit a pull request or to write an issue!

Also, if you have used AndTinder on your app and you let me know, I can link it from here :)

Contact

Enrique López Mañas - [email protected]

License

Copyright 2014 Enrique López Mañas  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

An android wrapper for openweathermap that uses Retrofit 2 under the hood.

You need an API Key to use the OpenWeatherMap API. Head on over to their website if you don't already have one.

Features

Get Current weather by:

  1. City Name
  2. City ID
  3. Geographic Coordinates
  4. Zip Code

Custom views of NestedScrollingChild class.

Logging value of object in a short and pretty way.

  • Don't need to define TAG, It is automatically generated by FileName - ClassName - Method - [Message] Object (Value)
  • Log all field and value of given object

This is small library with few annotations and processors that will generate all RecyclerView.Adapters stuff that you need with only few lines of annotations.

Advanced Sms Manager is library for sending sms for single and two sim-card phones. it is very handy and usefull.

An Android verification code EditText.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes