Fix 3065611: NPE in Launcher attempting to drag app to home screen
This commit is contained in:
1 parent
0423dcf286
commit
046e7eb472
3 files changed
+47
-47
No files matched your search
@@ -145,57 +145,57 @@ public class CellLayout extends ViewGroup implements Dimmable {
|
||||
|
||||
mWallpaperManager = WallpaperManager.getInstance(context);
|
||||
|
||||
if (LauncherApplication.isScreenXLarge()) {
|
||||
final Resources res = getResources();
|
||||
final Resources res = getResources();
|
||||
|
||||
if (LauncherApplication.isScreenXLarge()) {
|
||||
mBackgroundMini = res.getDrawable(R.drawable.mini_home_screen_bg);
|
||||
mBackgroundMini.setFilterBitmap(true);
|
||||
mBackground = res.getDrawable(R.drawable.home_screen_bg);
|
||||
mBackground.setFilterBitmap(true);
|
||||
mBackgroundMiniHover = res.getDrawable(R.drawable.mini_home_screen_bg_hover);
|
||||
mBackgroundMiniHover.setFilterBitmap(true);
|
||||
}
|
||||
|
||||
// Initialize the data structures used for the drag visualization.
|
||||
// Initialize the data structures used for the drag visualization.
|
||||
|
||||
mDragRectDrawable = res.getDrawable(R.drawable.rounded_rect_green);
|
||||
mCrosshairsDrawable = res.getDrawable(R.drawable.gardening_crosshairs);
|
||||
Interpolator interp = new DecelerateInterpolator(2.5f); // Quint ease out
|
||||
mDragRectDrawable = res.getDrawable(R.drawable.rounded_rect_green);
|
||||
mCrosshairsDrawable = res.getDrawable(R.drawable.gardening_crosshairs);
|
||||
Interpolator interp = new DecelerateInterpolator(2.5f); // Quint ease out
|
||||
|
||||
// Set up the animation for fading the crosshairs in and out
|
||||
int animDuration = res.getInteger(R.integer.config_crosshairsFadeInTime);
|
||||
mCrosshairsAnimator = new ValueAnimator<Float>(animDuration);
|
||||
mCrosshairsAnimator.addUpdateListener(new AnimatorUpdateListener() {
|
||||
// Set up the animation for fading the crosshairs in and out
|
||||
int animDuration = res.getInteger(R.integer.config_crosshairsFadeInTime);
|
||||
mCrosshairsAnimator = new ValueAnimator<Float>(animDuration);
|
||||
mCrosshairsAnimator.addUpdateListener(new AnimatorUpdateListener() {
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
mCrosshairsVisibility = ((Float) animation.getAnimatedValue()).floatValue();
|
||||
CellLayout.this.invalidate();
|
||||
}
|
||||
});
|
||||
mCrosshairsAnimator.setInterpolator(interp);
|
||||
|
||||
for (int i = 0; i < mDragRects.length; i++) {
|
||||
mDragRects[i] = new Rect();
|
||||
}
|
||||
|
||||
// When dragging things around the home screens, we show a green outline of
|
||||
// where the item will land. The outlines gradually fade out, leaving a trail
|
||||
// behind the drag path.
|
||||
// Set up all the animations that are used to implement this fading.
|
||||
final int duration = res.getInteger(R.integer.config_dragOutlineFadeTime);
|
||||
final int fromAlphaValue = 0;
|
||||
final int toAlphaValue = res.getInteger(R.integer.config_dragOutlineMaxAlpha);
|
||||
for (int i = 0; i < mDragRectAnims.length; i++) {
|
||||
final InterruptibleInOutAnimator anim =
|
||||
new InterruptibleInOutAnimator(duration, fromAlphaValue, toAlphaValue);
|
||||
anim.setInterpolator(interp);
|
||||
final int thisIndex = i;
|
||||
anim.addUpdateListener(new AnimatorUpdateListener() {
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
mCrosshairsVisibility = ((Float) animation.getAnimatedValue()).floatValue();
|
||||
CellLayout.this.invalidate();
|
||||
mDragRectAlphas[thisIndex] = (Integer) animation.getAnimatedValue();
|
||||
CellLayout.this.invalidate(mDragRects[thisIndex]);
|
||||
}
|
||||
});
|
||||
mCrosshairsAnimator.setInterpolator(interp);
|
||||
|
||||
for (int i = 0; i < mDragRects.length; i++) {
|
||||
mDragRects[i] = new Rect();
|
||||
}
|
||||
|
||||
// When dragging things around the home screens, we show a green outline of
|
||||
// where the item will land. The outlines gradually fade out, leaving a trail
|
||||
// behind the drag path.
|
||||
// Set up all the animations that are used to implement this fading.
|
||||
final int duration = res.getInteger(R.integer.config_dragOutlineFadeTime);
|
||||
final int fromAlphaValue = 0;
|
||||
final int toAlphaValue = res.getInteger(R.integer.config_dragOutlineMaxAlpha);
|
||||
for (int i = 0; i < mDragRectAnims.length; i++) {
|
||||
final InterruptibleInOutAnimator anim =
|
||||
new InterruptibleInOutAnimator(duration, fromAlphaValue, toAlphaValue);
|
||||
anim.setInterpolator(interp);
|
||||
final int thisIndex = i;
|
||||
anim.addUpdateListener(new AnimatorUpdateListener() {
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
mDragRectAlphas[thisIndex] = (Integer) animation.getAnimatedValue();
|
||||
CellLayout.this.invalidate(mDragRects[thisIndex]);
|
||||
}
|
||||
});
|
||||
mDragRectAnims[i] = anim;
|
||||
}
|
||||
mDragRectAnims[i] = anim;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user