Show cast record icon in the status bar

- Add CastDrawable that wraps ic_cast and draws the red record fill
- Add ic_cast_connected_fill that only contains the fill of the cast icon
- Updated all icon packs to include fill icon on the right ic_cast size

Fixes: 127479204
Test: visual; sysui demo mode
Change-Id: Idaed25ad0a5646af4be4170ee76938a4d40aaf3e
This commit is contained in:
Amin Shaikh
2019-05-03 16:02:13 -04:00
parent 78cbd8f8c6
commit 6c328ac58c
13 changed files with 232 additions and 17 deletions

View File

@@ -14,8 +14,8 @@ Copyright (C) 2017 The Android Open Source Project
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:width="17dp"
android:height="17dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path

View File

@@ -14,13 +14,13 @@ Copyright (C) 2017 The Android Open Source Project
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="17dp"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:fillColor="@android:color/white"
android:pathData="M1,18v3h3C4,19.34 2.66,18 1,18zM1,14v2c2.76,0 5,2.24 5,5h2C8,17.13 4.87,14 1,14zM19,7H5v1.63c3.96,1.28 7.09,4.41 8.37,8.37H19V7zM1,10v2c4.97,0 9,4.03 9,9h2C12,14.92 7.07,10 1,10zM21,3H3C1.9,3 1,3.9 1,5v3h2V5h18v14h-7v2h7c1.1,0 2,-0.9 2,-2V5C23,3.9 22.1,3 21,3"/>
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (C) 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
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="17dp"
android:tint="?android:attr/colorError"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M19,7H5v1.63c3.96,1.28 7.09,4.41 8.37,8.37H19V7z" />
</vector>

View File

@@ -13,7 +13,4 @@ Copyright (C) 2017 The Android Open Source Project
See the License for the specific language governing permissions and
limitations under the License.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="2.5dp"
android:insetRight="2.5dp"
android:drawable="@drawable/ic_cast_connected" />
<com.android.systemui.statusbar.CastDrawable />

View File

@@ -60,6 +60,9 @@
<!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
<!-- Default horizontal drawable padding for status bar icons. -->
<dimen name="status_bar_horizontal_padding">2.5dp</dimen>
<!-- Height of the battery icon in the status bar. -->
<dimen name="status_bar_battery_icon_height">13.0dp</dimen>

View File

@@ -0,0 +1,111 @@
/*
* Copyright (C) 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.
*/
package com.android.systemui.statusbar;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableWrapper;
import android.util.AttributeSet;
import com.android.systemui.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
/**
* The status bar cast drawable draws ic_cast and ic_cast_connected_fill to indicate that the
* screen is being recorded. A simple layer-list drawable isn't used here because the record fill
* must not be tinted by the caller.
*/
public class CastDrawable extends DrawableWrapper {
private Drawable mFillDrawable;
private int mHorizontalPadding;
/** No-arg constructor used by drawable inflation. */
public CastDrawable() {
super(null);
}
@Override
public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser,
@NonNull AttributeSet attrs, @Nullable Resources.Theme theme)
throws XmlPullParserException, IOException {
super.inflate(r, parser, attrs, theme);
setDrawable(r.getDrawable(R.drawable.ic_cast, theme).mutate());
mFillDrawable = r.getDrawable(R.drawable.ic_cast_connected_fill, theme).mutate();
mHorizontalPadding = r.getDimensionPixelSize(R.dimen.status_bar_horizontal_padding);
}
@Override
public boolean canApplyTheme() {
return mFillDrawable.canApplyTheme() || super.canApplyTheme();
}
@Override
public void applyTheme(Resources.Theme t) {
super.applyTheme(t);
mFillDrawable.applyTheme(t);
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
mFillDrawable.setBounds(bounds);
}
@Override
public boolean onLayoutDirectionChanged(int layoutDirection) {
mFillDrawable.setLayoutDirection(layoutDirection);
return super.onLayoutDirectionChanged(layoutDirection);
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
mFillDrawable.draw(canvas);
}
@Override
public boolean getPadding(Rect padding) {
padding.left += mHorizontalPadding;
padding.right += mHorizontalPadding;
return true;
}
@Override
public void setAlpha(int alpha) {
super.setAlpha(alpha);
mFillDrawable.setAlpha(alpha);
}
@Override
public boolean setVisible(boolean visible, boolean restart) {
mFillDrawable.setVisible(visible, restart);
return super.setVisible(visible, restart);
}
@Override
public Drawable mutate() {
mFillDrawable.mutate();
return super.mutate();
}
}

