Add TransportController API demo.

Change-Id: Id852ac8de1bcfbfba2d9e8557664c1aaa1e75df4
diff --git a/samples/Support4Demos/AndroidManifest.xml b/samples/Support4Demos/AndroidManifest.xml
index 99bacd4..8d20c9e 100644
--- a/samples/Support4Demos/AndroidManifest.xml
+++ b/samples/Support4Demos/AndroidManifest.xml
@@ -309,5 +309,13 @@
         </provider>
 <!-- END_INCLUDE(file_provider_declaration) -->
 
+        <activity android:name=".media.TransportControllerActivity"
+                android:label="@string/sample_transport_controller_activity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
     </application>
 </manifest>
diff --git a/samples/Support4Demos/res/layout/videoview.xml b/samples/Support4Demos/res/layout/videoview.xml
new file mode 100644
index 0000000..ff636b9
--- /dev/null
+++ b/samples/Support4Demos/res/layout/videoview.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    >
+    
+    <VideoView 
+        android:id="@+id/surface_view" 
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+    />
+    
+</FrameLayout>
diff --git a/samples/Support4Demos/res/raw/videoviewdemo.mp4 b/samples/Support4Demos/res/raw/videoviewdemo.mp4
new file mode 100644
index 0000000..5772810
--- /dev/null
+++ b/samples/Support4Demos/res/raw/videoviewdemo.mp4
Binary files differ
diff --git a/samples/Support4Demos/res/values/strings.xml b/samples/Support4Demos/res/values/strings.xml
index 977db2f..d0e096a 100644
--- a/samples/Support4Demos/res/values/strings.xml
+++ b/samples/Support4Demos/res/values/strings.xml
@@ -133,15 +133,19 @@
     <string name="share_text">Share some text</string>
     <string name="share_file">Share a file</string>
     <string name="share_multiple_file">Share multiple files</string>
-    <string name="sharing_support_title">ShareCompat Demo</string>
+    <string name="sharing_support_title">App/ShareCompat Demo</string>
     <string name="sharing_receiver_title">ShareCompat Receiver</string>
 
-    <string name="file_provider_example">FileProvider example</string>
+    <string name="file_provider_example">Content/FileProvider example</string>
 
     <!-- Text API -->
 
     <string name="without_bidiformatter">Without BidiFormatter:</string>
     <string name="with_bidiformatter">With BidiFormatter:</string>
-    <string name="bidiformatter_support_title">BidiFormatter Demo</string>
+    <string name="bidiformatter_support_title">Text/BidiFormatter Demo</string>
+
+    <!-- TransportController -->
+
+    <string name="sample_transport_controller_activity">Media/TransportController</string>
 
 </resources>
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/TransportControllerActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/media/TransportControllerActivity.java
new file mode 100644
index 0000000..58e54f0
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/media/TransportControllerActivity.java
@@ -0,0 +1,69 @@
+/*
+ * 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.supportv4.media;
+
+import android.view.KeyEvent;
+import com.example.android.supportv4.R;
+
+import android.app.Activity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.widget.MediaController;
+import android.widget.VideoView;
+
+import android.support.v4.media.TransportController;
+
+public class TransportControllerActivity extends Activity {
+
+    /**
+     * TODO: Set the path variable to a streaming video URL or a local media
+     * file path.
+     */
+    private VideoView mVideoView;
+    private TransportController mTransportController;
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        setContentView(R.layout.videoview);
+
+        // Find the video player in our UI.
+        mVideoView = (VideoView) findViewById(R.id.surface_view);
+
+        // Create transport controller to control video; use the standard
+        // control callbacks that knows how to talk to a MediaPlayerControl.
+        mTransportController = new TransportController(this,
+                new TransportController.PlayerControlCallbacks(mVideoView));
+
+        // We're just playing a built-in demo video.
+        mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +
+                "/" + R.raw.videoviewdemo));
+        mVideoView.setMediaController(new MediaController(this));
+        mVideoView.requestFocus();
+    }
+
+    @Override
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        if (super.dispatchKeyEvent(event)) {
+            return true;
+        }
+
+        // If the UI didn't handle the key, give the transport controller
+        // a crack at it.
+        return mTransportController.dispatchKeyEvent(event);
+    }
+}