Is there a way to start a gwt-app in fullscreen mode (without toolbar, navigation)?
I found only a hint to open a new window:
Window.open("SOMEURL","SOMETITLE",
"fullscreen=yes,hotkeys=no,scrollbars=no,location=no,menubar=no,status=no,
toolbar=no,resizable=no");
Is this the only way?
If yes, what's the best way to use the "Window.open" (Example)?
This works for me:
private native void requestFullscreen() /*-{
var element = $doc.documentElement;
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}-*/;
This isn't really a GWT question - this is a browser-provided API that GWT happens to wrap for you.
It's worth noting that modern browsers have a tendency to ignore some or all of these flags. For example, good luck getting Chrome to hide its address bar. The reason for this is that if they honoured all of the flags, you could write a web app which looked exactly like a desktop app and the user wouldn't know it - which is exactly what you sound like you're trying to do!
or use https://github.com/wokier/gwt-fullscreen
Caffeinate response has been used as a basis. I also added an event to be notified of fullscreen state change.
Related
Mobile keyboard (Android IPhone) has no tab button. That is why native application go to next field when enter is pressed. However browser forms are submitted when enter is pressed.
How can I solve this problem?
Use tabindex properly and it should work just like with native applications.
By the way, on Android at least, native apps don't have to do anything special to get this behavior (at most they have to specify nextFocusForward, if the layout is too complicated and Android can't figure that out by itself).
I assume you're talking about the on-screen keyboard. iPhone will show Previous | Next as a keyboard accessory in web forms. Android will too.
If they don't then something might be wrong with your markup. Is it possible for you to post your form HTML code?
I would also say that nLL's suggestion is correct. It will make it feel more polished.
since you are targeting high-end phones you can handle enter key with simple JavaScript
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode
//Do something
}
I'm having a strange problem while debugging my Blackberry Application on a real device (BB Bold 9700). When I debug the same application within the BB emulator, the app runs fine, but when I run it on the real device, the app behaves differently (custom painting goes completely wrong). What's even worse is that my Eclipse environment seems to be unable to view live objects correctly while being at a break point (debug time).
I've added a screenshot to illustrate the strange behaviour:
As you can see, the app stops at the breakpoint within the IF statement, but the Variables pane says that the variable "methodName" equals null. Moreover, when I want to look at the variable "methodArguments" which is of type org.json.me.JSONArray, it says "details unavailable - not supported by VM".
Does anyone know what's going on here? My app works great on the emulator, but it's currently useless on the real device.
Thanks in advance!
I think I fixed it:
The problem was that I was laying out Fields on a manager that wasn't yet added to the viewstack.
What did the trick for me was overriding onDisplay() in the manager that contained the Fields that were displayed wrong:
protected void onDisplay()
{
//Make sure superclass is called
super.onDisplay();
/*You have to call "this.setDirty(true)" when you perform layout on a
*manager that isn't added to the viewstack. Then you can use
*"this.isDirty()" to determine whether you need to re-layout the fields
*when the manager becomes visible.*/
if(this.isDirty())
{
//I'm not sure if I need to use "invokeAndWait" and not "invokeLater"
UiApplication.getUiApplication().invokeAndWait(new Runnable()
{
public void run()
{
for (int i = 0; i < getFieldCount(); i++)
{
/*This (custom) function makes sure the Field gets its
*size and position*/
layoutItem(getField(i));
}
}
});
//Make sure you set "dirty" to false, to make sure this only happens once
this.setDirty(false);
}
}
If anyone has a better solution, I'd be glad to hear it (and maybe improve my app).
org.json.me.JSONArray, it says "details unavailable - not supported by VM".
the JSON related stuff is not available on device running 4.5 and 4.6 BB OS. Import it into the code.
Download it from here.
https://github.com/douglascrockford/JSON-java
it is available as Open Source and then use it into your applications.
I want to give the user the possibility to change the language in my app.
The way to do this is described here, in monotouch code to set the preferred language to Dutch and alternate language to English:
NSUserDefaults.StandardUserDefaults.SetValueForKey
(NSArray.FromStrings("nl", "en"), new NSString("AppleLanguages"));
You have to restart the application before this will take effect. But on the iPhone 4 the app does not restart when you close it, it is just hidden. Is there a way to force an app to restart after closing?
Thanks Dimitris. So changing the language at runtime is not that simple.
I found a solution which works in my case:
When the user changes the language I use the solution described by Mauro Delrio in "How to force NSLocalizedString to use a specific language". In monotouch:
string newLanguage = "nl";
myBundle = NSBundle.FromPath(NSBundle.MainBundle.PathForResource(newLanguage, "lproj"));
All strings will now be loaded in the selected language with myBundle.LocalizedString(...). Of course, everything which was already printed on a view is not yet translated. But I found an easy way to reset all views. In my app I use a MainTabController which looks like this:
public class MainTabBarController : UITabBarController
{
public override void ViewDidLoad()
{
Reset();
SelectedIndex = 2;
}
public void Reset()
{
ViewControllers = new UIViewController[]
{
new ViewControllerTab1(),
new ViewControllerTab2(),
new ViewControllerTab3(),
new ViewControllerTab4(),
new ViewControllerTab5()
};
}
}
So all I have to do is call Reset like:
((AppDelegate)UIApplication.SharedApplication.Delegate).MainTabBarController.Reset();
All current views are disposed and re-created in the correct language. Seems like a trick, but it is perfectly legal and documented, see Apple documentation for MainTabBarController viewControllers property. It even activates the same tab index as the one which was active, so for the user it seems that nothing but the language is changed.
Of course, any unsaved data in all views is lost, so if this is a problem, you have to find a way to save this before resetting.
No there is no way to restart an app. You can only force it to terminate when the users presses the home button by setting the property "UIApplicationExitsOnSuspend" in your Info.plist file to true.
The trick to use specific language by selecting it from the app is to force the NSLocalizedString to use specific bundle depending on the selected language ,
here is the post i have written for this http://learning-ios.blogspot.com/2011/04/advance-localization-in-ios-apps.html
and here is the code of one sample app https://github.com/object2dot0/Advance-Localization-in-ios-apps
As an additional note, to force the UIBarButtonSystemItem to change their locale, you have to add
<key>CFBundleDevelopmentRegion</key>
<string>nl</string>
to your info.plist. Just fire up TextEdit and place it somewhere. Hope this helps!
I would reduce the time to get special characters when keeping a touch on the keyboard. Anyone has a clue?
Thanks.
(Undocumented) Override -[UIKeyboardImpl touchLongPressTimer] to call
-(void)touchLongPressTimer {
[self touchLongPressTimerWithDelay:0.5f]; // default = 1.8125f
}
I strongly doubt this is possible using the public API. You'd have a file bug with Apple to ask them to make this possible. It does however seem unlikely, as it would result in differing behavior between apps in a common control.
You could write your own keyboard control for your own app :)
I'm using jQTouch to develop a version of a website optimized for safari on the iphone. The jQTouch demo helpfully shows how to show an "install this" message for users not using full screen mode and hide it for those who are. When in fullscreen mode, the body should have the class "fullscreen." So you can hide the "install this" message for people who have already added your app to their home page by adding this css rule to your stylesheet:
body.fullscreen #home .info {
display: none;
}
What I'd like to do is require users to use the app in fullscreen mode only. When viewed from the regular browser, they should only see a message asking them to install the app. That message should of course be hidden otherwise.
This ought to be really, really easy, so I must just be missing something obvious.
I thought one way to do this would be to simply test for the class "fullscreen" on the body: if it's not there, use goTo to get to another div, or hide the other divs, or something like that.
Strangely, however, this doesn't work. As a test, I've still got the original "info" message, as in the jQTouch demo, and it doesn't show up when I launch in fullscreen mode. So the body must have the fullscreen class. And yet I can't find any other trace of it: when I put this alert to test things after the document has loaded, I get nothing when launching in fullscreen mode:
alert($("body").attr("class"));
I also thought I might test for fullscreen mode by checking for the value of the fullScreen boolean. But this doesn't seem to work either. What am I missing? What is the best way to do this?
Well, I couldn't figure out why the standard way wasn't working, but someone on the jQTouch Google Group suggested this, which works:
if (window.navigator.standalone) {
alert ('Thanks for launching this app your home screen')
} else {
alert('Add this app to your home screen for the best experience')
}