Commit 5345c348 authored by Jérémy VIGNELLES's avatar Jérémy VIGNELLES Committed by Martin Finkel

Fixed some android build errors

(cherry picked from commit d623e24c)

# Conflicts:
#	src/LibVLCSharp.Forms/Platforms/Android/SystemUI.cs
#	src/LibVLCSharp.Forms/Platforms/Android/VideoViewRenderer.cs
parent d0e62898
......@@ -2,7 +2,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
......
......@@ -2,7 +2,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
......
......@@ -2,7 +2,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
......
......@@ -23,34 +23,34 @@ namespace LibVLCSharp.Forms.Platforms.Android
set => CurrentActivity.SetTarget(value);
}
public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
public void OnActivityCreated(Activity? activity, Bundle? savedInstanceState)
{
Activity = activity;
}
public void OnActivityDestroyed(Activity activity)
public void OnActivityDestroyed(Activity? activity)
{
}
public void OnActivityPaused(Activity activity)
public void OnActivityPaused(Activity? activity)
{
Activity = activity;
}
public void OnActivityResumed(Activity activity)
public void OnActivityResumed(Activity? activity)
{
Activity = activity;
}
public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
public void OnActivitySaveInstanceState(Activity? activity, Bundle? outState)
{
}
public void OnActivityStarted(Activity activity)
public void OnActivityStarted(Activity? activity)
{
}
public void OnActivityStopped(Activity activity)
public void OnActivityStopped(Activity? activity)
{
}
}
......@@ -73,7 +73,13 @@ namespace LibVLCSharp.Forms.Platforms.Android
{
lifecycleListener = new ActivityLifecycleContextListener();
LifecycleListener = lifecycleListener;
activity.Application.RegisterActivityLifecycleCallbacks(lifecycleListener);
var app = activity.Application;
if (app is null)
{
throw new InvalidOperationException("The given activity is not linked to an Application instance (activity.Application is null)");
}
app.RegisterActivityLifecycleCallbacks(lifecycleListener);
}
lifecycleListener.Activity = activity;
}
......
using Android.App;
using Android.Views;
using Java.Lang;
using Android.Views;
using LibVLCSharp.Forms.Platforms.Android;
using LibVLCSharp.Forms.Shared;
using Xamarin.Forms;
......@@ -12,21 +10,23 @@ namespace LibVLCSharp.Forms.Platforms.Android
{
public void ShowSystemUI()
{
if (Platform.Activity == null)
var decorView = Platform.Activity?.Window?.DecorView;
if (decorView == null)
return;
Platform.Activity.Window.DecorView.SystemUiVisibility =
decorView.SystemUiVisibility =
(StatusBarVisibility)(SystemUiFlags.LayoutStable |
SystemUiFlags.LayoutFullscreen);
}
public void HideSystemUI()
{
if (Platform.Activity == null)
var decorView = Platform.Activity?.Window?.DecorView;
if (decorView == null)
return;
Platform.Activity.Window.DecorView.SystemUiVisibility =
Platform.Activity.Window.DecorView.SystemUiVisibility |
decorView.SystemUiVisibility =
decorView.SystemUiVisibility |
(StatusBarVisibility)(SystemUiFlags.ImmersiveSticky |
SystemUiFlags.Fullscreen |
SystemUiFlags.HideNavigation |
......
......@@ -35,7 +35,7 @@ namespace LibVLCSharp.Forms.Platforms.Android
{
if (Control == null)
{
SetNativeControl(new LibVLCSharp.Platforms.Android.VideoView(Context));
SetNativeControl(new LibVLCSharp.Platforms.Android.VideoView(Context!));
e.NewElement.MediaPlayerChanging += OnMediaPlayerChanging;
if (Control!.MediaPlayer != e.NewElement.MediaPlayer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment