Altering touch feedback for qsb assets. (Bug: 5560273)
- Removing some dead code Change-Id: If6f3ffcf28249ca08c23089acb5bcd501b455119
This commit is contained in:
1 parent
14cee9a9bb
commit
620542254c
6 files changed
+48
-18
No files matched your search
@@ -17,13 +17,21 @@
|
||||
package com.android.launcher2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.launcher.R;
|
||||
|
||||
public class HolographicLinearLayout extends LinearLayout {
|
||||
|
||||
private final HolographicViewHelper mHolographicHelper;
|
||||
private ImageView mImageView;
|
||||
private int mImageViewId;
|
||||
|
||||
public HolographicLinearLayout(Context context) {
|
||||
this(context, null);
|
||||
@@ -36,16 +44,37 @@ public class HolographicLinearLayout extends LinearLayout {
|
||||
public HolographicLinearLayout(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HolographicLinearLayout,
|
||||
defStyle, 0);
|
||||
mImageViewId = a.getResourceId(R.styleable.HolographicLinearLayout_sourceImageViewId, -1);
|
||||
a.recycle();
|
||||
|
||||
setWillNotDraw(false);
|
||||
mHolographicHelper = new HolographicViewHelper(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
|
||||
if (mImageView != null) {
|
||||
Drawable d = mImageView.getDrawable();
|
||||
if (d instanceof StateListDrawable) {
|
||||
StateListDrawable sld = (StateListDrawable) d;
|
||||
sld.setState(getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
// One time call to generate the pressed/focused state -- must be called after
|
||||
// measure/layout
|
||||
mHolographicHelper.generatePressedFocusedStates(this);
|
||||
if (mImageView == null) {
|
||||
mImageView = (ImageView) findViewById(mImageViewId);
|
||||
}
|
||||
mHolographicHelper.generatePressedFocusedStates(mImageView);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user