Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd94485c authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Android (Google) Code Review
Browse files

Merge "Make the Media Projection dialog consistent (1/3)" into tm-dev

parents 4b1a9e35 0e29f731
Loading
Loading
Loading
Loading
+0 −40
Original line number Diff line number Diff line
<?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.
-->

<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:theme="@style/Theme.SystemUI.MediaProjectionAlertDialog"
        android:paddingStart="?android:attr/dialogPreferredPadding"
        android:paddingEnd="?android:attr/dialogPreferredPadding"
        android:orientation="vertical">
    <ImageView
        android:id="@+id/dialog_icon"
        android:src="@drawable/ic_media_projection_permission"
        android:layout_height="24dp"
        android:layout_width="24dp"
        android:layout_marginTop="18dp"
        android:layout_marginBottom="12dp"
        android:layout_gravity="center_horizontal" />
    <TextView
        android:id="@+id/dialog_title"
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:textColor="?android:attr/textColorPrimary"
        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title" />
</LinearLayout>
+9 −18
Original line number Diff line number Diff line
@@ -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();