Skip to content

Commit a47cf09

Browse files
committed
up ver
1 parent b351b0b commit a47cf09

2 files changed

Lines changed: 3 additions & 98 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
minSdkVersion 21
99
targetSdkVersion 24
1010
versionCode 10
11-
versionName "1.6.7"
11+
versionName "1.6.8"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
resValue "string", "app_name", "SWeb"
1414
}

common/src/main/java/net/gnu/common/CustomWebView.java

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55

66
public class CustomWebView extends WebView {
77

8-
private VideoEnabledWebChromeClient videoEnabledWebChromeClient;
9-
private boolean addedJavascriptInterface;
10-
11-
public CustomWebView(final Context context) {
8+
public CustomWebView(final Context context) {
129
super(context);
1310
}
1411

@@ -23,97 +20,5 @@ public int computeVerticalScrollRangeMethod() {
2320
public int computeVerticalScrollExtentMethod() {
2421
return computeVerticalScrollExtent();
2522
}
26-
27-
public class JavascriptInterface {
28-
@android.webkit.JavascriptInterface
29-
@SuppressWarnings("unused")
30-
public void notifyVideoEnd() {// Must match Javascript interface method of VideoEnabledWebChromeClient
31-
Log.d("___", "GOT IT");
32-
// This code is not executed in the UI thread, so we must force that to happen
33-
new Handler(Looper.getMainLooper()).post(new Runnable() {
34-
@Override
35-
public void run() {
36-
if (videoEnabledWebChromeClient != null) {
37-
videoEnabledWebChromeClient.onHideCustomView();
38-
}
39-
}
40-
});
41-
}
42-
}
43-
44-
@SuppressWarnings("unused")
45-
public VideoEnabledWebView(Context context) {
46-
super(context);
47-
addedJavascriptInterface = false;
48-
}
49-
50-
@SuppressWarnings("unused")
51-
public VideoEnabledWebView(Context context, AttributeSet attrs) {
52-
super(context, attrs);
53-
addedJavascriptInterface = false;
54-
}
55-
56-
@SuppressWarnings("unused")
57-
public VideoEnabledWebView(Context context, AttributeSet attrs, int defStyle) {
58-
super(context, attrs, defStyle);
59-
addedJavascriptInterface = false;
60-
}
61-
62-
/**
63-
* Indicates if the video is being displayed using a custom view (typically full-screen)
64-
* @return true it the video is being displayed using a custom view (typically full-screen)
65-
*/
66-
@SuppressWarnings("unused")
67-
public boolean isVideoFullscreen() {
68-
return videoEnabledWebChromeClient != null && videoEnabledWebChromeClient.isVideoFullscreen();
69-
}
70-
71-
/**
72-
* Pass only a VideoEnabledWebChromeClient instance.
73-
*/
74-
@Override @SuppressLint("SetJavaScriptEnabled")
75-
public void setWebChromeClient(WebChromeClient client) {
76-
getSettings().setJavaScriptEnabled(true);
77-
78-
if (client instanceof VideoEnabledWebChromeClient) {
79-
this.videoEnabledWebChromeClient = (VideoEnabledWebChromeClient) client;
80-
}
81-
82-
super.setWebChromeClient(client);
83-
}
84-
85-
@Override
86-
public void loadData(String data, String mimeType, String encoding) {
87-
addJavascriptInterface();
88-
super.loadData(data, mimeType, encoding);
89-
}
90-
91-
@Override
92-
public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl) {
93-
addJavascriptInterface();
94-
super.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
95-
}
96-
97-
@Override
98-
public void loadUrl(String url) {
99-
addJavascriptInterface();
100-
super.loadUrl(url);
101-
}
102-
103-
@Override
104-
public void loadUrl(String url, Map<String, String> additionalHttpHeaders) {
105-
addJavascriptInterface();
106-
super.loadUrl(url, additionalHttpHeaders);
107-
}
108-
109-
private void addJavascriptInterface() {
110-
if (!addedJavascriptInterface) {
111-
// Add javascript interface to be called when the video ends (must be done before page load)
112-
//noinspection all
113-
addJavascriptInterface(new JavascriptInterface(), "_VideoEnabledWebView"); // Must match Javascript interface name of VideoEnabledWebChromeClient
114-
115-
addedJavascriptInterface = true;
116-
}
117-
}
118-
23+
11924
}

0 commit comments

Comments
 (0)