Loading packages/SystemUI/res/drawable/media_output_dialog_background.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2021 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="rectangle"> <corners android:radius="28dp"/> <solid android:color="@color/media_dialog_background" /> </shape> No newline at end of file packages/SystemUI/res/layout/media_output_dialog.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ android:id="@+id/media_output_dialog" android:layout_width="@dimen/large_dialog_width" android:layout_height="wrap_content" android:background="@drawable/media_output_dialog_background" android:orientation="vertical"> <LinearLayout Loading packages/SystemUI/res/values/colors.xml +1 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ <color name="media_dialog_item_main_content">@color/material_dynamic_primary20</color> <color name="media_dialog_item_background">@color/material_dynamic_secondary95</color> <color name="media_dialog_connected_item_background">@color/material_dynamic_primary90</color> <color name="media_dialog_seekbar_progress">@color/material_dynamic_secondary40</color> <color name="media_dialog_seekbar_progress">@android:color/system_accent1_200</color> <color name="media_dialog_button_background">@color/material_dynamic_primary40</color> <color name="media_dialog_solid_button_text">@color/material_dynamic_neutral95</color> Loading packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java +11 −2 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements if (icon.getType() != Icon.TYPE_BITMAP && icon.getType() != Icon.TYPE_ADAPTIVE_BITMAP) { // icon doesn't support getBitmap, use default value for color scheme updateButtonBackgroundColorFilter(); updateDialogBackgroundColor(); } else { Configuration config = mContext.getResources().getConfiguration(); int currentNightMode = config.uiMode & Configuration.UI_MODE_NIGHT_MASK; Loading @@ -319,11 +320,14 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements if (colorSetUpdated) { mAdapter.updateColorScheme(wallpaperColors, isDarkThemeOn); updateButtonBackgroundColorFilter(); updateDialogBackgroundColor(); } } mHeaderIcon.setVisibility(View.VISIBLE); mHeaderIcon.setImageIcon(icon); } else { updateButtonBackgroundColorFilter(); updateDialogBackgroundColor(); mHeaderIcon.setVisibility(View.GONE); } if (appSourceIcon != null) { Loading Loading @@ -381,11 +385,16 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements private void updateButtonBackgroundColorFilter() { ColorFilter buttonColorFilter = new PorterDuffColorFilter( mAdapter.getController().getColorButtonBackground(), mMediaOutputController.getColorButtonBackground(), PorterDuff.Mode.SRC_IN); mDoneButton.getBackground().setColorFilter(buttonColorFilter); mStopButton.getBackground().setColorFilter(buttonColorFilter); mDoneButton.setTextColor(mAdapter.getController().getColorPositiveButtonText()); mDoneButton.setTextColor(mMediaOutputController.getColorPositiveButtonText()); } private void updateDialogBackgroundColor() { getDialogView().getBackground().setTint(mMediaOutputController.getColorDialogBackground()); mDeviceListLayout.setBackgroundColor(mMediaOutputController.getColorDialogBackground()); } private Drawable resizeDrawable(Drawable drawable, int size) { Loading packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java +9 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, private int mColorItemBackground; private int mColorConnectedItemBackground; private int mColorPositiveButtonText; private int mColorDialogBackground; private float mInactiveRadius; private float mActiveRadius; Loading Loading @@ -188,6 +189,8 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, R.dimen.media_output_dialog_background_radius); mActiveRadius = mContext.getResources().getDimension( R.dimen.media_output_dialog_active_background_radius); mColorDialogBackground = Utils.getColorStateListDefaultColor(mContext, R.color.media_dialog_background); } void start(@NonNull Callback cb) { Loading Loading @@ -471,6 +474,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, mColorItemBackground = mCurrentColorScheme.getNeutral2().get(9); // N2-800 mColorConnectedItemBackground = mCurrentColorScheme.getAccent2().get(9); // A2-800 mColorPositiveButtonText = mCurrentColorScheme.getAccent2().get(9); // A2-800 mColorDialogBackground = mCurrentColorScheme.getNeutral1().get(10); // N1-900 } else { mColorItemContent = mCurrentColorScheme.getAccent1().get(9); // A1-800 mColorSeekbarProgress = mCurrentColorScheme.getAccent1().get(4); // A1-300 Loading @@ -478,6 +482,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, mColorItemBackground = mCurrentColorScheme.getAccent2().get(1); // A2-50 mColorConnectedItemBackground = mCurrentColorScheme.getAccent1().get(2); // A1-100 mColorPositiveButtonText = mCurrentColorScheme.getNeutral1().get(1); // N1-50 mColorDialogBackground = mCurrentColorScheme.getBackgroundColor(); } } Loading @@ -497,6 +502,10 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, return mColorPositiveButtonText; } public int getColorDialogBackground() { return mColorDialogBackground; } public int getColorItemContent() { return mColorItemContent; } Loading Loading
packages/SystemUI/res/drawable/media_output_dialog_background.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2021 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="rectangle"> <corners android:radius="28dp"/> <solid android:color="@color/media_dialog_background" /> </shape> No newline at end of file
packages/SystemUI/res/layout/media_output_dialog.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ android:id="@+id/media_output_dialog" android:layout_width="@dimen/large_dialog_width" android:layout_height="wrap_content" android:background="@drawable/media_output_dialog_background" android:orientation="vertical"> <LinearLayout Loading
packages/SystemUI/res/values/colors.xml +1 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ <color name="media_dialog_item_main_content">@color/material_dynamic_primary20</color> <color name="media_dialog_item_background">@color/material_dynamic_secondary95</color> <color name="media_dialog_connected_item_background">@color/material_dynamic_primary90</color> <color name="media_dialog_seekbar_progress">@color/material_dynamic_secondary40</color> <color name="media_dialog_seekbar_progress">@android:color/system_accent1_200</color> <color name="media_dialog_button_background">@color/material_dynamic_primary40</color> <color name="media_dialog_solid_button_text">@color/material_dynamic_neutral95</color> Loading
packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java +11 −2 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements if (icon.getType() != Icon.TYPE_BITMAP && icon.getType() != Icon.TYPE_ADAPTIVE_BITMAP) { // icon doesn't support getBitmap, use default value for color scheme updateButtonBackgroundColorFilter(); updateDialogBackgroundColor(); } else { Configuration config = mContext.getResources().getConfiguration(); int currentNightMode = config.uiMode & Configuration.UI_MODE_NIGHT_MASK; Loading @@ -319,11 +320,14 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements if (colorSetUpdated) { mAdapter.updateColorScheme(wallpaperColors, isDarkThemeOn); updateButtonBackgroundColorFilter(); updateDialogBackgroundColor(); } } mHeaderIcon.setVisibility(View.VISIBLE); mHeaderIcon.setImageIcon(icon); } else { updateButtonBackgroundColorFilter(); updateDialogBackgroundColor(); mHeaderIcon.setVisibility(View.GONE); } if (appSourceIcon != null) { Loading Loading @@ -381,11 +385,16 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements private void updateButtonBackgroundColorFilter() { ColorFilter buttonColorFilter = new PorterDuffColorFilter( mAdapter.getController().getColorButtonBackground(), mMediaOutputController.getColorButtonBackground(), PorterDuff.Mode.SRC_IN); mDoneButton.getBackground().setColorFilter(buttonColorFilter); mStopButton.getBackground().setColorFilter(buttonColorFilter); mDoneButton.setTextColor(mAdapter.getController().getColorPositiveButtonText()); mDoneButton.setTextColor(mMediaOutputController.getColorPositiveButtonText()); } private void updateDialogBackgroundColor() { getDialogView().getBackground().setTint(mMediaOutputController.getColorDialogBackground()); mDeviceListLayout.setBackgroundColor(mMediaOutputController.getColorDialogBackground()); } private Drawable resizeDrawable(Drawable drawable, int size) { Loading
packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java +9 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, private int mColorItemBackground; private int mColorConnectedItemBackground; private int mColorPositiveButtonText; private int mColorDialogBackground; private float mInactiveRadius; private float mActiveRadius; Loading Loading @@ -188,6 +189,8 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, R.dimen.media_output_dialog_background_radius); mActiveRadius = mContext.getResources().getDimension( R.dimen.media_output_dialog_active_background_radius); mColorDialogBackground = Utils.getColorStateListDefaultColor(mContext, R.color.media_dialog_background); } void start(@NonNull Callback cb) { Loading Loading @@ -471,6 +474,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, mColorItemBackground = mCurrentColorScheme.getNeutral2().get(9); // N2-800 mColorConnectedItemBackground = mCurrentColorScheme.getAccent2().get(9); // A2-800 mColorPositiveButtonText = mCurrentColorScheme.getAccent2().get(9); // A2-800 mColorDialogBackground = mCurrentColorScheme.getNeutral1().get(10); // N1-900 } else { mColorItemContent = mCurrentColorScheme.getAccent1().get(9); // A1-800 mColorSeekbarProgress = mCurrentColorScheme.getAccent1().get(4); // A1-300 Loading @@ -478,6 +482,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, mColorItemBackground = mCurrentColorScheme.getAccent2().get(1); // A2-50 mColorConnectedItemBackground = mCurrentColorScheme.getAccent1().get(2); // A1-100 mColorPositiveButtonText = mCurrentColorScheme.getNeutral1().get(1); // N1-50 mColorDialogBackground = mCurrentColorScheme.getBackgroundColor(); } } Loading @@ -497,6 +502,10 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback, return mColorPositiveButtonText; } public int getColorDialogBackground() { return mColorDialogBackground; } public int getColorItemContent() { return mColorItemContent; } Loading