SwipeStack


Source link: https://github.com/flschweiger/SwipeStack

SwipeStack

A simple, customizable and easy to use swipeable view stack for Android.

QuickStart

Include the Gradle dependency

dependencies {

  compile 'link.fls:swipestack:0.3.0' 
}

Use it in your layout file

  1. Use the link.fls.swipestack.SwipeStack view in your XML layout file
  2. Set the parent view's clipChildren attribute to false

Example:

<?xml version="1.0" encoding="utf-8"?> <FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:clipChildren="false">

<link.fls.swipestack.SwipeStack

android:id="@+id/swipeStack"

android:layout_width="320dp"

android:layout_height="240dp"

android:padding="32dp"/>  </FrameLayout>

Create an adapter

Create an adapter which holds the data and creates the views for the stack.

Example:

public class SwipeStackAdapter extends BaseAdapter {

private List<String> mData;

public SwipeStackAdapter(List<String> data) {

this.mData = data;
  
}

@Override
  public int getCount() {

return mData.size();

  
}

@Override
  public String getItem(int position) {

return mData.get(position);

  
}

@Override
  public long getItemId(int position) {

return position;
  
}

@Override
  public View getView(final int position, View convertView, ViewGroup parent) {

convertView = getLayoutInflater().inflate(R.layout.card, parent, false);

TextView textViewCard = (TextView) convertView.findViewById(R.id.textViewCard);

textViewCard.setText(mData.get(position));

 return convertView;
  
}
 
}

Assign the adapter to the SwipeStack

Last, but not least, assign the adapter to the SwipeStack.

Example:

SwipeStack swipeStack = (SwipeStack) findViewById(R.id.swipeStack);
 swipeStack.setAdapter(new SwipeStackAdapter(mData));

That's it!

Callbacks

Currently SwipeStack implements the following callbacks:

  • the SwipeStackListener notifies you when a view was swiped to the left / right or when the stack becomes empty.
  • the SwipeProgressListener notifies you about the progress when the user starts / stops dragging a view around.

Attributes

All attributes are optional.

allowed_swipe_directions specifies the allowed swipe directions. Default: both

animation_duration specifies the duration of the animations. Default: 300ms

stack_size specifies the maximum number of visible views. Default: 3

stack_spacing specifies the vertical distance between two views. Default: 12dp

stack_rotation specifies the maximum random ratation (in degrees) of a card on the stack. Default: 8

swipe_rotation specifies the rotation (in degrees) of the view when it gets swiped left / right. Default: 15

swipe_opacity specifies the opacity of the view when it gets swiped left / right. Default: 1.0

scale_factor specifies the scale factor of the views in the stack. Default: 1.0

disable_hw_acceleration set to true disables hardware acceleration. Default: false

Copyright Notice

Copyright (C) 2016 Frederik Schweiger  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

Quick Android Review Kit - This tool is designed to look for several security related Android application vulnerabilities, either in source code or packaged APKs. The tool is also capable of creating "Proof-of-Concept" deployable APKs and/or ADB commands, capable of exploiting many of the vulnerabilities it finds. There is no need to root the test device, as this tool focuses on vulnerabilities that can be exploited under otherwise secure conditions.

An interactive view with water waves flowing like in a washing machine.

A Pin view widget for Android.

PinView has a feature that allows you to find out when they have completed all parameters. Support for Android 3.0 and up. It supports portrait and landscape mode, saving the state.

A ToggleLayout that can be used in setting interface.

An opencore amr codec JNI wrapper with explanation and one solution for packaging amr audio files.

JConditions is an extension for JUnit framework, which allows to mark test methods with specific conditional annotations. It helps to keep clean your test methods and prevents a lot of unnecessary code.

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