Show video snapshot toast in first use.
bug:5494290
Change-Id: I7cb498ef50610d300a64d9d053b0a411d86da730
diff --git a/res/layout-sw600dp/preview_frame.xml b/res/layout-sw600dp/preview_frame.xml
index 961a407..896d394 100644
--- a/res/layout-sw600dp/preview_frame.xml
+++ b/res/layout-sw600dp/preview_frame.xml
@@ -31,6 +31,6 @@
android:visibility="gone"/>
<include layout="@layout/focus_indicator"/>
<include layout="@layout/priority_indicators"/>
- <include layout="@layout/tap_to_focus_toast"/>
+ <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 69b7fe3..4e59c90 100644
--- a/res/layout-sw600dp/preview_frame_video.xml
+++ b/res/layout-sw600dp/preview_frame_video.xml
@@ -44,5 +44,6 @@
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/tap_to_focus_toast.xml b/res/layout/first_hint_toast.xml
similarity index 92%
rename from res/layout/tap_to_focus_toast.xml
rename to res/layout/first_hint_toast.xml
index 1ea67e7..fb60d29 100644
--- a/res/layout/tap_to_focus_toast.xml
+++ b/res/layout/first_hint_toast.xml
@@ -17,13 +17,12 @@
*/
-->
<com.android.camera.ui.RotateLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/tap_to_focus_prompt"
+ 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:text="@string/tap_to_focus"
+ <TextView android:id="@+id/toast_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
@@ -32,4 +31,5 @@
android:paddingBottom="5dp"
android:textAppearance="?android:textAppearanceMedium"
android:background="@color/on_viewfinder_label_background_color" />
-</com.android.camera.ui.RotateLayout>
\ No newline at end of file
+</com.android.camera.ui.RotateLayout>
+
diff --git a/res/layout/preview_frame.xml b/res/layout/preview_frame.xml
index c225a58..31ba61b 100644
--- a/res/layout/preview_frame.xml
+++ b/res/layout/preview_frame.xml
@@ -32,7 +32,7 @@
android:visibility="gone"/>
<include layout="@layout/focus_indicator"/>
<include layout="@layout/priority_indicators"/>
- <include layout="@layout/tap_to_focus_toast"/>
+ <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 5e27169..af945f5 100644
--- a/res/layout/preview_frame_video.xml
+++ b/res/layout/preview_frame_video.xml
@@ -44,6 +44,7 @@
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/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 @@
}
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 @@
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 @@
}
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 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 @@
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.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.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 @@
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 @@
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 @@
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 @@
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 @@
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();
+ }
}