Android Development Tutorial - Swipe to show button Recycler View

  Рет қаралды 32,611

EDMT Dev

EDMT Dev

Күн бұрын

Пікірлер: 183
@OmarSanchez-vz5cf
@OmarSanchez-vz5cf 3 жыл бұрын
Thank you for this tutorial , I wil use in my job, Thank you very much
@eddydn71
@eddydn71 3 жыл бұрын
You're welcome my bro
@cioffy10
@cioffy10 3 жыл бұрын
This video is perfect, it was exactly what i was searching for! 😍🎉 But, next time, please... can you explain something more about what you’re writing? Bcs that will be very useful to understand better! Thank you so much!
@eddydn71
@eddydn71 3 жыл бұрын
^^ Thank you, i will try in some next video :D
@GXTRIGON
@GXTRIGON Жыл бұрын
nice video,do u have a git of this project?
@kazumanaka9220
@kazumanaka9220 4 жыл бұрын
Thank you for this tutorial video. It's helped me a lot. After watched the video,I was struggling to assign the touch event to only the switch. I solved it like this. If (rect.top< point.y && rect.bottom>point.y && rect.right < point.x){ gestureDetector.onTouchEvent(event) } Anyway thanks for the video. I really like your approach!
@eddydn71
@eddydn71 4 жыл бұрын
You're welcome my bro
@championway825
@championway825 4 жыл бұрын
Amazing tutorial!!! Thank you so much~ I am so curious about why you always know so many functions and libraries. They just really blow my mind XD
@eddydn71
@eddydn71 4 жыл бұрын
:D When we want do something , first , we will search is anyone already do that ? :) That why i found library :D
@setyadhitya
@setyadhitya 5 жыл бұрын
nice, this tutorial help me a lot. thx u very much.
@eddydn71
@eddydn71 5 жыл бұрын
You're welcome my bro
@ahsansyed4146
@ahsansyed4146 4 жыл бұрын
how to handle Arralist in it? where should i need to code to delete or add in ArrayList . . . . I just copied your tutorial and swipe gesture is working nice. . . .
@eddydn71
@eddydn71 4 жыл бұрын
ArrayList or List is what you already pass to Adapter of Recycler View
@SHAOLINSORA
@SHAOLINSORA 4 жыл бұрын
Thank you so much, this code helped me a lot.
@eddydn71
@eddydn71 4 жыл бұрын
You're welcome my bro
@nikldj
@nikldj 4 жыл бұрын
bro,your best. Thanks you
@eddydn71
@eddydn71 4 жыл бұрын
You're welcome my bro
@edsonrocha3628
@edsonrocha3628 4 жыл бұрын
Thank you and congratulations for the tutorial, is working perfectly. Just one question, how do I increase the size of the icon?
@eddydn71
@eddydn71 4 жыл бұрын
See in your MySwipeHelper, in code set icon my bro
@FOUFOU003
@FOUFOU003 4 жыл бұрын
Hello, Thank you for your tutorial. I just have a question how can enable or disable the swipe?
@eddydn71
@eddydn71 4 жыл бұрын
Try play with MySwipeHelper class, my bro :)
@FOUFOU003
@FOUFOU003 4 жыл бұрын
@@eddydn71 i found the solution i will post it in the comment today :)
@hamzabinamin123
@hamzabinamin123 4 жыл бұрын
@@FOUFOU003 what's the solutiion?
@muhammadtayyab7414
@muhammadtayyab7414 5 жыл бұрын
I was finding this feature that you make ..and i finally got it ...Thank you so much
@eddydn71
@eddydn71 5 жыл бұрын
You're welcome my bro
@luislopez7198
@luislopez7198 4 жыл бұрын
You are awesome!
@eddydn71
@eddydn71 4 жыл бұрын
You're welcome my bro
@bacthai3229
@bacthai3229 Жыл бұрын
anh ơi cho em hỏi là em làm gán cái swipe vào xml luôn thì có làm được cái show item này thì item kia phải đóng k ạ?
@Emoji_fan-j3b
@Emoji_fan-j3b 4 жыл бұрын
Hi EDMTDev, Your tutorial is fine but some lines are not completely visible in the screen so I could not write them. If the entire code of the tuto is available, please make it accessible for download.
@eddydn71
@eddydn71 4 жыл бұрын
What line you don't see in screen , please show me time in video :)
@Emoji_fan-j3b
@Emoji_fan-j3b 4 жыл бұрын
@@eddydn71 It is this tline: public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewH....
@Emoji_fan-j3b
@Emoji_fan-j3b 4 жыл бұрын
Hi EDMT, I rewind the tuto and now all is OK. It is so nice !!! Thank well all. I have just 1 issue: in every card I have Pie 0xx and under it again Pie 0xx(smaller italic text) instead of the price (100.000$). Image at left of the texts also is missing. I will investigate arount these issues and come back to you. Thanks a lot. A.KOTE
@hohieu1486
@hohieu1486 4 жыл бұрын
Anh ơi, cho em hỏi giờ mình xét cả chiều cao nữa thì làm như thế nào anh, vì swipe của em cao quá k bằng được với height
@eddydn71
@eddydn71 4 жыл бұрын
Nghiên cứu cái MySwipeHelper đó em :)
@hohieu1486
@hohieu1486 4 жыл бұрын
@@eddydn71 Giúp em đi anh, vì em có thêm một số int Height để xét chiều cao, mà vẫn không được a ơi, ko pik là lúc transtionY tính chiều cao. Anh cho em cách giải với anh
@neekoooo6282
@neekoooo6282 4 жыл бұрын
Hi Sir is it possible to do this without inputing any string values and just having the cardview to test the swiping? Because i intend to use firebase retrieval later on and want to do this first. Thank you
@eddydn71
@eddydn71 4 жыл бұрын
:) Dear, it still work with Firebase. And you can use it with just card view my dear :D
@uzzalcontact981
@uzzalcontact981 5 жыл бұрын
your tutorial is mind-blowing please make a blood app project
@eddydn71
@eddydn71 5 жыл бұрын
I will try my dear :D
@amponsahbenjamen9767
@amponsahbenjamen9767 4 жыл бұрын
I have a issue please, after swiping the recyclerview to the left and swiping back to its normal position, such that the delete and the edit buttons are not visible, when you click on the recylerview at the exact position where the delete and the edit buttons are, the buttons get called. any solution please
@amponsahbenjamen9767
@amponsahbenjamen9767 4 жыл бұрын
please i have solved it, just had to implement an onClick listener for my cardview.
@eddydn71
@eddydn71 4 жыл бұрын
You're welcome :d
@fayetan1959
@fayetan1959 4 жыл бұрын
May I know the code on how you solve this? Thank you!
@shyamkrishna5071
@shyamkrishna5071 4 жыл бұрын
Sir, what changes should I do if I want one button in the left and another one in the right?
@eddydn71
@eddydn71 4 жыл бұрын
Too much work to do that :( I will try to make tutorial
@shyamkrishna5071
@shyamkrishna5071 4 жыл бұрын
@@eddydn71 plzz make a video sir. I want to know how it's done
@fayetan1959
@fayetan1959 4 жыл бұрын
Hi, whenever I swipe, the buttons for editing and deleting is under my item recycler view but it is clickable because the toast shows up. It seems to be not visible but clickable. How to solve this?
@eddydn71
@eddydn71 4 жыл бұрын
Please watch my tutorial step by step , my dear
@KeremTatlc
@KeremTatlc 4 жыл бұрын
I got the same situation, did you solve this problem?
@fayetan1959
@fayetan1959 4 жыл бұрын
@@KeremTatlc No. I junk this tutorial.
@KeremTatlc
@KeremTatlc 4 жыл бұрын
@@fayetan1959 Wow, i spent my 3 hours to write this code and i don't want to junk this tutorial like you, so wish me luck 😃
@fayetan1959
@fayetan1959 4 жыл бұрын
@@KeremTatlc I spent 2 days for this tho. So I just look for other tutorials that I can follow like on github. Goodluck!
@moiseamani8384
@moiseamani8384 4 жыл бұрын
hello sir, is there a way of showing delete and update from lets say if a user clicks an icon ?Then the recycler view shows update and delete boxes for all the recycler view items.
@eddydn71
@eddydn71 4 жыл бұрын
:-? This is bad idea, i think we can create more button for delete all :))
@moiseamani8384
@moiseamani8384 4 жыл бұрын
I am trying to click a button that will set all the items in recycler to swiped(show options) so user can see update and delete. Please let me know sir.
@moiseamani8384
@moiseamani8384 4 жыл бұрын
EDMT Dev I am trying to click a button that will set all the items in recycler to swiped(show options) so user can see update and delete. Please let me know sir.
@prakashmaharjan6021
@prakashmaharjan6021 5 жыл бұрын
Nice demo.. Kotlin version of this demo? Thank you.
@eddydn71
@eddydn71 5 жыл бұрын
Please search on my channel before ask , thank you ^^ kzbin.info/www/bejne/aaiTo4CubK9gh7M
@abdullahalimran4600
@abdullahalimran4600 2 ай бұрын
private int swipePosition = -1; RecyclerView.ViewHolder swipeViewHolder=recyclerView.findViewHolderForAdapterPosition(swipePosition); at position =-1 swipeViewHolder is null ,cause there is no viewholder at poistion -1 .how to fix it ???
@lessonforcoding2193
@lessonforcoding2193 5 жыл бұрын
Sir, All library must be 64 bit, Do you think about the google play upcoming policy?
@eddydn71
@eddydn71 5 жыл бұрын
Hmm i will see this problem :)
@duongtri6428
@duongtri6428 4 жыл бұрын
SwipehHelper khởi tạo ở activity, e ko thấy sử dụng chỗ nào nhỉ. item của e chưa bắt đc event swipe.
@eddydn71
@eddydn71 4 жыл бұрын
Nó đc gọi init vào RecyclerView, ngay sau cái khai báo đó :)
@slash0t5
@slash0t5 4 жыл бұрын
This is an excellent video. But I wish you actually spoke and explained it because this is a difficult concept for beginners because there are so many things to learn. I am guessing you are from Laos. So even if you spoke in French, we could turn on the subtitles and have it translated in whichever language we want.
@eddydn71
@eddydn71 4 жыл бұрын
My dear ! I record my tutorial in my company while working , and other reason my English too bad :( I really want to record with voice but that is my reason why i can't talk in my tutorial I hope you understand :)
@aritrochowdhury161
@aritrochowdhury161 4 жыл бұрын
I have to drag from corner to corner slowly to make ta buttons visible.... How to make the buttons visible on fling or quick draging??
@eddydn71
@eddydn71 4 жыл бұрын
I will try my dear :D Thank you for your idea
@androiddev7866
@androiddev7866 5 жыл бұрын
Awesome!!
@eddydn71
@eddydn71 5 жыл бұрын
You're welcome my bro
@expense-moneytracking6577
@expense-moneytracking6577 4 жыл бұрын
Thank you for your nice video! However, the drawable icon is not align center. Could you please guy how to make it align in center like text ? Thanks. @Android Developer From @Cambodia
@eddydn71
@eddydn71 4 жыл бұрын
You can play with code on MySwipeHelper to center icon (width/2 + height/2)
@Y8_MUSiC
@Y8_MUSiC 4 жыл бұрын
hey edmt I am facing one issue I have followed your tutorial I caught one bug can you help to solve it? The bug is supposed I my list has three items in it n I swiped item one and I can see two buttons which are edit and delete suppose if I don't touch anywhere are swipe item one to its normal way where edit and delete buttons weren't visible n when I click when buttons aren't visible the points x and y are still their though because of which when I click after swipe is closed then too edit and delete functions are getting called Help needed! if u dont understood this issue I want to share images with u so that I can make this bug more clear
@eddydn71
@eddydn71 4 жыл бұрын
Okay i understand this problem, in above view of item, just setONClickListener for it ^^ And don't write anything for code inside :D
@hamzabinamin123
@hamzabinamin123 4 жыл бұрын
@@eddydn71 How do I close the swipe view programmatically? please help with the code, been stuck on it for days.
@raespim
@raespim 4 жыл бұрын
Hi! You can help me? I did everything just like you in the video, but my button click is not working! Anything happen when i click ;(
@raespim
@raespim 4 жыл бұрын
I already solved !! I had forget to write this code at SwipeHelper Constructor "this.recyclerView.setOnTouchListener(onTouchListener);" Thanks for this tutorial.. Hey, one more ask, please, you can help me how can i set radius corner to that button swipe? PLEEEASE HELP ME
@eddydn71
@eddydn71 4 жыл бұрын
You can play with MySwipeHelper , code create button here my dear :)
@raespim
@raespim 4 жыл бұрын
@@eddydn71 Please, you can give me an example? I don't know how write this code
@cristiancontreras5673
@cristiancontreras5673 4 жыл бұрын
Hi! your tutorial is for swipe of right to left and i'm trying to swipe of left to right, how i can do that? or swipe from the two ways, thanks!
@cristiancontreras5673
@cristiancontreras5673 4 жыл бұрын
Sorry, i'm doing in kotlin :x
@shubh0
@shubh0 3 жыл бұрын
i followed the tutorial but at the end when I want to swipe the app closes, why ???
@eddydn71
@eddydn71 3 жыл бұрын
Check the log cat when app crash, reason here ! :D
@muhammadtayyab7414
@muhammadtayyab7414 5 жыл бұрын
Sir click on show button doesn't show toast ,rather swipe close ,where i make mistake ??????????????
@eddydn71
@eddydn71 5 жыл бұрын
Please watch my tutorial step by step , my dear
@darshilshah4004
@darshilshah4004 4 жыл бұрын
Thank you for this tutorial Video, It is very Useful. When I Swipe top to bottom it is working fine as Swipe Position always remain 0. However, If I try to swap from bottom to top, first time it assign swipedposition=currentposition and then on next swipe it crash the app with error " android.view.View androidx.recyclerview.widget.RecyclerView$ViewHolder.itemView' as swipedposition = (last swipe deletion position). can you please check and help me to fix.
@eddydn71
@eddydn71 4 жыл бұрын
Thank you ! I will check and release tutorial fix :D
@ghaithdarwish1346
@ghaithdarwish1346 5 жыл бұрын
The first 9 items of the Recyclerview can be swiped, but don't work when clicked. Is there a reason?
@eddydn71
@eddydn71 5 жыл бұрын
In this tutorial we will work only for button click , not item of recycler view click
@kaff864
@kaff864 5 жыл бұрын
Yor are grate. Can you show us how to approve and disapprove the data inserted by the user in the firebase database. if data did not approve it ll be deleted from the database.
@eddydn71
@eddydn71 5 жыл бұрын
This is simple , you can use 2 reference. 1 for Need Check and 1 for APPORVE :D All new data you will assign to Need Check ref , and after you approve it , move it to APPROVE ref , and done ! Final result load from APPROVE ref
@kaff864
@kaff864 5 жыл бұрын
@@eddydn71 Sir need a tutorial i have try many time but not success can you make a video on it. Thanks
@eddydn71
@eddydn71 5 жыл бұрын
I will try when i have free time , now i've working on other project
@kaff864
@kaff864 5 жыл бұрын
@@eddydn71 Thank you, sir, i am waiting
@jrtgarciaruiz415
@jrtgarciaruiz415 4 жыл бұрын
What would it be like if the recyclerview was inside a fragment?
@eddydn71
@eddydn71 4 жыл бұрын
Same, my bro
@kentlubo7876
@kentlubo7876 4 жыл бұрын
Hello sir, how can i center the icon in canvas? My size of icon is 24x24 dp
@eddydn71
@eddydn71 4 жыл бұрын
Try play with position set, my bro
@dodisuprayogi
@dodisuprayogi 3 жыл бұрын
nice vid
@eddydn71
@eddydn71 3 жыл бұрын
You're welcome, my bro
@samirshrestha5252
@samirshrestha5252 3 жыл бұрын
Only first item of recycler view shows delete icon when swiped, other don't. What could be the issue here ? Would you help me by providing source code ?
@eddydn71
@eddydn71 3 жыл бұрын
Please watch my tutorial STEP BY STEP my bro :( If you don't get result :D Best way is write code by yourself, for learn from code ^^ Trust me, that help me improve
@aritrochowdhury161
@aritrochowdhury161 4 жыл бұрын
When I deleted an item and use recyclerAdapter.notifyItemRemoved(pos) the deleted item comes back in the bottom.... How to fix this??
@eddydn71
@eddydn71 4 жыл бұрын
First , item must be delete from database , next delete from list of adapter and notify it , check your code and make sure it same as me
@tavoosfilm
@tavoosfilm 4 жыл бұрын
Can you please share your delete function?
@jorgemoreno1943
@jorgemoreno1943 3 жыл бұрын
@@tavoosfilm you did?
@barteklipiec4599
@barteklipiec4599 4 жыл бұрын
I got this error when i remove item from LiveData list in recyclerview java.lang.NullPointerException: Attempt to read from field 'android.view.View androidx.recyclerview.widget.RecyclerView$ViewHolder.itemView' on a null object reference
@eddydn71
@eddydn71 4 жыл бұрын
Your Recycler View is null, make sure you already call findViewById for it before
@barteklipiec4599
@barteklipiec4599 4 жыл бұрын
@@eddydn71 i made "if" and working fine :P
@crimsoncisper3972
@crimsoncisper3972 3 жыл бұрын
how disable swipe some row of recyclerview?
@eddydn71
@eddydn71 3 жыл бұрын
You mean multiple row ?
@jeetpurohit121
@jeetpurohit121 4 жыл бұрын
I want these exactly but the delete options should only be available when user holds swipe right when user leave the part the delete option should be disappeared How to achieve this.
@eddydn71
@eddydn71 4 жыл бұрын
Sorry i don't understand :(
@lemontea8690
@lemontea8690 4 жыл бұрын
Can i get full code of this from anywhere? Thank you
@eddydn71
@eddydn71 4 жыл бұрын
All available in my tutorial ! Please watch and get it :D
@lemontea8690
@lemontea8690 4 жыл бұрын
@@eddydn71 i am done with this code and its working very good. But i have to ask one thing that if i want to do both left and right swipe then how can i possible with this code. Please help me. Thank you!! :)
@বিনোদনেরশহর-ঝ৮ঞ
@বিনোদনেরশহর-ঝ৮ঞ 5 жыл бұрын
Fast vew
@eddydn71
@eddydn71 5 жыл бұрын
You're welcome my bro
@srjlove2102
@srjlove2102 5 жыл бұрын
Pls share SwipeHelper class it's getting difficult to write the code
@arsarsars1able
@arsarsars1able 5 жыл бұрын
import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; import com.example.ars.salemart.Interface.MyButtonClickListener; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Queue; public abstract class MySwipeHelper extends ItemTouchHelper.SimpleCallback { int buttonWidth; private RecyclerView recyclerView; private List buttonList; private GestureDetector gestureDetector; private int swipePositive = -1; private float swipeThreshold = 0.5f; private Map buttonBuffer; private Queue removeQueue; private GestureDetector.SimpleOnGestureListener gestureListener = new GestureDetector.SimpleOnGestureListener(){ @Override public boolean onSingleTapUp(MotionEvent e) { for (MyButton button : buttonList){ if (button.onClick(e.getX(),e.getY())) break; } return true; } }; private View.OnTouchListener onTouchListener = new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (swipePositive < 0) return false; Point point = new Point((int)motionEvent.getRawX(),(int) motionEvent.getRawY()); RecyclerView.ViewHolder swipeViewHolder = recyclerView.findViewHolderForAdapterPosition(swipePositive); View swipeItem = swipeViewHolder.itemView; Rect rect = new Rect(); swipeItem.getGlobalVisibleRect(rect); if (motionEvent.getAction() == MotionEvent.ACTION_DOWN || motionEvent.getAction() == MotionEvent.ACTION_UP || motionEvent.getAction() == MotionEvent.ACTION_MOVE){ if (rect.top < point.y && rect.bottom > point.y){ gestureDetector.onTouchEvent(motionEvent); }else { removeQueue.add(swipePositive); swipePositive = -1; recoverSwipeItem(); } }return false; } }; public MySwipeHelper(Context context,RecyclerView recyclerView,int buttonWidth) { super(0,ItemTouchHelper.LEFT); this.recyclerView = recyclerView; this.buttonList = new ArrayList(); this.gestureDetector = new GestureDetector(context,gestureListener); this.recyclerView.setOnTouchListener(onTouchListener); this.buttonBuffer = new HashMap(); this.buttonWidth = buttonWidth; removeQueue = new LinkedList(){ @Override public boolean add(Integer integer) { if (contains(integer)) return false; else return super.add(integer); } }; attachSwipe(); } private void attachSwipe() { ItemTouchHelper itemTouchHelper = new ItemTouchHelper(this); itemTouchHelper.attachToRecyclerView(recyclerView); } private synchronized void recoverSwipeItem() { while (!removeQueue.isEmpty()){ int pos = removeQueue.poll(); if (pos > -1) recyclerView.getAdapter().notifyItemChanged(pos); } } public class MyButton { private String text; private int imageResId,textSize,color,pos; private RectF clickRegion; private MyButtonClickListener listener; private Context context; private Resources resources; public MyButton( Context context, String text, int textSize, int imageResId, int color, MyButtonClickListener listener) { this.text = text; this.imageResId = imageResId; this.textSize = textSize; this.color = color; this.listener = listener; this.context = context; resources = context.getResources(); } public boolean onClick(float x,float y){ if (clickRegion != null && clickRegion.contains(x,y)){ listener.onClick(pos); return true; } return false; } public void onDraw(Canvas c,RectF rectF,int pos){ Paint paint = new Paint(); paint.setColor(color); c.drawRect(rectF,paint); //Text paint.setColor(Color.WHITE); paint.setTextSize(textSize); Rect r = new Rect(); float cHeight = rectF.height(); float cWidth = rectF.width(); paint.setTextAlign(Paint.Align.LEFT); paint.getTextBounds(text,0,text.length(),r); float x = 0, y = 0; if (imageResId == 0){ //if just show text x = cWidth/2f - r.width()/2f - r.left; y = cHeight/2f + r.height()/2f - r.bottom; c.drawText(text,rectF.left + x, rectF.top + y, paint); }else { Drawable d = ContextCompat.getDrawable(context,imageResId); Bitmap bitmap = drawableToBitmap(d); c.drawBitmap(bitmap, (rectF.left + rectF.right)/2, (rectF.top + rectF.bottom)/2, paint); } clickRegion = rectF; this.pos = pos; } } private Bitmap drawableToBitmap(Drawable d) { if (d instanceof BitmapDrawable) return ((BitmapDrawable)d).getBitmap(); Bitmap bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); d.setBounds(0,0,canvas.getWidth(),canvas.getHeight()); d.draw(canvas); return bitmap; } @Override public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) { int pos = viewHolder.getAdapterPosition(); if (swipePositive != pos) removeQueue.add(swipePositive); swipePositive = pos; if (buttonBuffer.containsKey(swipePositive)) buttonList = buttonBuffer.get(swipePositive); else buttonList.clear(); buttonList.clear(); swipeThreshold = 0.5f*buttonList.size()*buttonWidth; recoverSwipeItem(); } public float getSwipeThreshold(RecyclerView.ViewHolder viewHolder) { return swipeThreshold; } @Override public float getSwipeEscapeVelocity(float defaultValue) { return 0.1f*defaultValue; } @Override public float getSwipeVelocityThreshold(float defaultValue) { return 5.0f * defaultValue; } @Override public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { int pos = viewHolder.getAdapterPosition(); float translationX = dX; View itemView = viewHolder.itemView; if (pos < 0){ swipePositive = pos; return; } if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE){ if (dX < 0){ List buffer = new ArrayList(); if (!buttonBuffer.containsKey(pos)){ instantiateMyButton(viewHolder,buffer); buttonBuffer.put(pos,buffer); }else { buffer = buttonBuffer.get(pos); } translationX = dX*buffer.size()*buttonWidth / itemView.getWidth(); drawButton(c,itemView,buffer,pos,translationX); } } super.onChildDraw(c,recyclerView,viewHolder,translationX,dY,actionState,isCurrentlyActive); } private void drawButton(Canvas c, View itemView, List buffer, int pos, float translationX) { float right = itemView.getRight(); float dButtonWidth = -1*translationX / buffer.size(); for (MyButton button:buffer){ float left = right - dButtonWidth; button.onDraw(c,new RectF(left,itemView.getTop(),right,itemView.getBottom()),pos); right = left; } } public abstract void instantiateMyButton(RecyclerView.ViewHolder viewHolder, List buffer); }
@arsarsars1able
@arsarsars1able 5 жыл бұрын
@Suraj bro there's some little bit error i won't be able to find it, if you find then must let me know
@abdulfattah5248
@abdulfattah5248 4 жыл бұрын
how can i swipe from left to right?
@tavoosfilm
@tavoosfilm 4 жыл бұрын
How does deleting items in recyclerView work? pls help
@eddydn71
@eddydn71 4 жыл бұрын
:) We will call removeItem from adapter to delete item display , and if you use SQLite / Room persistence , you can call delete function
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
Drawable d = ContextCompat.getDrawable(context,imgResId); this is my line no. 164 there is nothing like txt_abc.setText(number) am so depressed because of it am am still waiting for your help sir
@eddydn71
@eddydn71 5 жыл бұрын
okay , your imgResId is wrong , please check it :)
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
ok i try thanku but if dont proceed i wil inform you
@devdanielhernandez
@devdanielhernandez 4 жыл бұрын
'boolean android.graphics.Bitmap.isRecycled()' on a null object reference :(
@eddydn71
@eddydn71 4 жыл бұрын
Your Bitmap is null, please check it :D
@devdanielhernandez
@devdanielhernandez 4 жыл бұрын
@@eddydn71 Thank you!
@yasark6347
@yasark6347 5 жыл бұрын
Thanks a lot sir can u reply me if I send a mail to u about my project
@eddydn71
@eddydn71 5 жыл бұрын
All error please show me here my dear :D
@yasark6347
@yasark6347 5 жыл бұрын
@@eddydn71 it's not about error sir, I can understand sir that u can't reply my email anyway sir thanks a lot sir
@yasark6347
@yasark6347 5 жыл бұрын
@@eddydn71 Sir progress dialog showing when I uploading the image to firebase during the progress if I touch dialog then it's disappeared. The progress dialog should not be disappeared during the progress of uploading it will dismiss once the progress is finished how to do this sir
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
am waiting for your response sir plz as soon as possible help me
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
line 164 : Drawable d = ContextCompat.getDrawable(context,imgResId);
@eddydn71
@eddydn71 5 жыл бұрын
Show me your error my dear
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
today i dont know why i have found new errore E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.cashclick, PID: 5101 java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.recyclerview.widget.RecyclerView.setOnTouchListener(android.view.View$OnTouchListener)' on a null object reference at com.example.cashclick.Helper.MySwipHelper.(MySwipHelper.java:86) at com.example.cashclick.fragment_all_Employees$2.(fragment_all_Employees.java:131) at com.example.cashclick.fragment_all_Employees.RecyclerView_Swipeable(fragment_all_Employees.java:131) at com.example.cashclick.fragment_all_Employees.onCreateView(fragment_all_Employees.java:52) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600) at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881) at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238) at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303) at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
but my privious error was an other can i send you my projecta and can i contect you on whatsap ?
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
my actual error is this E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.db, PID: 9146 android.content.res.Resources$NotFoundException: Resource ID #0x2 at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:230) at android.content.res.Resources.getDrawableForDensity(Resources.java:887) at android.content.res.Resources.getDrawable(Resources.java:827) at android.content.Context.getDrawable(Context.java:631) at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:463) at com.example.db.Helper.MySwipHelper$myButton.onDraw(MySwipHelper.java:164) at com.example.db.Helper.MySwipHelper.drawButton(MySwipHelper.java:249) at com.example.db.Helper.MySwipHelper.onChildDraw(MySwipHelper.java:238) at android.support.v7.widget.helper.ItemTouchHelper$Callback.onDraw(ItemTouchHelper.java:1989) at android.support.v7.widget.helper.ItemTouchHelper.onDraw(ItemTouchHelper.java:561) at android.support.v7.widget.RecyclerView.onDraw(RecyclerView.java:4284) at android.view.View.draw(View.java:20837)
@eddydn71
@eddydn71 5 жыл бұрын
@@fkjoiya5008 ttempt to invoke virtual method 'void androidx.recyclerview.widget.RecyclerView.setOnTouchListener(android.view.View$OnTouchListener)' on a null object reference Please implement onItemClick in your holder in onBindViewHolder method
@anahiazcona
@anahiazcona 4 жыл бұрын
Hello, I found your channel and the truth is that it helped me a lot but I have a problem with the onClick, when selecting the button it does not perform any action. Do you think I can get in touch with you? It would help me a lot if it were possible
@eddydn71
@eddydn71 4 жыл бұрын
You can check your MySwipeHelper, you not follow my code exactly 100%, that why listener cant' be register in your code ! Please check again
@anahiazcona
@anahiazcona 4 жыл бұрын
@@eddydn71 I have solved the error I had but I would like to know how the process would be if you want the displacement to be for both sides?
@ashwathachark7656
@ashwathachark7656 4 жыл бұрын
Hai sir, Tutorial is good.I followed u and made an apk, then executed on my mobile, but when I swipe then app is getting crash. So please help me to solve this problem.
@eddydn71
@eddydn71 4 жыл бұрын
Hi , please show me your log cat when your app is crash :)
@abdulfattah5248
@abdulfattah5248 4 жыл бұрын
how can i centralize the icon?
@eddydn71
@eddydn71 4 жыл бұрын
Try play with MySwipeHelper class my dear :) Reverse code left to right and edit position to center icon like you want :D
@phongnguyenngoc2668
@phongnguyenngoc2668 3 жыл бұрын
I dont know why.. my edit button is invisible
@eddydn71
@eddydn71 3 жыл бұрын
Try check your code, i think it not same as me
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
so can u help me or not ?
@eddydn71
@eddydn71 5 жыл бұрын
My dear ! I'm not a free person just seat and wait your question to help. I have my work , if you need my help , feel free post question here and i will help when i read it ! I'm not your own so you can't ask me like this !
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
ok i appologize but sir i need your help implement this
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
i should try me best
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
please help me sir
@fkjoiya5008
@fkjoiya5008 5 жыл бұрын
response me as soon as possible plz
Kotlin Android Tutorial - Swipe to show button Recycler View
41:41
SISTER EXPOSED MY MAGIC @Whoispelagheya
00:45
MasomkaMagic
Рет қаралды 16 МЛН
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 26 МЛН
Wait for it 😂
00:32
ILYA BORZOV
Рет қаралды 6 МЛН
Highlight, Move, and Swipe RecyclerView with ItemTouchHelper
21:03
CodingWithMitch
Рет қаралды 26 М.
Palestine Must Be Free | Stand-up Comedy by Daniel Fernandes
15:07
Daniel Fernandes
Рет қаралды 88 М.
Kubernetes 101 workshop - complete hands-on
3:56:03
Kubesimplify
Рет қаралды 1,6 МЛН
Фоновая работа в Android: Service и WorkManager // Курс «Android Developer. Professional»
1:41:26
SISTER EXPOSED MY MAGIC @Whoispelagheya
00:45
MasomkaMagic
Рет қаралды 16 МЛН