In this webinar deck Tom Opgenorth dives into what’s new in Android 8 Oreo and shows how to add the latest features – like Picture-in-picture, notification channels, downloadable fonts, and more – to your apps, 100% in .NET and Visual Studio. Whether you’re building new or updating existing Xamarin.Android apps, you’ll get the step-by-step demos, code samples, and expert tips you need to start shipping Android 8 Oreo-ready apps to your users immediately.
Watch webinar at https://youtu.be/qEW6AyUdnKw
35. bool EnterPictureInPictureMode(PictureInPictureParams @params);
public class Builder
{
public Builder();
public PictureInPictureParams Build();
public PictureInPictureParams.Builder SetActions(IList<RemoteAction> actions);
public PictureInPictureParams.Builder SetAspectRatio(Rational aspectRatio);
public PictureInPictureParams.Builder SetSourceRectHint (Rect launchBounds);
}
36. public override void OnPictureInPictureModeChanged(bool isInPictureInPictureMode,
Configuration newConfig)
{
base.OnPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
if (isInPictureInPictureMode)
{
// Hide the controls in picture-in-picture mode.
}
else
{
// Restore fullscreen UI.
}
}
46. <TextView
android:text="The quick brown fox jumped over the lazy dog.“
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
52. FontRequest request = new FontRequest(
"com.google.android.gms.fonts",
"com.google.android.gms",
query,
Resource.Array.com_google_android_gms_fonts_certs);
53. class FontRequestCallbackImpl : FontsContractCompat.FontRequestCallback
{
public override void OnTypefaceRetrieved(Android.Graphics.Typeface typeface)
{
// Font downloaded - do something with the typeface
}
public override void OnTypefaceRequestFailed(int reason)
{
// Download failed - react to the failure
}
}
57. // Use downloadable fonts for EmojiCompat
var fontRequest = new FontRequest("com.google.android.gms.fonts",
"com.google.android.gms",
"Noto Color Emoji Compat",
Resource.Array.com_google_android_gms_fonts_certs);
EmojiCompat.Config config = new FontRequestEmojiCompatConfig(this, fontRequest)
.SetReplaceAll(true)
.RegisterInitCallback(new InitCallbackImpl());
EmojiCompat.Init(config);
// OR, if using the bundled EmojiCompat package:
EmojiCompat.Config config = new BundledEmojiCompatConfig(this);
EmojiCompat.Init(config);