From 5558bb784a7242136f22dcc83cb7d1926265e46c Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 2 May 2018 16:59:26 -0300 Subject: [PATCH] Splash screen with High Fidelity logo --- .../hifiinterface/InterfaceActivity.java | 10 ++-- .../hifiinterface/SplashActivity.java | 10 ++++ .../main/res/drawable/hifi_logo_splash.xml | 50 +++++++++++++++++++ .../src/main/res/layout/activity_splash.xml | 11 ++-- 4 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 android/app/src/main/res/drawable/hifi_logo_splash.xml diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java index fbefcf5b9a..6a89a8a819 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java @@ -101,13 +101,9 @@ public class InterfaceActivity extends QtActivity { final View rootView = getWindow().getDecorView().findViewById(android.R.id.content); // This is a workaround to hide the menu bar when the virtual keyboard is shown from Qt - rootView.getViewTreeObserver().addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - int heightDiff = rootView.getRootView().getHeight() - rootView.getHeight(); - if (getActionBar().isShowing()) { - getActionBar().hide(); - } + rootView.getViewTreeObserver().addOnGlobalLayoutListener(() -> { + if (getActionBar() != null && getActionBar().isShowing()) { + getActionBar().hide(); } }); startActivity(new Intent(this, SplashActivity.class)); diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/SplashActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/SplashActivity.java index 388592d2ed..484673bf4f 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/SplashActivity.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/SplashActivity.java @@ -3,6 +3,7 @@ package io.highfidelity.hifiinterface; import android.app.Activity; import android.content.Intent; import android.os.Bundle; +import android.view.View; public class SplashActivity extends Activity { @@ -20,6 +21,15 @@ public class SplashActivity extends Activity { super.onStart(); } + @Override + protected void onResume() { + super.onResume(); + View decorView = getWindow().getDecorView(); + // Hide the status bar. + int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + decorView.setSystemUiVisibility(uiOptions); + } + @Override protected void onStop() { super.onStop(); diff --git a/android/app/src/main/res/drawable/hifi_logo_splash.xml b/android/app/src/main/res/drawable/hifi_logo_splash.xml new file mode 100644 index 0000000000..919b2737e8 --- /dev/null +++ b/android/app/src/main/res/drawable/hifi_logo_splash.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/activity_splash.xml b/android/app/src/main/res/layout/activity_splash.xml index 5b4f91e733..ed25797917 100644 --- a/android/app/src/main/res/layout/activity_splash.xml +++ b/android/app/src/main/res/layout/activity_splash.xml @@ -5,8 +5,11 @@ android:id="@+id/root_activity_splash" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/backgroundLight"> - - - + android:background="@android:color/black"> +