summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-10-23 15:10:50 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-23 15:10:50 -0700
commitc29cd805fb9f955029e86c1283c6b2d17ec0cf19 (patch)
treefd8ed50fa53ec4582f9e3c91bc304466bef99325
parent80e4d5e36d3d3c8da550b7200a5359c9ff468809 (diff)
parent5894a6b55271727695d7a489dfc06d12fa49c788 (diff)
downloadandroid_packages_apps_Snap-c29cd805fb9f955029e86c1283c6b2d17ec0cf19.tar.gz
android_packages_apps_Snap-c29cd805fb9f955029e86c1283c6b2d17ec0cf19.tar.bz2
android_packages_apps_Snap-c29cd805fb9f955029e86c1283c6b2d17ec0cf19.zip
am d6453edc: Merge "Fix NPE" into gb-ub-photos-arches
* commit 'd6453edcdbdad2706d8ce4a4fddd8f7df347b78c': Fix NPE
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index 7e795fa0f..f129961ff 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -232,15 +232,17 @@ public class PhotoView extends GLView {
// item. The value Integer.MAX_VALUE means there is no such hint.
private int mUndoIndexHint = Integer.MAX_VALUE;
+ private Context mContext;
+
public PhotoView(AbstractGalleryActivity activity) {
mTileView = new TileImageView(activity);
addComponent(mTileView);
- Context context = activity.getAndroidContext();
- mPlaceholderColor = context.getResources().getColor(
+ mContext = activity.getAndroidContext();
+ mPlaceholderColor = mContext.getResources().getColor(
R.color.photo_placeholder);
- mEdgeView = new EdgeView(context);
+ mEdgeView = new EdgeView(mContext);
addComponent(mEdgeView);
- mUndoBar = new UndoBarView(context);
+ mUndoBar = new UndoBarView(mContext);
addComponent(mUndoBar);
mUndoBar.setVisibility(GLView.INVISIBLE);
mUndoBar.setOnClickListener(new OnClickListener() {
@@ -251,15 +253,15 @@ public class PhotoView extends GLView {
}
});
mNoThumbnailText = StringTexture.newInstance(
- context.getString(R.string.no_thumbnail),
+ mContext.getString(R.string.no_thumbnail),
DEFAULT_TEXT_SIZE, Color.WHITE);
mHandler = new MyHandler(activity.getGLRoot());
mGestureListener = new MyGestureListener();
- mGestureRecognizer = new GestureRecognizer(context, mGestureListener);
+ mGestureRecognizer = new GestureRecognizer(mContext, mGestureListener);
- mPositionController = new PositionController(context,
+ mPositionController = new PositionController(mContext,
new PositionController.Listener() {
@Override
@@ -292,7 +294,7 @@ public class PhotoView extends GLView {
mEdgeView.onAbsorb(velocity, direction);
}
});
- mVideoPlayIcon = new ResourceTexture(context, R.drawable.ic_control_play);
+ mVideoPlayIcon = new ResourceTexture(mContext, R.drawable.ic_control_play);
for (int i = -SCREEN_NAIL_MAX; i <= SCREEN_NAIL_MAX; i++) {
if (i == 0) {
mPictures.put(i, new FullPicture());
@@ -554,7 +556,7 @@ public class PhotoView extends GLView {
// The second is that it assumes landscape is a 90 rotation from portrait,
// however on landscape devices this is not true. Thus, if we are in portrait
// on a landscape device, we need to invert the output
- int orientation = getGLRoot().getContext().getResources().getConfiguration().orientation;
+ int orientation = mContext.getResources().getConfiguration().orientation;
boolean invertPortrait = (orientation == Configuration.ORIENTATION_PORTRAIT
&& (mDisplayRotation == 90 || mDisplayRotation == 270));
boolean invert = (mDisplayRotation >= 180);