am 3b892164: am 7b2114a4: Display still image when device can\'t play welcome video

* commit '3b8921646fb51b9bb91108cfc103a5feccbbbbe9':
  Display still image when device can't play welcome video
main
Tadashi G. Takaoka 2013-05-15 11:25:56 -07:00 committed by Android Git Automerger
commit 03fe0cf4dd
3 changed files with 10 additions and 0 deletions

View File

@ -35,6 +35,12 @@
android:layout_weight="@integer/setup_welcome_video_weight_in_screen"
android:layout_width="0dp"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/setup_welcome_image"
android:visibility="gone"
android:layout_weight="@integer/setup_welcome_video_weight_in_screen"
android:layout_width="0dp"
android:layout_height="wrap_content" />
<View
android:layout_weight="@integer/setup_welcome_video_right_padding_weight_in_screen"
android:layout_width="0dp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -30,6 +30,7 @@ import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.VideoView;
@ -201,11 +202,14 @@ public final class SetupActivity extends Activity implements View.OnClickListene
mWelcomeVideoView.setBackgroundResource(0);
}
});
final ImageView welcomeImageView = (ImageView)findViewById(R.id.setup_welcome_image);
mWelcomeVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(final MediaPlayer mp, final int what, final int extra) {
Log.e(TAG, "Playing welcome video causes error: what=" + what + " extra=" + extra);
mWelcomeVideoView.setVisibility(View.GONE);
welcomeImageView.setImageResource(R.raw.setup_welcome_image);
welcomeImageView.setVisibility(View.VISIBLE);
return true;
}
});