SystemUI: Update styling of media projection permission dialog.

Test: Visual
Bug: 128426351
Change-Id: I73e0af423157ccda11632fb96d13e4f981bb57bb
This commit is contained in:
Narayan Kamath
2019-03-15 16:54:53 +00:00
parent 8180db886c
commit b4bfa1b4e9
4 changed files with 49 additions and 5 deletions

View File

@@ -438,7 +438,7 @@
<activity
android:name=".media.MediaProjectionPermissionActivity"
android:exported="true"
android:theme="@style/Theme.AlertDialogHost"
android:theme="@style/Theme.MediaProjectionAlertDialog"
android:finishOnCloseSystemDialogs="true"
android:launchMode="singleTop"
android:excludeFromRecents="true"

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019, The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="@style/Theme.MediaProjectionAlertDialog"
android:paddingStart="?android:attr/dialogPreferredPadding"
android:paddingEnd="?android:attr/dialogPreferredPadding"
android:paddingTop="?android:attr/dialogPreferredPadding">
<ImageView
android:id="@+id/dialog_icon"
android:src="@drawable/ic_media_projection_permission"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginBottom="20dp"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/dialog_title"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dialog_icon"
android:textColor="?android:attr/colorPrimary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title" />
</RelativeLayout>

View File

@@ -349,13 +349,13 @@
<style name="AutoSizingList">
<item name="enableAutoSizing">true</item>
</style>
<style name="Theme.AlertDialogHost" parent="android:Theme.DeviceDefault">
<style name="Theme.MediaProjectionAlertDialog" parent="android:Theme.DeviceDefault">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:alertDialogTheme">@style/Theme.SystemUI.Dialog.Alert</item>
</style>

View File

@@ -38,8 +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;
@@ -133,9 +135,12 @@ public class MediaProjectionPermissionActivity extends Activity
String 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)
.setTitle(dialogTitle)
.setIcon(R.drawable.ic_media_projection_permission)
.setCustomTitle(dialogTitleView)
.setMessage(message)
.setPositiveButton(R.string.media_projection_action_text, this)
.setNegativeButton(android.R.string.cancel, this)