diff options
4 files changed, 127 insertions, 0 deletions
diff --git a/packages/SystemUI/res/drawable/dismiss_circle_background.xml b/packages/SystemUI/res/drawable/dismiss_circle_background.xml new file mode 100644 index 000000000000..e311c520d3d6 --- /dev/null +++ b/packages/SystemUI/res/drawable/dismiss_circle_background.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2020 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" + android:shape="oval"> + + <stroke + android:width="1dp" + android:color="#66FFFFFF" /> + + <solid android:color="#B3000000" /> + +</shape>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/dismiss_target_x.xml b/packages/SystemUI/res/drawable/dismiss_target_x.xml new file mode 100644 index 000000000000..3672efffe139 --- /dev/null +++ b/packages/SystemUI/res/drawable/dismiss_target_x.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2020 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. + --> + +<!-- 'X' icon. --> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24.0dp" + android:height="24.0dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="M19.000000,6.400000l-1.400000,-1.400000 -5.600000,5.600000 -5.600000,-5.600000 -1.400000,1.400000 5.600000,5.600000 -5.600000,5.600000 1.400000,1.400000 5.600000,-5.600000 5.600000,5.600000 1.400000,-1.400000 -5.600000,-5.600000z" + android:fillColor="#FFFFFFFF" + android:strokeColor="#FF000000"/> +</vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 4f803bccfb25..f35858277d59 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1183,6 +1183,9 @@ <dimen name="bubble_dismiss_target_padding_x">40dp</dimen> <dimen name="bubble_dismiss_target_padding_y">20dp</dimen> + <dimen name="dismiss_circle_size">52dp</dimen> + <dimen name="dismiss_target_x_size">24dp</dimen> + <!-- Bubbles user education views --> <dimen name="bubbles_manage_education_width">160dp</dimen> <!-- The inset from the top bound of the manage button to place the user education. --> diff --git a/packages/SystemUI/src/com/android/systemui/util/DismissCircleView.java b/packages/SystemUI/src/com/android/systemui/util/DismissCircleView.java new file mode 100644 index 000000000000..e3668dae9417 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/util/DismissCircleView.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2020 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.systemui.util; + +import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.view.Gravity; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.ImageView; + +import com.android.systemui.R; + +/** + * Circular view with a semitransparent, circular background with an 'X' inside it. + * + * This is used by both Bubbles and PIP as the dismiss target. + */ +public class DismissCircleView extends FrameLayout { + + private final ImageView mIconView = new ImageView(getContext()); + + public DismissCircleView(Context context) { + super(context); + final Resources res = getResources(); + + setBackground(res.getDrawable(R.drawable.dismiss_circle_background)); + + mIconView.setImageDrawable(res.getDrawable(R.drawable.dismiss_target_x)); + addView(mIconView); + + setViewSizes(); + } + + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + setViewSizes(); + } + + /** Retrieves the current dimensions for the icon and circle and applies them. */ + private void setViewSizes() { + final Resources res = getResources(); + + int iconSize = res.getDimensionPixelSize(R.dimen.dismiss_target_x_size); + int targetSize = res.getDimensionPixelSize(R.dimen.dismiss_circle_size); + + setLayoutParams(new ViewGroup.LayoutParams(targetSize, targetSize)); + + mIconView.setLayoutParams( + new FrameLayout.LayoutParams(iconSize, iconSize, Gravity.CENTER)); + } +} |