2020-06-14 01:18:12 +02:00
|
|
|
using Android.App;
|
2020-06-30 19:06:35 +02:00
|
|
|
using Android.Content;
|
2023-03-04 12:28:05 +01:00
|
|
|
using Android.OS;
|
2020-06-29 13:47:45 +02:00
|
|
|
using Android.Views;
|
2020-06-14 01:18:12 +02:00
|
|
|
using TouchyTickets;
|
2020-07-21 20:26:52 +02:00
|
|
|
using Uri = Android.Net.Uri;
|
2020-06-14 01:18:12 +02:00
|
|
|
|
2023-03-04 12:28:05 +01:00
|
|
|
namespace Android;
|
2020-06-14 01:18:12 +02:00
|
|
|
|
2023-02-11 10:16:42 +01:00
|
|
|
public class AndroidPlatform : Platform {
|
2020-06-14 01:18:12 +02:00
|
|
|
|
2023-02-11 10:16:42 +01:00
|
|
|
private readonly Activity activity;
|
|
|
|
|
2023-03-04 10:50:45 +01:00
|
|
|
public AndroidPlatform(Activity activity) {
|
2023-02-11 10:16:42 +01:00
|
|
|
this.activity = activity;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void SetKeepScreenOn(bool keep) {
|
|
|
|
if (keep) {
|
|
|
|
this.activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
|
|
|
|
} else {
|
|
|
|
this.activity.Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
|
2020-07-21 21:51:30 +02:00
|
|
|
}
|
2023-02-11 10:16:42 +01:00
|
|
|
}
|
2020-07-21 21:51:30 +02:00
|
|
|
|
2023-03-04 12:28:05 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-02-11 10:16:42 +01:00
|
|
|
public override void OpenRateLink() {
|
|
|
|
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
|
|
|
|
}
|
|
|
|
|
2020-06-14 01:18:12 +02:00
|
|
|
}
|