Speeding up AllApps click feedback

Change-Id: Ia16845b16d369bea610bb908d9a9f4805d4a1d54
This commit is contained in:
Michael Jurka
2012-01-12 07:46:24 -08:00
parent 298ce02189
commit e3517d01ec
3 changed files with 14 additions and 19 deletions
@@ -492,12 +492,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
if (v instanceof PagedViewIcon) {
// Animate some feedback to the click
final ApplicationInfo appInfo = (ApplicationInfo) v.getTag();
animateClickFeedback(v, new Runnable() {
@Override
public void run() {
mLauncher.startActivitySafely(appInfo.intent, appInfo);
}
});
mLauncher.startActivitySafely(appInfo.intent, appInfo);
} else if (v instanceof PagedViewWidget) {
// Let the user know that they have to long press to add a widget
Toast.makeText(getContext(), R.string.long_press_widget_to_add,
-13
View File
@@ -997,19 +997,6 @@ public abstract class PagedView extends ViewGroup {
return mTouchState != TOUCH_STATE_REST;
}
protected void animateClickFeedback(View v, final Runnable r) {
// animate the view slightly to show click feedback running some logic after it is "pressed"
ObjectAnimator anim = (ObjectAnimator) AnimatorInflater.
loadAnimator(mContext, R.anim.paged_view_click_feedback);
anim.setTarget(v);
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationRepeat(Animator animation) {
r.run();
}
});
anim.start();
}
protected void determineScrollingStart(MotionEvent ev) {
determineScrollingStart(ev, 1.0f);
}
@@ -54,4 +54,17 @@ public class PagedViewIcon extends TextView {
setText(info.title);
setTag(info);
}
protected void drawableStateChanged() {
if (isPressed()) {
if (getAlpha() != 0.5f) {
setAlpha(0.5f);
}
} else {
if (getAlpha() != 1f) {
setAlpha(1f);
}
}
super.drawableStateChanged();
}
}