diff options
author | Steve Kondik <steve@cyngn.com> | 2016-11-13 23:27:35 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-11-13 23:33:37 -0800 |
commit | 302dfef488297152978788c2341cd3460727b251 (patch) | |
tree | e505947a46b291f22f1ee625ff82ebbec528353b /src/com/android/camera/CameraActivity.java | |
parent | 7f040079cb93d6b5180147cd369e73d43078c91a (diff) | |
download | android_packages_apps_Snap-302dfef488297152978788c2341cd3460727b251.tar.gz android_packages_apps_Snap-302dfef488297152978788c2341cd3460727b251.tar.bz2 android_packages_apps_Snap-302dfef488297152978788c2341cd3460727b251.zip |
snap: UI checkpoint #2
* Fix bugs from previous commit
* Factor out recording controls
* Clean up layouts
* Asynchronous control for video module
* Performance improvements
Change-Id: I9d5833cecbd9280845b740ee8a3c47f023470625
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 30 |
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)); } }; |