Merge tag 'android-6.0.0_r26' into HEAD

Android 6.0.0 release 26

* tag 'android-6.0.0_r26':
  Import translations. DO NOT MERGE
  Support disabling timer-based lights out
  Add gradle support to photoviewer
  Import translations. DO NOT MERGE

Change-Id: Id6e885d6f7ae3d8eebfed3ff93efb4f2adf20c08
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..2edb32f
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,14 @@
+apply plugin: 'com.android.library'
+
+android {
+    sourceSets.main {
+        manifest.srcFile 'AndroidManifest.xml'
+        java.srcDirs = ['src', 'appcompat/src']
+        res.srcDirs = ['res', 'appcompat/res']
+    }
+}
+
+dependencies {
+    compile project(':support-v4')
+    compile project(':support-appcompat-v7')
+}
\ No newline at end of file
diff --git a/res/values-pt-rBR/strings.xml b/res/values-pt-rBR/strings.xml
new file mode 100644
index 0000000..6c05393
--- /dev/null
+++ b/res/values-pt-rBR/strings.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+     Copyright (C) 2012 Google Inc.
+     Licensed to The Android Open Source Project.
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string name="photo_view_count" msgid="3466690572899800275">"<xliff:g id="CURRENT_POS">%d</xliff:g> de <xliff:g id="COUNT">%d</xliff:g>"</string>
+    <string name="retry" msgid="3319517143224679074">"Tentar novamente"</string>
+    <string name="failed" msgid="1458877219699376279">"Impossível carregar a imagem"</string>
+    <string name="titles" msgid="8072357561981153438">"<xliff:g id="TITLE_0">%s</xliff:g>, <xliff:g id="SUBTITLE">%s</xliff:g>"</string>
+</resources>
diff --git a/sample/res/values-pt-rBR/strings.xml b/sample/res/values-pt-rBR/strings.xml
new file mode 100644
index 0000000..16e146a
--- /dev/null
+++ b/sample/res/values-pt-rBR/strings.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string name="app_name" msgid="559800164925277094">"AmostraPhotoViewer"</string>
+    <string name="menu_settings" msgid="1259682084875185697">"Configurações"</string>
+    <string name="title_activity_main" msgid="7695239211427024237">"AtividadePrincipal"</string>
+    <string name="launch" msgid="2345080120370773520">"Iniciar o Visualizador de fotos"</string>
+</resources>
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 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 @@
         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 @@
             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 @@
 
             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 @@
     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 @@
         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 @@
         }
     }
 
+    /**
+     * 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() {