| 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 | |
| 17 /** | |
| 18 * Uses an exisiting Activity to handle displaying video in full screen. | |
| 19 */ | |
| 20 public class ActivityContentVideoViewDelegate implements ContentVideoViewContext
Delegate { | |
| 21 private Activity mActivity; | |
| 22 | |
| 23 public ActivityContentVideoViewDelegate(Activity activity) { | |
| 24 this.mActivity = activity; | |
| 25 } | |
| 26 | |
| 27 @Override | |
| 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 @Override | |
| 41 public void onDestroyContentVideoView() { | |
| 42 mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCR
EEN); | |
| 43 } | |
| 44 | |
| 45 @Override | |
| 46 public Context getContext() { | |
| 47 return mActivity; | |
| 48 } | |
| 49 | |
| 50 @Override | |
| 51 public View getVideoLoadingProgressView() { | |
| 52 return null; | |
| 53 } | |
| 54 } | |
| OLD | NEW |