36 lines
No EOL
1.1 KiB
C#
36 lines
No EOL
1.1 KiB
C#
using Android.App;
|
|
using Android.Content;
|
|
using Android.OS;
|
|
using Android.Views;
|
|
using TouchyTickets;
|
|
using Uri = Android.Net.Uri;
|
|
|
|
namespace Android;
|
|
|
|
public class AndroidPlatform : Platform {
|
|
|
|
private readonly Activity activity;
|
|
|
|
public AndroidPlatform(Activity activity) {
|
|
this.activity = activity;
|
|
}
|
|
|
|
public override void SetKeepScreenOn(bool keep) {
|
|
if (keep) {
|
|
this.activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
|
|
} else {
|
|
this.activity.Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
|
|
}
|
|
}
|
|
|
|
public override void SetRenderUnderNotch(bool value) {
|
|
// don't render under notches by default
|
|
if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
|
|
this.activity.Window.Attributes.LayoutInDisplayCutoutMode = value ? LayoutInDisplayCutoutMode.ShortEdges : LayoutInDisplayCutoutMode.Never;
|
|
}
|
|
|
|
public override void OpenRateLink() {
|
|
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
|
|
}
|
|
|
|
} |