How to add UIAccessibilityTraitHeader properly? - accessibility

I am working with objective-c/swift and interface builder trying to make my application navigation accessible. I cannot figure out how to get my header to work when you use the accessibility rotor and select "headings." My heading title is set in Interface Builder (IB). Within IB its set in a Navigation Bar > UINavigationItem > Title attribute. I think what I want to do is find a way to add the UIAccessibilityTraitHeader to the UINavigationItem, but you cant do that in IB. I also tried making an outlet then adding the trait manually in viewDidLoad method. This is not working. If anybody could help that would be great!
#IBOutlet weak var menuTitle: UINavigationItem!
override dynamic func viewDidLoad() {
self.menuTitle.accessibilityTraits |= UIAccessibilityTraitHeader;
}

I found out this is a defect with the iOS Simulator (X-Code 6.2). It does not show "Headers" as a trait. It worked fine when I loaded it onto a device and tested it.

Related

Unable to override OnApplyTemplate

I'm trying to override the NavigationView behavior:
public partial class CustomizableNavigationView : NavigationView
{
public CustomizableNavigationView()
{
// This gets called
}
protected override void OnApplyTemplate()
{
// This doesn't
}
}
It works on UWP, but not on Android. On Android, it doesn't call OnApplyTemplate and the screen remains blank, there's not content. Questions:
Why doesn't OnApplyTemplate get called on Android? I see that here: https://platform.uno/docs/articles/implemented/windows-ui-xaml-frameworkelement.html it says OnApplyTemplate() is on all platforms
There's no error or anything displayed in the Output panne in VS while running with debugger. Should there be any in this case? Do I need to enable something to log errors?
I noticed that if I don't use partial it gaves me error saying partial is required. This is required only on Android, why is that? A more in-depth explanation would help a lot to understand how things work.
Once I figure out why OnApplyTemplate is not called, I want to do this:
base.OnApplyTemplate();
var settingsItem = (NavigationViewItem)GetTemplateChild("SettingsNavPaneItem");
settingsItem.Content = "Custom text";
My hunch is this won't work on Android. Am I correct? :)
Jerome's answer explains why OnApplyTemplate() was not getting called, to address your other questions:
You can configure logging filters for Uno, this is normally defined in App.xaml.cs. Warnings should be logged by default.
The partial is required because Uno does some code-gen behind the scenes to create plumbing methods used by the Xamarin runtime. Specifically because the control is ultimately inheriting from ViewGroup on Android, it's a native object, and requires special constructors that are used only by Xamarin's interop layer. There's some documentation in progress on this.
Try it and see. :) GetTemplateChild() is supported, and setting ContentControl.Content in this way is supported, so I would expect it to work.
At current version (1.45 and below), the application of styles is behaving differently from UWP. We're keeping track of this in this issue.
The gist of the issue is that Uno resolves the style using the current type and not DefaultStyleKey, and cannot find an implicit style for CustomizableNavigationView.
A workaround for this is to either create a named style from the default NavigationView style, or create an implicit style that uses CustomizableNavigationView as the TargetType instead of NavigationView.

How to implement transition between two PageRow in leanback BrowseFragment?

I'm using a leanback BrowseFragment to implement a simple android tv app. I have two PageRows which are backed by custom fragments. When I switch between the two in the browse navigation area, the content side of the screen goes blank briefly before the new fragment's views appear. How can I fade from one view to the other without a delay in between?
I see some references to "entrance transition" in the docs which I think is what I need, but I can't find any examples of what to do in those callbacks.
https://developer.android.com/reference/android/support/v17/leanback/app/BrowseFragment.MainFragmentAdapter.html#setEntranceTransitionState(boolean)
I tried to implement setEntranceTransitionState on my PageRow Fragment's MainFragmentAdapter, but it is never invoked:
class GuideFragment: Fragment(), BrowseFragment.MainFragmentAdapterProvider {
val fragmentAdapter = object: BrowseFragment.MainFragmentAdapter<GuideFragment>(this) {
override fun setEntranceTransitionState(state: Boolean) {
Log.v("TEST", "setEntrance($state)")
fragment.setEntranceTransitionState(state)
}
}
override fun getMainFragmentAdapter() = fragmentAdapter
}
There is no way to do this when using BrowseSupportFragment.
If you look at the implementation of swapToMainFragment(), you'll see that while scrolling the content is set to an empty fragment. When SCROLL_STATE_IDLE is reached, a regular fragment transaction is used to replace the child fragment with the new content.
leanback has a lot of limitations, It is better to fork the official code and create your own repo and modify it; we did the same in our app.

