Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java

Issue 2154883003: Make ContentVideoView progress view visible in WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Java continuation lines identation Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/java/strings/android_webview_strings.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
index 8166bd63b9b369162fcee32b4db36d8590c97a5b..b06de5e30c2b6e0e1e3d44d0fd2d7b42090a690d 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
@@ -6,11 +6,16 @@ package org.chromium.android_webview;
import android.content.Context;
import android.content.Intent;
+import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.webkit.WebChromeClient;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+import android.widget.ProgressBar;
+import android.widget.TextView;
import org.chromium.content.browser.ContentVideoViewEmbedder;
import org.chromium.content.browser.ContentViewClient;
@@ -24,6 +29,7 @@ public class AwContentViewClient extends ContentViewClient implements ContentVid
private final AwContents mAwContents;
private final Context mContext;
private FrameLayout mCustomView;
+ private View mProgressView;
public AwContentViewClient(AwContentsClient awContentsClient, AwSettings awSettings,
AwContents awContents, Context context) {
@@ -74,24 +80,40 @@ public class AwContentViewClient extends ContentViewClient implements ContentVid
}
@Override
- public void enterFullscreenVideo(View videoView) {
+ public void enterFullscreenVideo(View videoView, boolean isVideoLoaded) {
if (mCustomView == null) {
// enterFullscreenVideo will only be called after enterFullscreen, but
// in this case exitFullscreen has been invoked in between them.
// TODO(igsolla): Fix http://crbug/425926 and replace with assert.
return;
}
+
mCustomView.addView(videoView, 0);
+
+ if (isVideoLoaded) return;
+
+ mProgressView = mAwContentsClient.getVideoLoadingProgressView();
+ if (mProgressView == null) {
+ mProgressView = new ProgressView(mContext);
+ }
+ mCustomView.addView(
+ mProgressView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
}
@Override
- public void exitFullscreenVideo() {
- // Intentional no-op
+ public void fullscreenVideoLoaded() {
+ if (mCustomView == null) return;
+
+ if (mProgressView != null) {
+ mCustomView.removeView(mProgressView);
+ mProgressView = null;
+ }
}
@Override
- public View getVideoLoadingProgressView() {
- return mAwContentsClient.getVideoLoadingProgressView();
+ public void exitFullscreenVideo() {
+ // Intentional no-op
}
@Override
@@ -148,6 +170,7 @@ public class AwContentViewClient extends ContentViewClient implements ContentVid
public void exitFullscreen() {
if (mCustomView != null) {
mCustomView = null;
+ mProgressView = null;
mAwContents.exitFullScreen();
mAwContentsClient.onHideCustomView();
}
@@ -157,4 +180,25 @@ public class AwContentViewClient extends ContentViewClient implements ContentVid
public String getProductVersion() {
return AwContentsStatics.getProductVersion();
}
+
+ private static class ProgressView extends LinearLayout {
+ private final ProgressBar mProgressBar;
+ private final TextView mTextView;
+
+ public ProgressView(Context context) {
+ super(context);
+ setOrientation(LinearLayout.VERTICAL);
+ setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT));
+ mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
+ mTextView = new TextView(context);
+
+ String videoLoadingText = context.getString(
+ org.chromium.android_webview.R.string.media_player_loading_video);
+
+ mTextView.setText(videoLoadingText);
+ addView(mProgressBar);
+ addView(mTextView);
+ }
+ }
}
« no previous file with comments | « no previous file | android_webview/java/strings/android_webview_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698