summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/toast_frame_holo.9.pngbin0 -> 1585 bytes
-rw-r--r--res/drawable-mdpi/toast_frame_holo.9.pngbin0 -> 1585 bytes
-rw-r--r--res/drawable-xhdpi/toast_frame_holo.9.pngbin0 -> 1585 bytes
-rw-r--r--res/layout-sw600dp/preview_frame.xml1
-rw-r--r--res/layout-sw600dp/preview_frame_video.xml1
-rw-r--r--res/layout/first_hint_toast.xml35
-rw-r--r--res/layout/preview_frame.xml1
-rw-r--r--res/layout/preview_frame_video.xml1
-rw-r--r--res/layout/rotate_text_toast.xml39
-rw-r--r--src/com/android/camera/Camera.java22
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java25
-rw-r--r--src/com/android/camera/ui/RotateTextToast.java58
12 files changed, 105 insertions, 78 deletions
diff --git a/res/drawable-hdpi/toast_frame_holo.9.png b/res/drawable-hdpi/toast_frame_holo.9.png
new file mode 100644
index 0000000..f8f75db
--- /dev/null
+++ b/res/drawable-hdpi/toast_frame_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/toast_frame_holo.9.png b/res/drawable-mdpi/toast_frame_holo.9.png
new file mode 100644
index 0000000..f8f75db
--- /dev/null
+++ b/res/drawable-mdpi/toast_frame_holo.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/toast_frame_holo.9.png b/res/drawable-xhdpi/toast_frame_holo.9.png
new file mode 100644
index 0000000..f8f75db
--- /dev/null
+++ b/res/drawable-xhdpi/toast_frame_holo.9.png
Binary files differ
diff --git a/res/layout-sw600dp/preview_frame.xml b/res/layout-sw600dp/preview_frame.xml
index 896d394..1316f4a 100644
--- a/res/layout-sw600dp/preview_frame.xml
+++ b/res/layout-sw600dp/preview_frame.xml
@@ -31,6 +31,5 @@
android:visibility="gone"/>
<include layout="@layout/focus_indicator"/>
<include layout="@layout/priority_indicators"/>
- <include layout="@layout/first_hint_toast"/>
</com.android.camera.PreviewFrameLayout>
</RelativeLayout>
diff --git a/res/layout-sw600dp/preview_frame_video.xml b/res/layout-sw600dp/preview_frame_video.xml
index aab1ee1..1108814 100644
--- a/res/layout-sw600dp/preview_frame_video.xml
+++ b/res/layout-sw600dp/preview_frame_video.xml
@@ -48,6 +48,5 @@
android:background="@drawable/bg_pressed"
android:visibility="gone"
android:onClick="onReviewPlayClicked" />
- <include layout="@layout/first_hint_toast"/>
</com.android.camera.PreviewFrameLayout>
</RelativeLayout>
diff --git a/res/layout/first_hint_toast.xml b/res/layout/first_hint_toast.xml
deleted file mode 100644
index fb60d29..0000000
--- a/res/layout/first_hint_toast.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 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.
-*/
--->
-<com.android.camera.ui.RotateLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/first_use_hint"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:visibility="gone">
- <TextView android:id="@+id/toast_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="10dp"
- android:paddingRight="10dp"
- android:paddingTop="5dp"
- android:paddingBottom="5dp"
- android:textAppearance="?android:textAppearanceMedium"
- android:background="@color/on_viewfinder_label_background_color" />
-</com.android.camera.ui.RotateLayout>
-
diff --git a/res/layout/preview_frame.xml b/res/layout/preview_frame.xml
index 31ba61b..bed1fb0 100644
--- a/res/layout/preview_frame.xml
+++ b/res/layout/preview_frame.xml
@@ -32,7 +32,6 @@
android:visibility="gone"/>
<include layout="@layout/focus_indicator"/>
<include layout="@layout/priority_indicators"/>
- <include layout="@layout/first_hint_toast"/>
</com.android.camera.PreviewFrameLayout>
<include layout="@layout/indicator_bar" />
</RelativeLayout>
diff --git a/res/layout/preview_frame_video.xml b/res/layout/preview_frame_video.xml
index 43d1b5a..dd3ffc9 100644
--- a/res/layout/preview_frame_video.xml
+++ b/res/layout/preview_frame_video.xml
@@ -48,7 +48,6 @@
android:src="@drawable/ic_gallery_play"
android:visibility="gone"
android:onClick="onReviewPlayClicked"/>
- <include layout="@layout/first_hint_toast"/>
</com.android.camera.PreviewFrameLayout>
<!-- Fill up the space below preview frame with black. -->
diff --git a/res/layout/rotate_text_toast.xml b/res/layout/rotate_text_toast.xml
new file mode 100644
index 0000000..2c89b6f
--- /dev/null
+++ b/res/layout/rotate_text_toast.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<com.android.camera.ui.RotateLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/rotate_toast"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:visibility="gone">
+
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/toast_frame_holo">
+ <TextView
+ android:id="@+id/message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:textAppearanceMedium"
+ android:textColor="@android:color/white"
+ android:shadowColor="#BB000000"
+ android:shadowRadius="2.75" />
+ </FrameLayout>
+</com.android.camera.ui.RotateLayout>
+
+
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index c3f5d95..bb0c0e0 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -22,6 +22,7 @@ import com.android.camera.ui.IndicatorControlContainer;
import com.android.camera.ui.Rotatable;
import com.android.camera.ui.RotateImageView;
import com.android.camera.ui.RotateLayout;
+import com.android.camera.ui.RotateTextToast;
import com.android.camera.ui.SharePopup;
import com.android.camera.ui.ZoomControl;
@@ -95,8 +96,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
private static final int SET_CAMERA_PARAMETERS_WHEN_IDLE = 4;
private static final int CHECK_DISPLAY_ROTATION = 5;
private static final int SHOW_TAP_TO_FOCUS_TOAST = 6;
- private static final int DISMISS_TAP_TO_FOCUS_TOAST = 7;
- private static final int UPDATE_THUMBNAIL = 8;
+ private static final int UPDATE_THUMBNAIL = 7;
// The subset of parameters we need to update in setCameraParameters().
private static final int UPDATE_PARAM_INITIALIZE = 1;
@@ -310,14 +310,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
break;
}
- case DISMISS_TAP_TO_FOCUS_TOAST: {
- View v = findViewById(R.id.first_use_hint);
- v.setVisibility(View.GONE);
- v.setAnimation(AnimationUtils.loadAnimation(Camera.this,
- R.anim.on_screen_hint_exit));
- break;
- }
-
case UPDATE_THUMBNAIL: {
mImageSaver.updateThumbnail();
break;
@@ -2275,15 +2267,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
private void showTapToFocusToast() {
- // Set the text of toast
- TextView textView = (TextView) findViewById(R.id.toast_text);
- textView.setText(R.string.tap_to_focus);
- // Show the toast.
- RotateLayout v = (RotateLayout) findViewById(R.id.first_use_hint);
- v.setOrientation(mOrientationCompensation);
- v.startAnimation(AnimationUtils.loadAnimation(this, R.anim.on_screen_hint_enter));
- v.setVisibility(View.VISIBLE);
- mHandler.sendEmptyMessageDelayed(DISMISS_TAP_TO_FOCUS_TOAST, 5000);
+ new RotateTextToast(this, R.string.tap_to_focus, mOrientation).show();
// Clear the preference.
Editor editor = mPreferences.edit();
editor.putBoolean(CameraSettings.KEY_CAMERA_FIRST_USE_HINT_SHOWN, false);
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index fad9094..f725f43 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -22,6 +22,7 @@ import com.android.camera.ui.IndicatorControlWheelContainer;
import com.android.camera.ui.Rotatable;
import com.android.camera.ui.RotateImageView;
import com.android.camera.ui.RotateLayout;
+import com.android.camera.ui.RotateTextToast;
import com.android.camera.ui.SharePopup;
import com.android.camera.ui.ZoomControl;
@@ -98,7 +99,6 @@ public class VideoCamera extends ActivityBase
private static final int UPDATE_RECORD_TIME = 5;
private static final int ENABLE_SHUTTER_BUTTON = 6;
private static final int SHOW_TAP_TO_SNAPSHOT_TOAST = 7;
- private static final int DISMISS_TAP_TO_SNAPSHOT_TOAST = 8;
private static final int SCREEN_DELAY = 2 * 60 * 1000;
@@ -308,14 +308,6 @@ public class VideoCamera extends ActivityBase
break;
}
- case DISMISS_TAP_TO_SNAPSHOT_TOAST: {
- View v = findViewById(R.id.first_use_hint);
- v.setVisibility(View.GONE);
- v.setAnimation(AnimationUtils.loadAnimation(VideoCamera.this,
- R.anim.on_screen_hint_exit));
- break;
- }
-
default:
Log.v(TAG, "Unhandled message: " + msg.what);
break;
@@ -2344,8 +2336,8 @@ public class VideoCamera extends ActivityBase
@Override
public boolean onTouch(View v, MotionEvent e) {
if (mMediaRecorderRecording && effectsActive()) {
- Toast.makeText(this, getResources().getString(
- R.string.disable_video_snapshot_hint), Toast.LENGTH_LONG).show();
+ new RotateTextToast(this, R.string.disable_video_snapshot_hint,
+ mOrientation).show();
return false;
}
@@ -2444,15 +2436,8 @@ public class VideoCamera extends ActivityBase
}
private void showTapToSnapshotToast() {
- // Set the text of toast
- TextView textView = (TextView) findViewById(R.id.toast_text);
- textView.setText(R.string.video_snapshot_hint);
- // Show the toast.
- RotateLayout v = (RotateLayout) findViewById(R.id.first_use_hint);
- v.setOrientation(mOrientationCompensation);
- v.startAnimation(AnimationUtils.loadAnimation(this, R.anim.on_screen_hint_enter));
- v.setVisibility(View.VISIBLE);
- mHandler.sendEmptyMessageDelayed(DISMISS_TAP_TO_SNAPSHOT_TOAST, 5000);
+ new RotateTextToast(this, R.string.video_snapshot_hint, mOrientation)
+ .show();
// Clear the preference.
Editor editor = mPreferences.edit();
editor.putBoolean(CameraSettings.KEY_VIDEO_FIRST_USE_HINT_SHOWN, false);
diff --git a/src/com/android/camera/ui/RotateTextToast.java b/src/com/android/camera/ui/RotateTextToast.java
new file mode 100644
index 0000000..8ff381a
--- /dev/null
+++ b/src/com/android/camera/ui/RotateTextToast.java
@@ -0,0 +1,58 @@
+/*
+ * 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 com.android.camera.R;
+import com.android.camera.Util;
+
+import android.app.Activity;
+import android.os.Handler;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class RotateTextToast {
+ private static final int TOAST_DURATION = 5000; // milliseconds
+ ViewGroup mLayoutRoot;
+ RotateLayout mToast;
+ Handler mHandler;
+
+ public RotateTextToast(Activity activity, int textResourceId, int orientation) {
+ mLayoutRoot = (ViewGroup) activity.getWindow().getDecorView();
+ LayoutInflater inflater = activity.getLayoutInflater();
+ View v = inflater.inflate(R.layout.rotate_text_toast, mLayoutRoot);
+ mToast = (RotateLayout) v.findViewById(R.id.rotate_toast);
+ TextView tv = (TextView) mToast.findViewById(R.id.message);
+ tv.setText(textResourceId);
+ mToast.setOrientation(orientation);
+ mHandler = new Handler();
+ }
+
+ private final Runnable mRunnable = new Runnable() {
+ public void run() {
+ Util.fadeOut(mToast);
+ mLayoutRoot.removeView(mToast);
+ mToast = null;
+ }
+ };
+
+ public void show() {
+ mToast.setVisibility(View.VISIBLE);
+ mHandler.postDelayed(mRunnable, TOAST_DURATION);
+ }
+}