Restore "Merge downstream branch 'developers-dev' into 'klp-dev'"
This reverts commit ec985147ec781dfff9a229c6b794ee4eac0ced91.
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/.gitignore b/media/BasicMediaDecoder/BasicMediaDecoderSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/.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/media/BasicMediaDecoder/BasicMediaDecoderSample/proguard-project.txt b/media/BasicMediaDecoder/BasicMediaDecoderSample/proguard-project.txt
new file mode 100644
index 0000000..0d8f171
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/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/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/AndroidManifest.xml b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..d191491
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/AndroidManifest.xml
@@ -0,0 +1,37 @@
+<?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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.basicmediadecoder"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk android:minSdkVersion="17"/>
+ <application
+ android:label="@string/app_name" android:icon="@drawable/ic_launcher">
+ <activity
+ android:name=".MainActivity"
+ android:screenOrientation="landscape"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/java/com/example/android/basicmediadecoder/MainActivity.java b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/java/com/example/android/basicmediadecoder/MainActivity.java
new file mode 100644
index 0000000..cac5bf2
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/java/com/example/android/basicmediadecoder/MainActivity.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package com.example.android.basicmediadecoder;
+
+
+import android.animation.TimeAnimator;
+import android.app.Activity;
+import android.media.MediaCodec;
+import android.media.MediaExtractor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.Surface;
+import android.view.TextureView;
+import android.view.View;
+import android.widget.TextView;
+
+import com.example.android.common.media.MediaCodecWrapper;
+
+import java.io.IOException;
+
+/**
+ * This activity uses a {@link android.view.TextureView} to render the frames of a video decoded using
+ * {@link android.media.MediaCodec} API.
+ */
+public class MainActivity extends Activity {
+
+ private TextureView mPlaybackView;
+ private TimeAnimator mTimeAnimator = new TimeAnimator();
+
+ // A utility that wraps up the underlying input and output buffer processing operations
+ // into an east to use API.
+ private MediaCodecWrapper mCodecWrapper;
+ private MediaExtractor mExtractor = new MediaExtractor();
+ TextView mAttribView = null;
+
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.sample_main);
+ mPlaybackView = (TextureView) findViewById(R.id.PlaybackView);
+ mAttribView = (TextView)findViewById(R.id.AttribView);
+
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.action_menu, menu);
+ return true;
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ if(mTimeAnimator != null && mTimeAnimator.isRunning()) {
+ mTimeAnimator.end();
+ }
+
+ if (mCodecWrapper != null ) {
+ mCodecWrapper.stopAndRelease();
+ mExtractor.release();
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.menu_play) {
+ mAttribView.setVisibility(View.VISIBLE);
+ startPlayback();
+ item.setEnabled(false);
+ }
+ return true;
+ }
+
+
+ public void startPlayback() {
+
+ // Construct a URI that points to the video resource that we want to play
+ Uri videoUri = Uri.parse("android.resource://"
+ + getPackageName() + "/"
+ + R.raw.vid_bigbuckbunny);
+
+ try {
+
+ // BEGIN_INCLUDE(initialize_extractor)
+ mExtractor.setDataSource(this, videoUri, null);
+ int nTracks = mExtractor.getTrackCount();
+
+ // Begin by unselecting all of the tracks in the extractor, so we won't see
+ // any tracks that we haven't explicitly selected.
+ for (int i = 0; i < nTracks; ++i) {
+ mExtractor.unselectTrack(i);
+ }
+
+
+ // Find the first video track in the stream. In a real-world application
+ // it's possible that the stream would contain multiple tracks, but this
+ // sample assumes that we just want to play the first one.
+ for (int i = 0; i < nTracks; ++i) {
+ // Try to create a video codec for this track. This call will return null if the
+ // track is not a video track, or not a recognized video format. Once it returns
+ // a valid MediaCodecWrapper, we can break out of the loop.
+ mCodecWrapper = MediaCodecWrapper.fromVideoFormat(mExtractor.getTrackFormat(i),
+ new Surface(mPlaybackView.getSurfaceTexture()));
+ if (mCodecWrapper != null) {
+ mExtractor.selectTrack(i);
+ break;
+ }
+ }
+ // END_INCLUDE(initialize_extractor)
+
+
+
+
+ // By using a {@link TimeAnimator}, we can sync our media rendering commands with
+ // the system display frame rendering. The animator ticks as the {@link Choreographer}
+ // recieves VSYNC events.
+ mTimeAnimator.setTimeListener(new TimeAnimator.TimeListener() {
+ @Override
+ public void onTimeUpdate(final TimeAnimator animation,
+ final long totalTime,
+ final long deltaTime) {
+
+ boolean isEos = ((mExtractor.getSampleFlags() & MediaCodec
+ .BUFFER_FLAG_END_OF_STREAM) == MediaCodec.BUFFER_FLAG_END_OF_STREAM);
+
+ // BEGIN_INCLUDE(write_sample)
+ if (!isEos) {
+ // Try to submit the sample to the codec and if successful advance the
+ // extractor to the next available sample to read.
+ boolean result = mCodecWrapper.writeSample(mExtractor, false,
+ mExtractor.getSampleTime(), mExtractor.getSampleFlags());
+
+ if (result) {
+ // Advancing the extractor is a blocking operation and it MUST be
+ // executed outside the main thread in real applications.
+ mExtractor.advance();
+ }
+ }
+ // END_INCLUDE(write_sample)
+
+ // Examine the sample at the head of the queue to see if its ready to be
+ // rendered and is not zero sized End-of-Stream record.
+ MediaCodec.BufferInfo out_bufferInfo = new MediaCodec.BufferInfo();
+ mCodecWrapper.peekSample(out_bufferInfo);
+
+ // BEGIN_INCLUDE(render_sample)
+ if (out_bufferInfo.size <= 0 && isEos) {
+ mTimeAnimator.end();
+ mCodecWrapper.stopAndRelease();
+ mExtractor.release();
+ } else if (out_bufferInfo.presentationTimeUs / 1000 < totalTime) {
+ // Pop the sample off the queue and send it to {@link Surface}
+ mCodecWrapper.popSample(true);
+ }
+ // END_INCLUDE(render_sample)
+
+ }
+ });
+
+ // We're all set. Kick off the animator to process buffers and render video frames as
+ // they become available
+ mTimeAnimator.start();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_action_play.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_action_play.png
new file mode 100755
index 0000000..dbfd337
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_action_play.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_action_play_disabled.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_action_play_disabled.png
new file mode 100755
index 0000000..e4310ef
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_action_play_disabled.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_launcher.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..9bc536b
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_action_play.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_action_play.png
new file mode 100755
index 0000000..a2f198a
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_action_play.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_action_play_disabled.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_action_play_disabled.png
new file mode 100755
index 0000000..d69107b
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_action_play_disabled.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_launcher.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..d656b21
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_action_play.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_action_play.png
new file mode 100755
index 0000000..9e63c90
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_action_play.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_action_play_disabled.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_action_play_disabled.png
new file mode 100755
index 0000000..2ff8c39
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_action_play_disabled.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_launcher.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bbb9b16
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4a5c33f
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable/selector_play.xml b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable/selector_play.xml
new file mode 100644
index 0000000..2307135
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/drawable/selector_play.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="true"
+ android:drawable="@drawable/ic_action_play"/>
+
+ <item android:state_enabled="false"
+ android:drawable="@drawable/ic_action_play_disabled"/>
+</selector>
\ No newline at end of file
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/layout/sample_main.xml b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/layout/sample_main.xml
new file mode 100644
index 0000000..7543120
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/layout/sample_main.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <TextureView
+ android:id="@+id/PlaybackView"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+ <TextView
+ android:id="@+id/AttribView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right|bottom"
+ android:visibility="gone"
+ android:textColor="@android:color/holo_blue_bright"
+ android:text="@string/app_video_attrib"/>
+</FrameLayout>
+
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/menu/action_menu.xml b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/menu/action_menu.xml
new file mode 100644
index 0000000..2b31a86
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/menu/action_menu.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_play"
+ android:icon="@drawable/selector_play"
+ android:title="Play"
+ android:showAsAction="ifRoom|withText" />
+</menu>
\ No newline at end of file
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/raw/vid_bigbuckbunny.mp4 b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/raw/vid_bigbuckbunny.mp4
new file mode 100644
index 0000000..81d11df
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/raw/vid_bigbuckbunny.mp4
Binary files differ
diff --git a/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/values/strings.xml b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/values/strings.xml
new file mode 100644
index 0000000..2cf79ab
--- /dev/null
+++ b/media/BasicMediaDecoder/BasicMediaDecoderSample/src/main/res/values/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 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>
+ <string name="app_video_attrib">(c) copyright 2008, Blender Foundation / www.bigbuckbunny.org
+ </string>
+</resources>
diff --git a/media/BasicMediaDecoder/build.gradle b/media/BasicMediaDecoder/build.gradle
new file mode 100644
index 0000000..c7a137e
--- /dev/null
+++ b/media/BasicMediaDecoder/build.gradle
@@ -0,0 +1,10 @@
+// BEGIN_EXCLUDE
+import com.example.android.samples.build.SampleGenPlugin
+apply plugin: SampleGenPlugin
+
+samplegen {
+ pathToBuild "../../../../build"
+ pathToSamplesCommon "../../common"
+}
+apply from: "../../../../build/build.gradle"
+// END_EXCLUDE
diff --git a/media/BasicMediaDecoder/buildSrc/build.gradle b/media/BasicMediaDecoder/buildSrc/build.gradle
new file mode 100644
index 0000000..29282af
--- /dev/null
+++ b/media/BasicMediaDecoder/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/media/BasicMediaDecoder/gradle/wrapper/gradle-wrapper.jar b/media/BasicMediaDecoder/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
--- /dev/null
+++ b/media/BasicMediaDecoder/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/media/BasicMediaDecoder/gradle/wrapper/gradle-wrapper.properties b/media/BasicMediaDecoder/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..861eddc
--- /dev/null
+++ b/media/BasicMediaDecoder/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#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.8-bin.zip
diff --git a/media/BasicMediaDecoder/gradlew b/media/BasicMediaDecoder/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/media/BasicMediaDecoder/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/media/BasicMediaDecoder/gradlew.bat b/media/BasicMediaDecoder/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/media/BasicMediaDecoder/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/media/BasicMediaDecoder/settings.gradle b/media/BasicMediaDecoder/settings.gradle
new file mode 100644
index 0000000..1e76e09
--- /dev/null
+++ b/media/BasicMediaDecoder/settings.gradle
@@ -0,0 +1,4 @@
+
+
+
+include 'BasicMediaDecoderSample'
diff --git a/media/BasicMediaDecoder/template-params.xml b/media/BasicMediaDecoder/template-params.xml
new file mode 100644
index 0000000..bcb01af
--- /dev/null
+++ b/media/BasicMediaDecoder/template-params.xml
@@ -0,0 +1,36 @@
+<?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>BasicMediaDecoder</name>
+ <group>Media</group>
+ <package>com.example.android.basicmediadecoder</package>
+
+ <!-- change minSdk if needed-->
+ <minSdk>17</minSdk>
+
+ <strings>
+ <intro>
+ <![CDATA[
+ This activity uses a TextureView to render the frames of a video decoded using the
+ MediaCodec API.
+ ]]>
+ </intro>
+ </strings>
+
+ <template src="base"/>
+ <common src="media"/>
+</sample>
diff --git a/media/BasicMediaRouter/BasicMediaRouter/build.gradle b/media/BasicMediaRouter/BasicMediaRouter/build.gradle
deleted file mode 100644
index 945e1f5..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion "18.0.0"
-}
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/AndroidManifest.xml b/media/BasicMediaRouter/BasicMediaRouter/src/main/AndroidManifest.xml
deleted file mode 100644
index f909d5e..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.output.mediaroutersample"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk
- android:minSdkVersion="17"
- android:targetSdkVersion="17" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.example.android.media.basicmediarouter.MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
\ No newline at end of file
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-hdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 2fd4ce4..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-mdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 56b78c5..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-xhdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index da3db3b..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-xxhdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 4aa8bdd..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values-v11/styles.xml b/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values-v11/styles.xml
deleted file mode 100644
index 541752f..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values-v11/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
-</resources>
\ No newline at end of file
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values-v14/styles.xml b/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values-v14/styles.xml
deleted file mode 100644
index f20e015..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values-v14/styles.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
\ No newline at end of file
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/strings.xml b/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/strings.xml
deleted file mode 100644
index ca9e53f..0000000
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<resources>
-
- <string name="menu_present_to">Present to</string>
- <string name="app_name">BasicMediaRouter Sample</string>
- <string name="title_activity_main">MainActivity</string>
- <string name="intro">This sample demonstrates the use of the MediaRouter API to display
- content on a secondary display.\n\nUse the <b>Media Route Action Item</b> in the ActionBar
- to select an output device. If your device supports Miracast wireless displays,
- you may need to enable <b>Wireless Display</b> functionality in the system settings.
- Secondary screen simulation can also be enabled from the <b>Developer Options</b>.\n\n
-Once connected, use the <b>Change Color</b> button to change the background color of the secondary screen.
-</string>
- <string name="secondary_connected">Connected to:\n%s</string>
- <string name="secondary_notconnected">No secondary display connected.</string>
- <string name="change_color">Change Color</string>
- <string name="display_name">This display is: %s</string>
- <string name="display_color">Background color: #%X</string>
-
-</resources>
\ No newline at end of file
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/.gitignore b/media/BasicMediaRouter/BasicMediaRouterSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/.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/media/BasicMediaRouter/BasicMediaRouterSample/proguard-project.txt b/media/BasicMediaRouter/BasicMediaRouterSample/proguard-project.txt
new file mode 100644
index 0000000..0d8f171
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/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/media/BasicMediaRouter/BasicMediaRouterSample/src/main/AndroidManifest.xml b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..33c20d5
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/AndroidManifest.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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.basicmediarouter"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="17"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/java/com/example/android/media/basicmediarouter/MainActivity.java b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/java/com/example/android/basicmediarouter/MainActivity.java
similarity index 83%
rename from media/BasicMediaRouter/BasicMediaRouter/src/main/java/com/example/android/media/basicmediarouter/MainActivity.java
rename to media/BasicMediaRouter/BasicMediaRouterSample/src/main/java/com/example/android/basicmediarouter/MainActivity.java
index ccf6ad0..23b2709 100644
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/java/com/example/android/media/basicmediarouter/MainActivity.java
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/java/com/example/android/basicmediarouter/MainActivity.java
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-package com.example.android.media.basicmediarouter;
+package com.example.android.basicmediarouter;
import android.app.Activity;
import android.app.MediaRouteActionProvider;
-import android.app.Presentation;
import android.content.Context;
import android.content.DialogInterface;
import android.media.MediaRouter;
@@ -32,18 +31,16 @@
import android.widget.Button;
import android.widget.TextView;
-import com.example.android.output.mediaroutersample.R;
-
/**
* <p>
* This sample demonstrates the use of the MediaRouter API to show content on a
- * secondary display using a {@link Presentation}.
+ * secondary display using a {@link android.app.Presentation}.
* </p>
* <p>
- * The activity uses the {@link MediaRouter} API to automatically detect when a
+ * The activity uses the {@link android.media.MediaRouter} API to automatically detect when a
* presentation display is available and to allow the user to control the media
- * routes using a menu item provided by the {@link MediaRouteActionProvider}.
- * When a presentation display is available a {@link Presentation} (implemented
+ * routes using a menu item provided by the {@link android.app.MediaRouteActionProvider}.
+ * When a presentation display is available a {@link android.app.Presentation} (implemented
* as a {@link SamplePresentation}) is shown on the preferred display. A button
* toggles the background color of the secondary screen to show the interaction
* between the primary and secondary screens.
@@ -54,8 +51,8 @@
* to simulate secondary displays.
* </p>
*
- * @see Presentation
- * @see MediaRouter
+ * @see android.app.Presentation
+ * @see android.media.MediaRouter
*/
public class MainActivity extends Activity {
@@ -68,7 +65,7 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+ setContentView(R.layout.sample_main);
mTextStatus = (TextView) findViewById(R.id.textStatus);
// get the list of background colors
@@ -91,19 +88,19 @@
}
/**
- * Implementing a {@link MediaRouter.Callback} to update the displayed
- * {@link Presentation} when a route is selected, unselected or the
+ * Implementing a {@link android.media.MediaRouter.Callback} to update the displayed
+ * {@link android.app.Presentation} when a route is selected, unselected or the
* presentation display has changed. The provided stub implementation
- * {@link MediaRouter.SimpleCallback} is extended and only
- * {@link MediaRouter.SimpleCallback#onRouteSelected(MediaRouter, int, RouteInfo)}
+ * {@link android.media.MediaRouter.SimpleCallback} is extended and only
+ * {@link android.media.MediaRouter.SimpleCallback#onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo)}
* ,
- * {@link MediaRouter.SimpleCallback#onRouteUnselected(MediaRouter, int, RouteInfo)}
+ * {@link android.media.MediaRouter.SimpleCallback#onRouteUnselected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo)}
* and
- * {@link MediaRouter.SimpleCallback#onRoutePresentationDisplayChanged(MediaRouter, RouteInfo)}
- * are overridden to update the displayed {@link Presentation} in
+ * {@link android.media.MediaRouter.SimpleCallback#onRoutePresentationDisplayChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo)}
+ * are overridden to update the displayed {@link android.app.Presentation} in
* {@link #updatePresentation()}. These callbacks enable or disable the
* second screen presentation based on the routing provided by the
- * {@link MediaRouter} for {@link MediaRouter#ROUTE_TYPE_LIVE_VIDEO}
+ * {@link android.media.MediaRouter} for {@link android.media.MediaRouter#ROUTE_TYPE_LIVE_VIDEO}
* streams. @
*/
private final MediaRouter.SimpleCallback mMediaRouterCallback =
@@ -142,9 +139,9 @@
/**
* Updates the displayed presentation to enable a secondary screen if it has
- * been selected in the {@link MediaRouter} for the
- * {@link MediaRouter#ROUTE_TYPE_LIVE_VIDEO} type. If no screen has been
- * selected by the {@link MediaRouter}, the current screen is disabled.
+ * been selected in the {@link android.media.MediaRouter} for the
+ * {@link android.media.MediaRouter#ROUTE_TYPE_LIVE_VIDEO} type. If no screen has been
+ * selected by the {@link android.media.MediaRouter}, the current screen is disabled.
* Otherwise a new {@link SamplePresentation} is initialized and shown on
* the secondary screen.
*/
@@ -152,7 +149,7 @@
// BEGIN_INCLUDE(updatePresentationInit)
// Get the selected route for live video
- MediaRouter.RouteInfo selectedRoute = mMediaRouter.getSelectedRoute(
+ RouteInfo selectedRoute = mMediaRouter.getSelectedRoute(
MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
// Get its Display if a valid route has been selected
@@ -245,8 +242,8 @@
/**
* Inflates the ActionBar or options menu. The menu file defines an item for
- * the {@link MediaRouteActionProvider}, which is registered here for all
- * live video devices using {@link MediaRouter#ROUTE_TYPE_LIVE_VIDEO}.
+ * the {@link android.app.MediaRouteActionProvider}, which is registered here for all
+ * live video devices using {@link android.media.MediaRouter#ROUTE_TYPE_LIVE_VIDEO}.
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/java/com/example/android/media/basicmediarouter/SamplePresentation.java b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/java/com/example/android/basicmediarouter/SamplePresentation.java
similarity index 89%
rename from media/BasicMediaRouter/BasicMediaRouter/src/main/java/com/example/android/media/basicmediarouter/SamplePresentation.java
rename to media/BasicMediaRouter/BasicMediaRouterSample/src/main/java/com/example/android/basicmediarouter/SamplePresentation.java
index 0938635..ac1f40f 100644
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/java/com/example/android/media/basicmediarouter/SamplePresentation.java
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/java/com/example/android/basicmediarouter/SamplePresentation.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.media.basicmediarouter;
+package com.example.android.basicmediarouter;
import android.app.Presentation;
import android.content.Context;
@@ -23,16 +23,14 @@
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.example.android.output.mediaroutersample.R;
-
/**
* <p>
- * A {@link Presentation} used to demonstrate interaction between primary and
+ * A {@link android.app.Presentation} used to demonstrate interaction between primary and
* secondary screens.
* </p>
* <p>
* It displays the name of the display in which it has been embedded (see
- * {@link Presentation#getDisplay()}) and exposes a facility to change its
+ * {@link android.app.Presentation#getDisplay()}) and exposes a facility to change its
* background color and display its text.
* </p>
*/
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-hdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..b1efaf4
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-mdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f5f9244
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-xhdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..5d07b3f
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6ef21e1
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/layout/display.xml b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/layout/display.xml
similarity index 100%
rename from media/BasicMediaRouter/BasicMediaRouter/src/main/res/layout/display.xml
rename to media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/layout/display.xml
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/layout/activity_main.xml b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/layout/sample_main.xml
similarity index 95%
rename from media/BasicMediaRouter/BasicMediaRouter/src/main/res/layout/activity_main.xml
rename to media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/layout/sample_main.xml
index 18565c4..2768514 100644
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/layout/activity_main.xml
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/layout/sample_main.xml
@@ -11,7 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
- android:text="@string/intro" />
+ android:text="@string/intro_message" />
<TextView
android:id="@+id/textStatus"
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/menu/main.xml b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/menu/main.xml
similarity index 100%
rename from media/BasicMediaRouter/BasicMediaRouter/src/main/res/menu/main.xml
rename to media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/menu/main.xml
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/colors.xml b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/colors.xml
similarity index 100%
rename from media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/colors.xml
rename to media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/colors.xml
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/strings.xml b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/strings.xml
new file mode 100644
index 0000000..40c023a
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/strings.xml
@@ -0,0 +1,9 @@
+<resources>
+ <string name="menu_present_to">Present to</string>
+ <string name="title_activity_main">MainActivity</string>
+ <string name="secondary_connected">Connected to:\n%s</string>
+ <string name="secondary_notconnected">No secondary display connected.</string>
+ <string name="change_color">Change Color</string>
+ <string name="display_name">This display is: %s</string>
+ <string name="display_color">Background color: #%X</string>
+</resources>
\ No newline at end of file
diff --git a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/styles.xml b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/styles.xml
similarity index 79%
rename from media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/styles.xml
rename to media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/styles.xml
index 05c67f3..4f64054 100644
--- a/media/BasicMediaRouter/BasicMediaRouter/src/main/res/values/styles.xml
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/src/main/res/values/styles.xml
@@ -12,10 +12,6 @@
-->
</style>
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
<style name="DisplayLargeText">
<item name="android:textSize">30sp</item>
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/tests/AndroidManifest.xml b/media/BasicMediaRouter/BasicMediaRouterSample/tests/AndroidManifest.xml
new file mode 100644
index 0000000..8800232
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/tests/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 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.
+ -->
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.basicmediarouter.tests"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk
+ android:minSdkVersion="18"
+ android:targetSdkVersion="19" />
+
+ <!-- We add an application tag here just so that we can indicate that
+ this package needs to link against the android.test library,
+ which is needed when building test cases. -->
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <!--
+ Specifies the instrumentation test runner used to run the tests.
+ -->
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.example.android.basicmediarouter"
+ android:label="Tests for com.example.android.basicmediarouter" />
+
+</manifest>
\ No newline at end of file
diff --git a/media/BasicMediaRouter/BasicMediaRouterSample/tests/src/com/example/android/basicmediarouter/tests/SampleTests.java b/media/BasicMediaRouter/BasicMediaRouterSample/tests/src/com/example/android/basicmediarouter/tests/SampleTests.java
new file mode 100644
index 0000000..5c475a3
--- /dev/null
+++ b/media/BasicMediaRouter/BasicMediaRouterSample/tests/src/com/example/android/basicmediarouter/tests/SampleTests.java
@@ -0,0 +1,79 @@
+/*
+* 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.
+*/
+
+
+
+/*
+* Copyright (C) 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.
+*/
+package com.example.android.basicmediarouter.tests;
+
+import com.example.android.basicmediarouter.*;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+* Tests for BasicMediaRouter sample.
+*/
+public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
+
+ private MainActivity mTestActivity;
+ private BasicMediaRouterFragment mTestFragment;
+
+ public SampleTests() {
+ super(MainActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // Starts the activity under test using the default Intent with:
+ // action = {@link Intent#ACTION_MAIN}
+ // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
+ // All other fields are null or empty.
+ mTestActivity = getActivity();
+ mTestFragment = (BasicMediaRouterFragment)
+ mTestActivity.getSupportFragmentManager().getFragments().get(1);
+ }
+
+ /**
+ * Test if the test fixture has been set up correctly.
+ */
+ public void testPreconditions() {
+ //Try to add a message to add context to your assertions. These messages will be shown if
+ //a tests fails and make it easy to understand why a test failed
+ assertNotNull("mTestActivity is null", mTestActivity);
+ assertNotNull("mTestFragment is null", mTestFragment);
+ }
+
+ /**
+ * Add more tests below.
+ */
+
+}
\ No newline at end of file
diff --git a/media/BasicMediaRouter/README.txt b/media/BasicMediaRouter/README.txt
deleted file mode 100644
index 38608df..0000000
--- a/media/BasicMediaRouter/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/media/BasicMediaRouter/build.gradle b/media/BasicMediaRouter/build.gradle
index 036abc8..c7a137e 100644
--- a/media/BasicMediaRouter/build.gradle
+++ b/media/BasicMediaRouter/build.gradle
@@ -1,8 +1,10 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.5.+'
- }
+// BEGIN_EXCLUDE
+import com.example.android.samples.build.SampleGenPlugin
+apply plugin: SampleGenPlugin
+
+samplegen {
+ pathToBuild "../../../../build"
+ pathToSamplesCommon "../../common"
}
+apply from: "../../../../build/build.gradle"
+// END_EXCLUDE
diff --git a/media/BasicMediaRouter/buildSrc/build.gradle b/media/BasicMediaRouter/buildSrc/build.gradle
new file mode 100644
index 0000000..29282af
--- /dev/null
+++ b/media/BasicMediaRouter/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/media/BasicMediaRouter/gradle/wrapper/gradle-wrapper.properties b/media/BasicMediaRouter/gradle/wrapper/gradle-wrapper.properties
index 055ba6f..861eddc 100644
--- a/media/BasicMediaRouter/gradle/wrapper/gradle-wrapper.properties
+++ b/media/BasicMediaRouter/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/media/BasicMediaRouter/mediarouter.jd b/media/BasicMediaRouter/mediarouter.jd
deleted file mode 100644
index fcf6ec9..0000000
--- a/media/BasicMediaRouter/mediarouter.jd
+++ /dev/null
@@ -1,26 +0,0 @@
-page.title=MediaRouter Sample
-@jd:body
-<p>
-This sample demonstrates the use of the MediaRouter API to show content on a
-secondary display using a {@link Presentation}.
-</p>
-<p>
-The activity uses the
-<a href="http://developer.android.com/reference/android/media/MediaRouter.html">MediaRouter</a> API
- to automatically detect when a
- presentation display is available and to allow the user to control the media routes using a menu
- item provided by the
- <a href="http://developer.android.com/reference/android/app/MediaRouteActionProvider.html">
- MediaRouteActionProvider</a>.
-When a presentation display is available a
- <a href="http://developer.android.com/reference/android/app/Presentation.html">Presentation</a>
- is shown on the preferred display. A button toggles the background color of the secondary screen
- to show the interaction between the primary and secondary screens.
-</p>
-<p>
-This sample requires an HDMI or Wifi display. Alternatively, the
- "Simulate secondary displays" feature in Development Settings can be enabled
- to simulate secondary displays.
-</p>
-
-
diff --git a/media/BasicMediaRouter/settings.gradle b/media/BasicMediaRouter/settings.gradle
index 327efd6..9d5cbc2 100644
--- a/media/BasicMediaRouter/settings.gradle
+++ b/media/BasicMediaRouter/settings.gradle
@@ -1 +1,4 @@
-include ':BasicMediaRouter'
\ No newline at end of file
+
+
+
+include 'BasicMediaRouterSample'
diff --git a/media/BasicMediaRouter/template-params.xml b/media/BasicMediaRouter/template-params.xml
new file mode 100644
index 0000000..e7cbab5
--- /dev/null
+++ b/media/BasicMediaRouter/template-params.xml
@@ -0,0 +1,44 @@
+<?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>BasicMediaRouter</name>
+ <group>Media</group>
+ <package>com.example.android.basicmediarouter</package>
+
+
+
+ <!-- change minSdk if needed-->
+ <minSdk>17</minSdk>
+
+
+ <strings>
+ <intro>
+ <![CDATA[
+ This sample demonstrates the use of the MediaRouter API to display
+ content on a secondary display.\n\nUse the "Media Route Action Item" in the ActionBar
+ to select an output device. If your device supports Miracast wireless displays,
+ you may need to enable "Wireless Display" functionality in the system settings.
+ Secondary screen simulation can also be enabled from the "Developer Options".\n\n
+Once connected, use the "Change Color" button to change the background color of the secondary screen.
+ ]]>
+ </intro>
+ </strings>
+
+ <template src="base"/>
+ <common src="logger"/>
+
+</sample>
diff --git a/media/MediaRecorder/MediaRecorder/build.gradle b/media/MediaRecorder/MediaRecorder/build.gradle
deleted file mode 100644
index 10fb811..0000000
--- a/media/MediaRecorder/MediaRecorder/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/media/MediaRecorder/MediaRecorder/src/main/res/menu/main.xml b/media/MediaRecorder/MediaRecorder/src/main/res/menu/main.xml
deleted file mode 100644
index f3b10b6..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/menu/main.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/action_settings"
- android:title="@string/action_settings"
- android:orderInCategory="100"
- android:showAsAction="never" />
-</menu>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw600dp/dimens.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 886b05f..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<resources>
- <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw600dp devices (e.g. 7" tablets) here. -->
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw720dp-land/dimens.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 00059fc..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. -->
- <dimen name="activity_horizontal_margin">128dp</dimen>
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-v11/styles.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-v11/styles.xml
deleted file mode 100644
index 3c02242..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-v11/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-v14/styles.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-v14/styles.xml
deleted file mode 100644
index a91fd03..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-v14/styles.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values/dimens.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values/dimens.xml
deleted file mode 100644
index 47c8224..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <!-- Default screen margins, per the Android Design guidelines. -->
- <dimen name="activity_horizontal_margin">16dp</dimen>
- <dimen name="activity_vertical_margin">16dp</dimen>
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values/strings.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values/strings.xml
deleted file mode 100644
index 91ab13a..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <string name="app_name">MediaRecorder</string>
- <string name="action_settings">Settings</string>
- <string name="hello_world">Hello world!</string>
- <string name="btnCapture">capture</string>
-
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values/styles.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values/styles.xml
deleted file mode 100644
index 6ce89c7..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<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/media/MediaRecorder/MediaRecorderSample/.gitignore b/media/MediaRecorder/MediaRecorderSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/.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/media/MediaRecorder/MediaRecorderSample/proguard-project.txt b/media/MediaRecorder/MediaRecorderSample/proguard-project.txt
new file mode 100644
index 0000000..0d8f171
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/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/media/MediaRecorder/MediaRecorder/src/main/AndroidManifest.xml b/media/MediaRecorder/MediaRecorderSample/src/main/AndroidManifest.xml
similarity index 67%
rename from media/MediaRecorder/MediaRecorder/src/main/AndroidManifest.xml
rename to media/MediaRecorder/MediaRecorderSample/src/main/AndroidManifest.xml
index 038b1fd..32f88f6 100644
--- a/media/MediaRecorder/MediaRecorder/src/main/AndroidManifest.xml
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/AndroidManifest.xml
@@ -1,21 +1,26 @@
+<?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
+ Copyright 2013 The Android Open Source Project
- http://www.apache.org/licenses/LICENSE-2.0
+ 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
- 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.
+ 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.
-->
+
+
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.media.recorder"
+ package="com.example.android.mediarecorder"
android:versionCode="1"
- android:versionName="1.0" >
+ android:versionName="1.0">
<uses-sdk
android:minSdkVersion="14"
diff --git a/media/MediaRecorder/MediaRecorder/src/main/java/com/example/android/media/recorder/MainActivity.java b/media/MediaRecorder/MediaRecorderSample/src/main/java/com/example/android/mediarecorder/MainActivity.java
similarity index 91%
rename from media/MediaRecorder/MediaRecorder/src/main/java/com/example/android/media/recorder/MainActivity.java
rename to media/MediaRecorder/MediaRecorderSample/src/main/java/com/example/android/mediarecorder/MainActivity.java
index d50b53e..8587636 100644
--- a/media/MediaRecorder/MediaRecorder/src/main/java/com/example/android/media/recorder/MainActivity.java
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/java/com/example/android/mediarecorder/MainActivity.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package com.example.android.media.recorder;
+package com.example.android.mediarecorder;
import android.annotation.TargetApi;
+import android.app.Activity;
import android.hardware.Camera;
import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
-import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.TextureView;
@@ -36,8 +36,8 @@
import java.util.List;
/**
- * This activity uses the camera/camcorder as the A/V source for the {@link MediaRecorder} API.
- * A {@link TextureView} is used as the camera preview which limits the code to API 14+. This
+ * This activity uses the camera/camcorder as the A/V source for the {@link android.media.MediaRecorder} API.
+ * A {@link android.view.TextureView} is used as the camera preview which limits the code to API 14+. This
* can be easily replaced with a {@link android.view.SurfaceView} to run on older devices.
*/
public class MainActivity extends Activity {
@@ -53,7 +53,7 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+ setContentView(R.layout.sample_main);
mPreview = (TextureView) findViewById(R.id.surface_view);
captureButton = (Button) findViewById(R.id.button_capture);
@@ -61,8 +61,8 @@
/**
* The capture button controls all user interaction. When recording, the button click
- * stops recording, releases {@link MediaRecorder} and {@link Camera}. When not recording,
- * it prepares the {@link MediaRecorder} and starts recording.
+ * stops recording, releases {@link android.media.MediaRecorder} and {@link android.hardware.Camera}. When not recording,
+ * it prepares the {@link android.media.MediaRecorder} and starts recording.
*
* @param view the view generating the event.
*/
@@ -97,13 +97,6 @@
}
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
- @Override
protected void onPause() {
super.onPause();
// if we are using MediaRecorder, release it first
@@ -201,7 +194,7 @@
}
/**
- * Asynchronous task for preparing the {@link MediaRecorder} since it's a long blocking
+ * Asynchronous task for preparing the {@link android.media.MediaRecorder} since it's a long blocking
* operation.
*/
class MediaPrepareTask extends AsyncTask<Void, Void, Boolean> {
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-hdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-hdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-mdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-mdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-xhdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-xhdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-xxhdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/layout/activity_main.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/layout/sample_main.xml
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/layout/activity_main.xml
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/layout/sample_main.xml
diff --git a/media/MediaRecorder/MediaRecorderSample/src/main/res/values-sw720dp-land/dimens.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..c4aad9b
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,21 @@
+<!--
+ Copyright (C) 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>
+ <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. -->
+ <dimen name="activity_horizontal_margin">128dp</dimen>
+</resources>
diff --git a/media/MediaRecorder/MediaRecorderSample/src/main/res/values/dimens.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..0353ed6
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<!--
+ Copyright (C) 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>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
diff --git a/media/MediaRecorder/MediaRecorderSample/src/main/res/values/strings.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/strings.xml
new file mode 100644
index 0000000..b6a2cd2
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 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>
+
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="btnCapture">capture</string>
+
+</resources>
diff --git a/media/MediaRecorder/build.gradle b/media/MediaRecorder/build.gradle
index bd6967f..c886d80 100644
--- a/media/MediaRecorder/build.gradle
+++ b/media/MediaRecorder/build.gradle
@@ -1,9 +1,11 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.5.+'
- }
-}
\ No newline at end of file
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../build/build.gradle"
+samplegen {
+ pathToBuild "../../../../build"
+ pathToSamplesCommon "../../common"
+}
+// END_EXCLUDE
diff --git a/media/MediaRecorder/buildSrc/build.gradle b/media/MediaRecorder/buildSrc/build.gradle
new file mode 100644
index 0000000..29282af
--- /dev/null
+++ b/media/MediaRecorder/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/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties b/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties
index 5c22dec..861eddc 100644
--- a/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties
+++ b/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
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/media/MediaRecorder/settings.gradle b/media/MediaRecorder/settings.gradle
index 3fbbc54..61e4032 100644
--- a/media/MediaRecorder/settings.gradle
+++ b/media/MediaRecorder/settings.gradle
@@ -1 +1,4 @@
-include ':MediaRecorder'
+
+
+
+include 'MediaRecorderSample'
diff --git a/media/MediaRecorder/template-params.xml b/media/MediaRecorder/template-params.xml
new file mode 100644
index 0000000..6b6ddc5
--- /dev/null
+++ b/media/MediaRecorder/template-params.xml
@@ -0,0 +1,40 @@
+<?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>MediaRecorder</name>
+ <group>Media</group>
+ <package>com.example.android.mediarecorder</package>
+
+ <!-- change minSdk if needed-->
+ <minSdk>14</minSdk>
+
+ <strings>
+ <intro>
+ <![CDATA[
+ This sample uses the camera/camcorder as the A/V source for the MediaRecorder API.
+ A TextureView is used as the camera preview which limits the code to API 14+. This
+ can be easily replaced with a SurfaceView to run on older devices.
+ ]]>
+ </intro>
+ </strings>
+
+ <template src="base"/>
+ <common src="media"/>
+</sample>