AppCompat support in MVVMCross Android splash screen

As it’s mentioned in MVVMCross documentation Android is quite specific in terms of navigation requirements. The entry point is statically indicated by MainLauncher = true attribute parameter on the activity. On rest of the platforms, specifically on iOS, this can be done dynamically by implementing IMvxAppStart class for registration in MvxApplication.Initialize().

To achieve this MVVMCross introduce a special lightweight type of activity - IMvxAndroidSplashScreenActivity. Unfortunately the default implementation does not support the features from MvvmCross.Droid.Support.V7.AppCompat like vector images or material design themes.

The workaround is pretty straightforward. MvxSplashScreenActivity can be rewritten to derive from MvxAppCompatActivity instead of MvxActivity:

public abstract class MvxSplashScreenAppCompatActivity
  : MvxAppCompatActivity<MvxNullViewModel>, IMvxAndroidSplashScreenActivity
      // ...

For rest of the code see the original class.

Happy coding!

Marek Mierzwa

Marek Mierzwa
Husband, father, spiritual journeyman and in the meantime a software developer

Enterprise patterns for configuration in Xamarin app. Part 2: Managing dependencies

In [last post]({% post_url 2017/2017-12-02-enterprise-patterns-for-configuration-in-xamarin-app-part-1 %}) I described how to cope, in so...… Continue reading