Templatized TextSwitcher

Change-Id: Ie919dde659b924e1e1c923cc6fbb7b5ba731bfe7
diff --git a/ui/views/TextSwitcher/README.txt b/ui/views/TextSwitcher/README.txt
deleted file mode 100644
index 38608df..0000000
--- a/ui/views/TextSwitcher/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Build Instructions
--------------------
-This sample uses the Gradle build system. To build this project, use the
-"gradlew build" command.
-
-To see a list of all available commands, run "gradlew tasks".
\ No newline at end of file
diff --git a/ui/views/TextSwitcher/TextSwitcher/build.gradle b/ui/views/TextSwitcher/TextSwitcher/build.gradle
deleted file mode 100644
index 10fb811..0000000
--- a/ui/views/TextSwitcher/TextSwitcher/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply plugin: 'android'
-
-dependencies {
-    compile "com.android.support:support-v4:18.0.+"
-}
-
-android {
-    compileSdkVersion 18
-    buildToolsVersion "18.0.1"
-}
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values/styles.xml b/ui/views/TextSwitcher/TextSwitcher/src/main/res/values/styles.xml
deleted file mode 100644
index 27efa47..0000000
--- a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
-  Copyright 2013 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>
-
-    <!--
-        Base application theme, dependent on API level. This theme is replaced
-        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Light">
-        <!--
-            Theme customizations available in newer API levels can go in
-            res/values-vXX/styles.xml, while customizations related to
-            backward-compatibility can go here.
-        -->
-    </style>
-
-    <!-- Application theme. -->
-    <style name="AppTheme" parent="AppBaseTheme">
-        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
-    </style>
-
-</resources>
diff --git a/ui/views/TextSwitcher/TextSwitcherSample/.gitignore b/ui/views/TextSwitcher/TextSwitcherSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/ui/views/TextSwitcher/TextSwitcherSample/.gitignore
@@ -0,0 +1,16 @@
+# Copyright 2013 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.
+src/template/
+src/common/
+build.gradle
diff --git a/ui/views/TextSwitcher/TextSwitcherSample/proguard-project.txt b/ui/views/TextSwitcher/TextSwitcherSample/proguard-project.txt
new file mode 100644
index 0000000..0d8f171
--- /dev/null
+++ b/ui/views/TextSwitcher/TextSwitcherSample/proguard-project.txt
@@ -0,0 +1,20 @@
+ To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/AndroidManifest.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/AndroidManifest.xml
similarity index 90%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/AndroidManifest.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/AndroidManifest.xml
index 707bfe3..7f512a3 100644
--- a/ui/views/TextSwitcher/TextSwitcher/src/main/AndroidManifest.xml
+++ b/ui/views/TextSwitcher/TextSwitcherSample/src/main/AndroidManifest.xml
@@ -16,7 +16,7 @@
 -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.example.android.view.textswitcher"
+    package="com.example.android.textswitcher"
     android:versionCode="1"
     android:versionName="1.0" >
 
@@ -30,7 +30,7 @@
         android:label="@string/app_name"
         android:theme="@style/AppTheme" >
         <activity
-            android:name="com.example.android.ui.views.textswitcher.MainActivity"
+            android:name=".MainActivity"
             android:label="@string/app_name" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/java/com/example/android/ui/views/textswitcher/MainActivity.java b/ui/views/TextSwitcher/TextSwitcherSample/src/main/java/com/example/android/textswitcher/MainActivity.java
similarity index 83%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/java/com/example/android/ui/views/textswitcher/MainActivity.java
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/java/com/example/android/textswitcher/MainActivity.java
index 1beeb59..a8cbb5e 100644
--- a/ui/views/TextSwitcher/TextSwitcher/src/main/java/com/example/android/ui/views/textswitcher/MainActivity.java
+++ b/ui/views/TextSwitcher/TextSwitcherSample/src/main/java/com/example/android/textswitcher/MainActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.example.android.ui.views.textswitcher;
+package com.example.android.textswitcher;
 
 import android.app.Activity;
 import android.os.Bundle;
@@ -25,16 +25,13 @@
 import android.widget.Button;
 import android.widget.TextSwitcher;
 import android.widget.TextView;
-import android.widget.ViewSwitcher;
 import android.widget.ViewSwitcher.ViewFactory;
 
-import com.example.android.view.textswitcher.R;
-
 /**
- * This sample shows the use of the {@link TextSwitcher} View with animations. A
- * {@link TextSwitcher} is a special type of {@link ViewSwitcher} that animates
+ * This sample shows the use of the {@link android.widget.TextSwitcher} View with animations. A
+ * {@link android.widget.TextSwitcher} is a special type of {@link android.widget.ViewSwitcher} that animates
  * the current text out and new text in when
- * {@link TextSwitcher#setText(CharSequence)} is called.
+ * {@link android.widget.TextSwitcher#setText(CharSequence)} is called.
  */
 public class MainActivity extends Activity {
     private TextSwitcher mSwitcher;
@@ -43,7 +40,7 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_main);
+        setContentView(R.layout.sample_main);
 
         // Get the TextSwitcher view from the layout
         mSwitcher = (TextSwitcher) findViewById(R.id.switcher);
