How to handle Swipe and Click event in the same cardview - Android - java

I am working on a android app, which has card swiping functionality like Tinder. In each cards, I'm having a imageview, which on click, opens in full screen. My problem is when I try to swipe, the image view considers it as a click event and opens the image in full screen.
I'm having my code for imageview onclick in the card swipe adapter and the code for swipe in the main activity that uses the card swipe adapter. How can I restrict the child view from consuming the parent's event?

Related

Recycler view adapter remove items

I have two activities: HomePage and MyFavorites. Both have recycler views with items (similar to facebook posts) each item has a button, when you click on it, the item will be shown in the recycler view for MyFav activity. The code for when the button is clicked is in the Adapter class for the recycler view (both activities use the same adapter). Now when a user click on the button for the second time (while the user is in MyFav activity) it means that this specific item should be removed from the recycler view in MyFav activity, but when the button is clicked for a second time while the user is using/opening the HomePage activity the item shouldn’t be removed, the button will turn from red to white ONLY . How can i remove the item only from the recycler view in MyFav activity without removing it from the HomePage activity (since both use the same adapter for their recycler view) without making a new adapter?
If i create separate adapter class for each activity, is it good practice? Since the same code will be duplicated twice with minor changes.
Note: the button (Fav button) is a checkbox with a heart shaped icon, the color is initially white, it will turn red when clicked for the first time, and white when clicked again and so on..

I'm having a fragment, how can I display it as a navigation drawer like view on an image press open and close the fragment animation in Android

I'm having a fragment, how can I display it as a navigation drawer like view on an image press open and close the fragment animation?
So on an image icon press open the fragment from left to right and again clicking on image move the fragment right to left and hide it like a navigation drawer
Is it possible to do that?

Add Google Map to a button of bottom navigation bar

I try to put the bottom navigation bar under Google Map and I can't. When I tap the second button of navigation bar I want to open google map fragment but the bar stays at the bottom. Does anyone know how it can be done?
Here is an example of exactly what I want:
My app uses a bottom navigation layout and loads up three fragments (on one of them is a google map fragment), hence the bottom navigation menu stays there for all the three fragment of the app!
If you want to have a screen where the bottom navigation isn't present, why not use an activity with a layout without a bottom navigation view for that screen ? The user will just navigate back to the previous activity when the job is done.

Add user draggable fragment in android java

I want to add the draggable fragment in my android app which have two fragments in vertical linear layout so that user can able to resize or drag the fragment with middle line between them

Animating the image in recycler view to fullscreen through dialog box

In RecyclerView, how can I expand the image such that when we click the Whatsapp profile image of others, it shows a complete image in a dialog box? How can I achieve that in RecyclerView? with that transaction animation as well.
Use a Dailog Fragment with a single ImageView in the center Tutorials here
When the user clicks the recyclerView item, pass the imageView of that specific item to the Dialog Fragment using SharedElementTransition. ( SharedElementTransition Tutorial here)
This should do the trick.

Categories

Resources