Rework the splash screen for Android.
Allow the developers to define a splash screen which will be visible until the first window is created. [ChangeLog][Android] Allow the developers to define a splash screen which will be visible until the first window is created. Task-number: QTBUG-30652 Change-Id: I5da80be417ffffb03e66009f45745d4b387d2912 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
5e05c230af
commit
4d08d80be6
@ -48,6 +48,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -56,6 +57,7 @@ import android.os.ResultReceiver;
|
|||||||
import android.text.method.MetaKeyKeyListener;
|
import android.text.method.MetaKeyKeyListener;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.KeyCharacterMap;
|
import android.view.KeyCharacterMap;
|
||||||
@ -653,9 +655,6 @@ public class QtActivityDelegate
|
|||||||
m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
m_surfaces = new HashMap<Integer, QtSurface>();
|
m_surfaces = new HashMap<Integer, QtSurface>();
|
||||||
m_nativeViews = new HashMap<Integer, View>();
|
m_nativeViews = new HashMap<Integer, View>();
|
||||||
m_activity.setContentView(m_layout,
|
|
||||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
|
||||||
m_activity.registerForContextMenu(m_layout);
|
m_activity.registerForContextMenu(m_layout);
|
||||||
|
|
||||||
int orientation = m_activity.getResources().getConfiguration().orientation;
|
int orientation = m_activity.getResources().getConfiguration().orientation;
|
||||||
@ -989,6 +988,20 @@ public class QtActivityDelegate
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void createSurface(int id, boolean onTop, int x, int y, int w, int h) {
|
public void createSurface(int id, boolean onTop, int x, int y, int w, int h) {
|
||||||
|
if (m_surfaces.size() == 0) {
|
||||||
|
TypedValue attr = new TypedValue();
|
||||||
|
m_activity.getTheme().resolveAttribute(android.R.attr.windowBackground, attr, true);
|
||||||
|
if (attr.type >= TypedValue.TYPE_FIRST_COLOR_INT && attr.type <= TypedValue.TYPE_LAST_COLOR_INT) {
|
||||||
|
m_activity.getWindow().setBackgroundDrawable(new ColorDrawable(attr.data));
|
||||||
|
} else {
|
||||||
|
m_activity.getWindow().setBackgroundDrawable(m_activity.getResources().getDrawable(attr.resourceId));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_activity.setContentView(m_layout,
|
||||||
|
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
}
|
||||||
|
|
||||||
if (m_surfaces.containsKey(id))
|
if (m_surfaces.containsKey(id))
|
||||||
m_layout.removeView(m_surfaces.remove(id));
|
m_layout.removeView(m_surfaces.remove(id));
|
||||||
|
|
||||||
|
@ -29,8 +29,11 @@
|
|||||||
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||||
<!-- Messages maps -->
|
<!-- Messages maps -->
|
||||||
|
|
||||||
<!-- Splash screen -->
|
<!-- Splash screen -->
|
||||||
<meta-data android:name="android.app.splash_screen" android:resource="@layout/splash"/>
|
<!--
|
||||||
|
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
|
||||||
|
-->
|
||||||
<!-- Splash screen -->
|
<!-- Splash screen -->
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
>
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
@ -858,8 +858,8 @@ public class QtActivity extends Activity
|
|||||||
|
|
||||||
if (null == getLastNonConfigurationInstance()) {
|
if (null == getLastNonConfigurationInstance()) {
|
||||||
// if splash screen is defined, then show it
|
// if splash screen is defined, then show it
|
||||||
if (m_activityInfo.metaData.containsKey("android.app.splash_screen") )
|
if (m_activityInfo.metaData.containsKey("android.app.splash_screen_drawable"))
|
||||||
setContentView(m_activityInfo.metaData.getInt("android.app.splash_screen"));
|
getWindow().setBackgroundDrawableResource(m_activityInfo.metaData.getInt("android.app.splash_screen_drawable"));
|
||||||
startApp(true);
|
startApp(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<version value="5.2">
|
<version value="5.3">
|
||||||
<ignore>
|
<ignore>
|
||||||
<file>AndroidManifest.xml</file>
|
<file>AndroidManifest.xml</file>
|
||||||
<file>libs.xml</file>
|
<file>libs.xml</file>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user