SearchableSpinner stops dropping down after implementing touch event - xamarin.android

i have created an android app via xamarin.android. i have two searchable spinners. the first spinner has a vehicle list and the second has a drivers list. the drivers spinner includes the drivers corresponding to the vehicle chosen. so if no vehicle is chosen, no drivers are found in the drivers spinner. for this, i wanted to make something like when no vehicle is chosen and the user clicks on the drivers spinner, a toast is shown to tell him to chose a vehicle first. this one worked. but when the user chooses a vehicle and clicks again on the drivers spinner to choose a driver, the spinner list doesn't drop down. this is the code for the touch event of the drivers spinner:
driver_dropdown.Touch+=Driver_dropdown_Touch;
private void Driver_dropdown_Touch(object sender,View.TouchEventArgs e)
{
if(e.Event.Action==MotionEventActions.Down)
if(vehicle_code=="")
{
Toast.MakeText(this.Context,"choose vehicle first",ToastLength.Long).Show();
}
}
this one works, but when a vehicle is chosen, the drivers spinner doesn't work anymore. note that i fill the drivers spinner on vehicle spinner item selection.
what should i do?
thanks in advance

Related

Progress Indicator during Load Event - is it possible?

Developing Smart Devices in Genexus. I am using the Load Event to load some hundreds of records (returned by a 3rd party webService) into the Grid (some rows might have different layouts).
When the user hits the search button, a ProgressIndicator is immediately shown (during the procedure execution). When the procedure ends (data retrieved), the ProgressIndicator disappears but it may take an additional 4-5 seconds for the Grid to show the fresh data.
This causes the user to think that there was a problem with the search. Then, unexpectedly, the grid refreshes.
Is it possible to, somehow, show a ProgressIndication during the Load or Refresh Events?
Or do you have any suggestions to prevent this behavior?
The main issue is that Refresh and Load events are "server" events in SD architecture so you don't have access to the device's APIs or resources like the Progress Indicator.
We had the same requirement in iOS and what we did was using the GXRefresh event.
Event 'gxrefresh'
Composite
//Your code. Example: ProgressIndicator.Hide()
EndComposite
EndEvent
Gxrefresh is a Local event that is executed after the Refresh and Load. Is a hidden event that helped us accomplish this. (This is not an official event and it can be taken out in any version of GeneXus)
So the solution is:
Start a Progress Indicator on the ClientStart event of that Panel.
Hide the Progress Indicator on the 'gxrefresh' event of that panel.
Note: Remember that in order to use the gxrefresh event you will need to add a hidden button named 'gxrefresh'. You can hide that button as you will not need it in the UI (we put it Visible=false on the application bar).
If that solution for any reason is not possible (for example the gxrefresh event is deprecated or you are developing for Android) I can think of a second WA that is not elegant at all but should work.
Start the Progress Indicator in the Client Start Event of the panel
Put a hidden variable with control type SD Chronometer.
Set the timer for 6 seconds
Stop the Progress Indicator on the Tick event of the SD Chronometer and stop the Chronometer so the Tick event is not executed any more.
These are the two options I can think of.
Maybe there is an easier way but I haven't heard of it. A Grid.DidLoad event would be great for this scenario. For sure we will have this soon or some other solution for this problem.
Links:
SD Chronometer: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?25058
SD Events: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?17042
Server Side Events: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?24234

Using Jquery Mobile dynamically generated dialog box opens multiple times

In a multi page template,I have three category pages (comedy, action, drama) that you can swipe between each containing rows of images (Seinfeld, Modern Family, Family Guy, Big Bang). Clicking on an individual image should open a dialog box (Seinfeld summary), close when you click the close button, and stay close. Initially it works, then what happens is based on the number images click after two, it opens and closes n -1 (clicking the 3rd image, opens the dialog box twice).
what could be the reason behind this?
Without your code I can be sure but I think I understand what is happening to you.
You have a problem with multiple event binding. Because of jQuery Mobile architecture it is possible to bind an event numerous time to some object.
I have an blog ARTICLE on jQuery Mobile page events handling and there's a chapter dedicated to this problem, just search for the chapter Prevent multiple event triggering. Or it can be found HERE.
In few words always unbind event before you bind it to some object to prevent this from happening:
$('#test-button').die('click').live('click', function(e) {
alert('Button click');
});

