qTbot 0.89.ee6949a
qTbot is base back end library for your c++ Qt projects.
MainActivity.java
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2024 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8package com.quasarapp.androidtools;
9
10import org.qtproject.qt.android.bindings.QtActivity;
11import android.view.View;
12
13public class MainActivity extends QtActivity
14{
15@Override
16public void onWindowFocusChanged(boolean hasFocus) {
17 super.onWindowFocusChanged(hasFocus);
18 if (hasFocus) {
19 hideSystemUI();
20 }
21}
22
23private void hideSystemUI() {
24 // Enables regular immersive mode.
25 // For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
26 // Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY
27 View decorView = getWindow().getDecorView();
28 decorView.setSystemUiVisibility(
29 View.SYSTEM_UI_FLAG_IMMERSIVE
30 // Set the content to appear under the system bars so that the
31 // content doesn't resize when the system bars hide and show.
32 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
33 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
34 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
35 // Hide the nav bar and status bar
36 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
37 | View.SYSTEM_UI_FLAG_FULLSCREEN);
38}
39
40// Shows the system bars by removing all the flags
41// except for the ones that make the content appear under the system bars.
42private void showSystemUI() {
43 View decorView = getWindow().getDecorView();
44 decorView.setSystemUiVisibility(
45 View.SYSTEM_UI_FLAG_LAYOUT_STABLE
46 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
47 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
48}
49
50}
void onWindowFocusChanged(boolean hasFocus)