Adding an option to change the shadow size
am: 8b6ac00a1b
Change-Id: I6ebafb3b81f486adeb510bc021638dd266ca1234
This commit is contained in:
commit
233fbd7059
|
@ -15,4 +15,5 @@
|
|||
-->
|
||||
<com.android.launcher3.graphics.ShadowDrawable
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/ic_info_no_shadow" />
|
||||
android:src="@drawable/ic_info_no_shadow"
|
||||
android:elevation="@dimen/drop_target_shadow_elevation" />
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
-->
|
||||
<com.android.launcher3.graphics.ShadowDrawable
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/ic_remove_no_shadow" />
|
||||
android:src="@drawable/ic_remove_no_shadow"
|
||||
android:elevation="@dimen/drop_target_shadow_elevation" />
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
-->
|
||||
<com.android.launcher3.graphics.ShadowDrawable
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/ic_uninstall_no_shadow" />
|
||||
android:src="@drawable/ic_uninstall_no_shadow"
|
||||
android:elevation="@dimen/drop_target_shadow_elevation" />
|
||||
|
|
|
@ -114,5 +114,6 @@
|
|||
<declare-styleable name="ShadowDrawable">
|
||||
<attr name="android:src" />
|
||||
<attr name="android:shadowColor" />
|
||||
<attr name="android:elevation" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
<!-- Drag padding to add to the bottom of drop targets -->
|
||||
<dimen name="drop_target_drag_padding">14dp</dimen>
|
||||
<dimen name="drop_target_text_size">14sp</dimen>
|
||||
<dimen name="drop_target_shadow_elevation">2dp</dimen>
|
||||
|
||||
<!-- the distance an icon must be dragged before button drop targets accept it -->
|
||||
<dimen name="drag_distanceThreshold">30dp</dimen>
|
||||
|
@ -138,7 +139,6 @@
|
|||
<dimen name="blur_size_medium_outline">2dp</dimen>
|
||||
<dimen name="blur_size_click_shadow">4dp</dimen>
|
||||
<dimen name="click_shadow_high_shift">2dp</dimen>
|
||||
<dimen name="drawable_shadow_size">4dp</dimen>
|
||||
|
||||
<!-- Pending widget -->
|
||||
<dimen name="pending_widget_min_padding">8dp</dimen>
|
||||
|
|
|
@ -46,6 +46,7 @@ public class ShadowDrawable extends Drawable {
|
|||
|
||||
private final ShadowDrawableState mState;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public ShadowDrawable() {
|
||||
this(new ShadowDrawableState());
|
||||
}
|
||||
|
@ -98,17 +99,6 @@ public class ShadowDrawable extends Drawable {
|
|||
return mState.mIntrinsicWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color for the generated shadow
|
||||
*/
|
||||
public void setShadowColor(int color) {
|
||||
if (mState.mShadowColor != color) {
|
||||
mState.mShadowColor = color;
|
||||
mState.mLastDrawnBitmap = null;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
private void regenerateBitmapCache() {
|
||||
Bitmap bitmap = Bitmap.createBitmap(mState.mIntrinsicWidth, mState.mIntrinsicHeight,
|
||||
Bitmap.Config.ARGB_8888);
|
||||
|
@ -154,7 +144,8 @@ public class ShadowDrawable extends Drawable {
|
|||
}
|
||||
mState.mShadowColor = a.getColor(
|
||||
R.styleable.ShadowDrawable_android_shadowColor, Color.BLACK);
|
||||
mState.mShadowSize = r.getDimensionPixelSize(R.dimen.drawable_shadow_size);
|
||||
mState.mShadowSize = a.getDimensionPixelSize(
|
||||
R.styleable.ShadowDrawable_android_elevation, 0);
|
||||
|
||||
mState.mIntrinsicHeight = d.getIntrinsicHeight() + 2 * mState.mShadowSize;
|
||||
mState.mIntrinsicWidth = d.getIntrinsicWidth() + 2 * mState.mShadowSize;
|
||||
|
|
Loading…
Reference in New Issue