Coder Social home page Coder Social logo

ios_7-swipegesture-android's Introduction

IOS_7-SwipeGesture-Android

IOS 7 Swipe Gesture in Android listview. This repo provides listview swipe gesture pattern like IOS7 mailbox. messages to your Application.

IOS_7-SwipeGesture-Android IOS_7-SwipeGesture-Android IOS_7-SwipeGesture-Android

Please note that this swipe gesture pattern possible in side Relativelayout. Because the action options appears at background of listview item.

Supported Views

  * RelativeLayout

##Usage

Two Options at List Item Background

Sample code for two options on list item background.

	ListView cmn_list_view	            =	(ListView) findViewById(R.id.cmn_list_view);               //Listview
	ListViewSwipeGesture touchListener  = new ListViewSwipeGesture(cmn_list_view, swipeListener, this);
	touchListener.SwipeType	            =	ListViewSwipeGesture.Double;    //Set two options at background of list item, Default
		// These are optional --- Begins//

	//attributes for first action
	touchListener.HalfColor       	=	getResources().getString(R.string.str_green);
	touchListener.HalfText	        =	getResources().getString(R.string.basic_action_1);
	touchListener.HalfDrawable	    =	getResources().getDrawable(R.drawable.rating_favorite);
	
	//attributes for second action
	touchListener.HalfColor	        =	getResources().getString(R.string.str_orange);
	touchListener.HalfText	        =	getResources().getString(R.string.basic_action_2);
	touchListener.HalfDrawable	    =	getResources().getDrawable(R.drawable.rating_good);
	
	/* ------ End ------ */
	
	cmn_list_view.setOnTouchListener(touchListener);

Dismiss option

	ListView cmn_list_view	=	(ListView) findViewById(R.id.cmn_list_view);               //Listview
	
	ListViewSwipeGesture touchListener = new ListViewSwipeGesture(cmn_list_view, swipeListener, this);
			touchListener.SwipeType	=	ListViewSwipeGesture.Dismiss;
			cmn_list_view.setOnTouchListener(touchListener);

Swipe Gesture Callback functions

	ListViewSwipeGesture.TouchCallbacks swipeListener = new ListViewSwipeGesture.TouchCallbacks() {

	@Override
	public void FullSwipeListView(int position) {
		// Call back function for second action
	}

	@Override
	public void HalfSwipeListView(int position) {
		// Call back function for first option
	}

	@Override
	public void LoadDataForScroll(int count) {
		// call back function to load more data in listview (Continuous scroll)
		
		
	}

	@Override
	public void onDismiss(ListView listView, int[] reverseSortedPositions) {
		// Call back function to delete list item
	}

	@Override
	public void OnClickListView(int position) {
		// Call back function for onclick action
	}
	
};

ios_7-swipegesture-android's People

Contributors

dharanikumar avatar

Watchers

James Cloos avatar 尚晓东 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.