diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-08-12 19:13:50 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-08-12 19:18:32 +0800 |
commit | 7058a9318dd5d6d5a1e79a84080cdc02975f68c1 (patch) | |
tree | 974aa0cb6f5c24da4a4b17547c71e4908b02f69a /src/com/android | |
parent | d2db70880e6159413932f747eb82df3e925852c1 (diff) | |
download | LegacyCamera-7058a9318dd5d6d5a1e79a84080cdc02975f68c1.zip LegacyCamera-7058a9318dd5d6d5a1e79a84080cdc02975f68c1.tar.gz LegacyCamera-7058a9318dd5d6d5a1e79a84080cdc02975f68c1.tar.bz2 |
Remove zoom ratio text label.
Change-Id: Ia4d54034b0b2c039e874b1fa580b036962f4cd33
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/camera/Camera.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/Util.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 5 | ||||
-rw-r--r-- | src/com/android/camera/ui/ZoomPicker.java | 30 |
4 files changed, 7 insertions, 42 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 2e4de8c..86ab4e9 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -70,7 +70,6 @@ import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.RelativeLayout; -import android.widget.TextView; import android.widget.Toast; import java.io.File; @@ -456,7 +455,7 @@ public class Camera extends ActivityBase implements View.OnClickListener, mZoomMax = mParameters.getMaxZoom(); mSmoothZoomSupported = mParameters.isSmoothZoomSupported(); if (mZoomPicker != null) { - mZoomPicker.setZoomRatios(Util.convertZoomRatios(mParameters.getZoomRatios())); + mZoomPicker.setZoomMax(mZoomMax); mZoomPicker.setZoomIndex(mParameters.getZoom()); mZoomPicker.setSmoothZoomSupported(mSmoothZoomSupported); mZoomPicker.setOnZoomChangeListener( @@ -603,9 +602,8 @@ public class Camera extends ActivityBase implements View.OnClickListener, private void initializeZoomPicker() { View zoomIncrement = findViewById(R.id.zoom_increment); View zoomDecrement = findViewById(R.id.zoom_decrement); - TextView zoomRatio = (TextView) findViewById(R.id.zoom_ratio); if (zoomIncrement != null && zoomDecrement != null && mParameters.isZoomSupported()) { - mZoomPicker = new ZoomPicker(this, zoomIncrement, zoomDecrement, zoomRatio); + mZoomPicker = new ZoomPicker(this, zoomIncrement, zoomDecrement); } } diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 61b6aa6..948b3eb 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -380,14 +380,6 @@ public class Util { } } - public static float[] convertZoomRatios(List<Integer> zoomRatios) { - float result[] = new float[zoomRatios.size()]; - for (int i = 0, n = result.length; i < n; ++i) { - result[i] = (float) zoomRatios.get(i) / 100f; - } - return result; - } - /** * Returns whether the device is voice-capable (meaning, it can do MMS). */ diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 7ee148f..7271335 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -459,9 +459,8 @@ public class VideoCamera extends ActivityBase private void initializeZoomPicker() { View zoomIncrement = findViewById(R.id.zoom_increment); View zoomDecrement = findViewById(R.id.zoom_decrement); - TextView zoomRatio = (TextView) findViewById(R.id.zoom_ratio); if (zoomIncrement != null && zoomDecrement != null && mParameters.isZoomSupported()) { - mZoomPicker = new ZoomPicker(this, zoomIncrement, zoomDecrement, zoomRatio); + mZoomPicker = new ZoomPicker(this, zoomIncrement, zoomDecrement); } } @@ -1894,7 +1893,7 @@ public class VideoCamera extends ActivityBase mZoomMax = mParameters.getMaxZoom(); mSmoothZoomSupported = mParameters.isSmoothZoomSupported(); if (mZoomPicker != null) { - mZoomPicker.setZoomRatios(Util.convertZoomRatios(mParameters.getZoomRatios())); + mZoomPicker.setZoomMax(mZoomMax); mZoomPicker.setZoomIndex(mParameters.getZoom()); mZoomPicker.setSmoothZoomSupported(mSmoothZoomSupported); mZoomPicker.setOnZoomChangeListener( diff --git a/src/com/android/camera/ui/ZoomPicker.java b/src/com/android/camera/ui/ZoomPicker.java index e8305b3..3979bca 100644 --- a/src/com/android/camera/ui/ZoomPicker.java +++ b/src/com/android/camera/ui/ZoomPicker.java @@ -16,15 +16,11 @@ package com.android.camera.ui; -import com.android.camera.R; - import android.content.Context; import android.os.Handler; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; -import android.widget.Button; -import android.widget.TextView; import java.util.Formatter; @@ -33,16 +29,13 @@ import java.util.Formatter; */ public class ZoomPicker { private final String TAG = "ZoomPicker"; - private TextView mZoomTextView; private int mZoomMax, mZoomIndex; - private float[] mZoomRatios; private boolean mSmoothZoomSupported; private OnZoomChangedListener mListener; private boolean mIncrement, mDecrement; private final StringBuilder mBuilder = new StringBuilder(); private final Formatter mFormatter = new Formatter(mBuilder); private final Object[] mFormatterArgs = new Object[1]; - private String mZoomText; private View mIncrementButton; private View mDecrementButton; @@ -74,8 +67,7 @@ public class ZoomPicker { } }; - public ZoomPicker(Context context, View increment, View decrement, TextView zoomText) { - mZoomText = context.getString(R.string.zoom_text); + public ZoomPicker(Context context, View increment, View decrement) { mHandler = new Handler(); OnTouchListener incrementTouchListener = new OnTouchListener() { @@ -126,7 +118,6 @@ public class ZoomPicker { mDecrementButton = decrement; mDecrementButton.setOnTouchListener(decrementTouchListener); mDecrementButton.setVisibility(View.VISIBLE); - mZoomTextView = zoomText; } public void setOnZoomChangeListener(OnZoomChangedListener listener) { @@ -138,10 +129,8 @@ public class ZoomPicker { void onZoomStateChanged(int state); // only for smooth zoom } - public void setZoomRatios(float[] zoomRatios) { - mZoomMax = zoomRatios.length - 1; - mZoomRatios = zoomRatios; - updateView(); + public void setZoomMax(int zoomMax) { + mZoomMax = zoomMax; } public void setZoomIndex(int index) { @@ -149,7 +138,6 @@ public class ZoomPicker { throw new IllegalArgumentException("Invalid zoom value:" + index); } mZoomIndex = index; - updateView(); } public void setSmoothZoomSupported(boolean smoothZoomSupported) { @@ -162,21 +150,9 @@ public class ZoomPicker { if (mListener != null) { mListener.onZoomValueChanged(mZoomIndex); } - updateView(); return true; } - private void updateView() { - if (mZoomTextView == null) return; - - if (mZoomIndex == 0) { - mZoomTextView.setVisibility(View.INVISIBLE); - } else { - mZoomTextView.setText(String.format(mZoomText, formatZoomRatio(mZoomRatios[mZoomIndex]))); - mZoomTextView.setVisibility(View.VISIBLE); - } - } - private String formatZoomRatio(float value) { mFormatterArgs[0] = value; mBuilder.delete(0, mBuilder.length()); |