Merge "[LeAudio] New Broadcast dialog UI" into tm-dev am: fdfa0593f3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17659983 Change-Id: I8d6cdae5be73dc06bb2a77467f7b02fd324594b7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2022 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.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="?androidprv:attr/colorAccentPrimary" />
|
||||
<corners android:radius="@dimen/broadcast_dialog_btn_radius" />
|
||||
</shape>
|
||||
84
packages/SettingsLib/res/layout/broadcast_dialog.xml
Normal file
84
packages/SettingsLib/res/layout/broadcast_dialog.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 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.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/broadcast_dialog_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dialog_icon"
|
||||
android:layout_width="@dimen/broadcast_dialog_icon_size"
|
||||
android:layout_height="@dimen/broadcast_dialog_icon_size"
|
||||
android:layout_marginTop="@dimen/broadcast_dialog_icon_margin_top"
|
||||
android:layout_marginBottom="@dimen/broadcast_dialog_title_img_margin_top"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/settings_input_antenna"/>
|
||||
|
||||
<TextView
|
||||
style="@style/BroadcastDialogTitleStyle"
|
||||
android:id="@+id/dialog_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<TextView
|
||||
style="@style/BroadcastDialogBodyStyle"
|
||||
android:id="@+id/dialog_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/broadcast_dialog_margin"
|
||||
android:layout_marginBottom="@dimen/broadcast_dialog_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:layout_marginBottom="@dimen/broadcast_dialog_btn_margin_bottom"
|
||||
android:id="@+id/positive_btn"
|
||||
style="@style/BroadcastDialogButtonStyle"/>
|
||||
|
||||
<Button
|
||||
android:layout_marginBottom="@dimen/broadcast_dialog_btn_margin_bottom"
|
||||
android:id="@+id/negative_btn"
|
||||
android:text="@string/bt_le_audio_broadcast_dialog_different_output"
|
||||
style="@style/BroadcastDialogButtonStyle"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/neutral_btn"
|
||||
android:text="@android:string/cancel"
|
||||
style="@style/BroadcastDialogButtonStyle"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -92,6 +92,7 @@
|
||||
android:layout_marginStart="?attr/sudMarginStart"
|
||||
android:layout_marginEnd="?attr/sudMarginEnd"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -120,4 +120,18 @@
|
||||
<dimen name="qrcode_preview_margin">40dp</dimen>
|
||||
<dimen name="qrcode_preview_radius">30dp</dimen>
|
||||
<dimen name="qrcode_icon_size">27dp</dimen>
|
||||
|
||||
<!-- Broadcast dialog -->
|
||||
<dimen name="broadcast_dialog_title_img_margin_top">18dp</dimen>
|
||||
<dimen name="broadcast_dialog_title_text_size">24sp</dimen>
|
||||
<dimen name="broadcast_dialog_title_text_margin">16dp</dimen>
|
||||
<dimen name="broadcast_dialog_title_text_margin_top">18dp</dimen>
|
||||
<dimen name="broadcast_dialog_subtitle_text_size">14sp</dimen>
|
||||
<dimen name="broadcast_dialog_icon_size">24dp</dimen>
|
||||
<dimen name="broadcast_dialog_icon_margin_top">25dp</dimen>
|
||||
<dimen name="broadcast_dialog_btn_radius">100dp</dimen>
|
||||
<dimen name="broadcast_dialog_btn_margin_bottom">4dp</dimen>
|
||||
<dimen name="broadcast_dialog_btn_text_size">16sp</dimen>
|
||||
<dimen name="broadcast_dialog_btn_minHeight">44dp</dimen>
|
||||
<dimen name="broadcast_dialog_margin">16dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -39,4 +39,49 @@
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textDirection">locale</item>
|
||||
</style>
|
||||
|
||||
<style name="BroadcastDialogTitleStyle">
|
||||
<item name="android:textAppearance">@style/TextAppearanceBroadcastDialogTitle</item>
|
||||
<item name="android:layout_marginStart">@dimen/broadcast_dialog_title_text_margin</item>
|
||||
<item name="android:layout_marginEnd">@dimen/broadcast_dialog_title_text_margin</item>
|
||||
<item name="android:layout_marginTop">@dimen/broadcast_dialog_title_text_margin_top</item>
|
||||
<item name="android:layout_marginBottom">18dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearanceBroadcastDialogTitle" parent="@android:TextAppearance.DeviceDefault.Headline">
|
||||
<item name="android:textSize">@dimen/broadcast_dialog_title_text_size</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textDirection">locale</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
</style>
|
||||
|
||||
<style name="BroadcastDialogBodyStyle">
|
||||
<item name="android:textAppearance">@style/TextAppearanceBroadcastDialogSubTitle</item>
|
||||
<item name="android:layout_margin">@dimen/broadcast_dialog_title_text_margin</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearanceBroadcastDialogSubTitle" parent="@android:TextAppearance.DeviceDefault.Headline">
|
||||
<item name="android:textSize">@dimen/broadcast_dialog_subtitle_text_size</item>
|
||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||
<item name="android:textDirection">locale</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
</style>
|
||||
|
||||
<style name="BroadcastDialogButtonStyle">
|
||||
<item name="android:textAppearance">@style/TextAppearanceBroadcastDialogButton</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:stateListAnimator">@null</item>
|
||||
<item name="android:elevation">0dp</item>
|
||||
<item name="android:minHeight">@dimen/broadcast_dialog_btn_minHeight</item>
|
||||
<item name="android:background">@drawable/broadcast_dialog_btn_bg</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearanceBroadcastDialogButton" parent="@android:TextAppearance.DeviceDefault.Headline">
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textSize">@dimen/broadcast_dialog_btn_text_size</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Copyright (C) 2022 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.
|
||||
*/
|
||||
|
||||
package com.android.settingslib.bluetooth;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settingslib.R;
|
||||
|
||||
public class BroadcastDialog extends AlertDialog {
|
||||
|
||||
private static final String TAG = "BroadcastDialog";
|
||||
|
||||
private String mCurrentApp;
|
||||
private String mSwitchApp;
|
||||
private Context mContext;
|
||||
|
||||
public BroadcastDialog(Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
View layout = View.inflate(mContext, R.layout.broadcast_dialog, null);
|
||||
final Window window = getWindow();
|
||||
window.setContentView(layout);
|
||||
window.setWindowAnimations(R.style.Theme_AlertDialog_SettingsLib);
|
||||
|
||||
TextView title = layout.findViewById(R.id.dialog_title);
|
||||
TextView subTitle = layout.findViewById(R.id.dialog_subtitle);
|
||||
title.setText(mContext.getString(R.string.bt_le_audio_broadcast_dialog_title, mCurrentApp));
|
||||
subTitle.setText(
|
||||
mContext.getString(R.string.bt_le_audio_broadcast_dialog_sub_title, mSwitchApp));
|
||||
Button positiveBtn = layout.findViewById(R.id.positive_btn);
|
||||
Button negativeBtn = layout.findViewById(R.id.negative_btn);
|
||||
Button neutralBtn = layout.findViewById(R.id.neutral_btn);
|
||||
positiveBtn.setText(mContext.getString(
|
||||
R.string.bt_le_audio_broadcast_dialog_switch_app, mSwitchApp), null);
|
||||
neutralBtn.setOnClickListener((view) -> {
|
||||
Log.d(TAG, "BroadcastDialog dismiss.");
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ import android.util.Log;
|
||||
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.android.settingslib.bluetooth.BluetoothBroadcastUtils;
|
||||
import com.android.settingslib.R;
|
||||
import com.android.settingslib.bluetooth.BluetoothBroadcastUtils;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
|
||||
public class QrCodeScanModeActivity extends QrCodeScanModeBaseActivity {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -21,8 +21,8 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.android.settingslib.core.lifecycle.ObservableActivity;
|
||||
import com.android.settingslib.R;
|
||||
import com.android.settingslib.core.lifecycle.ObservableActivity;
|
||||
|
||||
public abstract class QrCodeScanModeBaseActivity extends ObservableActivity {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -35,9 +35,9 @@ import android.view.ViewOutlineProvider;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settingslib.R;
|
||||
import com.android.settingslib.bluetooth.BluetoothBroadcastUtils;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
import com.android.settingslib.R;
|
||||
import com.android.settingslib.core.lifecycle.ObservableFragment;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
Reference in New Issue
Block a user