Skip to content

Commit 104ac3d

Browse files
author
admin_dfzc
committed
update
1 parent e479dd6 commit 104ac3d

File tree

4 files changed

+8
-45
lines changed

4 files changed

+8
-45
lines changed

tbs_app/Activity/BrowserActivity.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,6 @@ public void OnTextChanged(ICharSequence s, int start, int before, int count)
437437

438438
internal class CusOnFocusChangeListener : Java.Lang.Object, View.IOnFocusChangeListener
439439
{
440-
private readonly Android.Content.Context ctx;
441-
private readonly X5WebView _webView;
442-
private readonly EditText mUrl;
443-
private readonly Button mGo;
444-
445440
private readonly Action<View, bool> _onFocusChange;
446441

447442
internal CusOnFocusChangeListener(Action<View, bool> onFocusChange)
@@ -452,40 +447,6 @@ internal CusOnFocusChangeListener(Action<View, bool> onFocusChange)
452447
public void OnFocusChange(View v, bool hasFocus)
453448
{
454449
_onFocusChange?.Invoke(v, hasFocus);
455-
456-
457-
if (hasFocus)
458-
{
459-
mGo.Visibility = ViewStates.Visible;
460-
if (null == _webView.Url)
461-
return;
462-
463-
if (_webView.Url.Equals(mHomeUrl, StringComparison.CurrentCultureIgnoreCase))
464-
{
465-
mUrl.Text = "";
466-
mGo.Text = "首页";
467-
mGo.SetTextColor(new Android.Graphics.Color(0X6F0F0F0F));
468-
}
469-
else
470-
{
471-
mUrl.Text = _webView.Url;
472-
mGo.Text = "进入";
473-
mGo.SetTextColor(new Android.Graphics.Color(0X6F0000CD));
474-
}
475-
}
476-
else
477-
{
478-
mGo.Visibility = ViewStates.Gone;
479-
string title = _webView.Title;
480-
if (title != null && title.Length > MAX_LENGTH)
481-
mUrl.Text = title.Substring(0, MAX_LENGTH) + "...";
482-
else
483-
mUrl.Text = title;
484-
485-
486-
var imm = ctx.GetSystemService(Context.InputMethodService) as Android.Views.InputMethods.InputMethodManager;
487-
imm.HideSoftInputFromWindow(v.WindowToken, 0);
488-
}
489450
}
490451
}
491452

tbs_app/Activity/FullScreenActivity.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ protected override void OnCreate(Bundle savedInstanceState)
3232
Window.SetFormat(Android.Graphics.Format.Translucent);
3333

3434
webView.View.OverScrollMode = OverScrollMode.Always;
35-
webView.AddJavascriptInterface(new CusWebViewJavaScriptFunction(this, webView), "Android");
35+
36+
IWebViewJavaScriptFunction iview = new CusWebViewJavaScriptFunction(this, webView);
37+
webView.AddJavascriptInterface((Java.Lang.Object)iview, "Android");
3638
}
3739

3840
protected override void OnDestroy()
@@ -69,12 +71,12 @@ public override void OnConfigurationChanged(Configuration newConfig)
6971
}
7072

7173

72-
internal class CusWebViewJavaScriptFunction : Java.Lang.Object, IWebViewJavaScriptFunction
74+
public class CusWebViewJavaScriptFunction : Java.Lang.Object, IWebViewJavaScriptFunction
7375
{
7476
private readonly Activity currentActivity;
7577
private readonly X5WebView webView;
7678

77-
internal CusWebViewJavaScriptFunction(Activity activity, X5WebView view)
79+
public CusWebViewJavaScriptFunction(Activity activity, X5WebView view)
7880
{
7981
currentActivity = activity;
8082
webView = view;

tbs_app/Resources/layout/fullscreen_sys_web.axml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="match_parent" >
5-
<com.example.test_webview_demo.utils.SystemWebView
5+
<tbs_app.utils.SystemWebView
66
android:layout_height="fill_parent"
77
android:layout_width="fill_parent"
88
android:id="@+id/full_sys_web_webview"
9-
></com.example.test_webview_demo.utils.SystemWebView>
9+
></tbs_app.utils.SystemWebView>
1010

1111

1212

tbs_app/utils/IWebViewJavaScriptFunction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace tbs_app.utils
1414
{
15-
public interface IWebViewJavaScriptFunction
15+
public interface IWebViewJavaScriptFunction : IJavaObject
1616
{
1717
void OnJsFunctionCalled(string tag);
1818
}

0 commit comments

Comments
 (0)