From d878d22f5f1d847b198ffe63c8a50bb5bf0855ba Mon Sep 17 00:00:00 2001
From: 陶汉栋 <2821744554@qq.com>
Date: Fri, 23 Mar 2018 16:03:37 +0800
Subject: [PATCH] no message

---
 app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java |  50 +++++++++++++++-----------------------------------
 app/src/main/res/layout/fragment_zi_xun.xml                                     | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------
 2 files changed, 87 insertions(+), 99 deletions(-)

diff --git a/app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java b/app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
index d6bac0f..fa92209 100644
--- a/app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
+++ b/app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
@@ -52,12 +52,9 @@ public class WebViewActivity extends BaseCompatActivity {
         context.startActivity(intent);
     }
 
-
     @Override
     protected void initView(Bundle savedInstanceState) {
 
-//        binding_success = findViewById(R.id.binding_success);
-
         binding_success = findViewById(R.id.binding_success1);
 
         binding_success2 = findViewById(R.id.binding_success2);
@@ -66,7 +63,6 @@ public class WebViewActivity extends BaseCompatActivity {
         zuoye = findViewById(R.id.zuoye);
         title_web = findViewById(R.id.title_web);
 
-
         close_btn.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
@@ -74,11 +70,8 @@ public class WebViewActivity extends BaseCompatActivity {
             }
         });
 
-
         nesteScrollWebView = findViewById(R.id.nesteScrollWebView);
 
