summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-rw-r--r--src/com/android/camera/CameraActivity.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 3d630ecad..570fad1c4 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -580,23 +580,25 @@ public class CameraActivity extends Activity
CameraActivity.this.setSystemBarsVisibility(visible);
}
- private boolean stripHasScrolled = false;
+ private float previewCoverAlpha = 1.0f;
- @Override
- public void onFilmStripScroll(int offset) {
- if (offset == 0) {
- if (stripHasScrolled) {
- mCurrentModule.hidePreviewCover();
- mCurrentModule.setPreviewCoverAlpha(1.0f);
- }
- } else {
- // preview cover becomes fully opaque when the film strip has
- // scrolled half the width of the screen
- float rangePx = mDisplayWidth / 2f;
- mCurrentModule.setPreviewCoverAlpha((float)Math.min(1.0, offset/rangePx));
+ private void setPreviewCoverAlpha(float alpha) {
+ if (alpha == previewCoverAlpha || alpha < 0.0f || alpha > 1.0f) {
+ return;
+ }
+ mCurrentModule.setPreviewCoverAlpha(alpha);
+ if (alpha == 0.0f) {
+ mCurrentModule.hidePreviewCover();
+ } else if (previewCoverAlpha == 0.0f) {
mCurrentModule.showPreviewCover();
- stripHasScrolled = true;
}
+ previewCoverAlpha = alpha;
+ }
+
+ @Override
+ public void onFilmStripScroll(int offset) {
+ float rangePx = mDisplayWidth / 2f;
+ setPreviewCoverAlpha((float)Math.min(1.0, offset/rangePx));
}
};