summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/camera_controls.xml14
-rw-r--r--res/layout/photo_module.xml17
-rw-r--r--res/values/cm_strings.xml1
-rwxr-xr-xsrc/com/android/camera/PhotoModule.java268
-rw-r--r--src/com/android/camera/PhotoUI.java12
-rw-r--r--src/com/android/camera/ui/CameraControls.java35
-rw-r--r--src/com/android/camera/ui/HistogramView.java130
-rw-r--r--src/com/android/camera/ui/RotatableLayout.java2
8 files changed, 220 insertions, 259 deletions
diff --git a/res/layout/camera_controls.xml b/res/layout/camera_controls.xml
index 99e649db4..3f097425f 100644
--- a/res/layout/camera_controls.xml
+++ b/res/layout/camera_controls.xml
@@ -132,4 +132,18 @@
android:visibility="gone" />
</LinearLayout>
+ <com.android.camera.ui.HistogramView
+ android:id="@+id/histogram"
+ android:layout_width="200dip"
+ android:layout_height="200dip"
+ android:layout_marginTop="20dip"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/auto_hdr_notice"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/auto_hdr_enabled"
+ android:visibility="gone" />
+
</com.android.camera.ui.CameraControls>
diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml
index 63a8f28e5..f184e0c56 100644
--- a/res/layout/photo_module.xml
+++ b/res/layout/photo_module.xml
@@ -41,23 +41,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black" />
- <RelativeLayout android:id="@+id/linear"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <com.android.camera.GraphView
- android:id="@+id/graph_view"
- android:layout_width="200dip"
- android:layout_height="200dip"
- android:layout_marginTop="60dip"
- android:layout_marginLeft="90dip" />
- <com.android.camera.DrawAutoHDR
- android:id="@+id/autohdr_view"
- android:layout_width="200dip"
- android:layout_height="200dip"
- android:layout_marginTop="50dip"
- android:layout_marginLeft="15dip" />
- </RelativeLayout>
<com.android.camera.ui.focus.FocusRingView
android:id="@+id/focus_ring"
android:layout_width="match_parent"
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 9e99dd5cc..410fa0b99 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -144,4 +144,5 @@
<string name="pref_camera_shutter_speed_entry_15" translatable="false">15</string>
<string name="pref_camera_shutter_speed_entry_30" translatable="false">30</string>
+ <string name="auto_hdr_enabled">Auto HDR enabled</string>
</resources>
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index efaa87ba8..3ebc460b8 100755
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -130,12 +130,7 @@ public class PhotoModule
private int mReceivedSnapNum = 0;
public boolean mFaceDetectionEnabled = false;
private boolean mLgeHdrMode = false;
- private DrawAutoHDR mDrawAutoHDR;
- /*Histogram variables*/
- private GraphView mGraphView;
- private static final int STATS_DATA = 257;
- public static int statsdata[] = new int[STATS_DATA];
- public boolean mHiston = false;
+ public boolean mHistogramEnabled = false;
// We number the request code from 1000 to avoid collision with Gallery.
private static final int REQUEST_CROP = 1000;
@@ -176,7 +171,6 @@ public class PhotoModule
private PhotoUI mUI;
- public boolean mAutoHdrEnable;
// The activity is going to switch to the specified camera id. This is
// needed because texture copy is done in GL thread. -1 means camera is not
// switching.
@@ -929,14 +923,6 @@ public class PhotoModule
}
mNamedImages = new NamedImages();
- mGraphView = (GraphView)mRootView.findViewById(R.id.graph_view);
- mDrawAutoHDR = (DrawAutoHDR )mRootView.findViewById(R.id.autohdr_view);
- if (mGraphView == null || mDrawAutoHDR == null){
- Log.e(TAG, "mGraphView or mDrawAutoHDR is null");
- } else{
- mGraphView.setPhotoModuleObject(this);
- mDrawAutoHDR.setPhotoModuleObject(this);
- }
mFirstTimeInitialized = true;
Log.d(TAG, "addIdleHandler in first time initialization");
@@ -1142,19 +1128,14 @@ public class PhotoModule
private final class StatsCallback
implements android.hardware.Camera.CameraDataCallback {
@Override
- public void onCameraData(int [] data, android.hardware.Camera camera) {
- //if(!mPreviewing || !mHiston || !mFirstTimeInitialized){
- if(!mHiston || !mFirstTimeInitialized){
+ public void onCameraData(final int [] data, android.hardware.Camera camera) {
+ if (!mHistogramEnabled || !mFirstTimeInitialized){
return;
}
- /*The first element in the array stores max hist value . Stats data begin from second value*/
- synchronized(statsdata) {
- System.arraycopy(data,0,statsdata,0,STATS_DATA);
- }
mActivity.runOnUiThread(new Runnable() {
+ @Override
public void run() {
- if(mGraphView != null)
- mGraphView.PreviewChanged();
+ mUI.updateHistogramData(data);
}
});
}
@@ -1171,24 +1152,12 @@ public class PhotoModule
}
/* Checking if the meta data is for auto HDR */
if (metadata[0] == 3) {
- if (metadata[2] == 1) {
- mAutoHdrEnable = true;
- mActivity.runOnUiThread(new Runnable() {
- public void run() {
- if (mDrawAutoHDR != null)
- mDrawAutoHDR.AutoHDR();
- }
- });
- }
- else {
- mAutoHdrEnable = false;
- mActivity.runOnUiThread(new Runnable() {
- public void run() {
- if (mDrawAutoHDR != null)
- mDrawAutoHDR.AutoHDR();
- }
- });
- }
+ boolean enable = metadata[2] == 1;
+ mActivity.runOnUiThread(new Runnable() {
+ public void run() {
+ mUI.setAutoHdrEnabled(enable);
+ }
+ });
}
}
}
@@ -1552,16 +1521,15 @@ public class PhotoModule
mJpegPictureCallbackTime = 0;
}
- if (mHiston && (mSnapshotMode ==CameraInfo.CAMERA_SUPPORT_MODE_ZSL)) {
+ if (mHistogramEnabled &&
+ (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL)) {
mActivity.runOnUiThread(new Runnable() {
- public void run() {
- if (mGraphView != null) {
- mGraphView.setVisibility(View.VISIBLE);
- mGraphView.PreviewChanged();
+ @Override
+ public void run() {
+ mUI.setHistogramEnabled(true, getCamera());
}
- }
- });
- }
+ });
+ }
if (mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL &&
mCameraState != LONGSHOT &&
mReceivedSnapNum == mBurstSnapNum &&
@@ -1686,15 +1654,15 @@ public class PhotoModule
mJpegImageData = null;
final boolean animateBefore = (mSceneMode == CameraUtil.SCENE_MODE_HDR);
- if(mHiston) {
+ if(mHistogramEnabled) {
if (mSnapshotMode != CameraInfo.CAMERA_SUPPORT_MODE_ZSL) {
- mHiston = false;
+ mHistogramEnabled = false;
mCameraDevice.setHistogramMode(null);
}
mActivity.runOnUiThread(new Runnable() {
+ @Override
public void run() {
- if(mGraphView != null)
- mGraphView.setVisibility(View.INVISIBLE);
+ mUI.setHistogramEnabled(false, null);
}
});
}
@@ -2203,9 +2171,6 @@ public class PhotoModule
}
mUI.tryToCloseSubList();
mUI.setOrientation(mOrientation, true);
- if (mGraphView != null) {
- mGraphView.setRotation(-mOrientation);
- }
}
// Show the toast after getting the first orientation changed.
@@ -2213,14 +2178,6 @@ public class PhotoModule
mHandler.removeMessages(SHOW_TAP_TO_FOCUS_TOAST);
showTapToFocusToast();
}
-
- // need to re-initialize mGraphView to show histogram on rotate
- mGraphView = (GraphView)mRootView.findViewById(R.id.graph_view);
- if(mGraphView != null){
- mGraphView.setAlpha(0.75f);
- mGraphView.setPhotoModuleObject(this);
- mGraphView.PreviewChanged();
- }
}
@Override
@@ -3713,27 +3670,14 @@ public class PhotoModule
if (CameraUtil.isSupported(histogram,
mParameters.getSupportedHistogramModes()) && mCameraDevice != null) {
// Call for histogram
- if(histogram.equals("enable")) {
- mActivity.runOnUiThread(new Runnable() {
- public void run() {
- if(mGraphView != null) {
- mGraphView.setVisibility(View.VISIBLE);
- mGraphView.PreviewChanged();
- }
- }
- });
- mCameraDevice.setHistogramMode(mStatsCallback);
- mHiston = true;
- } else {
- mHiston = false;
- mActivity.runOnUiThread(new Runnable() {
- public void run() {
- if (mGraphView != null)
- mGraphView.setVisibility(View.INVISIBLE);
- }
- });
- mCameraDevice.setHistogramMode(null);
- }
+ mHistogramEnabled = histogram.equals("enable");
+ mActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mUI.setHistogramEnabled(mHistogramEnabled, getCamera());
+ }
+ });
+ mCameraDevice.setHistogramMode(mHistogramEnabled ? mStatsCallback : null);
}
setFlipValue();
@@ -3782,26 +3726,11 @@ public class PhotoModule
("asd".equals(mSceneMode) || "auto".equals(mSceneMode)) &&
CameraUtil.isSupported("asd", mParameters.getSupportedSceneModes()) &&
(advancedFeature == null || "none".equals(advancedFeature))) {
- mActivity.runOnUiThread(new Runnable() {
- public void run() {
- if (mDrawAutoHDR != null) {
- mDrawAutoHDR.setVisibility(View.VISIBLE);
- }
- }
- });
mParameters.setSceneMode("asd");
mCameraDevice.setMetadataCb(mMetaDataCallback);
mParameters.set("auto-hdr-enable", "enable");
}
else {
- mAutoHdrEnable = false;
- mActivity.runOnUiThread( new Runnable() {
- public void run () {
- if (mDrawAutoHDR != null) {
- mDrawAutoHDR.setVisibility (View.INVISIBLE);
- }
- }
- });
mCameraDevice.setMetadataCb(null);
mParameters.set("auto-hdr-enable", "disable");
}
@@ -5152,140 +5081,3 @@ class JpegEncodingQualityMappings {
return CameraProfile.getJpegEncodingQualityParameter(quality.intValue());
}
}
-
-class GraphView extends View {
- private Bitmap mBitmap;
- private Paint mPaint = new Paint();
- private Paint mPaintRect = new Paint();
- private Canvas mCanvas = new Canvas();
- private float mScale = (float)3;
- private float mWidth;
- private float mHeight;
- private PhotoModule mPhotoModule;
- private CameraManager.CameraProxy mGraphCameraDevice;
- private float scaled;
- private static final int STATS_SIZE = 256;
-
- public GraphView(Context context, AttributeSet attrs) {
- super(context,attrs);
-
- mPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
- mPaintRect.setColor(0xFFFFFFFF);
- mPaintRect.setStyle(Paint.Style.FILL);
- }
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
- mCanvas.setBitmap(mBitmap);
- mWidth = w;
- mHeight = h;
- super.onSizeChanged(w, h, oldw, oldh);
- }
- @Override
- protected void onDraw(Canvas canvas) {
- if(mPhotoModule == null || !mPhotoModule.mHiston ) {
- return;
- }
-
- if (mBitmap != null) {
- final Paint paint = mPaint;
- final Canvas cavas = mCanvas;
- final float border = 5;
- float graphheight = mHeight - (2 * border);
- float graphwidth = mWidth - (2 * border);
- float left,top,right,bottom;
- float bargap = 0.0f;
- float barwidth = graphwidth/STATS_SIZE;
-
- cavas.drawColor(0xFFAAAAAA);
- paint.setColor(Color.BLACK);
-
- for (int k = 0; k <= (graphheight /32) ; k++) {
- float y = (float)(32 * k)+ border;
- cavas.drawLine(border, y, graphwidth + border , y, paint);
- }
- for (int j = 0; j <= (graphwidth /32); j++) {
- float x = (float)(32 * j)+ border;
- cavas.drawLine(x, border, x, graphheight + border, paint);
- }
- synchronized(PhotoModule.statsdata) {
- //Assumption: The first element contains
- // the maximum value.
- int maxValue = Integer.MIN_VALUE;
- if ( 0 == PhotoModule.statsdata[0] ) {
- for ( int i = 1 ; i <= STATS_SIZE ; i++ ) {
- if ( maxValue < PhotoModule.statsdata[i] ) {
- maxValue = PhotoModule.statsdata[i];
- }
- }
- } else {
- maxValue = PhotoModule.statsdata[0];
- }
- mScale = ( float ) maxValue;
- for(int i=1 ; i<=STATS_SIZE ; i++) {
- scaled = (PhotoModule.statsdata[i]/mScale)*STATS_SIZE;
- if(scaled >= (float)STATS_SIZE)
- scaled = (float)STATS_SIZE;
- left = (bargap * (i+1)) + (barwidth * i) + border;
- top = graphheight + border;
- right = left + barwidth;
- bottom = top - scaled;
- cavas.drawRect(left, top, right, bottom, mPaintRect);
- }
- }
- canvas.drawBitmap(mBitmap, 0, 0, null);
- }
- if (mPhotoModule.mHiston && mPhotoModule!= null) {
- mGraphCameraDevice = mPhotoModule.getCamera();
- if (mGraphCameraDevice != null){
- mGraphCameraDevice.sendHistogramData();
- }
- }
- }
- public void PreviewChanged() {
- invalidate();
- }
- public void setPhotoModuleObject(PhotoModule photoModule) {
- mPhotoModule = photoModule;
- }
-}
-
-class DrawAutoHDR extends View{
-
- private static final String TAG = "AutoHdrView";
- private PhotoModule mPhotoModule;
-
- public DrawAutoHDR (Context context, AttributeSet attrs) {
- super(context,attrs);
- }
-
- @Override
- protected void onDraw (Canvas canvas) {
- if (mPhotoModule == null)
- return;
- if (mPhotoModule.mAutoHdrEnable) {
- Paint AutoHDRPaint = new Paint();
- AutoHDRPaint.setColor(Color.WHITE);
- AutoHDRPaint.setAlpha (0);
- canvas.drawPaint(AutoHDRPaint);
- AutoHDRPaint.setStyle(Paint.Style.STROKE);
- AutoHDRPaint.setColor(Color.MAGENTA);
- AutoHDRPaint.setStrokeWidth(1);
- AutoHDRPaint.setTextSize(32);
- AutoHDRPaint.setAlpha (255);
- canvas.drawText("HDR On",200,100,AutoHDRPaint);
- }
- else {
- super.onDraw(canvas);
- return;
- }
- }
-
- public void AutoHDR () {
- invalidate();
- }
-
- public void setPhotoModuleObject (PhotoModule photoModule) {
- mPhotoModule = photoModule;
- }
-}
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 4934fad9e..75e810d8b 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -740,6 +740,18 @@ public class PhotoUI implements PieListener,
mOnScreenIndicators.updateLocationIndicator(location);
}
+ public void setAutoHdrEnabled(boolean enabled) {
+ mCameraControls.setAutoHdrEnabled(enabled);
+ }
+
+ public void setHistogramEnabled(boolean enabled, CameraManager.CameraProxy camera) {
+ mCameraControls.setHistogramEnabled(enabled, camera);
+ }
+
+ public void updateHistogramData(int[] data) {
+ mCameraControls.updateHistogramData(data);
+ }
+
public void setCameraState(int state) {
}
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java
index 186626015..a93b41773 100644
--- a/src/com/android/camera/ui/CameraControls.java
+++ b/src/com/android/camera/ui/CameraControls.java
@@ -38,6 +38,7 @@ import android.widget.TextView;
import java.util.ArrayList;
import org.codeaurora.snapcam.R;
+import com.android.camera.CameraManager;
import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.RotateImageView;
import com.android.camera.ShutterButton;
@@ -65,6 +66,8 @@ public class CameraControls extends RotatableLayout {
private View mReviewDoneButton;
private View mReviewCancelButton;
private View mReviewRetakeButton;
+ private View mAutoHdrNotice;
+ private HistogramView mHistogramView;
private ArrowTextView mRefocusToast;
private int mSize;
@@ -84,9 +87,11 @@ public class CameraControls extends RotatableLayout {
private static final int INDICATOR_INDEX = 8;
private static final int MUTE_INDEX = 9;
private static final int VIDEO_SHUTTER_INDEX = 10;
+ private static final int HISTOGRAM_INDEX = 11;
+ private static final int AUTO_HDR_INDEX = 12;
private static final int ANIME_DURATION = 300;
- private float[][] mLocX = new float[4][11];
- private float[][] mLocY = new float[4][11];
+ private float[][] mLocX = new float[4][13];
+ private float[][] mLocY = new float[4][13];
private boolean mLocSet = false;
private boolean mHideRemainingPhoto = false;
private LinearLayout mRemainingPhotos;
@@ -297,6 +302,8 @@ public class CameraControls extends RotatableLayout {
mFilterModeSwitcher = findViewById(R.id.filter_mode_switcher);
mRemainingPhotos = (LinearLayout) findViewById(R.id.remaining_photos);
mRemainingPhotosText = (TextView) findViewById(R.id.remaining_photos_text);
+ mAutoHdrNotice = (TextView) findViewById(R.id.auto_hdr_notice);
+ mHistogramView = (HistogramView) findViewById(R.id.histogram);
}
@Override
@@ -322,6 +329,13 @@ public class CameraControls extends RotatableLayout {
mBackgroundView.setVisibility(View.GONE);
setLocation(r - l, b - t);
+ center(mAutoHdrNotice, l, t + mSize, r,
+ t + mSize + mAutoHdrNotice.getMeasuredHeight(),
+ orientation, rotation, new Rect(), AUTO_HDR_INDEX);
+ center(mHistogramView, l, t + mSize,
+ r, t + mSize + mHistogramView.getMeasuredHeight(),
+ orientation, rotation, new Rect(), HISTOGRAM_INDEX);
+
View retake = findViewById(R.id.btn_retake);
if (retake != null) {
mReviewRetakeButton = retake;
@@ -516,6 +530,10 @@ public class CameraControls extends RotatableLayout {
}
}
+ public void setAutoHdrEnabled(boolean enabled) {
+ mAutoHdrNotice.setVisibility(enabled ? View.VISIBLE : View.GONE);
+ }
+
public void hideUI() {
if (!mAnimating)
enableTouch(false);
@@ -995,19 +1013,30 @@ public class CameraControls extends RotatableLayout {
}
}
+ public void setHistogramEnabled(boolean enabled, CameraManager.CameraProxy camera) {
+ mHistogramView.setVisibility(enabled ? View.VISIBLE : View.GONE);
+ mHistogramView.setCamera(camera);
+ }
+
+ public void updateHistogramData(int[] data) {
+ mHistogramView.updateData(data);
+ }
+
public void setOrientation(int orientation, boolean animation) {
mOrientation = orientation;
View[] views = {
mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher,
TsMakeupManager.HAS_TS_MAKEUP ? mTsMakeupSwitcher : mHdrSwitcher,
mMenu, mShutter, mPreview, mSwitcher, mMute, mReviewRetakeButton,
- mReviewCancelButton, mReviewDoneButton
+ mReviewCancelButton, mReviewDoneButton, mAutoHdrNotice, mHistogramView
};
for (View v : views) {
if (v != null) {
if (v instanceof RotateImageView) {
((RotateImageView) v).setOrientation(orientation,
animation);
+ } else if (v instanceof HistogramView) {
+ ((HistogramView) v).setRotation(-orientation);
}
}
}
diff --git a/src/com/android/camera/ui/HistogramView.java b/src/com/android/camera/ui/HistogramView.java
new file mode 100644
index 000000000..2ae2c40a8
--- /dev/null
+++ b/src/com/android/camera/ui/HistogramView.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2013-2015 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.ui;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+
+import com.android.camera.CameraManager;
+
+public class HistogramView extends View {
+ private static final int STATS_SIZE = 256;
+
+ private int[] mData = new int[STATS_SIZE + 1];
+ private boolean mDataValid;
+
+ private Bitmap mBitmap;
+ private Paint mPaint = new Paint();
+ private Paint mPaintRect = new Paint();
+ private Canvas mCanvas = new Canvas();
+ private float mWidth;
+ private float mHeight;
+ private CameraManager.CameraProxy mGraphCameraDevice;
+
+ public HistogramView(Context context, AttributeSet attrs) {
+ super(context,attrs);
+
+ mPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
+ mPaintRect.setColor(0xFFFFFFFF);
+ mPaintRect.setStyle(Paint.Style.FILL);
+ }
+
+ public void setCamera(CameraManager.CameraProxy camera) {
+ mGraphCameraDevice = camera;
+ if (camera == null) {
+ mDataValid = false;
+ }
+ }
+
+ public void updateData(int[] data) {
+ if (data.length == mData.length) {
+ System.arraycopy(data, 0, mData, 0, data.length);
+ drawGraph();
+ mDataValid = true;
+ invalidate();
+ }
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
+ mCanvas.setBitmap(mBitmap);
+ mWidth = w;
+ mHeight = h;
+ if (mDataValid) {
+ drawGraph();
+ }
+ super.onSizeChanged(w, h, oldw, oldh);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ if (mDataValid && mBitmap != null) {
+ canvas.drawBitmap(mBitmap, 0, 0, null);
+ if (mGraphCameraDevice != null) {
+ mGraphCameraDevice.sendHistogramData();
+ }
+ }
+ }
+
+ private void drawGraph() {
+ final float border = 5;
+ float graphheight = mHeight - (2 * border);
+ float graphwidth = mWidth - (2 * border);
+ float bargap = 0.0f;
+ float barwidth = graphwidth/STATS_SIZE;
+
+ mCanvas.drawColor(0xFFAAAAAA);
+ mPaint.setColor(Color.BLACK);
+
+ for (int k = 0; k <= (graphheight /32) ; k++) {
+ float y = (float)(32 * k)+ border;
+ mCanvas.drawLine(border, y, graphwidth + border , y, mPaint);
+ }
+ for (int j = 0; j <= (graphwidth /32); j++) {
+ float x = (float)(32 * j)+ border;
+ mCanvas.drawLine(x, border, x, graphheight + border, mPaint);
+ }
+
+ //Assumption: The first element contains the maximum value.
+ int maxValue = Integer.MIN_VALUE;
+ if (mData[0] == 0) {
+ for (int i = 1; i <= STATS_SIZE ; i++) {
+ maxValue = Math.max(maxValue, mData[i]);
+ }
+ } else {
+ maxValue = mData[0];
+ }
+
+ for (int i = 1; i <= STATS_SIZE; i++) {
+ float scaled = Math.min(STATS_SIZE,
+ (float) mData[i] * (float) STATS_SIZE / (float) maxValue);
+ float left = (bargap * (i+1)) + (barwidth * i) + border;
+ float top = graphheight + border;
+ float right = left + barwidth;
+ float bottom = top - scaled;
+ mCanvas.drawRect(left, top, right, bottom, mPaintRect);
+ }
+ }
+}
+
diff --git a/src/com/android/camera/ui/RotatableLayout.java b/src/com/android/camera/ui/RotatableLayout.java
index 6867e6a8b..702590f9f 100644
--- a/src/com/android/camera/ui/RotatableLayout.java
+++ b/src/com/android/camera/ui/RotatableLayout.java
@@ -280,4 +280,4 @@ public class RotatableLayout extends FrameLayout {
rotateClockwise(view);
rotateClockwise(view);
}
-} \ No newline at end of file
+}