diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-11-13 16:23:05 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-11-13 16:28:37 +0800 |
commit | 1b6cd72127f64a5306ee4acecaf6113627d35db2 (patch) | |
tree | 363e8022839dd938f54f845b26670002a15853a0 /src/com | |
parent | 13161c7fe39bf019a334d8ea7e4eaddc1988adad (diff) | |
download | LegacyCamera-1b6cd72127f64a5306ee4acecaf6113627d35db2.zip LegacyCamera-1b6cd72127f64a5306ee4acecaf6113627d35db2.tar.gz LegacyCamera-1b6cd72127f64a5306ee4acecaf6113627d35db2.tar.bz2 |
Move some classes out from Camera.java.
Change-Id: I455d6878feeacb3d44d80d899e8c948e1d28fca2
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/Camera.java | 60 | ||||
-rw-r--r-- | src/com/android/camera/JpegEncodingQualityMappings.java | 50 | ||||
-rw-r--r-- | src/com/android/camera/ui/FocusRectangle.java | 49 |
3 files changed, 100 insertions, 59 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 91af236..cad2981 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -22,6 +22,7 @@ import com.android.camera.ui.CameraHeadUpDisplay; import com.android.camera.ui.GLRootView; import com.android.camera.ui.HeadUpDisplay; import com.android.camera.ui.ControlPanel; +import com.android.camera.ui.FocusRectangle; import com.android.camera.ui.ZoomControllerListener; import com.android.camera.ui.ZoomPicker; @@ -47,7 +48,6 @@ import android.location.Location; import android.location.LocationManager; import android.location.LocationProvider; import android.media.AudioManager; -import android.media.CameraProfile; import android.media.ToneGenerator; import android.net.Uri; import android.os.Build; @@ -61,7 +61,6 @@ import android.provider.MediaStore; import android.provider.Settings; import android.provider.MediaStore.Images.ImageColumns; import android.provider.MediaStore.Images.Media; -import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.KeyEvent; @@ -2326,60 +2325,3 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, } } -class FocusRectangle extends View { - - @SuppressWarnings("unused") - private static final String TAG = "FocusRectangle"; - - public FocusRectangle(Context context, AttributeSet attrs) { - super(context, attrs); - } - - private void setDrawable(int resid) { - setBackgroundDrawable(getResources().getDrawable(resid)); - } - - public void showStart() { - setDrawable(R.drawable.focus_focusing); - } - - public void showSuccess() { - setDrawable(R.drawable.focus_focused); - } - - public void showFail() { - setDrawable(R.drawable.focus_focus_failed); - } - - public void clear() { - setBackgroundDrawable(null); - } -} - -/* - * Provide a mapping for Jpeg encoding quality levels - * from String representation to numeric representation. - */ -class JpegEncodingQualityMappings { - private static final String TAG = "JpegEncodingQualityMappings"; - private static final int DEFAULT_QUALITY = 85; - private static HashMap<String, Integer> mHashMap = - new HashMap<String, Integer>(); - - static { - mHashMap.put("normal", CameraProfile.QUALITY_LOW); - mHashMap.put("fine", CameraProfile.QUALITY_MEDIUM); - mHashMap.put("superfine", CameraProfile.QUALITY_HIGH); - } - - // Retrieve and return the Jpeg encoding quality number - // for the given quality level. - public static int getQualityNumber(String jpegQuality) { - Integer quality = mHashMap.get(jpegQuality); - if (quality == null) { - Log.w(TAG, "Unknown Jpeg quality: " + jpegQuality); - return DEFAULT_QUALITY; - } - return CameraProfile.getJpegEncodingQualityParameter(quality.intValue()); - } -} diff --git a/src/com/android/camera/JpegEncodingQualityMappings.java b/src/com/android/camera/JpegEncodingQualityMappings.java new file mode 100644 index 0000000..8b8fb08 --- /dev/null +++ b/src/com/android/camera/JpegEncodingQualityMappings.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 The Android Open Source 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; + +import android.media.CameraProfile; +import android.util.Log; + +import java.util.HashMap; + +/* + * Provide a mapping for Jpeg encoding quality levels + * from String representation to numeric representation. + */ +public class JpegEncodingQualityMappings { + private static final String TAG = "JpegEncodingQualityMappings"; + private static final int DEFAULT_QUALITY = 85; + private static HashMap<String, Integer> mHashMap = + new HashMap<String, Integer>(); + + static { + mHashMap.put("normal", CameraProfile.QUALITY_LOW); + mHashMap.put("fine", CameraProfile.QUALITY_MEDIUM); + mHashMap.put("superfine", CameraProfile.QUALITY_HIGH); + } + + // Retrieve and return the Jpeg encoding quality number + // for the given quality level. + public static int getQualityNumber(String jpegQuality) { + Integer quality = mHashMap.get(jpegQuality); + if (quality == null) { + Log.w(TAG, "Unknown Jpeg quality: " + jpegQuality); + return DEFAULT_QUALITY; + } + return CameraProfile.getJpegEncodingQualityParameter(quality.intValue()); + } +} diff --git a/src/com/android/camera/ui/FocusRectangle.java b/src/com/android/camera/ui/FocusRectangle.java new file mode 100644 index 0000000..c3f9a51 --- /dev/null +++ b/src/com/android/camera/ui/FocusRectangle.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 The Android Open Source 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 com.android.camera.R; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; + +public class FocusRectangle extends View { + public FocusRectangle(Context context, AttributeSet attrs) { + super(context, attrs); + } + + private void setDrawable(int resid) { + setBackgroundDrawable(getResources().getDrawable(resid)); + } + + public void showStart() { + setDrawable(R.drawable.focus_focusing); + } + + public void showSuccess() { + setDrawable(R.drawable.focus_focused); + } + + public void showFail() { + setDrawable(R.drawable.focus_focus_failed); + } + + public void clear() { + setBackgroundDrawable(null); + } +} |