1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 package com.android.mediadump; 18 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; 33 34 /** 35 * A media tool to play a video and dump the screen display 36 * into raw RGB files. Check VideoDumpView for tech details. 37 */ 38 public class VideoDumpActivity extends Activity { 39 40 private Context context; 41 42 private View mainView; 43 private VideoDumpView mVideoView; 44 45 @Override 46 protected void onCreate(Bundle savedInstanceState) { 47 super.onCreate(savedInstanceState); 48 49 context = this; 50 51 mainView = createView(); 52 setContentView(mainView); 53 } 54 55 @Override 56 protected void onPause() { 57 super.onPause(); 58 mVideoView.onPause(); 59 } 60 61 @Override 62 protected void onResume() { 63 super.onResume(); 64 mVideoView.onResume(); 65 } 66 67 private View createView() { 68 mVideoView = new VideoDumpView(this); 69 mVideoView.setMediaController(new MediaController(context)); 70 71 LinearLayout mainLayout = new LinearLayout(this); 72 mainLayout.addView(mVideoView, new LinearLayout.LayoutParams( 73 LinearLayout.LayoutParams.MATCH_PARENT, 74 LinearLayout.LayoutParams.MATCH_PARENT)); 75 76 return mainLayout; 77 } 78 79 protected void onStop() { 80 if (mVideoView != null) { 81 if (mVideoView.isPlaying()) { 82 mVideoView.stopPlayback(); 83 } 84 } 85 super.onStop(); 86 } 87 } 88 89