using Uno;
using Uno.Collections;
using Uno.Compiler.ExportTargetInterop;
using Fuse;
using Fuse.Scripting;
public class NavbarModule : NativeModule
{
public NavbarModule()
{
AddMember(new NativeFunction("HideBar", (NativeCallback)HideBar));
AddMember(new NativeFunction("ShowBar", (NativeCallback)ShowBar));
}
static object HideBar(Context c, object[] args)
{
SetNavigationBarVisible(false);
return null;
}
static object ShowBar(Context c, object[] args)
{
SetNavigationBarVisible(true);
return null;
}
[Foreign(Language.Java)]
static extern(Android) void SetNavigationBarVisible(bool visible)
@{
android.app.Activity rootActivity = @(Activity.Package).@(Activity.Name).GetRootActivity();
rootActivity.runOnUiThread(new Runnable() {
@Override
public void run() { android.view.Window window = @(Activity.Package).@(Activity.Name).GetRootActivity().getWindow();
// This code will always run on the UI thread, therefore is safe to modify UI elements.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
{
android.view.View decorView = window.getDecorView();
int uiOptions = decorView.getSystemUiVisibility();
if (visible)
{
uiOptions &= ~(android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
else
{
uiOptions |= android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
decorView.setSystemUiVisibility(uiOptions);
}
}
});
@}
static extern(!Android) void SetNavigationBarVisible(bool visible)
{
debug_log "SetNavigationBarVisible not available on this platform";
}
}
how to create onResume activity so navbar hide again after coming back from Home.