How to solve the problem that the video is covered by the navigation bar after full screen - fullscreen

like this as follow,When I want to play in full screen, the video is overlaid behind

You have to use this code to hide the navigation bar:
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mActivity.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
//View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
With fullscreen options you can hide status bar too and with Immersive sticky you can get the navigation and status bar again sliding your finger.
To remove this options use the following code:
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
View decorView = mActivity.getWindow().getDecorView();
int uiOptions = decorView.getSystemUiVisibility();
uiOptions &= ~View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
uiOptions &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
uiOptions &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}

you can use react-native-full-screen which provide full screen control
You can put that on componentDidmount or useeffect method with FullScreen.onFullScreen();

Related

Controlling Inner CTabControl Items with TAB and Arrow Keys

I have an issue Controlling CTabControl Inner tab items with TAB and Arrow keys.
here is my code and a few screenshots:
OnInitDialog() method of the main dialog window:
BOOL PressetsDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// AUTO GENERATED MFC DIALOGUE CODE HERE
...
// ..
// TODO: Add extra initialization here
CTabCtrl* pTabCtrl = (CTabCtrl*)GetDlgItem(IDC_TAB1);
m_one.Create(IDD_TAB_ONE, pTabCtrl);
CTabCtrl* pTabCtrl2 = (CTabCtrl*)GetDlgItem(IDC_TAB1);
m_two.Create(IDD_TAB_TWO, pTabCtrl2);
TCITEM item1, item2, item3;
item1.mask = TCIF_TEXT | TCIF_PARAM;
item1.lParam = (LPARAM)&m_one;
item1.pszText = L"Normal Presets";
pTabCtrl->InsertItem(0, &item1);
item2.mask = TCIF_TEXT | TCIF_PARAM;
item2.lParam = (LPARAM)&m_two;
item2.pszText = L"Movement Presets";
pTabCtrl2->InsertItem(1, &item2);
CRect rcItem;
pTabCtrl->GetItemRect(0, &rcItem);
m_one.SetWindowPos(NULL, rcItem.left, rcItem.bottom + 1, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
CRect rcItem2;
pTabCtrl2->GetItemRect(0, &rcItem2);
m_two.SetWindowPos(NULL, rcItem2.left, rcItem2.bottom + 1, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
m_one.ShowWindow(SW_SHOW);
m_two.ShowWindow(SW_HIDE);
return TRUE; // return TRUE unless you set the focus to a control
}
and the OnTcnSelchangeTab method:
void PressetsDlg::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int nSelect = m_Tab.GetCurSel();
if (nSelect == 0)
{
m_one.ShowWindow(SW_SHOW);
m_two.ShowWindow(SW_HIDE);
}
else if (nSelect == 1)
{
m_two.ShowWindow(SW_SHOW);
m_one.ShowWindow(SW_HIDE);
}
else
{
m_one.ShowWindow(SW_SHOW);
m_two.ShowWindow(SW_HIDE);
}
*pResult = 0;
}
[to see the tab design click here](https://i.stack.imgur.com/Tt8c1.jpg)
I've set the tab order with Ctrl + D for each dialogue resource and set Tabstop property to either True or False and still nothing happens.
At first I thought that this feature is supposed to be supported automatically but it seems that it's not.
the dialogue window moves between tabs and buttons that placed on it but as soon as I try to move to "inner Items" of each tab, it doesn't reach them.
I suspect the reason is probably that each tab is a separate window and that's probably the reason that the inner items are unreachable..
I've made a few changes and now Moving with TAB and arrow keys functions properly.
first of all I set the Control Property of both child dialogs to True.
You go to Resource View >> (Solution name) >> (project name) >> IDD + (the id you gave to the dialog) doble click on it >> Properties >> Control.
Essentially what it did is to add the flag WS_CONTROL as mentioned here early to each of the Child windows so that they could be accessed from the main dialog window that contains them.
Of course that alone didn't do much because I also had a few bugs in the code, after days of searching for it I found an example online which helped me solve the bugs.
Then I've changed my code to this: and it started working:
// first we create two modeless dialogs and embed them as child windows
// of CTabControlTutorialDlg.
// Have a look using Spy++ to see the layout of the controls as they
// appear to windows
m_one.Create(IDD_TAB_ONE, this);
m_two.Create(IDD_TAB_TWO, this);
// next we get the captions of the dialogs and use these as the caption
// for the tab window. Of course we could just load a string from the
// resources or hard code a string for the text of the tab.
TCITEM item1, item2;
item1.mask = TCIF_TEXT | TCIF_PARAM;
item1.lParam = (LPARAM)&m_one;
item1.pszText = L"Normal Presets";
m_Tab.InsertItem(0, &item1);
item2.mask = TCIF_TEXT | TCIF_PARAM;
item2.lParam = (LPARAM)&m_two;
item2.pszText = L"Custom Presets";
m_Tab.InsertItem(1, &item2);
// finally we set the tab order correctly for the so that we can tab through the dialogs and into
// the cancel and ok buttons. If we don;t do this then the tab order is tab control, ok button, cancel
// button embedded dialogs.
CRect rcItem;
m_Tab.GetItemRect(0, &rcItem);
m_one.SetWindowPos(NULL, rcItem.left, rcItem.bottom + 5, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOZORDER);
CRect rcItem2;
m_Tab.GetItemRect(0, &rcItem2);
m_two.SetWindowPos(NULL, rcItem2.left, rcItem2.bottom + 5, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOZORDER);
m_one.ShowWindow(SW_SHOW);
I found reference in this site:https://www.codeproject.com/Articles/4408/Creating-embedded-dialogs-in-MFC but in order to get their code example you need to register to the website.
It works!

Hide navigation bar in android tablet with API level 19 and above

My question is in android programming in android studio.
I can hide navigation bar but when dropdown spinner , it show again.
Besides that when i tap on EditText , revealing the softkeyboard will cause the navigation bar to reappear.
how can solve it?
(I searched a lot but could not find the correct answer)
call this method in onCreate , onResume and onWindowFocusChanged
private void hideNavigationBar() {
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(uiOptions);
}

Hiding the navigation bar in a background service- android

I have an app that introduces a translucent view over all other running apps (basically a filter running as a background service). The problem that i am facing is that the app does not apply the filter over the navigation bar (bottom bar with back, home and recent tabs buttons).
The flags that i have used to create a view are shown in the code below:
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
0 | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.addView(mView, params);
Is there any special flag or anything else that i need to cover the nav bar ?
This is the screenshot of the filter running with everything else covered except the nav bar
Add a Y offset to your layoutparams for your overlay to go over your navigation bar.
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,0, navbarHeight(),
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
0 | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.addView(mView, params);
private int navbarHeight() {
...code to calculate height of navbar
}

Removing menu in MFC

In MFC how to remove a menu-item of POPUP type. RemoveMenu() either take ID or position. Since, there is no ID for POPUP menu, option left is by using position.
But I am not getting how and where I can call RemoveMenu().
File Edit Test
Test_submenu_1
Test_submenu_2
Test_submenu_3 > submenu_3_item_1
Test_submenu_4
Test_submenu_5
I want to remove Test_submenu_3? I am not getting how do find CMenu object for Test so that I can call RemoveMenu() by passing position "2" for submenu_3_item_1.
Any suggestion for doing this will be greatly appreciated.
Thanks!
You cannot use LoadMenu, since this function does just that.
After modifying loaded menu it is killed when menu object used to load it goes out of scope. You have to modify menu that is currently used.
Your menu is a popup part of the main menu, second in position. It contains 5 items and second one is another popup. To my understanding, you want to remove this item and popup of this item.
To make it work you will have to ask main window for the current menu:
CMenu* pMenu = GetMenu(); // get the main menu
CMenu* pPopupMenu = pMenu->GetSubMenu(2);//(Test menu with item....)
pPopupMenu->RemoveMenu(2, MF_BYPOSITION);
Of course, this code is from the main frame. If you want to use it elsewhere, you will have to access all using pointer to the main frame.
Try the below. You get the Test sub-menu first (index 2), then once you have that you tell it to remove its Test_submenu_3 submenu by position (also 2).
CMenu topMenu;
topMenu.LoadMenu(IDR_YOUR_MENU);
CMenu& testSubMenu = *topMenu.GetSubMenu(2);
testSubMenu.RemoveMenu(2,MF_BYPOSITION);
'Test' is the 3rd menu item (by position) on the top level menu. It's just been rendered horizontally rather than vertically. Assuming you have a handle to the top level menu use the same code you'd use to the get the sub menus as you would to get the 'Test' menu.
You can use this below code to remove the submenu, by comparing name
bool RemoveSubmenu(CMenu * pMenu) {
for (int pos = 0; pos < pMenu->GetMenuItemCount(); pos++) {
wchar_t *name = new wchar_t[mf.cch + 1];
MENUITEMINFO mf;
ZeroMemory(&mf, sizeof(mf));
mf.cbSize = sizeof(mf);
mf.fMask = MIIM_SUBMENU | MIIM_FTYPE | MIIM_STRING;
mf.fType = MIIM_STRING;
mf.dwTypeData = NULL;
if (!GetMenuItemInfo(pMenu->m_hMenu, pos, TRUE, &mf))
break;
if (mf.hSubMenu != NULL){
mf.fMask = MIIM_TYPE;
mf.fType = MFT_STRING;
++mf.cch;
mf.dwTypeData = (LPSTR)name;
if (!GetMenuItemInfo(pMenu->m_hMenu, pos, TRUE, &mf)){
bRet = false;
break;
}
//
// compare sub menu name (i.e mf.dwTypeData) here, do the required
// modifications
//
pMenu->RemoveMenu(pos, MF_BYPOSITION);
bRet = true;
break;
}
}
}

Adding Minimize box to MFC Property Sheet system menu

How could I Add Minimize and Maximize box to the system menu of CMFCPropertySheet.
I have tried modifying the style by
CMFCPropertySheet::ModifyStyle(NULL, WS_SYSMENU);
but nothing happened.
Assuming you have a class derived from CPropertySheet, let's call it MySheet:
// Capture the WM_NCREATE message
BEGIN_MESSAGE_MAP(CMySheet, CPropertySheet)
ON_WM_NCCREATE()
END_MESSAGE_MAP()
BOOL CMySheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
{
if (!CPropertySheet::OnNcCreate(lpCreateStruct))
return FALSE;
// Modify the window style
LONG dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | WS_WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
return TRUE;
}
Note that you could do this in the OnInitDialog, but even though the Minimize/Maximize boxes will show, they won't do anything.
doing just this in the "OnInitDialog:" worked for me.
LONG dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | WS_WS_MINIMIZEBOX | WS_MAXIMIZEBOX);

Resources