Merge "Reenables crop aspect ratio menu." into gb-ub-photos-bryce
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index a50df66..2fcbe7c 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -82,8 +82,8 @@
<dimen name="pie_arc_offset">48dp</dimen>
<dimen name="pie_item_radius">370dp</dimen>
<dimen name="pie_arc_radius">214dp</dimen>
- <dimen name="pie_deadzone_width">48dp</dimen>
- <dimen name="pie_anglezone_width">80dp</dimen>
+ <dimen name="pie_deadzone_width">36dp</dimen>
+ <dimen name="pie_anglezone_width">92dp</dimen>
<dimen name="focus_radius_offset">8dp</dimen>
<dimen name="focus_inner_offset">24dp</dimen>
<dimen name="focus_outer_stroke">3dp</dimen>
diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml
index e2b04d2..b8d4929 100644
--- a/res/values/filtershow_strings.xml
+++ b/res/values/filtershow_strings.xml
@@ -28,6 +28,9 @@
<!-- generic strings -->
+
+ <!-- Text for to display on a download failure [CHAR LIMIT=NONE] -->
+ <string name="download_failure">Could not download photo. Network unavailable.</string>
<!-- Text for original image [CHAR LIMIT=20] -->
<string name="original">Original</string>
<!-- Text for filters that apply a border to a picture [CHAR LIMIT=20] -->
@@ -39,10 +42,10 @@
<string name="filtershow_undo">Undo</string>
<!-- Text for redo menu item [CHAR LIMIT=20] -->
<string name="filtershow_redo">Redo</string>
- <!-- Text for the image state panel menu item [CHAR LIMIT=20] -->
- <string name="show_imagestate_panel">Show Image State</string>
- <!-- Text for the image state panel menu item [CHAR LIMIT=20] -->
- <string name="hide_imagestate_panel">Hide Image State</string>
+ <!-- Text for the image menu item showing the filters that have been applied [CHAR LIMIT=30] -->
+ <string name="show_imagestate_panel">Show Applied Effects</string>
+ <!-- Text for the image state panel menu item [CHAR LIMIT=30] -->
+ <string name="hide_imagestate_panel">Hide Applied Effects</string>
<!-- Name for the overflow menu item for settings [CHAR LIMIT=20] -->
<string name="menu_settings">Settings</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e4a0f9d..a1c2e31 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -768,7 +768,7 @@
<string name="pref_camera_scenemode_entry_party">Party</string>
<!-- Settings menu, scene mode labels [CHAR LIMIT=50] -->
- <string name="pref_camera_scenemode_label_auto">AUTO</string>
+ <string name="pref_camera_scenemode_label_auto">NONE</string>
<!-- Scene mode that takes an image quickly with little motion blur. [CHAR LIMIT=50] -->
<string name="pref_camera_scenemode_label_action">ACTION</string>
<!-- Scene mode that takes long exposures to capture night scenes without flash. [CHAR LIMIT=50] -->
diff --git a/src/com/android/camera/PreviewGestures.java b/src/com/android/camera/PreviewGestures.java
index b968a02..90ab075 100644
--- a/src/com/android/camera/PreviewGestures.java
+++ b/src/com/android/camera/PreviewGestures.java
@@ -317,6 +317,14 @@
private boolean isInside(MotionEvent evt, View v) {
v.getLocationInWindow(mLocation);
+ // when view is flipped horizontally
+ if ((int) v.getRotationY() == 180) {
+ mLocation[0] -= v.getWidth();
+ }
+ // when view is flipped vertically
+ if ((int) v.getRotationX() == 180) {
+ mLocation[1] -= v.getHeight();
+ }
return (v.getVisibility() == View.VISIBLE
&& evt.getX() >= mLocation[0] && evt.getX() < mLocation[0] + v.getWidth()
&& evt.getY() >= mLocation[1] && evt.getY() < mLocation[1] + v.getHeight());
diff --git a/src/com/android/camera/drawable/TextDrawable.java b/src/com/android/camera/drawable/TextDrawable.java
index ac5f1ce..60d8719 100644
--- a/src/com/android/camera/drawable/TextDrawable.java
+++ b/src/com/android/camera/drawable/TextDrawable.java
@@ -21,6 +21,7 @@
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
+import android.graphics.Typeface;
import android.graphics.Paint.Align;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -36,6 +37,7 @@
private CharSequence mText;
private int mIntrinsicWidth;
private int mIntrinsicHeight;
+ private boolean mUseDropShadow;
public TextDrawable(Resources res) {
this(res, "");
@@ -43,9 +45,7 @@
public TextDrawable(Resources res, CharSequence text) {
mText = text;
- mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mPaint.setColor(DEFAULT_COLOR);
- mPaint.setTextAlign(Align.CENTER);
+ updatePaint();
float textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
DEFAULT_TEXTSIZE, res.getDisplayMetrics());
mPaint.setTextSize(textSize);
@@ -53,6 +53,21 @@
mIntrinsicHeight = mPaint.getFontMetricsInt(null);
}
+ private void updatePaint() {
+ if (mPaint == null) {
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ }
+ mPaint.setColor(DEFAULT_COLOR);
+ mPaint.setTextAlign(Align.CENTER);
+ if (mUseDropShadow) {
+ mPaint.setTypeface(Typeface.DEFAULT_BOLD);
+ mPaint.setShadowLayer(10, 0, 0, 0xff000000);
+ } else {
+ mPaint.setTypeface(Typeface.DEFAULT);
+ mPaint.setShadowLayer(0, 0, 0, 0);
+ }
+ }
+
public void setText(CharSequence txt) {
mText = txt;
if (txt == null) {
@@ -73,6 +88,11 @@
}
}
+ public void setDropShadow(boolean shadow) {
+ mUseDropShadow = shadow;
+ updatePaint();
+ }
+
@Override
public int getOpacity() {
return mPaint.getAlpha();
diff --git a/src/com/android/camera/ui/PieRenderer.java b/src/com/android/camera/ui/PieRenderer.java
index 03c995c..bd3c2f7 100644
--- a/src/com/android/camera/ui/PieRenderer.java
+++ b/src/com/android/camera/ui/PieRenderer.java
@@ -77,7 +77,7 @@
private static final int MSG_OPENSUBMENU = 2;
protected static float CENTER = (float) Math.PI / 2;
- protected static float RAD20 = (float)(Math.PI /9); // 20 degrees
+ protected static float RAD24 = (float)(24 * Math.PI / 180);
protected static final float SWEEP_SLICE = 0.14f;
protected static final float SWEEP_ARC = 0.23f;
@@ -220,6 +220,7 @@
mArcRadius = res.getDimensionPixelSize(R.dimen.pie_arc_radius);
mArcOffset = res.getDimensionPixelSize(R.dimen.pie_arc_offset);
mLabel = new TextDrawable(res);
+ mLabel.setDropShadow(true);
mDeadZone = res.getDimensionPixelSize(R.dimen.pie_deadzone_width);
mAngleZone = res.getDimensionPixelSize(R.dimen.pie_anglezone_width);
}
@@ -340,7 +341,7 @@
private void resetPieCenter() {
mPieCenterX = mCenterX;
- mPieCenterY = mCenterY + mCenterY / 3;
+ mPieCenterY = (int) (getHeight() - 2.5f * mDeadZone);
}
private void layoutPie() {
@@ -413,10 +414,10 @@
private float getCenterAngle() {
float center = CENTER;
if (mPieCenterX < mDeadZone + mAngleZone) {
- center = CENTER - (mAngleZone - mPieCenterX + mDeadZone) * RAD20
+ center = CENTER - (mAngleZone - mPieCenterX + mDeadZone) * RAD24
/ (float) mAngleZone;
} else if (mPieCenterX > getWidth() - mDeadZone - mAngleZone) {
- center = CENTER + (mPieCenterX - (getWidth() - mDeadZone - mAngleZone)) * RAD20
+ center = CENTER + (mPieCenterX - (getWidth() - mDeadZone - mAngleZone)) * RAD24
/ (float) mAngleZone;
}
return center;
@@ -757,6 +758,7 @@
private void openCurrentItem() {
if ((mCurrentItem != null) && mCurrentItem.hasItems()) {
mOpen.add(mCurrentItem);
+ layoutLabel(getLevel());
mOpening = true;
if (mFadeIn != null) {
mFadeIn.cancel();
@@ -774,7 +776,6 @@
mXFade = null;
ci.setSelected(false);
mOpening = false;
- mLabel.setText("");
}
@Override
diff --git a/src/com/android/camera/ui/RotatableLayout.java b/src/com/android/camera/ui/RotatableLayout.java
index 6836b39..bf80605 100644
--- a/src/com/android/camera/ui/RotatableLayout.java
+++ b/src/com/android/camera/ui/RotatableLayout.java
@@ -38,6 +38,8 @@
public class RotatableLayout extends FrameLayout {
private static final String TAG = "RotatableLayout";
+ // Initial orientation of the layout (ORIENTATION_PORTRAIT, or ORIENTATION_LANDSCAPE)
+ private int mInitialOrientation;
private int mPrevRotation;
private RotationListener mListener = null;
public interface RotationListener {
@@ -45,19 +47,33 @@
}
public RotatableLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ mInitialOrientation = getResources().getConfiguration().orientation;
}
public RotatableLayout(Context context, AttributeSet attrs) {
super(context, attrs);
+ mInitialOrientation = getResources().getConfiguration().orientation;
}
public RotatableLayout(Context context) {
super(context);
+ mInitialOrientation = getResources().getConfiguration().orientation;
}
@Override
- public void onFinishInflate() { // get initial orientation
- super.onFinishInflate();
+ public void onAttachedToWindow() {
+ // check if there is any rotation before the view is attached to window
+ int currentOrientation = getResources().getConfiguration().orientation;
+ if (mInitialOrientation == currentOrientation) {
+ return;
+ }
+ if (mInitialOrientation == Configuration.ORIENTATION_LANDSCAPE
+ && currentOrientation == Configuration.ORIENTATION_PORTRAIT) {
+ rotateLayout(true);
+ } else if (mInitialOrientation == Configuration.ORIENTATION_PORTRAIT
+ && currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
+ rotateLayout(false);
+ }
mPrevRotation = Util.getDisplayRotation((Activity) getContext());
}
@@ -65,7 +81,16 @@
public void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
int rotation = Util.getDisplayRotation((Activity) getContext());
+ if ((rotation - mPrevRotation + 360) % 180 == 0) {
+ flipChildren();
+ return;
+ }
boolean clockwise = isClockWiseRotation(mPrevRotation, rotation);
+ rotateLayout(clockwise);
+ mPrevRotation = rotation;
+ }
+
+ protected void rotateLayout(boolean clockwise) {
// Change the size of the layout
ViewGroup.LayoutParams lp = getLayoutParams();
int width = lp.width;
@@ -75,7 +100,6 @@
setLayoutParams(lp);
// rotate all the children
- mPrevRotation = rotation;
rotateChildren(clockwise);
}
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
index bd7e654..ac39aa5 100644
--- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java
+++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
@@ -40,12 +40,11 @@
import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.MediaItem;
-import com.android.photos.data.GalleryBitmapPool;
import com.android.gallery3d.ui.GLRoot;
import com.android.gallery3d.ui.GLRootView;
import com.android.gallery3d.util.LightCycleHelper.PanoramaViewHelper;
import com.android.gallery3d.util.ThreadPool;
-import com.android.gallery3d.util.UsageStatistics;
+import com.android.photos.data.GalleryBitmapPool;
public class AbstractGalleryActivity extends Activity implements GalleryContext {
@SuppressWarnings("unused")
@@ -76,7 +75,6 @@
mPanoramaViewHelper = new PanoramaViewHelper(this);
mPanoramaViewHelper.onCreate();
doBindBatchService();
- UsageStatistics.showOptInDialogIfNeeded(this);
}
@Override
diff --git a/src_pd/com/android/gallery3d/util/UsageStatistics.java b/src_pd/com/android/gallery3d/util/UsageStatistics.java
index 9549b8f..acc0be4 100644
--- a/src_pd/com/android/gallery3d/util/UsageStatistics.java
+++ b/src_pd/com/android/gallery3d/util/UsageStatistics.java
@@ -16,7 +16,6 @@
package com.android.gallery3d.util;
-import android.app.Activity;
import android.content.Context;
public class UsageStatistics {
@@ -42,7 +41,6 @@
public static final String ACTION_SHARE = "Share";
public static void initialize(Context context) {}
- public static void showOptInDialogIfNeeded(Activity activity) {}
public static void setPendingTransitionCause(String cause) {}
public static void onContentViewChanged(String screenComponent, String screenName) {}
public static void onEvent(String category, String action, String label) {};