Progress Dialog causing Virtual Keyboard to not show on WebView - android

I have a weirb bug that is pissing me off.
I have an app that is pretty much only a webview with some extra functionalities, one of them is a Custom Loading Dialog (Extended from the progress dialog) that I show on the onPageStarted call, and dismiss on the onPageFinished call. The problem is, if I do that (show the dialog), the virtual keyboard will only show if the user touch TWO times on a form text box (Html or Javascript Text box on the Webview).
I've tried manually giving focus to the webview, before and after the GUI update by the handler that dismisses the Dialog.
Redrawing the WebView
Not showing the dialog (this works, but I need the dialog)
Anyone have an idea on how to fix that?
Thanks!

Related

Start Activity from Soft Keyboard WITHOUT hiding the soft keyboard

I know this should not be a big challenge but it really drives me insane.
I am developing a simple soft keyboard input method and basically I have added a button to my softkeyboard, by pressing which, a dialog should pop up to prompt user to do some choices.
By far everything is ok about creating and opening the dialog. Since normally a dialog is created and displayed from outside an activity, so a flick solution could be to create a transparent activity which embedded the dialog in it. By doing so, I could easily start a dialog when user click the button on my softkeyboard.
But one tricky problem is: every time user click the button and the dialog (actually a dialog in a transparent activity) displays, it will always make my softkeyboard hide. I just need to start the dialog without any changes to the status of my softkeyboard -- I want my softkeyboard keeps showing when the dialog starts.
Here is a snapshot of Google Keyboard, it has the similar button which display a dialog and the dialog did not hide the keyboard, this is exactly what I want. So please anyone suggest me how to achieve this. Thanks so much.
THey aren't launching an Activity. They're launching a dialog. Which is tricky from an input method because its a service (you have to specify the dialog's window token to make it show) but doable.

How to recenter a dialog vertically?

I'm working on a mobile version of a website and I have a jQuery UI dialog sized at 100% of the screen width and height with text inputs and a textarea in it. When the user presses on an input, it is selected and the phone pushes the dialog up in order to show the keyboard. The problem is that when the user presses out of the input (dis-selecting it), the phone's keyboard disappears and the dialog is still "pushed up." So, what I need to do is recenter the dialog vertically after the keyboard slides back down.
I can add an event handler to the inputs that runs when they are dis-selected, but I'm unsure of how to recenter the dialog vertically.
How can I do this?
I should have done some more searching before asking, because I just stumbled across the solution here: https://stackoverflow.com/a/3060895/1101095
I'll leave the question here in case it helps someone with the same problem. Here's the code from the above solution inside a .blur() handler:
$("input, textarea").blur(function() {
$(".ui-dialog-content").dialog("option", "position", "center"); // resize the (technically all) dialog
});
That fixes the issue!

disable touch focus while loading

I have an android app that uses a glSurfaceView that takes a few sections to load up.
I have onTouchEvent overridden, and I'm trying to disable focus while it loads but setFocusable(false) isn't working.
The problem is if the user taps on the screen before everything loads, the app gets a null and it crashes.
I'd pop up a progress dialog and use an AsyncTask to do the loading of the view. Once the view is loaded you can kill the dialog. Any heavy lifting should not be done on the UI thread anyway.

Android: Dismissing a dialog before displaying another

My application displays alert dialogs in some cases. Also, it is possible for a user to launch my application using the VIEW/SEND intent. The scenario I am considering is, the dialog is visible, the user presses 'Home' & selects my application to View/Share a file.
I would want to dismiss the dialog before beginning with the view/share operation. Although I can maintain which dialog is visible and hide it before the operation begins, I was wondering if there is a conventional/recommended way or API, something like activity.dismissAnyVisibleDialog() that can come in handy.
Thanks a lot,
Akshay
I finally myself maintained which dialog is visible & dismissed it before displaying the next one.
-Akshay
Just close the dialog in the onPause() method (override in your activity).
This way it will be dismissed when the activity is no longer visible i.e if you switch to the home screen.

Showing Keyboard with Android Dialog

I want to show the Android version of a Model Dialog with text input however I think the keyboard will be behind the actual activity since dialogs weren't made to have inputs. Is there any way I can get the keyboard to show in an actual dialog.
I did see this SO question -- however I'd rather not use an Theme.Dialog'ed activity because I feel like an activity would be too heavy for my purposes. How can I show this Model Dialog with the keyboard input in the foreground?
This is what I am talking about:
Who said dialogs aren't made to have inputs?! A dialog can contain anything - text, buttons, progress bars, input fields. Did you try it out? A keyboard resizes your canvas, so there's no "behind"/"front" going on. (Besides, you can always summon the IME on a phone without a QWERTY
keyboard by holding the menu button - even there's a modAl dialog.)
EDIT: If you need proof, just look at the API Demos (App -> Dialog). There's an example for a dialog with text entry. Source code here: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.html (DIALOG_TEXT_ENTRY)

Categories

Resources