| | |
| | | import android.app.NotificationChannel; |
| | | import android.app.NotificationManager; |
| | | import android.content.Intent; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.graphics.BitmapFactory; |
| | | import android.graphics.Color; |
| | | import android.graphics.PixelFormat; |
| | |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.view.WindowManager; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.tencent.smtt.export.external.interfaces.IX5WebChromeClient; |
| | | import com.tencent.smtt.export.external.interfaces.SslError; |
| | | import com.tencent.smtt.export.external.interfaces.SslErrorHandler; |
| | | import com.tencent.smtt.export.external.interfaces.WebResourceRequest; |
| | |
| | | |
| | | webview.setWebChromeClient(new WebChromeClient() { |
| | | |
| | | View myVideoView; |
| | | View myNormalView; |
| | | IX5WebChromeClient.CustomViewCallback callback; |
| | | |
| | | @Override |
| | | public void onReceivedTitle(WebView view, String title) { |
| | | tv_title.setText(title); |
| | |
| | | } |
| | | super.onProgressChanged(webView, i); |
| | | } |
| | | |
| | | /** |
| | | * 全屏播放配置 |
| | | */ |
| | | @Override |
| | | public void onShowCustomView(View view, |
| | | IX5WebChromeClient.CustomViewCallback customViewCallback) { |
| | | LinearLayout normalView = (LinearLayout) findViewById(R.id.ll_content); |
| | | ViewGroup viewGroup = (ViewGroup) normalView.getParent(); |
| | | viewGroup.removeView(normalView); |
| | | viewGroup.addView(view); |
| | | myVideoView = view; |
| | | myNormalView = normalView; |
| | | callback = customViewCallback; |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
| | | WindowManager.LayoutParams attrs = getWindow().getAttributes(); |
| | | attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | | getWindow().setAttributes(attrs); |
| | | } |
| | | |
| | | @Override |
| | | public void onHideCustomView() { |
| | | if (callback != null) { |
| | | callback.onCustomViewHidden(); |
| | | callback = null; |
| | | } |
| | | if (myVideoView != null) { |
| | | ViewGroup viewGroup = (ViewGroup) myVideoView.getParent(); |
| | | viewGroup.removeView(myVideoView); |
| | | viewGroup.addView(myNormalView); |
| | | } |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | WindowManager.LayoutParams attrs = getWindow().getAttributes(); |
| | | attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | | getWindow().setAttributes(attrs); |
| | | } |
| | | |
| | | }); |
| | | WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |