Commit d623e24c authored by Jérémy VIGNELLES's avatar Jérémy VIGNELLES

Fixed some android build errors

parent a6de4ffd
......@@ -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.
......@@ -1289,6 +1288,7 @@ namespace LibVLCSharp.Forms.MediaPlayerElement.Sample.Android
global::LibVLCSharp.Forms.Resource.String.abc_shareactionprovider_share_with_application = global::LibVLCSharp.Forms.MediaPlayerElement.Sample.Android.Resource.String.abc_shareactionprovider_share_with_application;
global::LibVLCSharp.Forms.Resource.String.abc_toolbar_collapse_description = global::LibVLCSharp.Forms.MediaPlayerElement.Sample.Android.Resource.String.abc_toolbar_collapse_description;
global::LibVLCSharp.Forms.Resource.String.appbar_scrolling_view_behavior = global::LibVLCSharp.Forms.MediaPlayerElement.Sample.Android.Resource.String.appbar_scrolling_view_behavior;
global::LibVLCSharp.Forms.Resource.String.app_name = global::LibVLCSharp.Forms.MediaPlayerElement.Sample.Android.Resource.String.app_name;
global::LibVLCSharp.Forms.Resource.String.bottom_sheet_behavior = global::LibVLCSharp.Forms.MediaPlayerElement.Sample.Android.Resource.String.bottom_sheet_behavior;
global::LibVLCSharp.Forms.Resource.String.character_counter_pattern = global::LibVLCSharp.Forms.MediaPlayerElement.Sample.Android.Resource.String.character_counter_pattern;
global::LibVLCSharp.Forms.Resource.String.mr_button_content_description = global::LibVLCSharp.Forms.MediaPlayerElement.Sample.Android.Resource.String.mr_button_content_description;
......
......@@ -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.
......@@ -1297,6 +1296,7 @@ namespace LibVLCSharp.Forms.Sample.Droid
global::LibVLCSharp.Forms.Resource.String.abc_shareactionprovider_share_with_application = global::LibVLCSharp.Forms.Sample.Droid.Resource.String.abc_shareactionprovider_share_with_application;
global::LibVLCSharp.Forms.Resource.String.abc_toolbar_collapse_description = global::LibVLCSharp.Forms.Sample.Droid.Resource.String.abc_toolbar_collapse_description;
global::LibVLCSharp.Forms.Resource.String.appbar_scrolling_view_behavior = global::LibVLCSharp.Forms.Sample.Droid.Resource.String.appbar_scrolling_view_behavior;
global::LibVLCSharp.Forms.Resource.String.app_name = global::LibVLCSharp.Forms.Sample.Droid.Resource.String.app_name;
global::LibVLCSharp.Forms.Resource.String.bottom_sheet_behavior = global::LibVLCSharp.Forms.Sample.Droid.Resource.String.bottom_sheet_behavior;
global::LibVLCSharp.Forms.Resource.String.character_counter_pattern = global::LibVLCSharp.Forms.Sample.Droid.Resource.String.character_counter_pattern;
global::LibVLCSharp.Forms.Resource.String.mr_button_content_description = global::LibVLCSharp.Forms.Sample.Droid.Resource.String.mr_button_content_description;
......
......@@ -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
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
{
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;
using Xamarin.Forms;
......@@ -11,21 +9,23 @@ namespace LibVLCSharp.Forms
{
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 |
......
......@@ -33,7 +33,7 @@ namespace LibVLCSharp.Forms
{
if (Control == null)
{
SetNativeControl(new LibVLCSharp.VideoView(Context));
SetNativeControl(new LibVLCSharp.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