summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xres/layout/capture_module.xml6
-rw-r--r--res/layout/menu_help.xml69
-rwxr-xr-xres/layout/photo_module.xml4
-rw-r--r--res/values/attrs.xml3
-rw-r--r--res/values/colors.xml14
-rwxr-xr-xres/values/qcomstrings.xml16
-rw-r--r--res/values/styles.xml5
-rw-r--r--src/com/android/camera/CameraSettings.java2
-rw-r--r--src/com/android/camera/CaptureUI.java33
-rw-r--r--src/com/android/camera/PhotoUI.java31
-rw-r--r--src/com/android/camera/ui/Arrows.java91
-rw-r--r--src/com/android/camera/ui/MenuHelp.java387
-rw-r--r--src/com/android/camera/ui/OneUICameraControls.java3
13 files changed, 6 insertions, 658 deletions
diff --git a/res/layout/capture_module.xml b/res/layout/capture_module.xml
index 2c381bf..7a04a18 100755
--- a/res/layout/capture_module.xml
+++ b/res/layout/capture_module.xml
@@ -24,7 +24,6 @@
layout. -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
@@ -122,11 +121,6 @@
layout="@layout/one_ui_layout"
android:layout_gravity="center" />
- <include
- style="@style/CameraControls"
- layout="@layout/menu_help"
- android:layout_gravity="center" />
-
<FrameLayout
android:id="@+id/preview_of_intent"
android:layout_height="match_parent"
diff --git a/res/layout/menu_help.xml b/res/layout/menu_help.xml
deleted file mode 100644
index aa6b97a..0000000
--- a/res/layout/menu_help.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright (c) 2016, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<com.android.camera.ui.MenuHelp xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/menu_help"
- android:visibility="gone"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <View
- android:id="@+id/background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="bottom"/>
- <com.android.camera.ui.Arrows
- android:id="@+id/arrows"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
- <com.android.camera.ui.RotateLayout
- android:id="@+id/help_text_0_0"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="@style/MenuButton"/>
- <com.android.camera.ui.RotateLayout
- android:id="@+id/help_text_1_0"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="@style/MenuButton"/>
- <com.android.camera.ui.RotateLayout
- android:id="@+id/help_text_3_0"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="@style/MenuButton"/>
- <com.android.camera.ui.RotateLayout
- android:id="@+id/help_text_4_6"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="@style/MenuButton"/>
- <com.android.camera.ui.RotateLayout
- android:id="@+id/help_ok_2_4"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="@style/MenuButton"/>
-</com.android.camera.ui.MenuHelp>
diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml
index 9d767a1..dc22dd6 100755
--- a/res/layout/photo_module.xml
+++ b/res/layout/photo_module.xml
@@ -90,9 +90,7 @@
<include layout="@layout/camera_controls"
android:layout_gravity="center"
style="@style/CameraControls"/>
- <include layout="@layout/menu_help"
- android:layout_gravity="center"
- style="@style/CameraControls"/>
+
<RelativeLayout
android:id="@+id/id_tsmakeup_level_layout_root"
android:layout_width="match_parent"
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index bf79746..a243e5f 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -45,7 +45,4 @@
<attr name="images" format="reference" />
</declare-styleable>
- <declare-styleable name="MenuHelp">
- <attr name="forCamera2" format="boolean"/>
- </declare-styleable>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index d663d2c..ee79867 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -81,20 +81,6 @@
<color name="refocus_indicator_1">#a0ffffff</color>
<color name="refocus_indicator_2">#ff29b6f6</color>
- <!-- Help menu text color -->
- <color name="help_menu_scene_mode_1">#ffffff</color>
- <color name="help_menu_scene_mode_2">#00ff00</color>
- <color name="help_menu_scene_mode_3">#ffffff</color>
- <color name="help_menu_color_filter_1">#ffffff</color>
- <color name="help_menu_color_filter_2">#00ff00</color>
- <color name="help_menu_color_filter_3">#ffffff</color>
- <color name="help_menu_color_filter_4">#ffffff</color>
- <color name="help_menu_beautify_1">#ffffff</color>
- <color name="help_menu_beautify_2">#ffffff</color>
- <color name="help_menu_beautify_3">#00ff00</color>
- <color name="help_menu_switcher_1">#00ff00</color>
- <color name="help_menu_switcher_2">#ffffff</color>
- <color name="help_menu_switcher_3">#ffffff</color>
<color name="dialog_background">#ffffff</color>
<color name="dialog_text">#000000</color>
<color name="dialog_button">#008B8B</color>
diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml
index baa70d0..57df98a 100755
--- a/res/values/qcomstrings.xml
+++ b/res/values/qcomstrings.xml
@@ -933,22 +933,6 @@
<string name="mute_button_desc">Mute Button</string>
- <!-- Help menu strings -->
- <string name="help_menu_ok" translatable="true">OK</string>
- <string name="help_menu_scene_mode_1" translatable="true">Select a</string>
- <string name="help_menu_scene_mode_2" translatable="true">Scene Mode</string>
- <string name="help_menu_scene_mode_3" translatable="true">for better pictures</string>
- <string name="help_menu_color_filter_1" translatable="true">Apply color</string>
- <string name="help_menu_color_filter_2" translatable="true">filters</string>
- <string name="help_menu_color_filter_3" translatable="true">to</string>
- <string name="help_menu_color_filter_4" translatable="true">improve pictures</string>
- <string name="help_menu_beautify_1" translatable="true">Enhance portraits</string>
- <string name="help_menu_beautify_2" translatable="true">with the</string>
- <string name="help_menu_beautify_3" translatable="true">Beautify feature</string>
- <string name="help_menu_switcher_1" translatable="true">Switch</string>
- <string name="help_menu_switcher_2" translatable="true">between</string>
- <string name="help_menu_switcher_3" translatable="true">camera, video, and panorama</string>
-
<string name="pref_camera2_camera2_title" translatable="true">Camera2 Mode</string>
<string name="pref_camera2_camera2_entry_enable" translatable="true">Enable</string>
<string name="pref_camera2_camera2_entry_disable" translatable="true">Disable</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1ec7a99..4b93f33 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -270,8 +270,9 @@
<item name="android:scaleType">center</item>
</style>
<style name="OneUIMenuButton">
- <item name="android:layout_width">25dp</item>
- <item name="android:layout_height">25dp</item>
+ <item name="android:layout_width">45dp</item>
+ <item name="android:layout_height">45dp</item>
+ <item name="android:padding">10dp</item>
<item name="android:scaleType">fitCenter</item>
</style>
<style name="MenuIndicator">
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 95baf3e..dd26c79 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -283,8 +283,6 @@ public class CameraSettings {
public static final String KEY_REFOCUS_PROMPT = "refocus-prompt";
- public static final String KEY_SHOW_MENU_HELP = "help_menu";
-
public static final String KEY_REQUEST_PERMISSION = "request_permission";
public static final String KEY_SELFIE_FLASH = "pref_selfie_flash_key";
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java
index 200f90e..502e7a6 100644
--- a/src/com/android/camera/CaptureUI.java
+++ b/src/com/android/camera/CaptureUI.java
@@ -68,7 +68,6 @@ import android.widget.TextView;
import com.android.camera.ui.AutoFitSurfaceView;
import com.android.camera.ui.Camera2FaceView;
import com.android.camera.ui.CameraControls;
-import com.android.camera.ui.MenuHelp;
import com.android.camera.ui.OneUICameraControls;
import com.android.camera.ui.CountDownView;
import com.android.camera.ui.FlashToggleButton;
@@ -171,7 +170,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
private FlashToggleButton mFlashButton;
private CountDownView mCountDownView;
private OneUICameraControls mCameraControls;
- private MenuHelp mMenuHelp;
private PieRenderer mPieRenderer;
private ZoomRenderer mZoomRenderer;
private Allocation mMonoDummyAllocation;
@@ -504,7 +502,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
mActivity.setPreviewGestures(mGestures);
mRecordingTimeRect.setVisibility(View.GONE);
- showFirstTimeHelp();
}
protected void showCapturedImageForReview(byte[] jpegData, int orientation) {
@@ -1508,9 +1505,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
public void setOrientation(int orientation, boolean animation) {
mOrientation = orientation;
mCameraControls.setOrientation(orientation, animation);
- if (mMenuHelp != null) {
- mMenuHelp.setOrientation(orientation, animation);
- }
if (mFilterLayout != null) {
ViewGroup vg = (ViewGroup) mFilterLayout.getChildAt(0);
if (vg != null)
@@ -1558,33 +1552,6 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
return mOrientation;
}
- public void showFirstTimeHelp() {
- final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
- boolean isMenuShown = prefs.getBoolean(CameraSettings.KEY_SHOW_MENU_HELP, false);
- if(!isMenuShown) {
- showFirstTimeHelp(mTopMargin, mBottomMargin);
- SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(CameraSettings.KEY_SHOW_MENU_HELP, true);
- editor.apply();
- }
- }
-
- private void showFirstTimeHelp(int topMargin, int bottomMargin) {
- mMenuHelp = (MenuHelp) mRootView.findViewById(R.id.menu_help);
- mMenuHelp.setForCamera2(true);
- mMenuHelp.setVisibility(View.VISIBLE);
- mMenuHelp.setMargins(topMargin, bottomMargin);
- mMenuHelp.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mMenuHelp != null) {
- mMenuHelp.setVisibility(View.GONE);
- mMenuHelp = null;
- }
- }
- });
- }
-
@Override
public void onSingleTapUp(View view, int x, int y) {
mModule.onSingleTapUp(view, x, y);
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index c24ada5..b08c8f1 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -71,7 +71,6 @@ import com.android.camera.ui.FaceView;
import com.android.camera.ui.FocusIndicator;
import com.android.camera.ui.ListSubMenu;
import com.android.camera.ui.ModuleSwitcher;
-import com.android.camera.ui.MenuHelp;
import com.android.camera.ui.PieRenderer;
import com.android.camera.ui.PieRenderer.PieListener;
import com.android.camera.ui.RenderOverlay;
@@ -116,7 +115,6 @@ public class PhotoUI implements PieListener,
private PhotoMenu mMenu;
private ModuleSwitcher mSwitcher;
private CameraControls mCameraControls;
- private MenuHelp mMenuHelp;
private AlertDialog mLocationDialog;
private SeekBar mBlurDegreeProgressBar;
@@ -309,7 +307,6 @@ public class PhotoUI implements PieListener,
mScreenRatio = CameraUtil.determineRatio(size.x, size.y);
calculateMargins(size);
mCameraControls.setMargins(mTopMargin, mBottomMargin);
- showFirstTimeHelp();
}
public SeekBar getBokehDegreeBar() {
@@ -333,21 +330,6 @@ public class PhotoUI implements PieListener,
mOrientationResize = orientation;
}
- private void showFirstTimeHelp(int topMargin, int bottomMargin) {
- mMenuHelp = (MenuHelp) mRootView.findViewById(R.id.menu_help);
- mMenuHelp.setVisibility(View.VISIBLE);
- mMenuHelp.setMargins(topMargin, bottomMargin);
- mMenuHelp.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mMenuHelp != null) {
- mMenuHelp.setVisibility(View.GONE);
- mMenuHelp = null;
- }
- }
- });
- }
-
public void setAspectRatio(float ratio) {
if (ratio <= 0.0) throw new IllegalArgumentException();
@@ -1364,8 +1346,6 @@ public class PhotoUI implements PieListener,
public void setOrientation(int orientation, boolean animation) {
mOrientation = orientation;
mCameraControls.setOrientation(orientation, animation);
- if (mMenuHelp != null)
- mMenuHelp.setOrientation(orientation, animation);
if (mMenuLayout != null)
mMenuLayout.setOrientation(orientation, animation);
if (mSubMenuLayout != null)
@@ -1431,17 +1411,6 @@ public class PhotoUI implements PieListener,
setOrientation(mOrientation, true);
}
- public void showFirstTimeHelp() {
- final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
- boolean isMenuShown = prefs.getBoolean(CameraSettings.KEY_SHOW_MENU_HELP, false);
- if(!isMenuShown) {
- showFirstTimeHelp(mTopMargin, mBottomMargin);
- SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(CameraSettings.KEY_SHOW_MENU_HELP, true);
- editor.apply();
- }
- }
-
public void showRefocusDialog() {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
int prompt = prefs.getInt(CameraSettings.KEY_REFOCUS_PROMPT, 1);
diff --git a/src/com/android/camera/ui/Arrows.java b/src/com/android/camera/ui/Arrows.java
deleted file mode 100644
index 4923eb1..0000000
--- a/src/com/android/camera/ui/Arrows.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-Copyright (c) 2016, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-package com.android.camera.ui;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.util.AttributeSet;
-import android.view.View;
-
-import java.util.ArrayList;
-
-public class Arrows extends View {
- private static final int ARROW_COLOR = Color.WHITE;
- private static final double ARROW_END_DEGREE = 15d;
- private static final int ARROW_END_LENGTH = 50;
-
- private Paint mPaint;
- private ArrayList<Path> mPaths;
-
- public Arrows(Context context, AttributeSet attrs) {
- super(context, attrs);
- mPaths = new ArrayList<Path>();
- mPaint = new Paint();
- mPaint.setStyle(Paint.Style.STROKE);
- mPaint.setColor(ARROW_COLOR);
- mPaint.setStrokeWidth(2f);
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- if (mPaths != null) {
- for(int i=0; i < mPaths.size(); i++) {
- canvas.drawPath(mPaths.get(i), mPaint);
- }
- }
- }
-
- public void addPath(float[] x, float[] y) {
- Path path = new Path();
- path.reset();
- path.moveTo(x[0], y[0]);
- for(int i=1; i < x.length; i++) {
- if(i == x.length-1) {
- path.lineTo(x[i], y[i]);
-
- double setha = Math.toDegrees(Math.atan2(y[i] - y[i - 1], x[i] - x[i - 1]));
- setha = (setha + ARROW_END_DEGREE + 360) % 360;
- path.lineTo(x[i]-(float)(ARROW_END_LENGTH*Math.cos(Math.toRadians(setha))),
- y[i]-(float)(ARROW_END_LENGTH*Math.sin(Math.toRadians(setha))));
- path.lineTo(x[i], y[i]);
- setha = (setha - ARROW_END_DEGREE*2 + 360) % 360;
- path.lineTo(x[i]-(float)(ARROW_END_LENGTH*Math.cos(Math.toRadians(setha))),
- y[i]-(float)(ARROW_END_LENGTH*Math.sin(Math.toRadians(setha))));
- }
- else
- path.quadTo(x[i],y[i], x[i+1], y[i+1]);
- }
- mPaths.add(path);
- invalidate();
- }
-}
diff --git a/src/com/android/camera/ui/MenuHelp.java b/src/com/android/camera/ui/MenuHelp.java
deleted file mode 100644
index 4adff0f..0000000
--- a/src/com/android/camera/ui/MenuHelp.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
-Copyright (c) 2016, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-package com.android.camera.ui;
-
-import android.animation.Animator;
-import android.animation.Animator.AnimatorListener;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Typeface;
-import android.graphics.drawable.AnimationDrawable;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewPropertyAnimator;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-import android.widget.TableLayout;
-import android.widget.TextView;
-import java.util.ArrayList;
-
-import org.codeaurora.snapcam.R;
-import com.android.camera.ui.ModuleSwitcher;
-import com.android.camera.ui.RotateImageView;
-import com.android.camera.ShutterButton;
-import com.android.camera.Storage;
-import com.android.camera.util.CameraUtil;
-import com.android.camera.TsMakeupManager;
-
-public class MenuHelp extends RotatableLayout {
-
- private static final String TAG = "MenuHelp";
- private View mBackgroundView;
- private Arrows mArrows;
- private static int mTopMargin = 0;
- private static int mBottomMargin = 0;
- private static final int HELP_0_0_INDEX = 0;
- private static final int HELP_1_0_INDEX = 1;
- private static final int HELP_3_0_INDEX = 2;
- private static final int HELP_4_6_INDEX = 3;
- private static final int OK_2_4_INDEX = 4;
- private static final int MAX_INDEX = 5;
- private float[][] mLocX = new float[4][MAX_INDEX];
- private float[][] mLocY = new float[4][MAX_INDEX];
- private RotateLayout mHelp0_0;
- private RotateLayout mHelp1_0;
- private RotateLayout mHelp3_0;
- private RotateLayout mHelp4_6;
- private RotateLayout mOk2_4;
- private Context mContext;
- private int mOrientation;
- private final static int POINT_MARGIN = 50;
- private static final int WIDTH_GRID = 5;
- private static final int HEIGHT_GRID = 7;
- private Typeface mTypeface;
- private boolean forCamera2 = false;
-
- public MenuHelp(Context context, AttributeSet attrs) {
- super(context, attrs);
- mContext = context;
- mTypeface = Typeface.create(Typeface.SERIF, Typeface.NORMAL);
- }
-
- public MenuHelp(Context context) {
- this(context, null);
- }
-
- public void setForCamera2(boolean forCamera2) {
- this.forCamera2 = forCamera2;
- }
-
- public void setMargins(int top, int bottom) {
- mTopMargin = top;
- mBottomMargin = bottom;
- }
-
- @Override
- public void onLayout(boolean changed, int l, int t, int r, int b) {
- r = r - l;
- b = b - t;
- l = 0;
- t = 0;
- for (int i = 0; i < getChildCount(); i++) {
- View v = getChildAt(i);
- v.layout(l, t, r, b);
- }
- setLocation(r - l, b - t);
- }
-
- private void setLocation(int w, int h) {
- int rotation = getUnifiedRotation();
- toIndex(mHelp0_0, w, h, rotation, 1, 3, HELP_0_0_INDEX);
- toIndex(mHelp1_0, w, h, rotation, 2, 2, HELP_1_0_INDEX);
- if(TsMakeupManager.HAS_TS_MAKEUP)
- toIndex(mHelp3_0, w, h, rotation, 3, 1, HELP_3_0_INDEX);
- if (!forCamera2) {
- toIndex(mHelp4_6, w, h, rotation, 3, 4, HELP_4_6_INDEX);
- } else {
- mHelp4_6.setVisibility(View.GONE);
- }
- toIndex(mOk2_4, w, h, rotation, 1, 5, OK_2_4_INDEX);
- fillArrows(w, h, rotation);
- }
-
- private void fillArrows(int w, int h, int rotation) {
- View v1 = new View(mContext);
- View v2 = new View(mContext);
- View v3 = new View(mContext);
- {
- toIndex(v1, w, h, rotation, 1, 3, -1);
- toIndex(v2, w, h, rotation, 0, 1, -1);
- toIndex(v3, w, h, rotation, 0, 0, -1);
- float[] x = {v1.getX()-POINT_MARGIN, v2.getX(), v3.getX()};
- float[] y = {v1.getY()-POINT_MARGIN, v2.getY(), v3.getY()+POINT_MARGIN};
- mArrows.addPath(x, y);
- }
-
- {
- toIndex(v1, w, h, rotation, 2, 2, -1);
- toIndex(v2, w, h, rotation, 1, 1, -1);
- toIndex(v3, w, h, rotation, 1, 0, -1);
- float[] x = {v1.getX()-POINT_MARGIN, v2.getX(), v3.getX()};
- float[] y = {v1.getY()-POINT_MARGIN, v2.getY(), v3.getY()+POINT_MARGIN};
- mArrows.addPath(x, y);
- }
-
- if(TsMakeupManager.HAS_TS_MAKEUP) {
- toIndex(v1, w, h, rotation, 3, 1, -1);
- toIndex(v2, w, h, rotation, 3, 0, -1);
- float[] x = {v1.getX(), v2.getX()};
- float[] y = {v1.getY()-POINT_MARGIN*2, v2.getY()+POINT_MARGIN};
- mArrows.addPath(x, y);
- }
-
- if (!forCamera2) {
- toIndex(v1, w, h, rotation, 3, 4, -1);
- toIndex(v2, w, h, rotation, 3, 5, -1);
- toIndex(v3, w, h, rotation, 4, 6, -1);
- float[] x = {v1.getX(), v2.getX(), v3.getX()};
- float[] y = {v1.getY()+POINT_MARGIN, v2.getY(), v3.getY()-POINT_MARGIN};
- mArrows.addPath(x, y);
- }
- }
-
- private void toIndex(View v, int w, int h, int rotation, int index, int index2, int index3) {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) v.getLayoutParams();
- int tw = v.getMeasuredWidth();
- int th = v.getMeasuredHeight();
- int l = 0, r = 0, t = 0, b = 0;
-
- int wnumber = WIDTH_GRID;
- int hnumber = HEIGHT_GRID;
- int windex = 0;
- int hindex = 0;
- switch (rotation) {
- case 0:
- // portrait, to left of anchor at bottom
- wnumber = WIDTH_GRID;
- hnumber = HEIGHT_GRID;
- windex = index;
- hindex = index2;
- break;
- case 90:
- // phone landscape: below anchor on right
- wnumber = HEIGHT_GRID;
- hnumber = WIDTH_GRID;
- windex = index2;
- hindex = hnumber - index - 1;
- break;
- case 180:
- // phone upside down: right of anchor at top
- wnumber = WIDTH_GRID;
- hnumber = HEIGHT_GRID;
- windex = wnumber - index - 1;
- hindex = hnumber - index2 - 1;
- break;
- case 270:
- // reverse landscape: above anchor on left
- wnumber = HEIGHT_GRID;
- hnumber = WIDTH_GRID;
- windex = wnumber - index2 - 1;
- hindex = index;
- break;
- }
- int boxh = h / hnumber;
- int boxw = w / wnumber;
- int cx = (2 * windex + 1) * boxw / 2;
- int cy = (2 * hindex + 1) * boxh / 2;
-
- if (index2 == 0 && mTopMargin != 0) {
- switch (rotation) {
- case 90:
- cx = mTopMargin / 2;
- break;
- case 180:
- cy = h - mTopMargin / 2;
- break;
- case 270:
- cx = w - mTopMargin / 2;
- break;
- default:
- cy = mTopMargin / 2;
- break;
- }
- }
-
- l = cx - tw / 2;
- r = cx + tw / 2;
- t = cy - th / 2;
- b = cy + th / 2;
-
- if (index3 != -1) {
- int idx1 = rotation / 90;
- int idx2 = index3;
- mLocX[idx1][idx2] = l;
- mLocY[idx1][idx2] = t;
- }
- v.layout(l, t, r, b);
- }
-
- public void setOrientation(int orientation, boolean animation) {
- mOrientation = orientation;
- RotateLayout[] layouts = {
- mHelp0_0, mHelp1_0, mHelp3_0, mHelp4_6, mOk2_4
- };
- for (RotateLayout l : layouts) {
- l.setOrientation(orientation, animation);
- }
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- mBackgroundView = findViewById(R.id.background);
- mBackgroundView.setBackgroundColor(Color.argb(200, 0, 0, 0));
- mHelp0_0 = (RotateLayout)findViewById(R.id.help_text_0_0);
- fillHelp0_0();
- mHelp1_0 = (RotateLayout)findViewById(R.id.help_text_1_0);
- fillHelp1_0();
- mHelp3_0 = (RotateLayout) findViewById(R.id.help_text_3_0);
- fillHelp3_0();
- mHelp4_6 = (RotateLayout)findViewById(R.id.help_text_4_6);
- fillHelp4_6();
- mOk2_4 = (RotateLayout)findViewById(R.id.help_ok_2_4);
- fillOk2_4();
- mArrows = (Arrows)findViewById(R.id.arrows);
- }
-
- private void fillOk2_4() {
- LinearLayout linearLayout = new LinearLayout(mContext);
- mOk2_4.addView(linearLayout);
- linearLayout.setGravity(Gravity.CENTER);
- linearLayout.setPadding(40, 20, 40, 20);
- linearLayout.setBackgroundColor(Color.WHITE);
- TextView text1 = new TextView(mContext);
- text1.setText(getResources().getString(R.string.help_menu_ok));
- text1.setTextColor(Color.BLACK);
- text1.setTypeface(mTypeface);
- linearLayout.addView(text1);
- }
-
- private void fillHelp0_0() {
- TableLayout tableLayout = new TableLayout(mContext);
- mHelp0_0.addView(tableLayout);
- LinearLayout linearLayout = new LinearLayout(mContext);
- TextView text1 = new TextView(mContext);
- text1.setTextColor(getResources().getColor(R.color.help_menu_scene_mode_1));
- text1.setText(getResources().getString(R.string.help_menu_scene_mode_1)+" ");
- text1.setTypeface(mTypeface);
- linearLayout.addView(text1);
- TextView text2 = new TextView(mContext);
- text2.setText(getResources().getString(R.string.help_menu_scene_mode_2));
- text2.setTypeface(mTypeface);
- linearLayout.addView(text2);
- text2.setTextColor(getResources().getColor(R.color.help_menu_scene_mode_2));
- tableLayout.addView(linearLayout);
- TextView text3 = new TextView(mContext);
- text3.setText(getResources().getString(R.string.help_menu_scene_mode_3));
- text3.setTextColor(getResources().getColor(R.color.help_menu_scene_mode_3));
- text3.setTypeface(mTypeface);
- tableLayout.addView(text3);
- }
-
- private void fillHelp1_0() {
- TableLayout tableLayout = new TableLayout(mContext);
- mHelp1_0.addView(tableLayout);
- LinearLayout linearLayout = new LinearLayout(mContext);
- TextView text1 = new TextView(mContext);
- text1.setText(getResources().getString(R.string.help_menu_color_filter_1)+" ");
- text1.setTextColor(getResources().getColor(R.color.help_menu_color_filter_1));
- text1.setTypeface(mTypeface);
- linearLayout.addView(text1);
- TextView text2 = new TextView(mContext);
- text2.setText(getResources().getString(R.string.help_menu_color_filter_2)+" ");
- text2.setTextColor(getResources().getColor(R.color.help_menu_color_filter_2));
- text2.setTypeface(mTypeface);
- linearLayout.addView(text2);
- TextView text3 = new TextView(mContext);
- text3.setText(getResources().getString(R.string.help_menu_color_filter_3));
- text3.setTextColor(getResources().getColor(R.color.help_menu_color_filter_3));
- text3.setTypeface(mTypeface);
- linearLayout.addView(text3);
- tableLayout.addView(linearLayout);
- TextView text4 = new TextView(mContext);
- text4.setText(getResources().getString(R.string.help_menu_color_filter_4));
- text4.setTextColor(getResources().getColor(R.color.help_menu_color_filter_4));
- text4.setTypeface(mTypeface);
- tableLayout.addView(text4);
- }
-
- private void fillHelp3_0() {
- TableLayout tableLayout = new TableLayout(mContext);
- mHelp3_0.addView(tableLayout);
- if(TsMakeupManager.HAS_TS_MAKEUP) {
- TextView text1 = new TextView(mContext);
- text1.setText(getResources().getString(R.string.help_menu_beautify_1));
- text1.setTextColor(getResources().getColor(R.color.help_menu_beautify_1));
- text1.setTypeface(mTypeface);
- tableLayout.addView(text1);
- TextView text2 = new TextView(mContext);
- text2.setText(getResources().getString(R.string.help_menu_beautify_2));
- text2.setTextColor(getResources().getColor(R.color.help_menu_beautify_2));
- text2.setTypeface(mTypeface);
- tableLayout.addView(text2);
- TextView text3 = new TextView(mContext);
- text3.setText(getResources().getString(R.string.help_menu_beautify_3));
- text3.setTextColor(getResources().getColor(R.color.help_menu_beautify_3));
- text3.setTypeface(mTypeface);
- tableLayout.addView(text3);
- }
- }
-
- private void fillHelp4_6() {
- TableLayout tableLayout = new TableLayout(mContext);
- mHelp4_6.addView(tableLayout);
- LinearLayout linearLayout = new LinearLayout(mContext);
- TextView text1 = new TextView(mContext);
- text1.setText(getResources().getString(R.string.help_menu_switcher_1)+" ");
- text1.setTextColor(Color.GREEN);
- text1.setTypeface(mTypeface);
- linearLayout.addView(text1);
- TextView text2 = new TextView(mContext);
- text2.setText(getResources().getString(R.string.help_menu_switcher_2));
- text2.setTextColor(Color.WHITE);
- text2.setTypeface(mTypeface);
- linearLayout.addView(text2);
- tableLayout.addView(linearLayout);
- TextView text3 = new TextView(mContext);
- text3.setText(getResources().getString(R.string.help_menu_switcher_3));
- text3.setTextColor(Color.WHITE);
- text3.setTypeface(mTypeface);
- tableLayout.addView(text3);
- }
-}
diff --git a/src/com/android/camera/ui/OneUICameraControls.java b/src/com/android/camera/ui/OneUICameraControls.java
index 1a0b7ce..04c8286 100644
--- a/src/com/android/camera/ui/OneUICameraControls.java
+++ b/src/com/android/camera/ui/OneUICameraControls.java
@@ -309,7 +309,8 @@ public class OneUICameraControls extends RotatableLayout {
} else {
v.setY(mHeight - mBottom + (mBottom - h) / 2);
}
- float bW = mWidth / 5f;
+ int bW = mWidth / 5;
+
v.setX(bW * idx + (bW - w) / 2);
}