Baseflow / Baseflow/Xamarin-Sidebar

[PR] Hide status bar when side menu open

Open
#50 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
112
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I've spent long hour to modify sidebar navigation to hide status bar when side menu open. I want to create pull request but due to my lack of knowledge, I just wrote my code in this page.

In the "Xamarin-Sidebar-Unified" project, find the "Sidebar.cs" file and make some change with below code

1) Add HideStatusBar member variable in the line 99
`
public bool HideStatusBar { get; set; }
`

2) Add Default value of HideStatusBar in the SetDefaults() methods in the line 225
`
HideStatusBar = true;
`

3) Add the setstatusbarhidden method in the OpenMenu(), CloseMenu() method in the line 121 like this

```
public void OpenMenu()
{
if (IsOpen || Disabled)
return;
ShowShadow();
_sidebarContentArea.BeforeOpenAnimation();
// INSERT THIS CODE
if (HideStatusBar)
UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Slide);
// INSERT THIS CODE

UIView.Animate(
Sidebar.SlideSpeed,
0,
UIViewAnimationOptions.CurveEaseInOut,
() => {
_sidebarContentArea.OpenAnimation(MenuLocation, MenuWidth);

},
() => {
_sidebarContentArea.AfterOpenAnimation(TapGesture);
IsOpen = true;
});
}

public void CloseMenu(bool animate = true)
{
if (!IsOpen || Disabled)
return;
MenuViewController.View.EndEditing(true);
// INSERT THIS CODE
if(HideStatusBar)
UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Slide);
// INSERT THIS CODE
UIView.Animate(
animate ? Sidebar.SlideSpeed : 0,
0,
UIViewAnimationOptions.CurveEaseInOut,
() => { _sidebarContentArea.CloseAnimation(); },
() => {
_sidebarContentArea.AfterCloseAnimation(TapGesture);
IsOpen = false;
});
HideShadow();
}
```

4) Build the "Xamarin-Sidebar-Unified" project

5) Open the Project options and check the output path

6) In the output path folder, find the Xamarin-Sidebar-Unified.dll

7) Open your own project

8) Edit References -> .Net Assembly -> Browse -> (Above output path) -> select Xamarin-Sidebar-Unified.dll

9) Open Info.plist with text editor (like sublime text) to add this key value pair inside area
UIViewControllerBasedStatusBarAppearance

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.