/RecyclerViewHalfSwipe

RecyclerViewButtonUnderSwipe

Primary LanguageKotlinApache License 2.0Apache-2.0

RecyclerView Button Under Swipe

RecyclerView Button Under Swipe

Download

Install

dependencies {
   ...........
   ...........
   implementation 'com.tutorialsbuzz.halfswipe:halfswipe:1.0.0'
}

Kotlin

object : SwipeHelper(this, recyclerView, false) {
	override fun instantiateUnderlayButton(viewHolder: RecyclerView.ViewHolder?, underlayButtons: MutableList?) {
		
		//adding first button 
		underlayButtons?.add(
			SwipeHelper.UnderlayButton("Archive", AppCompatResources.getDrawable(this@MainActivity, R.drawable.ic_archive_black_24dp),
				Color.parseColor("#000000"), Color.parseColor("#ffffff"),

				UnderlayButtonClickListener { pos: Int ->
					//Perform click operation on button1 at given pos
				}
			))
  	     
         //similarly add more to underlayButtons list		 
		 // ..
         // ..		  
		 // ..  
		 }
	 }


Java

new SwipeHelper(this, recyclerview, false) {

	@Override
	public void instantiateUnderlayButton(RecyclerView.ViewHolder viewHolder, List underlayButtons) {

		//adding button 1
		underlayButtons.add(new UnderlayButton("Archive",
				AppCompatResources.getDrawable(MainActivity.this, R.drawable.ic_archive_black_24dp),
				Color.parseColor("#000000"), Color.parseColor("#ffffff"),

				new UnderlayButtonClickListener() {
					@Override
					public void onClick(int pos) {
						 //Perform click operation on button1 at given pos
					}
				}));
			//similarly add more to underlayButtons list		 
			// ..
			// ..		  
			// ..           
		}
   }

Screenshot

RecyclerViewSwipe