@@ -88,10 +85,10 @@
 
     // BEGIN_INCLUDE(factory)
     /**
-     * The {@link ViewFactory} used to create {@link TextView}s that the
-     * {@link TextSwitcher} will switch between.
+     * The {@link android.widget.ViewSwitcher.ViewFactory} used to create {@link android.widget.TextView}s that the
+     * {@link android.widget.TextSwitcher} will switch between.
      */
-    private ViewSwitcher.ViewFactory mFactory = new ViewFactory() {
+    private ViewFactory mFactory = new ViewFactory() {
 
         @Override
         public View makeView() {
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-hdpi/ic_launcher.png b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-hdpi/ic_launcher.png
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-mdpi/ic_launcher.png b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-mdpi/ic_launcher.png
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-xhdpi/ic_launcher.png b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-xhdpi/ic_launcher.png
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-xxhdpi/ic_launcher.png b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/layout/activity_main.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/layout/sample_main.xml
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/layout/activity_main.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/layout/sample_main.xml
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values-sw600dp/dimens.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-sw600dp/dimens.xml
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/values-sw600dp/dimens.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-sw600dp/dimens.xml
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values-sw720dp-land/dimens.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-sw720dp-land/dimens.xml
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/values-sw720dp-land/dimens.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-sw720dp-land/dimens.xml
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values-v11/styles.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-v11/styles.xml
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/values-v11/styles.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-v11/styles.xml
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values-v14/styles.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-v14/styles.xml
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/values-v14/styles.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values-v14/styles.xml
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values/dimens.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values/dimens.xml
similarity index 100%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/values/dimens.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values/dimens.xml
diff --git a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values/strings.xml b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values/strings.xml
similarity index 94%
rename from ui/views/TextSwitcher/TextSwitcher/src/main/res/values/strings.xml
rename to ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values/strings.xml
index 6b281e6..612b6cb 100644
--- a/ui/views/TextSwitcher/TextSwitcher/src/main/res/values/strings.xml
+++ b/ui/views/TextSwitcher/TextSwitcherSample/src/main/res/values/strings.xml
@@ -17,7 +17,6 @@
 
 <resources>
 
-    <string name="app_name">TextSwitcherSample</string>
     <string name="intro">This sample illustrates the use of a <b>TextSwitcher</b> to display text.
 \n\n<b>Click the button</b> below to set new text in the TextSwitcher and observe the in and out
  fade animations.</string>
diff --git a/ui/views/TextSwitcher/build.gradle b/ui/views/TextSwitcher/build.gradle
index 036abc8..ffb5c2f 100644
--- a/ui/views/TextSwitcher/build.gradle
+++ b/ui/views/TextSwitcher/build.gradle
@@ -1,8 +1,11 @@
-buildscript {
-    repositories {
-        mavenCentral()
-    }
-    dependencies {
-        classpath 'com.android.tools.build:gradle:0.5.+'
-    }
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../../build/build.gradle"
+samplegen {
+  pathToBuild "../../../../../build"
+  pathToSamplesCommon "../../../common"
 }
+// END_EXCLUDE
diff --git a/ui/views/TextSwitcher/buildSrc/build.gradle b/ui/views/TextSwitcher/buildSrc/build.gradle
new file mode 100644
index 0000000..e344a8c
--- /dev/null
+++ b/ui/views/TextSwitcher/buildSrc/build.gradle
@@ -0,0 +1,18 @@
+
+
+
+repositories {
+    mavenCentral()
+}
+dependencies {
+    compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+    main {
+        groovy {
+            srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
+        }
+    }
+}
+
diff --git a/ui/views/TextSwitcher/gradle/wrapper/gradle-wrapper.properties b/ui/views/TextSwitcher/gradle/wrapper/gradle-wrapper.properties
index 055ba6f..861eddc 100644
--- a/ui/views/TextSwitcher/gradle/wrapper/gradle-wrapper.properties
+++ b/ui/views/TextSwitcher/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,6 @@
-#
-#Mon Jul 22 11:40:20 PDT 2013
+#Wed Apr 10 15:27:10 PDT 2013
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
diff --git a/ui/views/TextSwitcher/settings.gradle b/ui/views/TextSwitcher/settings.gradle
index aefb871..6740a95 100644
--- a/ui/views/TextSwitcher/settings.gradle
+++ b/ui/views/TextSwitcher/settings.gradle
@@ -1 +1,4 @@
-include ':TextSwitcher'
+
+
+
+include 'TextSwitcherSample'
diff --git a/ui/views/TextSwitcher/template-params.xml b/ui/views/TextSwitcher/template-params.xml
new file mode 100644
index 0000000..dffc256
--- /dev/null
+++ b/ui/views/TextSwitcher/template-params.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 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.
+-->
+
+
+
+<sample>
+    <name>TextSwitcher</name>
+    <group>NoGroup</group>
+    <package>com.example.android.textswitcher</package>
+
+    <!-- change minSdk if needed-->
+    <minSdk>4</minSdk>
+
+    <strings>
+        <intro>
+            <![CDATA[
+                This sample illustrates the use of a TextSwitcher to display text.
+                \n\nClick the button below to set new text in the TextSwitcher and observe the
+                in and out fade animations.
+            ]]>
+        </intro>
+    </strings>
+
+    <template src="base"/>
+    <common src="logger"/>
+
+</sample>