diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-05-15 13:00:37 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-05-17 13:47:17 +0800 |
commit | 9e1fcfe35695fd1e71d6c86f28075ca356e5bad5 (patch) | |
tree | deddca3e5e31e5f04e66dc5ef2f5a5b20a8e3afd /src/com/android | |
parent | 940b813c57c6c6eb66f55d968c9cb2b28e79b24b (diff) | |
download | LegacyCamera-9e1fcfe35695fd1e71d6c86f28075ca356e5bad5.zip LegacyCamera-9e1fcfe35695fd1e71d6c86f28075ca356e5bad5.tar.gz LegacyCamera-9e1fcfe35695fd1e71d6c86f28075ca356e5bad5.tar.bz2 |
Remove dead code and reduce visibility.
Change-Id: Icec126d3d83f3b158d284dd63dfed8452ffa2249
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/camera/IconIndicator.java | 85 | ||||
-rw-r--r-- | src/com/android/camera/MenuHelper.java | 28 | ||||
-rw-r--r-- | src/com/android/camera/OnScreenHint.java | 1 | ||||
-rw-r--r-- | src/com/android/camera/Util.java | 64 | ||||
-rw-r--r-- | src/com/android/camera/ui/IndicatorWheel.java | 6 |
5 files changed, 12 insertions, 172 deletions
diff --git a/src/com/android/camera/IconIndicator.java b/src/com/android/camera/IconIndicator.java deleted file mode 100644 index c032502..0000000 --- a/src/com/android/camera/IconIndicator.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2009 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.content.Context; -import android.content.res.Resources; -import android.content.res.TypedArray; -import android.graphics.drawable.Drawable; -import android.util.AttributeSet; -import android.widget.ImageView; - -import com.android.camera.R; - -/** - * This class draws an icon which changes according to the mode. For example, - * The flash icon can have on, off, and auto modes. The user can use - * {@link #setMode(String)} to change the mode (and the icon). - */ -public class IconIndicator extends ImageView { - - private Drawable[] mIcons; - private CharSequence[] mModes; - - public IconIndicator(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - TypedArray a = context.obtainStyledAttributes( - attrs, R.styleable.IconIndicator, defStyle, 0); - Drawable icons[] = loadIcons(context.getResources(), - a.getResourceId(R.styleable.IconIndicator_icons, 0)); - CharSequence modes[] = - a.getTextArray(R.styleable.IconIndicator_modes); - a.recycle(); - - setModesAndIcons(modes, icons); - setImageDrawable(mIcons.length > 0 ? mIcons[0] : null); - } - - public IconIndicator(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - private Drawable[] loadIcons(Resources resources, int iconsId) { - TypedArray array = resources.obtainTypedArray(iconsId); - int n = array.length(); - Drawable drawable[] = new Drawable[n]; - for (int i = 0; i < n; ++i) { - int id = array.getResourceId(i, 0); - drawable[i] = id == 0 ? null : resources.getDrawable(id); - } - array.recycle(); - return drawable; - } - - private void setModesAndIcons(CharSequence[] modes, Drawable icons[]) { - if (modes.length != icons.length || icons.length == 0) { - throw new IllegalArgumentException(); - } - mIcons = icons; - mModes = modes; - } - - public void setMode(String mode) { - for (int i = 0, n = mModes.length; i < n; ++i) { - if (mModes[i].equals(mode)) { - setImageDrawable(mIcons[i]); - return; - } - } - throw new IllegalArgumentException("unknown mode: " + mode); - } -} diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java index fba5738..860a642 100644 --- a/src/com/android/camera/MenuHelper.java +++ b/src/com/android/camera/MenuHelper.java @@ -39,35 +39,13 @@ import java.io.Closeable; public class MenuHelper { private static final String TAG = "MenuHelper"; - public static final int INCLUDE_ALL = 0xFFFFFFFF; - public static final int INCLUDE_VIEWPLAY_MENU = (1 << 0); - public static final int INCLUDE_SHARE_MENU = (1 << 1); - public static final int INCLUDE_SET_MENU = (1 << 2); - public static final int INCLUDE_CROP_MENU = (1 << 3); - public static final int INCLUDE_DELETE_MENU = (1 << 4); - public static final int INCLUDE_ROTATE_MENU = (1 << 5); - public static final int INCLUDE_DETAILS_MENU = (1 << 6); - public static final int INCLUDE_SHOWMAP_MENU = (1 << 7); - - public static final int INCLUDE_IMAGES = (1 << 0); - public static final int INCLUDE_VIDEOS = (1 << 2); - - public static final int MENU_IMAGE_SHARE = 1; - public static final int MENU_IMAGE_SHOWMAP = 2; + // TODO: These should be public and added to frameworks. + private static final int INCLUDE_IMAGES = (1 << 0); + private static final int INCLUDE_VIDEOS = (1 << 2); public static final int POSITION_SWITCH_CAMERA_MODE = 1; public static final int POSITION_GOTO_GALLERY = 2; public static final int POSITION_SWITCH_CAMERA_ID = 3; - public static final int POSITION_SWITCH_TIME_LAPSE_MODE = 4; - - public static final String EMPTY_STRING = ""; - public static final String JPEG_MIME_TYPE = "image/jpeg"; - // valid range is -180f to +180f - public static final float INVALID_LATLNG = 255f; - - /** Activity result code used to report crop results. - */ - public static final int RESULT_COMMON_MENU_CROP = 490; private static final int NO_ANIMATION = 0; private static final String CAMERA_CLASS = "com.android.camera.Camera"; diff --git a/src/com/android/camera/OnScreenHint.java b/src/com/android/camera/OnScreenHint.java index e471031..110b374 100644 --- a/src/com/android/camera/OnScreenHint.java +++ b/src/com/android/camera/OnScreenHint.java @@ -41,7 +41,6 @@ import com.android.camera.R; */ public class OnScreenHint { static final String TAG = "OnScreenHint"; - static final boolean LOCAL_LOGV = false; int mGravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; int mX, mY; diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index de176c4..5d4f9b0 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -44,16 +44,16 @@ import java.util.StringTokenizer; */ public class Util { private static final String TAG = "Util"; - public static final int DIRECTION_LEFT = 0; - public static final int DIRECTION_RIGHT = 1; - public static final int DIRECTION_UP = 2; - public static final int DIRECTION_DOWN = 3; + private static final int DIRECTION_LEFT = 0; + private static final int DIRECTION_RIGHT = 1; + private static final int DIRECTION_UP = 2; + private static final int DIRECTION_DOWN = 3; public static final String REVIEW_ACTION = "com.android.camera.action.REVIEW"; // Private intent extras. Test only. - public static final String EXTRAS_CAMERA_FACING = - "android.intent.extras.CAMERA_FACING"; + private static final String EXTRAS_CAMERA_FACING = + "android.intent.extras.CAMERA_FACING"; private Util() { } @@ -215,54 +215,6 @@ public class Util { .show(); } - public static Animation slideOut(View view, int to) { - view.setVisibility(View.INVISIBLE); - Animation anim; - switch (to) { - case DIRECTION_LEFT: - anim = new TranslateAnimation(0, -view.getWidth(), 0, 0); - break; - case DIRECTION_RIGHT: - anim = new TranslateAnimation(0, view.getWidth(), 0, 0); - break; - case DIRECTION_UP: - anim = new TranslateAnimation(0, 0, 0, -view.getHeight()); - break; - case DIRECTION_DOWN: - anim = new TranslateAnimation(0, 0, 0, view.getHeight()); - break; - default: - throw new IllegalArgumentException(Integer.toString(to)); - } - anim.setDuration(500); - view.startAnimation(anim); - return anim; - } - - public static Animation slideIn(View view, int from) { - view.setVisibility(View.VISIBLE); - Animation anim; - switch (from) { - case DIRECTION_LEFT: - anim = new TranslateAnimation(-view.getWidth(), 0, 0, 0); - break; - case DIRECTION_RIGHT: - anim = new TranslateAnimation(view.getWidth(), 0, 0, 0); - break; - case DIRECTION_UP: - anim = new TranslateAnimation(0, 0, -view.getHeight(), 0); - break; - case DIRECTION_DOWN: - anim = new TranslateAnimation(0, 0, view.getHeight(), 0); - break; - default: - throw new IllegalArgumentException(Integer.toString(from)); - } - anim.setDuration(500); - view.startAnimation(anim); - return anim; - } - public static <T> T checkNotNull(T object) { if (object == null) throw new NullPointerException(); return object; @@ -272,10 +224,6 @@ public class Util { return (a == b) || (a == null ? false : a.equals(b)); } - public static boolean isPowerOf2(int n) { - return (n & -n) == n; - } - public static int nextPowerOf2(int n) { n -= 1; n |= n >>> 16; diff --git a/src/com/android/camera/ui/IndicatorWheel.java b/src/com/android/camera/ui/IndicatorWheel.java index df0ebbb..1a374da 100644 --- a/src/com/android/camera/ui/IndicatorWheel.java +++ b/src/com/android/camera/ui/IndicatorWheel.java @@ -214,7 +214,7 @@ public class IndicatorWheel extends ViewGroup implements invalidate(); } - public void removeIndicators() { + private void removeIndicators() { // Remove everything but the shutter button. int count = getChildCount(); if (count > 1) { @@ -374,7 +374,7 @@ public class IndicatorWheel extends ViewGroup implements } // Scene mode may override other camera settings (ex: flash mode). - public void overrideSettings(String key, String value) { + private void overrideSettings(String key, String value) { int count = getChildCount(); for (int j = 1; j < count; j++) { View v = getChildAt(j); @@ -427,7 +427,7 @@ public class IndicatorWheel extends ViewGroup implements } } - protected void addIndicator(Context context, IconListPreference pref) { + private void addIndicator(Context context, IconListPreference pref) { addView(new IndicatorButton(context, pref)); mIndicatorCount++; } |