Delphi Firemonkey for Android - Listview Gesture Handling - android

I have a listview where I am capturing both a list view item click (to change available options) and a list view double tap (to move to a new screen). When the user double taps, the event seqeunce is Item Click, Double Tap, Item Click.
The second Item click event is overwriting some of the logic behind the double tap event. What is the best way to disable or cancel the second item click? I thought the "Handled := true" would work but it made no difference.
Any help greatly appreciated

Related

Is it possible to simulate the event of anchors (html) with the Android interface (xml)?

Is it possible to simulate the event of anchors (html) with the Android interface?
I mean I have a listview with several titles and I want to press a button that moves the screen to the specific title.
If you know the position of the item in the List, you can use setSelection() in your button's click handler.
http://developer.android.com/reference/android/widget/ListView.html#setSelection%28int%29

Handling touch event on menu item click

I want to handle the touch event on click of menu item in the menu, and on click of spinner text in the spinner and on select date or on click ok button in a date control. OnUserInteraction() method is not triggered when click on these above items.
Note: Just to clearify, I know about onClick event. but like onUserInteraction(), whenever user touch the screen, I am notifed and I do some stuff. But this event is not invoked when user touches on extra menu item(which comes as drop down), spinner drop down and or button click in dialog.
So is there some way to be notified for the same. I know we have some event(I can say that coz screen brightness increase when left for some time and user touch any of the above mentioned item).
Can anybody tell me, is there is any other touch events available for handle this?
Thanks
Mindus

Prevent double click when Inflating View android

I was changing view when click button using Layoutinflater.The button have located in the same position in all the screen.
If i click button it change the view only once.If i double click the button it change the view twice.It means click event
dispatched twice in two different layouts.Here when i double click the button it should change only once.
For that what should i do?
Thnx,
You can take diff of two click events, that is store system time of first event in variable ( global scope) and diff it by system time of latest event. Here you need to decide time span between two click events oon the basis of which you consider wether its a double click or not. Say i consider if second click is done within 35 milliseconds of first click event, its a double click.
Thus if the time difference above is less than 35 seconds, you can restrict view change
Hope this would help u

How do I permanently select / highlight a TableView row in Titanium Android?

I have a tablet app with a Master / Detail layout, with a TableView in the Master panel that changes the content of the Detail pane. I'd like to have the master's row stay highlighted when clicked like it does in the android OS settings.
Right now the best I'm able to do is set the backgroundColor to a new color in response to a 'click' event. However, when I do a quick tap, the row highlights, then blinks back to normal before highlighting again. I'm guessing this is the delay between when I lift my finger off and when the backgroundColor gets changed.
tableview.addEventListener('click', function(e) {
...
else if (e.rowData.id == 3) { // scan history
e.row.backgroundColor = 'blue';
This appears to be the way others have done it: http://developer.appcelerator.com/question/124359/android---tableviews-deselectrow
And if I was just using android and not Titanium: How can I highlight the table row on click ?
Try this instead. The touch start is called immediately, while the click usually is not. Note that according to the docs a scroll event and a touch event cant happen concurrently for iOS and Android, so you probably want to handle the touchcancel event also if you have a `touchstart`` listener.
tableview.addEventListener('touchstart', function(e) {
...
// Get the source row, and then get its id
else if (e.source.id == 3) { // scan history
e.row.backgroundColor = 'blue';
});
EDIT:
Maybe a better way to do this would be to handle the touchend event. This would handle bothe the quick taps, the user sliding to a different row, and the scrolling edge cases.
When creating your row, use:
selectionStyle : "NONE"
This prevents it from changing color on click/touch
And roll your own event listeners to govern exactly when your row is highlighted.
The iOS blue row selection color is something like: "#006EF1"

Custom Dialog at the location of the button clicked on the ListView

- Previously i have done showing off the custom Dialog on the clicking of the button on the ListView, but that was at a static location.
- Now i want to display the Dialog dynamically on the location of the button click on the ListView.
- I am not sure about how to find the location of the button on the Screen, cause the click is absorbed by the button, so i can't get the click transferred to the Screen.
- Even if onTouch is implemented, i am not sure about how to find the location of the button which is being clicked on the ListView, cause the click is being absorbed by the button and ListView won't receive it.
- So please help me find out the solution to this tricky situation.
Try to insert the button click listener in the Adapter of ListView, or insert the Object one parameter and insert here when the button is touch and onClickListener get the Object and verify the parameter.

Categories

Resources