diff options
author | Ken Thai <kenthai@google.com> | 2015-09-15 21:18:16 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-15 21:18:16 +0000 |
commit | f1e94b9150274be84371dfae3f0b89c28dab7346 (patch) | |
tree | 1555049f958085547bb85b3a088788e101148e5e | |
parent | 1eeb3075a625a182f920d9af7c69979b24411ceb (diff) | |
parent | 8518692e99aafdbcc4db75c140a02651dcba74b4 (diff) | |
download | photoviewer-f1e94b9150274be84371dfae3f0b89c28dab7346.tar.gz |
am 8518692e: am 8650d3cd: Support disabling timer-based lights out
* commit '8518692e99aafdbcc4db75c140a02651dcba74b4':
Support disabling timer-based lights out
-rw-r--r-- | src/com/android/ex/photo/Intents.java | 12 | ||||
-rw-r--r-- | src/com/android/ex/photo/PhotoViewController.java | 14 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/ex/photo/Intents.java b/src/com/android/ex/photo/Intents.java index a1e9ffa..104ae28 100644 --- a/src/com/android/ex/photo/Intents.java +++ b/src/com/android/ex/photo/Intents.java @@ -39,6 +39,7 @@ public class Intents { public static final String EXTRA_THUMBNAIL_URI = "thumbnail_uri"; public static final String EXTRA_MAX_INITIAL_SCALE = "max_scale"; public static final String EXTRA_WATCH_NETWORK = "watch_network"; + public static final String EXTRA_ENABLE_TIMER_LIGHTS_OUT = "enable_timer_lights_out"; // Parameters affecting the intro/exit animation @@ -117,6 +118,8 @@ public class Intents { private String mThumbnailUri; /** The maximum scale to display images at before */ private Float mMaxInitialScale; + /** True if lights out should automatically be invoked on a timer basis */ + private boolean mEnableTimerLightsOut; /** * True if the PhotoViewFragments should watch for network changes to restart their loaders */ @@ -151,6 +154,13 @@ public class Intents { mScaleAnimation = false; mActionBarHiddenInitially = false; mDisplayFullScreenThumbs = false; + mEnableTimerLightsOut = true; + } + + /** Sets auto lights out */ + public PhotoViewIntentBuilder setEnableTimerLightsOut(boolean enable) { + mEnableTimerLightsOut = enable; + return this; } /** Sets the photo index */ @@ -319,7 +329,7 @@ public class Intents { mIntent.putExtra(EXTRA_ACTION_BAR_HIDDEN_INITIALLY, mActionBarHiddenInitially); mIntent.putExtra(EXTRA_DISPLAY_THUMBS_FULLSCREEN, mDisplayFullScreenThumbs); - + mIntent.putExtra(EXTRA_ENABLE_TIMER_LIGHTS_OUT, mEnableTimerLightsOut); return mIntent; } } diff --git a/src/com/android/ex/photo/PhotoViewController.java b/src/com/android/ex/photo/PhotoViewController.java index fac1478..9da1759 100644 --- a/src/com/android/ex/photo/PhotoViewController.java +++ b/src/com/android/ex/photo/PhotoViewController.java @@ -179,6 +179,8 @@ public class PhotoViewController implements protected int mAnimationStartWidth; protected int mAnimationStartHeight; + /** Whether lights out should invoked based on timer */ + protected boolean mIsTimerLightsOutEnabled; protected boolean mActionBarHiddenInitially; protected boolean mDisplayThumbsFullScreen; @@ -237,6 +239,10 @@ public class PhotoViewController implements if (intent.hasExtra(Intents.EXTRA_PHOTOS_URI)) { mPhotosUri = intent.getStringExtra(Intents.EXTRA_PHOTOS_URI); } + + mIsTimerLightsOutEnabled = intent.getBooleanExtra( + Intents.EXTRA_ENABLE_TIMER_LIGHTS_OUT, true); + if (intent.getBooleanExtra(Intents.EXTRA_SCALE_UP_ANIMATION, false)) { mScaleAnimationEnabled = true; mAnimationStartX = intent.getIntExtra(Intents.EXTRA_ANIMATION_START_X, 0); @@ -704,8 +710,14 @@ public class PhotoViewController implements } } + /** + * Posts a runnable to enter full screen after mEnterFullScreenDelayTime. This method is a + * no-op if mIsTimerLightsOutEnabled is set to false. + */ private void postEnterFullScreenRunnableWithDelay() { - mHandler.postDelayed(mEnterFullScreenRunnable, mEnterFullScreenDelayTime); + if (mIsTimerLightsOutEnabled) { + mHandler.postDelayed(mEnterFullScreenRunnable, mEnterFullScreenDelayTime); + } } private void cancelEnterFullScreenRunnable() { |