Upload
xamarin
View
140
Download
1
Embed Size (px)
Citation preview
dependencies {
...
compile “com.android.support:support-emoji:27.0.0”
}
developer.android.com
developer.android.com
developer.android.com
developer.android.com
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
developer.android.com
developer.android.com
public const string PRIMARY_CHANNEL_ID = "default";
var chan1 = new NotificationChannel(
PRIMARY_CHANNEL_ID,channelName,
NotificationImportance.Default);
var channelName = GetString(Resource.String.noti_channel_default);
chan1.LightColor = Color.Green;chan1.LockscreenVisibility = NotificationVisibility.Private;
manager.CreateNotificationChannel(chan1);
var manager = (NotificationManager)GetSystemService(NotificationService);
var notificationBuilder= new Notification.Builder(ApplicationContext, PRIMARY_CHANNEL_ID).SetContentTitle(title).SetContentText(body).SetSmallIcon(smallIcon).SetAutoCancel(true);
var manager = (NotificationManager)GetSystemService(NotificationService);
manager.Notify(notificationId, notificationBuilder.Build();
public const string PRIMARY_CHANNEL_ID = "default";
developer.android.com/guide/components/broadcast-exceptions.html
developer.android.com
[Activity(Label = "PictureInPicture",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize |
ConfigChanges.SmallestScreenSize |
ConfigChanges.ScreenLayout |
ConfigChanges.Orientation,
SupportsPictureInPicture = true)]public class MainActivity : AppCompatActivity{
}
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);}
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.
}}
protected override void OnUserLeaveHint(){
if (iWantToBeInPipMode) {
EnterPictureInPictureMode(BuildParametersForPiP());}
}
TextView regular
TextVie
w auto-
sizing
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="100sp"
android:autoSizeStepGranularity="2sp" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="match_parent“
android:orientation="vertical" >
<TextView
android:id="@+id/text_view“
android:layout_width="match_parent"
android:layout_height="200dp"
android:text="Auto Size Text."
app:autoSizeTextType="uniform" />
</LinearLayout>
developer.android.com
<EditTextandroid:id="@+id/passwordField"android:layout_width="@dimen/text_field_width"android:layout_height="wrap_content"android:autofillHints="password"android:inputType="textPassword“ />
<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" />
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<font android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/lobster_regular"/>
<font android:fontStyle="italic“
android:fontWeight="400“
android:font="@font/lobster_italic" />
</font-family>
Fonts Contract
Font Provider
Font Cache
<?xml version="1.0" encoding="utf-8"?>
<font-family
xmlns:android=“http://schemas.android.com/apk/res/android”
android:fontProviderAuthority=“com.example.fontprovider.authority”
android:fontProviderPackage="com.example.fontprovider"
android:fontProviderQuery="example font"
android:fontProviderCerts="@array/certs">
</font-family>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts">
<item>@font/font1</item>
<item>@font/font2</item>
</array>
</resources>
<meta-data android:name="preloaded_fonts“android:resource="@array/preloaded_fonts"/>
[Application][MetaData("preloaded_fonts", Resource="@array/preloaded_fonts")]public class EmojiCompatApplication : Application{
// Code omitted for clarity}
FontRequest request = new FontRequest(
"com.google.android.gms.fonts",
"com.google.android.gms",
query,
Resource.Array.com_google_android_gms_fonts_certs);
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}
}
HandlerThread handlerThread = new HandlerThread("fonts");handlerThread.Start();
FontsContractCompat.RequestFont(this, request, callback, handlerThread);
developer.android.com
// Use downloadable fonts for EmojiCompatvar 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);
<android.support.text.emoji.widget.EmojiTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.text.emoji.widget.EmojiAppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.text.emoji.widget.EmojiEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.text.emoji.widget.EmojiAppCompatEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.text.emoji.widget.EmojiButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.text.emoji.widget.EmojiAppCompatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
github.com/xamarin/monodroid-samples/tree/master/android-o
www.youtube.com/user/androiddevelopers
developer.android.com/about/versions/oreo/index.html
xamarin.com/download
Tom Opgenorth
Senior Content Developer, Microsoft