What is the equivalent of Android Toast in RIM?

In android, there is a function call Toast and it show instantly without involve in time. I tried to use Status in RIM but it must run in the invokeLater and cannot set the time less than 1 second. So it cannot display instantly.
Any other built in that same with Toast or Status?
No there is not afaik. Toast was "invented" in a way by Android.
Previous OS's have used popup boxes with confirmation buttons. A Toast is almost like a popup box with a timer attached to it.
Of course, #Signare gives the common replacement correctly for what you would "normally" do on BlackBerry. Dialog.alert(String)
If you want something more "Androidy", this is something we want to implement at Cobi, but have not gotten around to yet due to time constraints working on client work.
There are 2 unique aspects to a Toast compared to the "old" way of doing things:
the popup only shows for a short time
the popup does not block the user from interacting with the background screen at all
To create the popup screen, look at the PopupScreen class - and you pass in a layout manager of your own that will be displayed.
You could start a timer when the screen is shown (we have not implemented this yet) and that could close the screen for you.
As far as not blocking the user - this is the major difference - and I do not know if it can be done if you use the PopupScreen class. Perhaps if your PopupScreen passes all keypresses through to the underlying screen, this may be possible.
In some of our apps, we have a custom field, defined in our base MainScreen subclass, that can be positioned over the rest of the fields on the screen. This allows the user to continue interacting with the screen while the field is displayed. I cannot share that code at the moment here.

Blackberry Event Handling and Focus Issues

I am having an issue with a small blackberry application where touch events are being processed by 1 of 2 certain fields that has focus.
In my case, I have 2 images, one at the top (first element on the screen) and at the bottom (last element added to the screen. Both are subclasses of the BitmapField. Their purpose is to display a web site when the user taps (clicks with the trackpad/ball).
The issue is when either of these has focus, no matter where the user taps on the screen (i.e. in an EditField, another custom button, or just a part of the background), the BitmapField that has focus consumes the event calls the web browser. This obviously only an issue on the BB Torch simulator, and I building for BB OS 5.0.
I have the BitmapField consuming both navigation clicks and touch events.
Also, any direction on where to get a good (as in not written by RIM) event handling guide for the Blackberry API would be helpful.
UPDATE:
I have tried:
public boolean isFocusable() {
return false;
}
But, ideally I would like this to work on devices such as the Curve and Bold.
UPDATE 2:
There a couple of LabelFields inside layout managers that can receive focus, but they do not cause this issue, it only happens when the BitmapFields have focus.
I'd suggest to create a custom image button field by subclassing from Field. Override paint(Graphics graphics) to draw image and focused border (or background). Then just override navigationClick(int status, int time). The BB UI framework will call that method when user clicks your field on a touch screen. As well it'll work for a non-touch screen devices. As a great benefit - you will not need to bother yourself with TouchEvents at all.
Make sure that on the touchEvent() you are checking the location of the touch. If it is outside of your BitmapField's extent, you should be returning super.touchEvent(message). Regardless of where the touch is, when a field has focus it is sent to it first to determine if it should be handling it at all.

detecting notificationbox close event - firefox addons

We are using to display custom notifications for a
Firefox addon. All is good, except that we also need to do some custom
cleanup activity when the user presses the red [x] button (in Windows)
on the right side of our notification bar to close it (or technically
"hide" it).
That said, what would be the best way to detect or get an indication
that the user has pressed the red [x] button to close/hide the
notification?
There is this event AlertClose as the document say but how to handle it?
i tried this but no effect..
notificationobj.addEventListener('AlertClose',function() { alert('closed'); },false)
The bad news is the "AlertClose" is only fired in Firefox Mobile. We should move the event to the toolkit so all apps get the support. I don't have any good ideas, except using a DOM mutation event to watch for "DOMNodeRemoved".

Resources