OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.content.browser; |
| 6 |
| 7 import android.app.Activity; |
| 8 import android.content.Context; |
| 9 import android.view.Gravity; |
| 10 import android.view.View; |
| 11 import android.view.ViewGroup; |
| 12 import android.view.WindowManager; |
| 13 import android.widget.FrameLayout; |
| 14 |
| 15 import org.chromium.content.browser.ContentVideoViewContextDelegate; |
| 16 import org.chromium.content.R; |
| 17 |
| 18 /** |
| 19 * Uses an exisiting Activity to handle displaying video in full screen. |
| 20 */ |
| 21 public class ActivityContentVideoViewDelegate implements ContentVideoViewContext
Delegate { |
| 22 private Activity mActivity; |
| 23 |
| 24 public ActivityContentVideoViewDelegate(Activity activity) { |
| 25 this.mActivity = activity; |
| 26 } |
| 27 |
| 28 public void onShowCustomView(View view) { |
| 29 mActivity.getWindow().setFlags( |
| 30 WindowManager.LayoutParams.FLAG_FULLSCREEN, |
| 31 WindowManager.LayoutParams.FLAG_FULLSCREEN); |
| 32 |
| 33 mActivity.getWindow().addContentView(view, |
| 34 new FrameLayout.LayoutParams( |
| 35 ViewGroup.LayoutParams.MATCH_PARENT, |
| 36 ViewGroup.LayoutParams.MATCH_PARENT, |
| 37 Gravity.CENTER)); |
| 38 } |
| 39 |
| 40 public void onDestroyContentVideoView() { |
| 41 mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCR
EEN); |
| 42 } |
| 43 |
| 44 public Context getContext() { |
| 45 return mActivity; |
| 46 } |
| 47 |
| 48 public String getPlayBackErrorText() { |
| 49 return mActivity.getString(R.string.media_player_error_text_invalid_prog
ressive_playback); |
| 50 } |
| 51 |
| 52 public String getUnknownErrorText() { |
| 53 return mActivity.getString(R.string.media_player_error_text_unknown); |
| 54 } |
| 55 |
| 56 public String getErrorButton() { |
| 57 return mActivity.getString(R.string.media_player_error_button); |
| 58 } |
| 59 |
| 60 public String getErrorTitle() { |
| 61 return mActivity.getString(R.string.media_player_error_title); |
| 62 } |
| 63 |
| 64 public String getVideoLoadingText() { |
| 65 return mActivity.getString(R.string.media_player_loading_video); |
| 66 } |
| 67 } |
OLD | NEW |