2024年6月14日发(作者:蒲雨南)
public class WebViewActivity extends AppCompatActivity {
private FrameLayout mFrameLayout;
private WebView mWebView;
private MyWebChromeClient mMyWebChromeClient;
private String URL = "/20130704/";
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(E_NO_TITLE);
te(savedInstanceState);
setContentView(ty_webview);
mFrameLayout = (FrameLayout) findViewById(Layout);
mWebView = (WebView) findViewById(ew);
initWebView();
l(URL);
}
private void initWebView() {
WebSettings settings = tings();
aScriptEnabled(true);
aScriptCanOpenWindowsAutomatically(true);
ginState();
owFileAccess(true);
dWithOverviewMode(true);
WideViewPort(true);
heMode(_NO_CACHE);
heMode(_DEFAULT);
mMyWebChromeClient = new MyWebChromeClient();
ChromeClient(mMyWebChromeClient);
ViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
l(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
Finished(view, url);
}
});
}
private class MyWebChromeClient extends WebChromeClient {
private View mCustomView;
private CustomViewCallback mCustomViewCallback;
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
CustomView(view, callback);
if (mCustomView != null) {
omViewHidden();
return;
}
mCustomView = view;
w(mCustomView);
mCustomViewCallback = callback;
ibility();
setRequestedOrientation(_ORIENTATION_LANDSCAPE);
}
public void onHideCustomView() {
ibility(E);
if (mCustomView == null) {
return;
}
ibility();
View(mCustomView);
omViewHidden();
mCustomView = null;
setRequestedOrientation(_ORIENTATION_PORTRAIT);
CustomView();
}
}
@Override
public void onConfigurationChanged(Configuration config) {
igurationChanged(config);
switch (ation) {
case ATION_LANDSCAPE:
getWindow().clearFlags(_FORCE_NOT_FULLSCREEN);
2024年6月14日发(作者:蒲雨南)
public class WebViewActivity extends AppCompatActivity {
private FrameLayout mFrameLayout;
private WebView mWebView;
private MyWebChromeClient mMyWebChromeClient;
private String URL = "/20130704/";
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(E_NO_TITLE);
te(savedInstanceState);
setContentView(ty_webview);
mFrameLayout = (FrameLayout) findViewById(Layout);
mWebView = (WebView) findViewById(ew);
initWebView();
l(URL);
}
private void initWebView() {
WebSettings settings = tings();
aScriptEnabled(true);
aScriptCanOpenWindowsAutomatically(true);
ginState();
owFileAccess(true);
dWithOverviewMode(true);
WideViewPort(true);
heMode(_NO_CACHE);
heMode(_DEFAULT);
mMyWebChromeClient = new MyWebChromeClient();
ChromeClient(mMyWebChromeClient);
ViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
l(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
Finished(view, url);
}
});
}
private class MyWebChromeClient extends WebChromeClient {
private View mCustomView;
private CustomViewCallback mCustomViewCallback;
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
CustomView(view, callback);
if (mCustomView != null) {
omViewHidden();
return;
}
mCustomView = view;
w(mCustomView);
mCustomViewCallback = callback;
ibility();
setRequestedOrientation(_ORIENTATION_LANDSCAPE);
}
public void onHideCustomView() {
ibility(E);
if (mCustomView == null) {
return;
}
ibility();
View(mCustomView);
omViewHidden();
mCustomView = null;
setRequestedOrientation(_ORIENTATION_PORTRAIT);
CustomView();
}
}
@Override
public void onConfigurationChanged(Configuration config) {
igurationChanged(config);
switch (ation) {
case ATION_LANDSCAPE:
getWindow().clearFlags(_FORCE_NOT_FULLSCREEN);