I have a couple of UITextFields and a UISearchBar in my app that all have a ResignFirstResponder() on it so the keyboard would go away if the user touch the done/search button on the keyboard.
Now on the iPhone 3/4 versions everything works just fine on release. But on the iPhone 5 some of the controls just don't respond when clicking on them on release. If I debug on the iPhone 5 everything works just fine but in release mode it won't work.
Anybody got any tips/solutions? Xamarin products are all from the latest version.
-- Added code
The following part of the code the iPhone 5 is going wrong.
searchProducts = UISearchBar
searchProducts.ShouldEndEditing += delegate {
searchProducts.ResignFirstResponder();
return false;
};
If I comment this part of the code everything is working just fine (only the search button on the keyboard won't work).
Fixed it to find the UITextField in UISearchBar and on that preform ResignFirstResponder.
searchProducts == UISearchBar
foreach (var item in searchProducts.Subviews)
{
if(item is UITextField){
var tf = item as UITextField;
tf.ResignFirstResponder();
}
}
Related
Ok, so I'm just getting started with adaptive cards and downloaded the PNP ACE project (Git Hub Link) to use as a jumping off point. Started the project up and ran gulp serve.... everything seemed great.... until I tried to click either the View Items or Add Item buttons on the CardView. Both of these buttons fire QuickViews, but when you click them nothing happened. Tried 2 different browsers, no errors registered in the console, it just acts like there isn't an action tied to the buttons.
So, thinking "well maybe something got screwed up in a commit", I started a brand new project using yeoman.
Got the project set up, building and served it up; EXACT SAME PROBLEM!! The button in the default ACE project template didn't work either. I can't figure out what gives.
Here is the function for the button that the template created :
public get cardButtons(): [ICardButton] | [ICardButton, ICardButton] | undefined {
return [
{
title: strings.QuickViewButton,
action: {
type: 'QuickView',
parameters: {
view: QUICK_VIEW_REGISTRY_ID
}
}
}
]};
That looks just like the PNP example (and every other example I've seen online). Even the quickViewNavigator is populated the same. Here is the one from the template project (class definitions removed to save space):
const CARD_VIEW_REGISTRY_ID: string = 'JasonAdaptiveTest_CARD_VIEW';
export const QUICK_VIEW_REGISTRY_ID: string = 'JasonAdaptiveTest_QUICK_VIEW';
public onInit(): Promise<void> {
this.state = { };
this.cardNavigator.register(CARD_VIEW_REGISTRY_ID, () => new CardView());
this.quickViewNavigator.register(QUICK_VIEW_REGISTRY_ID, () => new QuickView());
return Promise.resolve();
}
So what gives? Why do these not work? Is there some NPM package that may be missing?
Well, found the line buried in the tutorials that explains my problem. A single note, in a page that isn't necessarily about quick views.
Note
ACE interaction is disabled while in Edit mode. The Workbench or Page must be >in Preview or Read mode to interact with the ACE.
I want to play a notification sound for my Vaadin based website on Android and iOS devices. The notification sound works perfect on desktops. How do I get it to work on mobile devices.
I am using the "Audio" component, with no controls displayed, and just "play" it when I need it. It is a very short sound and small file.
Edit 6/1/2017 ( my current implementation ):
First of all, in the constructor for my very simple form:
barcode.setInputPrompt("Barcode");
barcode.setCaption("Barcode");
barcode.setMaxLength(22);
barcode.setNullRepresentation("");
barcode.setRequired(true);
submit = new Button("Submit");
addComponents(barcode, facilityId, submit );
submit.setStyleName(ValoTheme.BUTTON_PRIMARY);
submit.setClickShortcut(KeyCode.ENTER);
submit.addClickListener(e->this.handleSubmit());
goodScan = new Audio(null, new ThemeResource( "sounds/good-scan.mp3"));
goodScan.setAutoplay(false);
goodScan.setShowControls(false);
badScan = new Audio(null, new ThemeResource( "sounds/bad-scan.mp3"));
badScan.setAutoplay(false);
badScan.setShowControls(false);
addComponents( goodScan, badScan );
Note that I turned auto-play and controls off, so it won't show up on the screen. Actually, at least in my case, the "setShowContrtols(false)" is what hides things, it seems. Later, in my submit method, I have this ( "..." for unrelated code ):
private void submit() {
try {
...
barcode.setValue(null);
barcode.focus();
goodScan.play();
} catch (WMSException e) {
...
Notification.show("Consumption Scan Error", message, Type.ERROR_MESSAGE);
barcode.focus();
badScan.play();
}
...
}
The above works on desktops, but does not work consistently ( if at all ) on Android and iOS devices. I have not dug back into this since the original post because I have had no ideas myself, and people I have asked did not have anything new to offer.
All that said, the above code should work for Vaadin 8 ( knock on wood ), which might help you, Basil.
I have used below code to hide status bar in UWP. When I run the app in development mode in my computer the status bar is not shown in windows phone. I deployed the app in Windows Store, after downloading the app, I see the status bar appears in my app.
Here is my code:
var isAvailable = Windows.Foundation.Metadata.ApiInformation.IsTypePresent(typeof(StatusBar).ToString());
if (isAvailable)
hideBar();
async void hideBar()
{
StatusBar bar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
await bar.HideAsync();
}
The question is, why the above code shouldn't work in windows store?
Also, I have the link to my app App link in windows store, but when i search for exact key word in windows store, my application is not shown in windows store, but clicking in link would appear my app in window store.
Thanks!
Checking for the Contract, rather for the type StatusBar works fine for me.
private async Task InitializeUi()
{
// If we have a phone contract, hide the status bar
if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
{
var statusBar = StatusBar.GetForCurrentView();
await statusBar.HideAsync();
}
}
You have to use FullName instead of ToString():
...
ApiInformation.IsTypePresent(typeof(StatusBar).FullName);
...
This code won't work because after .Net Native compilation (which Store does) typeof(StatusBar).ToString() will not return the literal type name as you expect, but will return something like "EETypeRVA:0x00021968". Use literal string instead (you aren't going to rename StatusBar, right? ;) or use IsApiContractPresent or typeof(StatusBar).FullName (as was already advised).
P.S. The same issue can be reproduced without publishing, just run it using Release configuration.
Could it be that when you compile in Release and with the .NET Native toolchain, the type info gets discarded and so you're not passing the string you think you're passing? Maybe you can try hard-coding the full type name?
In Windows 10 the command is
Window.Current.SetTitleBar(null);
I am creating an app in which snapview should be disabled.I have tried using:
window.addEventListener("resize", onViewStateChanged);
function onViewStateChanged(eventArgs) {
var viewStates = Windows.UI.ViewManagement.ApplicationViewState;
var newViewState = Windows.UI.ViewManagement.ApplicationView.value;
if (newViewState === 2 || newViewState===3) {
showMenu('snapped');
}
}
function showMenu(event) {
//Detect View State
if (event === 'snapped') {
var msg = new Windows.UI.Popups.MessageDialog(
"Resizing Window");
msg.showAsync();
window.innerWidth=screen.width
}
But this doesn't seem to work.Is there anything that i might have missed to disable the snapview.
Thanks
Because you're talking about snapped view, I assume that you're targeting Windows 8.0 and not Windows 8.1. In the latter, the snapped view state was removed in favor of variable-sized views, and in the app manifest you can indicate a minimum width of 500px (the default) or 320px (the former snapped view). Leaving it to 500px will prevent the narrow snapped view altogether.
If you are yet targeting Windows 8.0, there is unfortunately no means to disable snapped view (which is, by the way, why the change happened for 8.1). Apps that cannot effectively operate in the 320px view just display a message to that effect, suggesting to the user that they resize the view to use the app.
I'm developing an applications which I've got running on a server on my linux desktop. Due to the shortcomings of Flash on Linux (read: too hard) I'm developing the (small) flash portion of the app in Windows, which means there's a lot of frustrating back and forth. Now I'm trying to capture the output of the flash portion using flash tracer and that is proving very difficult also. Is there any other way I could monitor the output of trace on linux? Thanks...
Hope this helps too (for the sake of google search i came from):
In order to do trace, you need the debugger version of Flash Player from
http://www.adobe.com/support/flashplayer/downloads.html (look for "debugger" version specifically - they are hard to spot on first look)
Then an mm.cfg file in your home containing
ErrorReportingEnable=1 TraceOutputFileEnable=1 MaxWarnings=50
And then you are good to go - restart the browser. When traces start to fill in, you will find the log file in
~/.macromedia/Flash_Player/Logs/flashlog.txt
Something like
tail ~/.macromedia/Flash_Player/Logs/flashlog.txt -f
Should suffice to follow the trace.
A different and mind-bogglingly simple workaround that I've used for years is to simply create an output module directly within the swf. All this means is a keyboard shortcut that attaches a MovieClip with a textfield. All my traces go to this textfield instead of (or in addition to) the output window. Over the years I've refined it of course, making the window draggable, resizable, etc. But I've never needed any other approach for simple logging, and it's 100% reliable and reusable across all platforms.
[EDIT - response to comment]
There's no alert quite like javascript's alert() function. But using an internal textfield is just this simple:
ACTIONSCRIPT 1 VERSION
(See notes at bottom)
/* import ExternalInterface package */
import flash.external.*;
/* Create a movieclip for the alert. Set an arbitrary (but very high) number for the depth
* since we want the alert in front of everything else.
*/
var alert = this.createEmptyMovieClip("alert", 32000);
/* Create the alert textfield */
var output_txt = alert.createTextField("output_txt", 1, 0, 0, 300, 200);
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
/* Set up drag behaviour */
alert.onPress = function()
{
this.startDrag();
}
alert.onMouseUp = function()
{
stopDrag();
}
/* I was using a button to text EI. You don't need to. */
testEI_btn.onPress = function()
{
output_txt.text = (ExternalInterface.available);
}
Notes: This works fine for AS1, and will translate well into AS2 (best to use strong data-typing if doing so, but not strictly required). It should work in Flash Players 8-10. ExternalInterface was added in Flash 8, so it won't work in previous player versions.
ACTIONSCRIPT 3 VERSION
var output_txt:TextField = new TextField();
addChild(output_txt);
output_txt.text = (String(ExternalInterface.available));
If you want to beef it out a bit:
var alert:Sprite = new Sprite();
var output_txt:TextField = new TextField();
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
output_txt.width = 300;
output_txt.height = 300;
alert.addChild(output_txt);
addChild(alert);
alert.addEventListener(MouseEvent.MOUSE_DOWN, drag);
alert.addEventListener(MouseEvent.MOUSE_UP, stopdrag);
output_txt.text = (String(ExternalInterface.available));
function drag(e:MouseEvent):void
{
var alert:Sprite = e.currentTarget as Sprite;
alert.startDrag();
}
function stopdrag(e:MouseEvent):void
{
var alert:Sprite = e.currentTarget as Sprite;
alert.stopDrag();
}
[/EDIT]
If you only need the trace output at runtime, you can use Firebug in Firefox and then use Flash.external.ExternalInterface to call the console.log() Javascript method provided by Firebug.
I've used that strategy multiple times to a large degree of success.
Thunderbolt is a great logging framework with built-in firebug support.
I use the flex compiler on linux to build actionscript files, [embed(source="file")] for all my assets including images and fonts, I find actionscript development on linux very developer friendly.
Then again, I'm most interested in that flash has become Unix Friendly as aposed to the other way around :)
To implement FlashTracer, head to the following address and be sure you have the latest file. http://www.sephiroth.it/firefox/flashtracer/ . Install it and restart the browser.
Head over to adobe and get the latest flash debugger. Download and install the firefox version as FlashTracer is a firefox addition.
Now that firefox has the latest flash debugger and flash tracer we need to locate mm.cfg
Location on PC: C:\Documents and Settings\username
Inside of mm.cfg should be:
ErrorReportingEnable=1
TraceOutputFileEnable=1
MaxWarnings=100 //Change to your own liking.
Once that is saved, open firefox, head to the flash tracer window by heading to tools > flash tracer. In the panel that pops up there is two icons in the bottom right corner, click the wrench and make sure the path is set to where your log file is being saved. Also check to see that flash tracer is turned on, there is a play/pause button at the bottom.
I currently use this implementation and hope that it works for you. Flash Tracer is a little old, but works with the newest versions of FireFox. I am using it with FireFox 3.0.10.