Skip to content

Instantly share code, notes, and snippets.

Created March 7, 2017 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e34c6f9403c120501dd42f14164567e0 to your computer and use it in GitHub Desktop.
Save anonymous/e34c6f9403c120501dd42f14164567e0 to your computer and use it in GitHub Desktop.
using Uno;
using Uno.Compiler.ExportTargetInterop;
using Uno.Platform2;
using Fuse.Platform;
using Fuse;
[ForeignInclude(Language.Java, "android.app.Activity", "android.view.View",
"android.view.Window", "android.os.Build", "android.view.Window")]
internal static extern(android) class StatusBarHackHelper
{
[Foreign(Language.Java)]
static public void Light(bool isEnabled)
@{
com.fuse.Activity.getRootActivity().runOnUiThread(new Runnable() { public void run()
{
// Marshmallow and above
if (android.os.Build.VERSION.SDK_INT >= 23)
{
View decorView = com.fuse.Activity.getRootActivity().getWindow().getDecorView();
if(isEnabled) decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
else decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}});
@}
}
public class AndroidStatusBarHack: Behavior
{
bool _isLight = false;
public bool IsLight
{
get { return _isLight; }
set
{
_isLight = value;
if defined(Android)
StatusBarHackHelper.Light(value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment