The whole idea of what I'm doing is, creating a notebook use case, where we can have n pages.
Now, I have used RecyclerView and added the item adapter, using the complete screen as a single item for writing.
Now, whenever I start writing on the view which is the property for HW acceleration, I got events but the recycler adapter thinks differently.
How do I solve this? I would like to make sure when writing is happening using a digital pen, the adapter should ignore it, and when we do finger swipe it should move to the next screen/page.
You can use a setOnTouchListener to differentiate between the events. check this links out from SO:
here or here or here
Related
I want to implement touch listener that detects
Click/tap on chess piece in order to select ot
Swipe/move of chess piece immediately.
How to do it?
Unfortunately, I am not sure what you mean by a "chess piece", but let's assume that the board is a view in the background, and inside you have inner views which are chess pieces.
To achieve the select/unselect given piece effect you should add a simple View.OnClickListener interface to your view. Each of your pieces should have a view class and some data connected to it (like a position, a type of piece, id, etc.). After clicking the piece update the state of some global variable, for example, selectedPiece with an ID assigned to a given piece. You should also change the UI of a given piece, for example change the border to show the selected piece to a user. Then after clicking a new field for moving the piece you should update the UI by moving your piece view to an appropriate position. Also, the data of a piece or a game should be updated - depending on the place of storing the pieces' positions.
For this you should implement the drag&drop feature which is described here: https://www.tutorialspoint.com/android/android_drag_and_drop.html. You should determine the places where the user can move a piece and in case of dropping the piece in the wrong place, cancel the move and go with the piece to a start position.
Basic response to touch events using event.x and event.y works:
https://developer.android.com/develop/ui/views/graphics/opengl/touch
https://suragch.medium.com/how-touch-events-are-delivered-in-android-eee3b607b038
...more info:
Android Touch Listener
I want to create a list, for example, To-Do List.
In this User is allowed to select/unselect an item, reorder according to their priority. In the current scenario, I am able to give them all of the above functionality using ItemTouchHelper.SimpleCallback.
My Challenge starts here -
When User selects an item(or right swipe it) I need to show that row disabled with strike-through text.
In such a case, I am changing its position and after that, all features like Drag & Drop, Swipe Left or Right should not work on that particular row.
And, If the user manually unselects it by tapping an icon, all the mentioned gestures should work.
I read about Method getSwipeDirs but didn't understand how to utilize it in my scenario.
I have gone through a couple of articles but all of them remove an item on swipe. Hence, I couldn't find the reference for my case.
If anyone has an idea about it and guide me further then it would be a great help! I am open
Note: I have used com.daimajia.swipe.SwipeLayout library just for left swipe as I want to enable full swipe just for Right direction. I am able to disable the library swipe by utilizing some of its methods. However, I still can not disable Drag/Drop or Right Swipe which I am using with help of ItemTouchHelper.SimpleCallback.
We can simply add the tag to the viewHolder of recyclerView and fetch the info from the tag for any particular row in the getMovementFlags method of ItemTouchHelper.Callback and manipulate drag/ drop or swipe flag as needed!
I don't have much experience in Android animation so I'm asking for some help for the following:
I have a RecyclerView and a custom view which appears whenever one of the items from RecyclerView is selected (gets binded with certain data etc.).
What I need to make is an animation that would clearly show the new view 'fade in & rise'/ 'expand' from the location of that selected RecyclerView and spread through the whole screen.
For better visualisation : force touch in certain iOS apps does this perfectly.
Are there any good 3rd party libraries for this sort of animations or any other solution? I tried working with built-in Android animations functions but I find them very limited for this kind of animations.
Your question is vague: are you asking either how to create the 'force touch' animation either how pass the click event from your view holder to the main app?
Anyways, there's a library that does specifically what you want: Android 3D Touch - PeekView
In my application I have requirement like this.I have number of data and I need to show that data on ListView kind of layout,now I have suppose total 6pages on each pages I want to show such data.I have listed number of textview on each page.Suppose i have 7pages so i need to make book kind of layout for that i am using this Code.https://github.com/harism/android_page_curl.
with this i am able to get such effect.As mentioned in below image.
Now my issue is,As OpenGl is converting entire layout to bitmap,i am not able to handle click event of textview.Whenever i click on textview on that time ACTION_DOWN method is called.and offcourse it should be called as entire layout is converting to bitmap thus we can't handle textview click event.
for making solution of this have googled and found some trick from This issue.Here mentioned to make seperate layout for handeling click listener,but not getting what exactly i have to do,as i don't have any experience in OpenGl,so if any one have idea about this issue,any one who can guide me handle click event.
The above solutions depends on your views pages. It may not work if you use ListViews on your pages or any ScrollView, you have to retest your application performance...
What i have done to get it working, is to create an extra root parent with,FrameLayout, place on top the widget, fi.harism.curl.CurlView and add PageContainer(RelativeLayout on may app).
At run time, get the drawable of your view page (View.getDrawingCache()) , and add The real PageView(witch contains click listener) to the PageContainer. Make the PageContainer alpha to 0. You have a duplicate page (transclude) to receive the page clic, the CurlView will still handle touch events for curl.
I search for a good and handy user interface to put items from list 1
to a empty list 2 with drag&drop. I need this function for Android 2.2.
Have anybody heard about this feature?
EDIT
I found this website and i think it is also interesting.
http://techdroid.kbeanie.com/2010/04/simple-drag-n-drop-on-android.html
Look also at the comments.
It may also be helpful to reference my simple Drag and Drop list. You can find here
if u don't getting then use this
An example of this in github https://github.com/mtparet/Drag-And-Drop-Android
It could help you.All contribution are welcome
Take a look at this sample that Drag and drop inside a List View..
Refer to the drag and drop API launched in API Version 11
http://developer.android.com/guide/topics/ui/drag-drop.html
A drag and drop operation starts when the user makes some gesture that you recognize as a signal to start dragging data. In response, your application tells the system that the drag is starting. The system calls back to your application to get a representation of the data being dragged. As the user's finger moves this representation (a "drag shadow") over the current layout, the system sends drag events to the drag event listener objects and drag event callback methods associated with the View objects in the layout. Once the user releases the drag shadow, the system ends the drag operation.