* commit '20ba658bdb32cb6f02cb12d9f94419e29420f9f5': Use SCREEN Xfermode for keyguard badges; update SeekBar
@@ -27,6 +27,7 @@ import android.graphics.Matrix;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Xfermode;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
@@ -73,6 +74,7 @@ public class ImageView extends View {
|
||||
|
||||
// these are applied to the drawable
|
||||
private ColorFilter mColorFilter;
|
||||
private Xfermode mXfermode;
|
||||
private int mAlpha = 255;
|
||||
private int mViewAlphaScale = 256;
|
||||
private boolean mColorMod = false;
|
||||
@@ -1124,6 +1126,18 @@ public class ImageView extends View {
|
||||
setColorFilter(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide Candidate for future API inclusion
|
||||
*/
|
||||
public final void setXfermode(Xfermode mode) {
|
||||
if (mXfermode != mode) {
|
||||
mXfermode = mode;
|
||||
mColorMod = true;
|
||||
applyColorMod();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the active color filter for this ImageView.
|
||||
*
|
||||
@@ -1200,6 +1214,7 @@ public class ImageView extends View {
|
||||
if (mDrawable != null && mColorMod) {
|
||||
mDrawable = mDrawable.mutate();
|
||||
mDrawable.setColorFilter(mColorFilter);
|
||||
mDrawable.setXfermode(mXfermode);
|
||||
mDrawable.setAlpha(mAlpha * mViewAlphaScale >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.Xfermode;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.LayoutDirection;
|
||||
@@ -530,6 +531,14 @@ public class BitmapDrawable extends Drawable {
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide Candidate for future API inclusion
|
||||
*/
|
||||
public void setXfermode(Xfermode xfermode) {
|
||||
mBitmapState.mPaint.setXfermode(xfermode);
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* A mutable BitmapDrawable still shares its Bitmap with any other Drawable
|
||||
* that comes from the same resource.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Xfermode;
|
||||
import android.os.Trace;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -427,6 +428,15 @@ public abstract class Drawable {
|
||||
*/
|
||||
public abstract void setColorFilter(ColorFilter cf);
|
||||
|
||||
/**
|
||||
* @hide Consider for future API inclusion
|
||||
*/
|
||||
public void setXfermode(Xfermode mode) {
|
||||
// Base implementation drops it on the floor for compatibility. Whee!
|
||||
// TODO: For this to be included in the API proper, all framework drawables need impls.
|
||||
// For right now only BitmapDrawable has it.
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a color and porterduff mode to be the colorfilter for this
|
||||
* drawable.
|
||||
|
||||
BIN
packages/Keyguard/res/drawable-hdpi/progress_bg_holo_light.9.png
Normal file
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 413 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 983 B |
|
After Width: | Height: | Size: 973 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
BIN
packages/Keyguard/res/drawable-hdpi/scrubber_primary_holo.9.png
Normal file
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 179 B |
|
After Width: | Height: | Size: 179 B |
BIN
packages/Keyguard/res/drawable-mdpi/progress_bg_holo_light.9.png
Normal file
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 704 B |
|
After Width: | Height: | Size: 696 B |
|
After Width: | Height: | Size: 824 B |
|
After Width: | Height: | Size: 1.0 KiB |
BIN
packages/Keyguard/res/drawable-mdpi/scrubber_primary_holo.9.png
Normal file
|
After Width: | Height: | Size: 171 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 169 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 563 B |
|
After Width: | Height: | Size: 182 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
BIN
packages/Keyguard/res/drawable-xhdpi/scrubber_primary_holo.9.png
Normal file
|
After Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 186 B |
BIN
packages/Keyguard/res/drawable-xxhdpi/kg_add_widget_pressed.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2013 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false" android:drawable="@drawable/scrubber_control_disabled_holo" />
|
||||
<item android:state_pressed="true" android:drawable="@drawable/scrubber_control_pressed_holo" />
|
||||
<item android:state_selected="true" android:drawable="@drawable/scrubber_control_focused_holo" />
|
||||
<item android:drawable="@drawable/scrubber_control_normal_holo" />
|
||||
</selector>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2013 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.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background"
|
||||
android:drawable="@drawable/scrubber_track_holo_light" />
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<scale android:scaleWidth="100%"
|
||||
android:drawable="@drawable/scrubber_secondary_holo" />
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%"
|
||||
android:drawable="@drawable/scrubber_primary_holo" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -75,7 +75,8 @@
|
||||
<SeekBar
|
||||
android:id="@+id/transient_seek_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.TransportControl.SeekBar" />
|
||||
<TextView
|
||||
android:id="@+id/transient_seek_time_elapsed"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -68,4 +68,18 @@
|
||||
<item name="android:textSize">@dimen/widget_big_font_size</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TransportControl.SeekBar" parent="@android:style/Widget.Holo.SeekBar">
|
||||
<item name="android:indeterminateOnly">false</item>
|
||||
<item name="android:progressDrawable">@drawable/scrubber_progress_horizontal_holo_light</item>
|
||||
<item name="android:indeterminateDrawable">@drawable/scrubber_progress_horizontal_holo_light</item>
|
||||
<item name="android:minHeight">13dip</item>
|
||||
<item name="android:maxHeight">13dip</item>
|
||||
<item name="android:thumb">@drawable/scrubber_control_selector_holo</item>
|
||||
<item name="android:thumbOffset">16dip</item>
|
||||
<item name="android:focusable">true</item>
|
||||
<item name="android:paddingStart">16dip</item>
|
||||
<item name="android:paddingEnd">16dip</item>
|
||||
<item name="android:mirrorForRtl">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -43,8 +43,6 @@ public class KeyguardStatusView extends GridLayout {
|
||||
|
||||
private TextView mAlarmStatusView;
|
||||
|
||||
private final int MARQUEE_VIEWS[] = { R.id.alarm_status };
|
||||
|
||||
private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
|
||||
|
||||
@Override
|
||||
@@ -83,12 +81,7 @@ public class KeyguardStatusView extends GridLayout {
|
||||
|
||||
private void setEnableMarquee(boolean enabled) {
|
||||
if (DEBUG) Log.v(TAG, (enabled ? "Enable" : "Disable") + " transport text marquee");
|
||||
for (int i = 0; i < MARQUEE_VIEWS.length; i++) {
|
||||
View v = findViewById(MARQUEE_VIEWS[i]);
|
||||
if (v != null) {
|
||||
v.setSelected(enabled);
|
||||
}
|
||||
}
|
||||
if (mAlarmStatusView != null) mAlarmStatusView.setSelected(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,8 @@ import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.ColorMatrix;
|
||||
import android.graphics.ColorMatrixColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaMetadataEditor;
|
||||
@@ -84,8 +86,6 @@ public class KeyguardTransportControlView extends FrameLayout {
|
||||
private AudioManager mAudioManager;
|
||||
private RemoteController mRemoteController;
|
||||
|
||||
private int MARQUEE_VIEWS[] = { R.id.title, R.id.artist_album };
|
||||
|
||||
private ImageView mBadge;
|
||||
|
||||
private boolean mSeekEnabled;
|
||||
@@ -264,12 +264,8 @@ public class KeyguardTransportControlView extends FrameLayout {
|
||||
|
||||
private void setEnableMarquee(boolean enabled) {
|
||||
if (DEBUG) Log.v(TAG, (enabled ? "Enable" : "Disable") + " transport text marquee");
|
||||
for (int i = 0; i < MARQUEE_VIEWS.length; i++) {
|
||||
View v = findViewById(MARQUEE_VIEWS[i]);
|
||||
if (v != null) {
|
||||
v.setSelected(enabled);
|
||||
}
|
||||
}
|
||||
if (mTrackTitle != null) mTrackTitle.setSelected(enabled);
|
||||
if (mTrackArtistAlbum != null) mTrackTitle.setSelected(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -334,6 +330,7 @@ public class KeyguardTransportControlView extends FrameLayout {
|
||||
final ColorMatrix cm = new ColorMatrix();
|
||||
cm.setSaturation(0);
|
||||
mBadge.setColorFilter(new ColorMatrixColorFilter(cm));
|
||||
mBadge.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SCREEN));
|
||||
mBadge.setImageAlpha(0xef);
|
||||
}
|
||||
|
||||
|
||||