* commit '782994efd30a153af44c38a9871d24fecb0eb609': Apply color to progress bar for notifications
This commit is contained in:
@@ -23,6 +23,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
@@ -2773,6 +2774,14 @@ public class Notification implements Parcelable
|
|||||||
contentView.setViewVisibility(R.id.progress, View.VISIBLE);
|
contentView.setViewVisibility(R.id.progress, View.VISIBLE);
|
||||||
contentView.setProgressBar(
|
contentView.setProgressBar(
|
||||||
R.id.progress, mProgressMax, mProgress, mProgressIndeterminate);
|
R.id.progress, mProgressMax, mProgress, mProgressIndeterminate);
|
||||||
|
contentView.setProgressBackgroundTintList(
|
||||||
|
R.id.progress, ColorStateList.valueOf(mContext.getResources().getColor(
|
||||||
|
R.color.notification_progress_background_color)));
|
||||||
|
if (mColor != COLOR_DEFAULT) {
|
||||||
|
ColorStateList colorStateList = ColorStateList.valueOf(mColor);
|
||||||
|
contentView.setProgressTintList(R.id.progress, colorStateList);
|
||||||
|
contentView.setProgressIndeterminateTintList(R.id.progress, colorStateList);
|
||||||
|
}
|
||||||
showLine2 = true;
|
showLine2 = true;
|
||||||
} else {
|
} else {
|
||||||
contentView.setViewVisibility(R.id.progress, View.GONE);
|
contentView.setViewVisibility(R.id.progress, View.GONE);
|
||||||
|
|||||||
@@ -604,6 +604,7 @@ public class ProgressBar extends View {
|
|||||||
* @see #getIndeterminateTintList()
|
* @see #getIndeterminateTintList()
|
||||||
* @see Drawable#setTintList(ColorStateList)
|
* @see Drawable#setTintList(ColorStateList)
|
||||||
*/
|
*/
|
||||||
|
@RemotableViewMethod
|
||||||
public void setIndeterminateTintList(@Nullable ColorStateList tint) {
|
public void setIndeterminateTintList(@Nullable ColorStateList tint) {
|
||||||
if (mProgressTintInfo == null) {
|
if (mProgressTintInfo == null) {
|
||||||
mProgressTintInfo = new ProgressTintInfo();
|
mProgressTintInfo = new ProgressTintInfo();
|
||||||
@@ -842,6 +843,7 @@ public class ProgressBar extends View {
|
|||||||
* @see #getProgressTintList()
|
* @see #getProgressTintList()
|
||||||
* @see Drawable#setTintList(ColorStateList)
|
* @see Drawable#setTintList(ColorStateList)
|
||||||
*/
|
*/
|
||||||
|
@RemotableViewMethod
|
||||||
public void setProgressTintList(@Nullable ColorStateList tint) {
|
public void setProgressTintList(@Nullable ColorStateList tint) {
|
||||||
if (mProgressTintInfo == null) {
|
if (mProgressTintInfo == null) {
|
||||||
mProgressTintInfo = new ProgressTintInfo();
|
mProgressTintInfo = new ProgressTintInfo();
|
||||||
@@ -923,6 +925,7 @@ public class ProgressBar extends View {
|
|||||||
* @see #getProgressBackgroundTintList()
|
* @see #getProgressBackgroundTintList()
|
||||||
* @see Drawable#setTintList(ColorStateList)
|
* @see Drawable#setTintList(ColorStateList)
|
||||||
*/
|
*/
|
||||||
|
@RemotableViewMethod
|
||||||
public void setProgressBackgroundTintList(@Nullable ColorStateList tint) {
|
public void setProgressBackgroundTintList(@Nullable ColorStateList tint) {
|
||||||
if (mProgressTintInfo == null) {
|
if (mProgressTintInfo == null) {
|
||||||
mProgressTintInfo = new ProgressTintInfo();
|
mProgressTintInfo = new ProgressTintInfo();
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentSender;
|
import android.content.IntentSender;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@@ -1069,6 +1070,7 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
static final int BITMAP = 12;
|
static final int BITMAP = 12;
|
||||||
static final int BUNDLE = 13;
|
static final int BUNDLE = 13;
|
||||||
static final int INTENT = 14;
|
static final int INTENT = 14;
|
||||||
|
static final int COLOR_STATE_LIST = 15;
|
||||||
|
|
||||||
String methodName;
|
String methodName;
|
||||||
int type;
|
int type;
|
||||||
@@ -1142,6 +1144,11 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
this.value = Intent.CREATOR.createFromParcel(in);
|
this.value = Intent.CREATOR.createFromParcel(in);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case COLOR_STATE_LIST:
|
||||||
|
if (in.readInt() != 0) {
|
||||||
|
this.value = ColorStateList.CREATOR.createFromParcel(in);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1212,6 +1219,11 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
((Intent)this.value).writeToParcel(out, flags);
|
((Intent)this.value).writeToParcel(out, flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case COLOR_STATE_LIST:
|
||||||
|
out.writeInt(this.value != null ? 1 : 0);
|
||||||
|
if (this.value != null) {
|
||||||
|
((ColorStateList)this.value).writeToParcel(out, flags);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1247,6 +1259,8 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
return Bundle.class;
|
return Bundle.class;
|
||||||
case INTENT:
|
case INTENT:
|
||||||
return Intent.class;
|
return Intent.class;
|
||||||
|
case COLOR_STATE_LIST:
|
||||||
|
return ColorStateList.class;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -2206,6 +2220,42 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
colorFilter, mode, level));
|
colorFilter, mode, level));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
* Equivalent to calling {@link android.widget.ProgressBar#setProgressTintList}.
|
||||||
|
*
|
||||||
|
* @param viewId The id of the view whose tint should change
|
||||||
|
* @param tint the tint to apply, may be {@code null} to clear tint
|
||||||
|
*/
|
||||||
|
public void setProgressTintList(int viewId, ColorStateList tint) {
|
||||||
|
addAction(new ReflectionAction(viewId, "setProgressTintList",
|
||||||
|
ReflectionAction.COLOR_STATE_LIST, tint));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
* Equivalent to calling {@link android.widget.ProgressBar#setProgressBackgroundTintList}.
|
||||||
|
*
|
||||||
|
* @param viewId The id of the view whose tint should change
|
||||||
|
* @param tint the tint to apply, may be {@code null} to clear tint
|
||||||
|
*/
|
||||||
|
public void setProgressBackgroundTintList(int viewId, ColorStateList tint) {
|
||||||
|
addAction(new ReflectionAction(viewId, "setProgressBackgroundTintList",
|
||||||
|
ReflectionAction.COLOR_STATE_LIST, tint));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
* Equivalent to calling {@link android.widget.ProgressBar#setIndeterminateTintList}.
|
||||||
|
*
|
||||||
|
* @param viewId The id of the view whose tint should change
|
||||||
|
* @param tint the tint to apply, may be {@code null} to clear tint
|
||||||
|
*/
|
||||||
|
public void setProgressIndeterminateTintList(int viewId, ColorStateList tint) {
|
||||||
|
addAction(new ReflectionAction(viewId, "setIndeterminateTintList",
|
||||||
|
ReflectionAction.COLOR_STATE_LIST, tint));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent to calling {@link android.widget.TextView#setTextColor(int)}.
|
* Equivalent to calling {@link android.widget.TextView#setTextColor(int)}.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -136,6 +136,8 @@
|
|||||||
<color name="notification_media_primary_color">@color/primary_text_material_dark</color>
|
<color name="notification_media_primary_color">@color/primary_text_material_dark</color>
|
||||||
<color name="notification_media_secondary_color">@color/secondary_text_material_dark</color>
|
<color name="notification_media_secondary_color">@color/secondary_text_material_dark</color>
|
||||||
|
|
||||||
|
<color name="notification_progress_background_color">@color/secondary_text_material_light</color>
|
||||||
|
|
||||||
<!-- Keyguard colors -->
|
<!-- Keyguard colors -->
|
||||||
<color name="keyguard_avatar_frame_color">#ffffffff</color>
|
<color name="keyguard_avatar_frame_color">#ffffffff</color>
|
||||||
<color name="keyguard_avatar_frame_shadow_color">#80000000</color>
|
<color name="keyguard_avatar_frame_shadow_color">#80000000</color>
|
||||||
|
|||||||
@@ -1782,6 +1782,7 @@
|
|||||||
<java-symbol type="drawable" name="notification_icon_legacy_bg" />
|
<java-symbol type="drawable" name="notification_icon_legacy_bg" />
|
||||||
<java-symbol type="color" name="notification_media_primary_color" />
|
<java-symbol type="color" name="notification_media_primary_color" />
|
||||||
<java-symbol type="color" name="notification_media_secondary_color" />
|
<java-symbol type="color" name="notification_media_secondary_color" />
|
||||||
|
<java-symbol type="color" name="notification_progress_background_color" />
|
||||||
<java-symbol type="id" name="media_actions" />
|
<java-symbol type="id" name="media_actions" />
|
||||||
|
|
||||||
<!-- From SystemUI -->
|
<!-- From SystemUI -->
|
||||||
|
|||||||
Reference in New Issue
Block a user