From 732c93815aecb9066b0b371774b8fc6e88699144 Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Fri, 26 Apr 2013 14:55:08 +0900
Subject: [PATCH] Get rid of janky black box before the movie starts

Bug: 8159728
Change-Id: I1d0a01a05b3b694d21fdfdc246d1329ab829908d
---
 java/res/layout/setup_welcome_video.xml                   | 1 +
 .../android/inputmethod/latin/setup/SetupActivity.java    | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/java/res/layout/setup_welcome_video.xml b/java/res/layout/setup_welcome_video.xml
index da59ec8831..09cef988bd 100644
--- a/java/res/layout/setup_welcome_video.xml
+++ b/java/res/layout/setup_welcome_video.xml
@@ -29,6 +29,7 @@
             android:layout_height="0dp" />
         <VideoView
             android:id="@+id/setup_welcome_video"
+            android:background="@color/setup_background"
             android:layout_weight="@integer/setup_welcome_video_weight_in_screen"
             android:layout_marginTop="@dimen/setup_welcome_video_vertical_margin"
             android:layout_marginBottom="@dimen/setup_welcome_video_vertical_margin"
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
index 578787dac8..72a485287a 100644
--- a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
+++ b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
@@ -190,6 +190,14 @@ public final class SetupActivity extends Activity implements View.OnClickListene
                 mp.start();
             }
         });
+        mWelcomeVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+            @Override
+            public void onPrepared(final MediaPlayer mp) {
+                // Now VideoView has been laid-out and ready to play, remove background of it to
+                // reveal the video.
+                mWelcomeVideoView.setBackgroundResource(0);
+            }
+        });
 
         mActionStart = findViewById(R.id.setup_start_label);
         mActionStart.setOnClickListener(this);
-- 
GitLab