View File

@@ -15,10 +15,10 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:height="17dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp" >
android:width="17dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M2.25,9C2.66,9,3,8.66,3,8.25v-1C3,6.01,4.01,5,5.25,5h13.5C19.99,5,21,6.01,21,7.25V19h-7.25C13.34,19,13,19.34,13,19.75 s0.34,0.75,0.75,0.75h8.75V7.25c0-2.07-1.68-3.75-3.75-3.75H5.25C3.18,3.5,1.5,5.18,1.5,7.25v1C1.5,8.66,1.84,9,2.25,9z" />

View File

@@ -15,10 +15,10 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="17dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="17dp" >
android:width="24dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M2.25,9C2.66,9,3,8.66,3,8.25v-1C3,6.01,4.01,5,5.25,5h13.5C19.99,5,21,6.01,21,7.25V19h-7.25C13.34,19,13,19.34,13,19.75 s0.34,0.75,0.75,0.75h8.75V7.25c0-2.07-1.68-3.75-3.75-3.75H5.25C3.18,3.5,1.5,5.18,1.5,7.25v1C1.5,8.66,1.84,9,2.25,9z" />

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="17dp"
android:tint="?android:attr/colorError"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="17dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M13.75,15C13.34,15,13,15.34,13,15.75s0.34,0.75,0.75,0.75h4c0.41,0,0.75-0.34,0.75-0.75v-6.5c0-0.96-0.79-1.75-1.75-1.75 H6.25C5.84,7.5,5.5,7.84,5.5,8.25S5.84,9,6.25,9h10.5C16.89,9,17,9.11,17,9.25V15H13.75z" />
</vector>

View File

@@ -15,10 +15,10 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:height="17dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp" >
android:width="17dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M2.11,14.08C1.52,13.99,1.02,14.46,1,15.06c-0.01,0.51,0.32,0.93,0.82,1.02c2.08,0.36,3.74,2,4.1,4.08 C6.01,20.64,6.42,21,6.91,21c0.61,0,1.09-0.54,1-1.14C7.42,16.88,5.09,14.56,2.11,14.08z" />

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="17dp"
android:tint="?android:attr/colorError"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="17dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M19,7H5v1.63c3.96,1.28,7.09,4.41,8.37,8.37H19V7z" />
</vector>

View File

@@ -15,10 +15,10 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:height="17dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp" >
android:width="17dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M2.75,14.25C2.34,14.25,2,14.59,2,15s0.34,0.75,0.75,0.75c1.93,0,3.5,1.57,3.5,3.5C6.25,19.66,6.59,20,7,20 s0.75-0.34,0.75-0.75C7.75,16.49,5.51,14.25,2.75,14.25z" />

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="17dp"
android:tint="?android:attr/colorError"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="17dp" >
<path
android:fillColor="@android:color/white"
android:pathData="M13.25,15.5c-0.41,0-0.75,0.34-0.75,0.75S12.84,17,13.25,17h5c0.41,0,0.75-0.34,0.75-0.75v-8.5C19,7.34,18.66,7,18.25,7 H5.75C5.34,7,5,7.34,5,7.75v1C5,9.16,5.34,9.5,5.75,9.5S6.5,9.16,6.5,8.75V8.5h11v7H13.25z" />
</vector>