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:
parent
6f298be076
commit
d40839db2f
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user