Android: Update splash screen in onConfigurationChanged

When the device orientation changes, we should set the background
to a drawable appropriate for that orientation.

Task-number: QTBUG-44238
Change-Id: I4ea50aedc704060c0b35c2d35b75cbaed3b4979a
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Daiwei Li 2015-01-31 00:33:32 -08:00
parent 6f298be076
commit d40839db2f
2 changed files with 20 additions and 0 deletions

View File

@ -879,6 +879,23 @@ public class QtActivityDelegate
} catch (Exception e) {
e.printStackTrace();
}
// if splash screen is defined, then show it
// Note: QtActivity handles settting the splash screen
// in onCreate, change that too if you are changing
// how the splash screen should be displayed
try {
if (m_surfaces.size() == 0) {
ActivityInfo info = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), PackageManager.GET_META_DATA);
if (info.metaData.containsKey("android.app.splash_screen_drawable"))
m_activity.getWindow().setBackgroundDrawableResource(info.metaData.getInt("android.app.splash_screen_drawable"));
else
m_activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
}
} catch (Exception e) {
e.printStackTrace();
}
int rotation = m_activity.getWindowManager().getDefaultDisplay().getRotation();
if (rotation != m_currentRotation) {
QtNative.handleOrientationChanged(rotation, m_nativeOrientation);

View File

@ -886,6 +886,9 @@ public class QtActivity extends Activity
if (null == getLastNonConfigurationInstance()) {
// if splash screen is defined, then show it
// Note: QtActivityDelegate handles updating the splash screen
// in onConfigurationChanged, change that too if you are changing
// how the splash screen should be displayed
if (m_activityInfo.metaData.containsKey("android.app.splash_screen_drawable"))
getWindow().setBackgroundDrawableResource(m_activityInfo.metaData.getInt("android.app.splash_screen_drawable"));
else