Created
March 7, 2017 16:25
-
-
Save anonymous/e34c6f9403c120501dd42f14164567e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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