2 * Copyright (C) 2011 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com
.android
.mediadump
;
19 import android
.app
.Activity
;
20 import android
.app
.AlertDialog
;
21 import android
.content
.Context
;
22 import android
.content
.DialogInterface
;
23 import android
.content
.Intent
;
24 import android
.content
.SharedPreferences
;
25 import android
.os
.Bundle
;
26 import android
.util
.Log
;
27 import android
.view
.Gravity
;
28 import android
.view
.View
;
29 import android
.widget
.EditText
;
30 import android
.widget
.FrameLayout
;
31 import android
.widget
.LinearLayout
;
32 import android
.widget
.MediaController
;
35 * A media tool to play a video and dump the screen display
36 * into raw RGB files. Check VideoDumpView for tech details.
38 public class VideoDumpActivity
extends Activity
{
40 private Context context
;
42 private View mainView
;
43 private VideoDumpView mVideoView
;
46 protected void onCreate(Bundle savedInstanceState
) {
47 super.onCreate(savedInstanceState
);
51 mainView
= createView();
52 setContentView(mainView
);
56 protected void onPause() {
62 protected void onResume() {
64 mVideoView
.onResume();
67 private View
createView() {
68 mVideoView
= new VideoDumpView(this);
69 mVideoView
.setMediaController(new MediaController(context
));
71 LinearLayout mainLayout
= new LinearLayout(this);
72 mainLayout
.addView(mVideoView
, new LinearLayout
.LayoutParams(
73 LinearLayout
.LayoutParams
.MATCH_PARENT
,
74 LinearLayout
.LayoutParams
.MATCH_PARENT
));
79 protected void onStop() {
80 if (mVideoView
!= null) {
81 if (mVideoView
.isPlaying()) {
82 mVideoView
.stopPlayback();