MvvmCross UINavigationController customise navigationBar

Further to my experiences with MvvmCross, I've managed to build an app for iPhone which starts with a TabBarController. I can also successfully navigate within each tab to deeper levels. The problems start when I want to customise the navigationBar on the deeper levels - setting the backButton colours, etc. The code I use for navigation is the standard viewModel code -
this.RequestNavigate<InJourneyViewModel>();
…which works fine, but I can't do anything to the navigated-to view's navBar, other than set its title.
Any thoughts or advice appreciated!
I think it might help if you posted some more of your code that is failing.
My suspicion is that the problem is a more generic Cocoa, MonoTouch and/or backbarbutton problem.
I've just played with the ViewDidLoad code in MapView.cs in https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20CirriousConference/Cirrious.Conference.UI.Touch
At the end of this, I was able to add some bar button changes like:
var leftButton = new UIBarButtonItem("FooBar", UIBarButtonItemStyle.Bordered, null);
leftButton.TintColor = UIColor.Green;
NavigationItem.SetLeftBarButtonItem(leftButton, false);
NavigationItem.RightBarButtonItem.TintColor = UIColor.Red;
Which resulted in:
Alternatively, by placing code in the WelcomeView:
var leftButton = new UIBarButtonItem("FooBar", UIBarButtonItemStyle.Bordered, null);
leftButton.TintColor = UIColor.Green;
NavigationItem.BackBarButton = leftButton;
Then I succeed in achieving:
Alternatively, by using code like:
UIBarButtonItem.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.Blue;
Then this enabled me to customise all the navigation bar buttons like:
At one point, I also managed to achieve:
... but sadly I've genuinely no idea which code combo gave me that! If your problem is with back buttons in particular, then I think you will need to dig around other questions and/or post some code and hope someone can help - there's lots of posts about how to do this, but I can't quite figure out what they all mean for MonoTouch - e.g. Separate title in NavigationBar and navigation buttons

How to change the state in Adobe Flex, using ActionScript?

I`m really new to Flex and ActionScript so please be patient with me.
I want to implement this script: tinyurl.com/yafqrqb
...that is doing this "magic" : tinyurl.com/y9qg32r
...but I want to tweak it a little on InfoWindowTabbedComponent. To be more precisely I`m trying to insert links in that tabs, and when you click one the state will change.
You can see my custom InfoWindowTabbedComponent at the end of the post As you can see, right now I have 2 functions that open url`s.
What I`m trying to do is to change this:
var adobeURL:URLRequest = new URLRequest("http://www.microsoft.com" );
navigateToURL(adobeURL, "_self");
Into something that change the current state.
Can you please help me?
Here`s my custom InfoWindowTabbedComponent: http://pastebin.com/f387bc3b9
I'm not sure I understand what you want to do. If you just want to set the selected Tab, instead of calling navigateToURL() set myTabNavigator.selectedIndex (or selectedChild)
If you really want to change the state, each component has a currentState property, but then you would have to define the states first (via the tag)
And if you really want to navigateToURL() you could navigate to javascript:somefunction() and then set the application state via ExternalInterface, but that would be horribly circumstantial.
Cheers,
Jörg

How print Flex components in FireFox3?

Thanks to FireFox's buggy implementation of ActiveX components (it really should take an image of them when printing) Flex components (in our case charts) don't print in FX.
They print fine in IE7, even IE6.
We need these charts to print, but they also have dynamic content. I don't really want to draw them again as images when the user prints - the Flex component should do it.
We've found a potential workaround, but unfortunately it doesn't work in FireFox3 (in FireFox2 it sort-of works, but not well enough).
Anyone know a workaround?
Using the ACPrintManager I was able to get firefox 3 to print perfectly!
The one thing I had to add to the example was to check if stage was null, and callLater if the stage was null.
private function initPrint():void {
//if we don't have a stage, wait until the next frame and try again
if ( stage == null ) {
callLater(initPrint);
return;
}
PrintManager.init(stage);
var data:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
data.draw(myDataGrid);
PrintManager.setPrintableContent(data);
}
Thanks. A load of callLater-s added to our custom chart code seems to have done it.

Resources