Android: fix deprecations for getDrawable() on QtMessageDialogHelper

Change-Id: Icd359663af11f44b4bcf0cd4e4f1f7f5a51242e4
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 31a0d99fa565d39bf39f0c3ae5ed00859679a969)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Assam Boudjelthia 2022-12-20 16:27:21 +02:00 committed by Qt Cherry-pick Bot
parent fe24040e90
commit 5244c8df0c

View File

@ -73,7 +73,8 @@ public class QtMessageDialogHelper
try {
TypedValue typedValue = new TypedValue();
m_theme.resolveAttribute(android.R.attr.alertDialogIcon, typedValue, true);
return m_activity.getResources().getDrawable(typedValue.resourceId);
return m_activity.getResources().getDrawable(typedValue.resourceId,
m_activity.getTheme());
} catch (Exception e) {
e.printStackTrace();
}
@ -83,7 +84,8 @@ public class QtMessageDialogHelper
{
case 1: // Information
try {
return m_activity.getResources().getDrawable(android.R.drawable.ic_dialog_info);
return m_activity.getResources().getDrawable(android.R.drawable.ic_dialog_info,
m_activity.getTheme());
} catch (Exception e) {
e.printStackTrace();
}
@ -97,14 +99,16 @@ public class QtMessageDialogHelper
// break;
case 3: // Critical
try {
return m_activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert);
return m_activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert,
m_activity.getTheme());
} catch (Exception e) {
e.printStackTrace();
}
break;
case 4: // Question
try {
return m_activity.getResources().getDrawable(android.R.drawable.ic_menu_help);
return m_activity.getResources().getDrawable(android.R.drawable.ic_menu_help,
m_activity.getTheme());
} catch (Exception e) {
e.printStackTrace();
}