summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-05-27 01:02:34 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-27 01:02:34 -0700
commitb9286870d56f085e74b0142eaa138bb83b5e0eb3 (patch)
tree78bb07b81fc2919897a0a55d93e45039829b0c17 /src/com/android/camera
parent48846dcb7430de1ac003c52273459a12d16c2c6a (diff)
parent6374ed8614a151c27d6277272e3e72769e768766 (diff)
downloadLegacyCamera-b9286870d56f085e74b0142eaa138bb83b5e0eb3.zip
LegacyCamera-b9286870d56f085e74b0142eaa138bb83b5e0eb3.tar.gz
LegacyCamera-b9286870d56f085e74b0142eaa138bb83b5e0eb3.tar.bz2
Merge "Add share button for phone UI."
Diffstat (limited to 'src/com/android/camera')
-rw-r--r--src/com/android/camera/Camera.java4
-rw-r--r--src/com/android/camera/VideoCamera.java8
-rw-r--r--src/com/android/camera/ui/CamcorderHeadUpDisplay.java2
-rw-r--r--src/com/android/camera/ui/CameraHeadUpDisplay.java1
-rw-r--r--src/com/android/camera/ui/HeadUpDisplay.java9
-rw-r--r--src/com/android/camera/ui/IndicatorBar.java10
-rw-r--r--src/com/android/camera/ui/ShareIndicator.java48
7 files changed, 78 insertions, 4 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index b00eac7..53647e5 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -2405,6 +2405,10 @@ public class Camera extends ActivityBase implements View.OnClickListener,
public void onPopupWindowVisibilityChanged(int visibility) {
}
+
+ public void onShareButtonClicked() {
+ Camera.this.onShareButtonClicked();
+ }
}
protected void onRestorePreferencesClicked() {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 010099e..f1f488f 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -1816,6 +1816,14 @@ public class VideoCamera extends ActivityBase
public void onPopupWindowVisibilityChanged(final int visibility) {
}
+
+ public void onShareButtonClicked() {
+ mHandler.post(new Runnable() {
+ public void run() {
+ VideoCamera.this.onShareButtonClicked();
+ }
+ });
+ }
}
private void onRestorePreferencesClicked() {
diff --git a/src/com/android/camera/ui/CamcorderHeadUpDisplay.java b/src/com/android/camera/ui/CamcorderHeadUpDisplay.java
index 6d4ef55..04898eb 100644
--- a/src/com/android/camera/ui/CamcorderHeadUpDisplay.java
+++ b/src/com/android/camera/ui/CamcorderHeadUpDisplay.java
@@ -26,7 +26,6 @@ public class CamcorderHeadUpDisplay extends HeadUpDisplay {
private static final String TAG = "CamcorderHeadUpDisplay";
- private boolean mCaptureTimeLapse;
private OtherSettingsIndicator mOtherSettings;
private int mInitialOrientation;
@@ -66,6 +65,7 @@ public class CamcorderHeadUpDisplay extends HeadUpDisplay {
addIndicator(context, group, CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE);
addIndicator(context, group, CameraSettings.KEY_VIDEO_QUALITY);
addIndicator(context, group, CameraSettings.KEY_CAMERA_ID);
+ mIndicatorBar.addComponent(new ShareIndicator(context));
mIndicatorBar.setOrientation(mInitialOrientation);
}
diff --git a/src/com/android/camera/ui/CameraHeadUpDisplay.java b/src/com/android/camera/ui/CameraHeadUpDisplay.java
index b3c5ea0..3b1a0f9 100644
--- a/src/com/android/camera/ui/CameraHeadUpDisplay.java
+++ b/src/com/android/camera/ui/CameraHeadUpDisplay.java
@@ -81,6 +81,7 @@ public class CameraHeadUpDisplay extends HeadUpDisplay {
}
addIndicator(context, group, CameraSettings.KEY_CAMERA_ID);
+ mIndicatorBar.addComponent(new ShareIndicator(context));
mIndicatorBar.setOrientation(mInitialOrientation);
}
diff --git a/src/com/android/camera/ui/HeadUpDisplay.java b/src/com/android/camera/ui/HeadUpDisplay.java
index dd12926..ed4ea0a 100644
--- a/src/com/android/camera/ui/HeadUpDisplay.java
+++ b/src/com/android/camera/ui/HeadUpDisplay.java
@@ -25,18 +25,17 @@ import com.android.camera.R;
import android.content.Context;
import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Rect;
import android.hardware.Camera.Parameters;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
+import android.util.Log;
import android.view.MotionEvent;
import android.view.View.MeasureSpec;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
-
import java.util.ArrayList;
// This is the UI for the on-screen settings. Since the rendering is run in the
@@ -133,6 +132,7 @@ public class HeadUpDisplay extends GLView {
public void onPopupWindowVisibilityChanged(int visibility);
public void onRestorePreferencesClicked();
public void onSharedPreferenceChanged();
+ public void onShareButtonClicked();
}
public void overrideSettings(final String ... keyvalues) {
@@ -226,6 +226,7 @@ public class HeadUpDisplay extends GLView {
}
private void hidePopupWindow() {
+ if (mPopupWindow == null) return;
mPopupWindow.popoff();
// Unregister is important to avoid leaking activities.
// ComboPreference.sMap->ComboPreference->HeadUpDisplay->Activity
@@ -366,6 +367,10 @@ public class HeadUpDisplay extends GLView {
public void onNothingSelected() {
hidePopupWindow();
}
+
+ public void onShareSelected() {
+ if (mListener != null) mListener.onShareButtonClicked();
+ }
}
public boolean collapse() {
diff --git a/src/com/android/camera/ui/IndicatorBar.java b/src/com/android/camera/ui/IndicatorBar.java
index 95098b9..0dfc637 100644
--- a/src/com/android/camera/ui/IndicatorBar.java
+++ b/src/com/android/camera/ui/IndicatorBar.java
@@ -19,12 +19,13 @@ package com.android.camera.ui;
import javax.microedition.khronos.opengles.GL11;
import android.graphics.Rect;
+import android.util.Log;
import android.view.MotionEvent;
import android.view.View.MeasureSpec;
import android.view.animation.AlphaAnimation;
class IndicatorBar extends GLView {
-
+ private static final String TAG ="IndicatorBar";
public static final int INDEX_NONE = -1;
private NinePatchTexture mBackground;
@@ -54,6 +55,7 @@ class IndicatorBar extends GLView {
public interface OnItemSelectedListener {
public void onItemSelected(GLView view, int position);
public void onNothingSelected();
+ public void onShareSelected();
}
public IndicatorBar() {
@@ -127,6 +129,12 @@ class IndicatorBar extends GLView {
}
private void setSelectedItem(GLView view, int index) {
+ // Share button has no popup window. Just notifiy the listener.
+ if (view instanceof ShareIndicator) {
+ if (mSelectedListener != null) mSelectedListener.onShareSelected();
+ return;
+ }
+
if (index == mSelectedIndex) return;
mSelectionChanged = true;
mSelectedIndex = index;
diff --git a/src/com/android/camera/ui/ShareIndicator.java b/src/com/android/camera/ui/ShareIndicator.java
new file mode 100644
index 0000000..916f19d
--- /dev/null
+++ b/src/com/android/camera/ui/ShareIndicator.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 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 android.content.Context;
+
+import com.android.camera.R;
+
+class ShareIndicator extends AbstractIndicator {
+ private ResourceTexture mIcon;
+
+ public ShareIndicator(Context context) {
+ super(context);
+ mIcon = new ResourceTexture(context, R.drawable.ic_viewfinder_share);
+ }
+
+ @Override
+ protected BitmapTexture getIcon() {
+ return mIcon;
+ }
+
+ @Override
+ public GLView getPopupContent() {
+ return null;
+ }
+
+ @Override
+ public void overrideSettings(String key, String settings) {
+ }
+
+ @Override
+ public void reloadPreferences() {
+ }
+}