ViewModel and leanback fragments - android-tv

How can I use android.arch.lifecycle.ViewModel with leanback fragments? For example GuidedStepFragment extends android.app.Fragment which cannot be used in ViewModel instance creation via ViewModelProviders.of(fragment).get(viewModelClass) because method ViewModelProviders.of requires android.support.v4.app.Fragment.
Am I something missing or ViewModel can't be used for leanback fragments?
Leanback developers, hello? Why are you extending android.app.Fragment instead of android.support.v4.app.Fragment?

There is GuidedStepSupportFragment (extends android.support.v4.app.Fragment) in leanback starting from 27.1.0

Related

PRISM - CustomRenderer for NavigationPage

I would like to ask if creating a custom renderer for NavigationPage would override Prism's NavigationService? since as per CustomPageTransition Prism uses Xamarin's built-in PushAsync/PopAsync -- correct me if I am wrong, this is the Navigation.PushAsync(page) right?
Thanks!

What is the proper way to create control in Xamarin Form PCL?

What is the proper way to create control in Xamarin Form PCL?
In my class library I have "control" class not derived from any View, just a layout with some labels, scrollviews, logic etc.
I am using it in my pages in the same PLC in several places.
My question is - what is the proper way to wrap this "control" and use it in PLC pages?
I ended up having this control class to expose its root layout where I add all the child elements and subsequently add this layout to the children of page layout. This makes this class to be some sort of a builder of a part of UI of a page.
It looks like that using "View" as a base class requires me to add custom renderers to Android and iOS projects
which I don't need to do - all my UI functionality fits into PCL withot the need for any custom work.
I have a feeling that I am not doing it the right way.
Advise and/or link to the documentation on how to properly do it will be greatly appreciated.
It seems to me that you're actually hurting yourself by not wanting to use a View as a base class. I commonly use ContentView as a base class to create my own controls and it works great without the need for a custom renderer since ContentView already has its own renderers in iOS and Android. Something like this should do the trick.
public class MyContentView : ContentView
{
private Layout createLayout();
public MyContentView()
{
Content = createLayout();
}
}

In a tabpage GUI Extension, what does the ext:pagetype node do?

I have a GUI Extension adding a Tab (ext:tabpage) to View.
What does the ext:pagetype node do? I have been using Namespace:Name like the following. Are there other options for the value?
<ext:pagetype>RC.TabExtension</ext:pagetype>
It allows you to have a specific JavaScript implementation for that tab.
If you specify the full name of a JavaScript class and it implements the Tridion.Controls.DeckPage interface, it will use that implementation for the tab.
If it's not a class or it doesn't implement the interface, it will just use the default implementation.
(Tabs inherit from Decks, in case you are wondering)

MVVM Light Global Message registration?

I am using MVVM light to build my application and so far it has given excellent results. but I have this one small issue that i need to resolve.
Is there a way to globally register message listeners for each View model before they are initiated by the view. Something like a GlobalMessageRegistrationClass() ?
If you are using the MVVM Light tool kit, then you have to create a base Videmodel class which should be inherited from the MVVM Light tool kit class "ViewModelbase". Then all your view model class should be inherited from your custom viewmodel base class instead of MVVM light tool kit base class "ViewModelbase". In constructor of custom view model base class you can register for messages.

How to hack private static field in Flex?

Is there a way to change private static field of an alien class?
For example:
package mx.managers {
public class TooltipManager ... {
private static var _impl:IToolTipManager2; // <- assign my own value here
...
}
}
In Java it is possible to do it using Reflection API. What about Flex?
No, that is not possible.
If you are looking into changing the implementation of the TooltipManager, have a look at the Singleton class in the Flex SDK. You'll need to create a custom implementation and register it via the Singleton class before the application initializes. The best is to override the application preloader and do the registration there.
Well, if you feel like you can handle the extra responsibility, you can monkey patch the class by copying the source into your own source tree with the same package and apply the necessary modifications. That way the flex compiler will use your implementation rather than the SDK implementation.
This technique is sometimes used as a last resort to fix issues which cannot be fixed otherwise. Drawbacks include issues such as forwards compatibility and unintended side effects in the same or other classes dependant on the class your editing.

Resources