summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorChih-yu Huang <akahuang@google.com>2011-10-28 16:27:08 +0800
committerChih-yu Huang <akahuang@google.com>2011-10-28 18:51:28 +0800
commitd6e5029b2df45210834334f7c2e99dfc85e962f0 (patch)
tree96bce8fdb2d21237d13484bfe9aaca21c348309a /src/com/android
parent60dc073ff3087af41f9cf3b738eaa74bb2212f95 (diff)
downloadLegacyCamera-d6e5029b2df45210834334f7c2e99dfc85e962f0.zip
LegacyCamera-d6e5029b2df45210834334f7c2e99dfc85e962f0.tar.gz
LegacyCamera-d6e5029b2df45210834334f7c2e99dfc85e962f0.tar.bz2
Show video snapshot toast in first use.
bug:5494290 Change-Id: I7cb498ef50610d300a64d9d053b0a411d86da730
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/camera/Camera.java11
-rw-r--r--src/com/android/camera/CameraSettings.java3
-rw-r--r--src/com/android/camera/ComboPreferences.java3
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java45
4 files changed, 56 insertions, 6 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 151ef7a..8012a2b 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -303,7 +303,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
case DISMISS_TAP_TO_FOCUS_TOAST: {
- View v = findViewById(R.id.tap_to_focus_prompt);
+ View v = findViewById(R.id.first_use_hint);
v.setVisibility(View.GONE);
v.setAnimation(AnimationUtils.loadAnimation(Camera.this,
R.anim.on_screen_hint_exit));
@@ -389,7 +389,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
startFaceDetection();
// Show the tap to focus toast if this is the first start.
if (mFocusAreaSupported &&
- mPreferences.getBoolean(CameraSettings.KEY_TAP_TO_FOCUS_PROMPT_SHOWN, true)) {
+ mPreferences.getBoolean(CameraSettings.KEY_CAMERA_FIRST_USE_HINT_SHOWN, true)) {
// Delay the toast for one second to wait for orientation.
mHandler.sendEmptyMessageDelayed(SHOW_TAP_TO_FOCUS_TOAST, 1000);
}
@@ -2214,15 +2214,18 @@ 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.tap_to_focus_prompt);
+ 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);
// Clear the preference.
Editor editor = mPreferences.edit();
- editor.putBoolean(CameraSettings.KEY_TAP_TO_FOCUS_PROMPT_SHOWN, false);
+ editor.putBoolean(CameraSettings.KEY_CAMERA_FIRST_USE_HINT_SHOWN, false);
editor.apply();
}
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 9c3104b..c861366 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -50,7 +50,8 @@ public class CameraSettings {
public static final String KEY_EXPOSURE = "pref_camera_exposure_key";
public static final String KEY_VIDEO_EFFECT = "pref_video_effect_key";
public static final String KEY_CAMERA_ID = "pref_camera_id_key";
- public static final String KEY_TAP_TO_FOCUS_PROMPT_SHOWN = "pref_tap_to_focus_prompt_shown_key";
+ public static final String KEY_CAMERA_FIRST_USE_HINT_SHOWN = "pref_camera_first_use_hint_shown_key";
+ public static final String KEY_VIDEO_FIRST_USE_HINT_SHOWN = "pref_video_first_use_hint_shown_key";
public static final String EXPOSURE_DEFAULT_VALUE = "0";
diff --git a/src/com/android/camera/ComboPreferences.java b/src/com/android/camera/ComboPreferences.java
index 1af634c..bea2ffd 100644
--- a/src/com/android/camera/ComboPreferences.java
+++ b/src/com/android/camera/ComboPreferences.java
@@ -76,7 +76,8 @@ public class ComboPreferences implements SharedPreferences, OnSharedPreferenceCh
return key.equals(CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL)
|| key.equals(CameraSettings.KEY_CAMERA_ID)
|| key.equals(CameraSettings.KEY_RECORD_LOCATION)
- || key.equals(CameraSettings.KEY_TAP_TO_FOCUS_PROMPT_SHOWN)
+ || key.equals(CameraSettings.KEY_CAMERA_FIRST_USE_HINT_SHOWN)
+ || key.equals(CameraSettings.KEY_VIDEO_FIRST_USE_HINT_SHOWN)
|| key.equals(CameraSettings.KEY_VIDEO_EFFECT);
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 7c87892..78978f5 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -32,6 +32,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences.Editor;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
@@ -65,6 +66,7 @@ import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -95,6 +97,8 @@ public class VideoCamera extends ActivityBase
private static final int CLEAR_SCREEN_DELAY = 4;
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;
@@ -298,6 +302,19 @@ public class VideoCamera extends ActivityBase
break;
}
+ case SHOW_TAP_TO_SNAPSHOT_TOAST: {
+ showTapToSnapshotToast();
+ 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;
@@ -540,6 +557,12 @@ public class VideoCamera extends ActivityBase
setOrientationIndicator(mOrientationCompensation);
}
}
+
+ // Show the toast after getting the first orientation changed.
+ if (mHandler.hasMessages(SHOW_TAP_TO_SNAPSHOT_TOAST)) {
+ mHandler.removeMessages(SHOW_TAP_TO_SNAPSHOT_TOAST);
+ showTapToSnapshotToast();
+ }
}
}
@@ -2292,6 +2315,12 @@ public class VideoCamera extends ActivityBase
private void initializeVideoSnapshot() {
if (mParameters.isVideoSnapshotSupported() && !mIsVideoCaptureIntent) {
findViewById(R.id.camera_preview).setOnTouchListener(this);
+ // Show the tap to focus toast if this is the first start.
+ if (mPreferences.getBoolean(
+ CameraSettings.KEY_VIDEO_FIRST_USE_HINT_SHOWN, true)) {
+ // Delay the toast for one second to wait for orientation.
+ mHandler.sendEmptyMessageDelayed(SHOW_TAP_TO_SNAPSHOT_TOAST, 1000);
+ }
}
}
@@ -2405,4 +2434,20 @@ public class VideoCamera extends ActivityBase
mVideoFileDescriptor = null;
}
}
+
+ 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);
+ // Clear the preference.
+ Editor editor = mPreferences.edit();
+ editor.putBoolean(CameraSettings.KEY_VIDEO_FIRST_USE_HINT_SHOWN, false);
+ editor.apply();
+ }
}