Added in the function onWindowFocusChanged(boolean hasFocus)
if (hasFocus) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
--
You received this message because you are subscribed to the Google Groups "android-qt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-qt+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I found out a better way of doing this.
1. Add the ANDROID_PACKAGE_SOURCE_DIR = ./android/ in the Qt project file
2. Copy all files from the android templates located the Qt install directory (in my case C:\Qt\Qt5.2.0_android\5.2.0-rc1\android_armv7\src\android\java) and put them in your android folder (overwrite existing files).
3. Remove all files that are identical to the template files (keep the
files you edit/create for your project)
in my case I deleted all files except these:
./android/AndroidManifest.xml
./android/src/org/qtproject/qt5/android/bindings/StartActivity.java
4. StartActivity.java is a new file and it looks like this in my case, it turns on the immersive mode and the call the super class. It extends the QtActivity class that will handle other calls necessary.
StartActivity.java
---- start ----
package org.qtproject.qt5.android.bindings;
import org.qtproject.qt5.android.bindings.QtActivity;
import android.os.Build;
import android.view.View;
import android.util.Log;
public class StartActivity extends QtActivity
{
public StartActivity(){}
@Override
public void onWindowFocusChanged(boolean hasFocus)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (hasFocus) {
Log.d("SCREEN","IMMERSIVE MODE ACTIVE");
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
}
if (!QtApplication.invokeDelegate(hasFocus).invoked)
super.onWindowFocusChanged(hasFocus);
}
}
---- end ----
5. In the AndroidManifest.xml I edit the activity class to be StartActivity
instead of QtActivity
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
android:name="org.qtproject.qt5.android.bindings.StartActivity"
By doing this step you do not have to change the template file.
This solution will be project specific.