-//        nesteScrollWebView = findViewById(R.id.webView);
-
         pvWeb = findViewById(R.id.pb_web);
         type = getIntent().getIntExtra("type", 0);
         if (type == AppConfig.BINDING_SUCCESS_HEZUO) {
@@ -114,7 +107,7 @@ public class WebViewActivity extends BaseCompatActivity {
         initWebView();
         initWebSetting(nesteScrollWebView.getSettings());
         nesteScrollWebView.loadUrl(getIntent().getStringExtra("url"));
-        Log.d("66666","getIntent().getStringExtra(\"url\")="+getIntent().getStringExtra("url"));
+//        Log.d("66666","getIntent().getStringExtra(\"url\")="+getIntent().getStringExtra("url"));
     }
 
     @Override
@@ -128,7 +121,7 @@ public class WebViewActivity extends BaseCompatActivity {
             nesteScrollWebView.goBack();
         } else {
             super.onBackPressedSupport();
-            if(type!=-1&&type!= AppConfig.ORDER_CENTER) {
+            if (type != -1 && type != AppConfig.ORDER_CENTER) {
                 startActivity(new Intent().setClass(this, MainActivity.class));
             }
         }
@@ -175,8 +168,10 @@ public class WebViewActivity extends BaseCompatActivity {
         nesteScrollWebView.addJavascriptInterface(new SupportJavascriptInterface(this),
                 "imagelistner");
         nesteScrollWebView.setWebViewClient(new WebViewClient() {
+
             @Override
             public boolean shouldOverrideUrlLoading(WebView view, String url) {
+//                Log.d("66666","shouldOverrideUrlLoading="+url);
                 if (url.startsWith("http")) view.loadUrl(url);
 //                if (url.contains("platformapi/startapp")) {
 //                    startAlipayActivity(url);
@@ -209,9 +204,6 @@ public class WebViewActivity extends BaseCompatActivity {
 
             @Override
             public void onPageStarted(WebView view, String url, Bitmap favicon) {
-//                Log.d("666666","onPageStartedurl="+url);
-//                if (url.startsWith("http"))view.loadUrl(url);
-//                view.getSettings().setJavaScriptEnabled(true);
                 super.onPageStarted(view, url, favicon);
             }
 
@@ -233,6 +225,14 @@ public class WebViewActivity extends BaseCompatActivity {
         });
 
         nesteScrollWebView.setWebChromeClient(new WebChromeClient() {
+
+            @Override
+            public void onReceivedTitle(WebView view, String title) {
+                super.onReceivedTitle(view, title);
+
+                if (null != title) title_web.setText(title);
+            }
+
             @Override
             public void onProgressChanged(WebView view, int newProgress) {
                 if (newProgress == 100) {
@@ -243,26 +243,19 @@ public class WebViewActivity extends BaseCompatActivity {
                 }
             }
         });
+
         nesteScrollWebView.setOnLongClickListener(new View.OnLongClickListener() {
             @Override
             public boolean onLongClick(View v) {
                 WebView.HitTestResult result = ((WebView) v).getHitTestResult();
                 if (null == result)
                     return false;
-
-//                mPresenter.imageLongClicked(result);
-//                mImgurl = result.getExtra();
-
                 return true;
             }
         });
 
-//        nswvDetailContent.setOnTouchListener(WebViewOnTouchListener);
     }
 
-
-
-
     /**
      * 初始化WebSetting
      *
@@ -276,9 +269,9 @@ public class WebViewActivity extends BaseCompatActivity {
         // 是否应该支持使用其屏幕缩放控件和手势缩放
         settings.setSupportZoom(true);
         //        //是否支持手势缩放控制
-        //        settings.setBuiltInZoomControls(true);
+        settings.setBuiltInZoomControls(true);
         //        是否隐藏原生的缩放控件
-        //        settings.setDisplayZoomControls(false);
+        settings.setDisplayZoomControls(false);
         // 启动应用缓存
         settings.setAppCacheEnabled(true);
         // 排版适应屏幕,只显示一列
@@ -303,19 +296,6 @@ public class WebViewActivity extends BaseCompatActivity {
             settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY);
         }
 
-        //        settings.setBlockNetworkImage(false);
-        //        settings.setAppCacheEnabled(true);
-        //        settings.setDomStorageEnabled(true);
-        //        settings.setDatabaseEnabled(true);
-        //        if (NetworkConnectionUtils.isConnected(mContext)) {
-        //            settings.setCacheMode(WebSettings.LOAD_DEFAULT);
-        //        } else {
-        //            settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY);
-        //        }
-        //        settings.setJavaScriptEnabled(true);
-        //        settings.setLoadWithOverviewMode(true);
-        //        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
-        //        settings.setSupportZoom(true);
     }
 
 }
diff --git a/app/src/main/res/layout/fragment_zi_xun.xml b/app/src/main/res/layout/fragment_zi_xun.xml
index 154229b..5d741aa 100644
--- a/app/src/main/res/layout/fragment_zi_xun.xml
+++ b/app/src/main/res/layout/fragment_zi_xun.xml
@@ -6,79 +6,87 @@
     android:orientation="vertical"
     tools:context="com.shunzhi.parent.ui.fragment.ConsultFragment">
 
-    <include layout="@layout/layout_search"/>
+    <include layout="@layout/layout_search" />
 
-    <com.stx.xhb.xbanner.XBanner
-        android:id="@+id/xBanner"
+    <android.support.v4.widget.NestedScrollView
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="2"></com.stx.xhb.xbanner.XBanner>
+        android:layout_height="match_parent">
 
-
-<include layout="@layout/layout_textandimgshow"
-    />
-
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:paddingLeft="@dimen/size_dp_10"
-        android:paddingRight="@dimen/size_dp_10"
-        android:layout_weight="3"
-        android:orientation="vertical">
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/consult_huati"
-            android:textColor="@color/xueqing_blue"
-            android:textSize="@dimen/textSize16" />
-
-        <!--<include layout="@layout/layout_consult_content"/>-->
         <LinearLayout
             android:layout_width="match_parent"
-            android:layout_height="wrap_content">
+            android:layout_height="match_parent"
+            android:orientation="vertical">
 
-            <com.jcodecraeer.xrecyclerview.XRecyclerView
-                android:id="@+id/recycler_content"
+
+            <com.stx.xhb.xbanner.XBanner
+                android:id="@+id/xBanner"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-            </com.jcodecraeer.xrecyclerview.XRecyclerView>
-        </LinearLayout>
-    </LinearLayout>
+                android:layout_height="0dp"
+                android:layout_weight="2"></com.stx.xhb.xbanner.XBanner>
 
 
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:visibility="gone"
-        android:layout_height="0dp"
-        android:layout_margin="@dimen/size_dp_10"
-        android:layout_weight="2">
+            <include layout="@layout/layout_textandimgshow" />
 
-        <cn.jzvd.JZVideoPlayerStandard
-            android:id="@+id/videoplayer"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            ></cn.jzvd.JZVideoPlayerStandard>
-
-        <TextView
-            android:id="@+id/tvVideoTitle"
-            style="@style/TextView_Wrap_16"
-            android:layout_gravity="bottom"
-            android:layout_margin="@dimen/size_dp_5"
-            android:text="视频:关于图形工具的使用"
-            android:textColor="@color/white"
-            android:textSize="@dimen/textSize14" />
-
-        <TextView
-            android:id="@+id/tvVideoPingluns"
-            style="@style/TextView_Wrap_16"
-            android:layout_gravity="right|bottom"
-            android:layout_margin="@dimen/size_dp_5"
-            android:text="评论:30"
-            android:textColor="@color/white"
-            android:textSize="@dimen/textSize14" />
-
-    </FrameLayout>
 
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_weight="3"
+                android:orientation="vertical"
+                android:paddingLeft="@dimen/size_dp_10"
+                android:paddingRight="@dimen/size_dp_10">
+
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/consult_huati"
+                    android:textColor="@color/xueqing_blue"
+                    android:textSize="@dimen/textSize16" />
+
+                <!--<include layout="@layout/layout_consult_content"/>-->
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content">
+
+                    <com.jcodecraeer.xrecyclerview.XRecyclerView
+                        android:id="@+id/recycler_content"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"></com.jcodecraeer.xrecyclerview.XRecyclerView>
+                </LinearLayout>
+            </LinearLayout>
+
+
+            <FrameLayout
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_margin="@dimen/size_dp_10"
+                android:layout_weight="2"
+                android:visibility="gone">
+
+                <cn.jzvd.JZVideoPlayerStandard
+                    android:id="@+id/videoplayer"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"></cn.jzvd.JZVideoPlayerStandard>
+
+                <TextView
+                    android:id="@+id/tvVideoTitle"
+                    style="@style/TextView_Wrap_16"
+                    android:layout_gravity="bottom"
+                    android:layout_margin="@dimen/size_dp_5"
+                    android:text="视频:关于图形工具的使用"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/textSize14" />
+
+                <TextView
+                    android:id="@+id/tvVideoPingluns"
+                    style="@style/TextView_Wrap_16"
+                    android:layout_gravity="right|bottom"
+                    android:layout_margin="@dimen/size_dp_5"
+                    android:text="评论:30"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/textSize14" />
+
+            </FrameLayout>
+        </LinearLayout>
+    </android.support.v4.widget.NestedScrollView>
 </LinearLayout>
--
libgit2 0.21.0