From 0e29f73116d0e5cda9b0f7010c55fbbf254eb920 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Wed, 16 Feb 2022 16:09:44 +0100 Subject: [PATCH] Make the Media Projection dialog consistent (1/3) This CL makes the Media Projection dialog consistent with other SysUI dialogs. Bug: 219931621 Test: Manual Change-Id: Ie1c4ad10d8500cf023ae6ba5276bc1916b23a78a --- .../layout/media_projection_dialog_title.xml | 40 ------------------- .../MediaProjectionPermissionActivity.java | 27 +++++-------- 2 files changed, 9 insertions(+), 58 deletions(-) delete mode 100644 packages/SystemUI/res/layout/media_projection_dialog_title.xml diff --git a/packages/SystemUI/res/layout/media_projection_dialog_title.xml b/packages/SystemUI/res/layout/media_projection_dialog_title.xml deleted file mode 100644 index b9e39dae13dcb..0000000000000 --- a/packages/SystemUI/res/layout/media_projection_dialog_title.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java index e2716e992c48d..77873e829be30 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java +++ b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java @@ -38,12 +38,10 @@ import android.text.TextPaint; import android.text.TextUtils; import android.text.style.StyleSpan; import android.util.Log; -import android.view.View; import android.view.Window; -import android.view.WindowManager; -import android.widget.TextView; import com.android.systemui.R; +import com.android.systemui.statusbar.phone.SystemUIDialog; import com.android.systemui.util.Utils; public class MediaProjectionPermissionActivity extends Activity @@ -56,7 +54,7 @@ public class MediaProjectionPermissionActivity extends Activity private int mUid; private IMediaProjectionManager mService; - private AlertDialog mDialog; + private SystemUIDialog mDialog; @Override public void onCreate(Bundle icicle) { @@ -143,25 +141,18 @@ public class MediaProjectionPermissionActivity extends Activity dialogTitle = getString(R.string.media_projection_dialog_title, appName); } - View dialogTitleView = View.inflate(this, R.layout.media_projection_dialog_title, null); - TextView titleText = (TextView) dialogTitleView.findViewById(R.id.dialog_title); - titleText.setText(dialogTitle); - - mDialog = new AlertDialog.Builder(this) - .setCustomTitle(dialogTitleView) - .setMessage(dialogText) - .setPositiveButton(R.string.media_projection_action_text, this) - .setNegativeButton(android.R.string.cancel, this) - .setOnCancelListener(this) - .create(); + mDialog = new SystemUIDialog(this); + mDialog.setTitle(dialogTitle); + mDialog.setIcon(R.drawable.ic_media_projection_permission); + mDialog.setMessage(dialogText); + mDialog.setPositiveButton(R.string.media_projection_action_text, this); + mDialog.setNeutralButton(android.R.string.cancel, this); + mDialog.setOnCancelListener(this); mDialog.create(); mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setFilterTouchesWhenObscured(true); final Window w = mDialog.getWindow(); - // QS is not closed when pressing CastTile. Match the type of the dialog shown from the - // tile. - w.setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); w.addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); mDialog.show();