Sencha Touch - Windows Phone 8 Phonegap Application Bar not hiding on back button click - windows-phone-7

We are developing an hybrid mobile application using Sencha touch 2 for Windows Phone 8.
While developing we noticed that for a number field in windows phone 8 there is no keyboard done button available.Please refer to the below screenshot.
We then decided to write a custom application bar in Windows Phone 8 - Phonegap application inside the MainPage.cs with an Done button inside that application bar.Please refer to the below screenshot.
Now the done functionality works fine but when we click on the back button of the device the keyboard hides but the application bar remains in the view as in the below screenshot
We tried overriding the back button functionality in phonegap, but when the keyboard is shown the back button click is fired only the second click ,the first click hides the keyboard and the second click fires the overridden function.
Can someone provide some alternatives or a solution on how to hide the custom application bar along with the keyboard when the back button is clicked the first time ?

In MainPage.xaml.cs add listener mentioned below which listens the event when back button is pressed in device when keypad is opened.
And pass a string from java script when ur calling particular plugin to show the application bar contains done button, by using that you can identify in which case you have to show and other case you can hide the bar.
cordova.exec(null, null, "Cordova.Extension.Commands.DoneButtonPlugin", "keyboardDoneShow", "Num");
cordova.exec(null, null, "Cordova.Extension.Commands.DoneButtonPlugin", "keyboardDoneHide", "input string");
private void CordovaView_LayoutUpdated(object sender, EventArgs e)
{
if (CordovaView.Content.DesiredSize.Height == 0)
{
if(App.appBar.IsVisible)
App.HideShell();
}
else
{
if (App.NumKey == "\"Num\"") {
if(!App.appBar.IsVisible)
App.ShowShell();
}
}
}

Related

I can't click Webbrowser's Mobile Element

I want to click one but I couldn't click it with my standard code. You need to press F12 and select mobile emulator to see this mobile version of website. After then you can click button manually but you can't click it programmatically. I can't use API so I need to do it with web elements.
This is my standard code;
For Each obj1 In WebBrowser1.Document.GetElementsByTagName("div")
If (obj1.GetAttribute("class") = "_o5rm6 coreSpriteCameraInactive") Then
obj1.Click: Exit For
End If
Next
This is the button where I want to click:

Windows 10 UWP app - Back button only works when pressed the second time

I am developing a Windows 10 UWP app with Visual Studio 2015. I am working on the back button functionality right now. Unfortunately there is a problem. When I press the back button (either on a Phone or on the PC) it doesn't go back to the previous page. When I press it again it works.
It is like this example:
Start App (page 1)
Go to page 2
Go to page 3
Click back button (nothing happens)
Click back button (it goes to page 2)
Click back button (it goes to page 1)
So the first time when you want to go back it needs two presses... why? Additionally I've found out that the first press doesn't trigger the back button event. But why?
I am using the implementation as described in this article:
http://www.wintellect.com/devcenter/jprosise/handling-the-back-button-in-windows-10-uwp-apps
It has to do with SplitView staying open and holding the back event. You should close it if you are using it as overlay.
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
this.SplitView.IsPaneOpen = false;
Frame.Navigate(typeof(SettingsPage));
}

Display custom Windows phone dialog

I'm developing a windows phone app and I want to pop up a dialog when a button is clicked.That dialog will be custom and contain some information. In android it is simple, could I do it in windows phone?
You can make use of popup control create a UI element of your need and add as child to the popup window and make the isopen property to true to show the dialog. For more information look here http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup%28v=vs.95%29.aspx

What is the hype around the Windows Phone 8 back button?

I know how to implement the back button. My question is about the desired behaviour (as I experienced there is a hype around it that the good implementation of back button is required to sell the app in the store).
There is the official source:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402536(v=vs.105).aspx#BKMK_BackButton
But I have never used a WP8 for more than 5 minutes. I understood that the "Windows" button/key is the same as android home and ios home buttons. Is it true, that the WP8 back should be the same as the android back? (Briefly navigate back through pages (screens/activities), dismiss alerts or cancel confirm popups, or if it is the first/only/final page/activity, the app should exit.)
As I experienced, there is a long-press on the back button, which brings up the app switcher (~ios double home). Is it true that I should not take care about of this button? Is the default behavoiur the same for the remaining buttons (windows, power off, camera (half and full), search)? Should I override them? Can I override them (I think I can use camera, but can I use volume controls for other purposes)?
The certification requirements lay out what the back button should do pretty well. In short, it sounds like how you described the Android back button - here are the relevant requirements:
(5.2.4.1) Pressing the Back button must return the app to the previous page or return to any previous page within the back stack.
(5.2.4.2) Pressing the Back button from the first screen of an app must close the app.
(5.2.4.3) If the current page displays a context menu or a dialog, the pressing of the Back button must close the menu or dialog and return the user to the screen where the context menu or dialog box was opened.
You don't have to handle triggering the long-press, nor do you need to handle navigation specifically (assuming you're using the NavigationService for page navigation.)
You can definitely override the camera button, but search, power, and volume are off limits.

Pressing the device's back button do we have to close the Message box and cancel the backwards navigation too in WP7?

In the Certification guidelines 5.2.4 C they mentioned that if the current page displays a context menu or a dialog, the pressing of the Back button must close the menu or dialog and cancel the backward navigation to the previous page.
Is this applicable for MessageBox also?
I am using MessageBox to prompt the user to allow the location service api to use location i.e. lat and long which is in application launching.
Do I have to follow the 5.2.4 C for the MessageBox too be closed and stop back navigation.
Please guide me for standard way to implement so not to fail in Windows phone 7 Certification process.
4.Check the Back button Twice:
protected override void OnBackKeyPress( System.ComponentModel.CancelEventArgs e )
{
if (DemoPopup.isOpen)
{
e.Cancel = true;
//hide the popup
DemoPopup.IsOpen = false;
}
else
{
base.OnBackKeyPress(e);
}
}
Yes, if you have a Message Box displayed (or a Context Menu) then pressing the back button should dismiss the Message Box instead of navigating backwards, i.e. backwards navigation should not occur.
However, in the case of MessageBox.Show and ContextMenu (from the Silverlight Toolkit), I think this happens for you automatically.

Resources