Commit d878d22f5f1d847b198ffe63c8a50bb5bf0855ba
1 parent
69679356
Exists in
yxb_dev
and in
2 other branches
no message
Showing
2 changed files
with
87 additions
and
99 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/ui/activity/mywebview/WebViewActivity.java
| @@ -52,12 +52,9 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -52,12 +52,9 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 52 | context.startActivity(intent); | 52 | context.startActivity(intent); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | - | ||
| 56 | @Override | 55 | @Override |
| 57 | protected void initView(Bundle savedInstanceState) { | 56 | protected void initView(Bundle savedInstanceState) { |
| 58 | 57 | ||
| 59 | -// binding_success = findViewById(R.id.binding_success); | ||
| 60 | - | ||
| 61 | binding_success = findViewById(R.id.binding_success1); | 58 | binding_success = findViewById(R.id.binding_success1); |
| 62 | 59 | ||
| 63 | binding_success2 = findViewById(R.id.binding_success2); | 60 | binding_success2 = findViewById(R.id.binding_success2); |
| @@ -66,7 +63,6 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -66,7 +63,6 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 66 | zuoye = findViewById(R.id.zuoye); | 63 | zuoye = findViewById(R.id.zuoye); |
| 67 | title_web = findViewById(R.id.title_web); | 64 | title_web = findViewById(R.id.title_web); |
| 68 | 65 | ||
| 69 | - | ||
| 70 | close_btn.setOnClickListener(new View.OnClickListener() { | 66 | close_btn.setOnClickListener(new View.OnClickListener() { |
| 71 | @Override | 67 | @Override |
| 72 | public void onClick(View v) { | 68 | public void onClick(View v) { |
| @@ -74,11 +70,8 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -74,11 +70,8 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 74 | } | 70 | } |
| 75 | }); | 71 | }); |
| 76 | 72 | ||
| 77 | - | ||
| 78 | nesteScrollWebView = findViewById(R.id.nesteScrollWebView); | 73 | nesteScrollWebView = findViewById(R.id.nesteScrollWebView); |
| 79 | 74 | ||
| 80 | -// nesteScrollWebView = findViewById(R.id.webView); | ||
| 81 | - | ||
| 82 | pvWeb = findViewById(R.id.pb_web); | 75 | pvWeb = findViewById(R.id.pb_web); |
| 83 | type = getIntent().getIntExtra("type", 0); | 76 | type = getIntent().getIntExtra("type", 0); |
| 84 | if (type == AppConfig.BINDING_SUCCESS_HEZUO) { | 77 | if (type == AppConfig.BINDING_SUCCESS_HEZUO) { |
| @@ -114,7 +107,7 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -114,7 +107,7 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 114 | initWebView(); | 107 | initWebView(); |
| 115 | initWebSetting(nesteScrollWebView.getSettings()); | 108 | initWebSetting(nesteScrollWebView.getSettings()); |
| 116 | nesteScrollWebView.loadUrl(getIntent().getStringExtra("url")); | 109 | nesteScrollWebView.loadUrl(getIntent().getStringExtra("url")); |
| 117 | - Log.d("66666","getIntent().getStringExtra(\"url\")="+getIntent().getStringExtra("url")); | 110 | +// Log.d("66666","getIntent().getStringExtra(\"url\")="+getIntent().getStringExtra("url")); |
| 118 | } | 111 | } |
| 119 | 112 | ||
| 120 | @Override | 113 | @Override |
| @@ -128,7 +121,7 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -128,7 +121,7 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 128 | nesteScrollWebView.goBack(); | 121 | nesteScrollWebView.goBack(); |
| 129 | } else { | 122 | } else { |
| 130 | super.onBackPressedSupport(); | 123 | super.onBackPressedSupport(); |
| 131 | - if(type!=-1&&type!= AppConfig.ORDER_CENTER) { | 124 | + if (type != -1 && type != AppConfig.ORDER_CENTER) { |
| 132 | startActivity(new Intent().setClass(this, MainActivity.class)); | 125 | startActivity(new Intent().setClass(this, MainActivity.class)); |
| 133 | } | 126 | } |
| 134 | } | 127 | } |
| @@ -175,8 +168,10 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -175,8 +168,10 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 175 | nesteScrollWebView.addJavascriptInterface(new SupportJavascriptInterface(this), | 168 | nesteScrollWebView.addJavascriptInterface(new SupportJavascriptInterface(this), |
| 176 | "imagelistner"); | 169 | "imagelistner"); |
| 177 | nesteScrollWebView.setWebViewClient(new WebViewClient() { | 170 | nesteScrollWebView.setWebViewClient(new WebViewClient() { |
| 171 | + | ||
| 178 | @Override | 172 | @Override |
| 179 | public boolean shouldOverrideUrlLoading(WebView view, String url) { | 173 | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| 174 | +// Log.d("66666","shouldOverrideUrlLoading="+url); | ||
| 180 | if (url.startsWith("http")) view.loadUrl(url); | 175 | if (url.startsWith("http")) view.loadUrl(url); |
| 181 | // if (url.contains("platformapi/startapp")) { | 176 | // if (url.contains("platformapi/startapp")) { |
| 182 | // startAlipayActivity(url); | 177 | // startAlipayActivity(url); |
| @@ -209,9 +204,6 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -209,9 +204,6 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 209 | 204 | ||
| 210 | @Override | 205 | @Override |
| 211 | public void onPageStarted(WebView view, String url, Bitmap favicon) { | 206 | public void onPageStarted(WebView view, String url, Bitmap favicon) { |
| 212 | -// Log.d("666666","onPageStartedurl="+url); | ||
| 213 | -// if (url.startsWith("http"))view.loadUrl(url); | ||
| 214 | -// view.getSettings().setJavaScriptEnabled(true); | ||
| 215 | super.onPageStarted(view, url, favicon); | 207 | super.onPageStarted(view, url, favicon); |
| 216 | } | 208 | } |
| 217 | 209 | ||
| @@ -233,6 +225,14 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -233,6 +225,14 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 233 | }); | 225 | }); |
| 234 | 226 | ||
| 235 | nesteScrollWebView.setWebChromeClient(new WebChromeClient() { | 227 | nesteScrollWebView.setWebChromeClient(new WebChromeClient() { |
| 228 | + | ||
| 229 | + @Override | ||
| 230 | + public void onReceivedTitle(WebView view, String title) { | ||
| 231 | + super.onReceivedTitle(view, title); | ||
| 232 | + | ||
| 233 | + if (null != title) title_web.setText(title); | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | @Override | 236 | @Override |
| 237 | public void onProgressChanged(WebView view, int newProgress) { | 237 | public void onProgressChanged(WebView view, int newProgress) { |
| 238 | if (newProgress == 100) { | 238 | if (newProgress == 100) { |
| @@ -243,26 +243,19 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -243,26 +243,19 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 243 | } | 243 | } |
| 244 | } | 244 | } |
| 245 | }); | 245 | }); |
| 246 | + | ||
| 246 | nesteScrollWebView.setOnLongClickListener(new View.OnLongClickListener() { | 247 | nesteScrollWebView.setOnLongClickListener(new View.OnLongClickListener() { |
| 247 | @Override | 248 | @Override |
| 248 | public boolean onLongClick(View v) { | 249 | public boolean onLongClick(View v) { |
| 249 | WebView.HitTestResult result = ((WebView) v).getHitTestResult(); | 250 | WebView.HitTestResult result = ((WebView) v).getHitTestResult(); |
| 250 | if (null == result) | 251 | if (null == result) |
| 251 | return false; | 252 | return false; |
| 252 | - | ||
| 253 | -// mPresenter.imageLongClicked(result); | ||
| 254 | -// mImgurl = result.getExtra(); | ||
| 255 | - | ||
| 256 | return true; | 253 | return true; |
| 257 | } | 254 | } |
| 258 | }); | 255 | }); |
| 259 | 256 | ||
| 260 | -// nswvDetailContent.setOnTouchListener(WebViewOnTouchListener); | ||
| 261 | } | 257 | } |
| 262 | 258 | ||
| 263 | - | ||
| 264 | - | ||
| 265 | - | ||
| 266 | /** | 259 | /** |
| 267 | * 初始化WebSetting | 260 | * 初始化WebSetting |
| 268 | * | 261 | * |
| @@ -276,9 +269,9 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -276,9 +269,9 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 276 | // 是否应该支持使用其屏幕缩放控件和手势缩放 | 269 | // 是否应该支持使用其屏幕缩放控件和手势缩放 |
| 277 | settings.setSupportZoom(true); | 270 | settings.setSupportZoom(true); |
| 278 | // //是否支持手势缩放控制 | 271 | // //是否支持手势缩放控制 |
| 279 | - // settings.setBuiltInZoomControls(true); | 272 | + settings.setBuiltInZoomControls(true); |
| 280 | // 是否隐藏原生的缩放控件 | 273 | // 是否隐藏原生的缩放控件 |
| 281 | - // settings.setDisplayZoomControls(false); | 274 | + settings.setDisplayZoomControls(false); |
| 282 | // 启动应用缓存 | 275 | // 启动应用缓存 |
| 283 | settings.setAppCacheEnabled(true); | 276 | settings.setAppCacheEnabled(true); |
| 284 | // 排版适应屏幕,只显示一列 | 277 | // 排版适应屏幕,只显示一列 |
| @@ -303,19 +296,6 @@ public class WebViewActivity extends BaseCompatActivity { | @@ -303,19 +296,6 @@ public class WebViewActivity extends BaseCompatActivity { | ||
| 303 | settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY); | 296 | settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY); |
| 304 | } | 297 | } |
| 305 | 298 | ||
| 306 | - // settings.setBlockNetworkImage(false); | ||
| 307 | - // settings.setAppCacheEnabled(true); | ||
| 308 | - // settings.setDomStorageEnabled(true); | ||
| 309 | - // settings.setDatabaseEnabled(true); | ||
| 310 | - // if (NetworkConnectionUtils.isConnected(mContext)) { | ||
| 311 | - // settings.setCacheMode(WebSettings.LOAD_DEFAULT); | ||
| 312 | - // } else { | ||
| 313 | - // settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY); | ||
| 314 | - // } | ||
| 315 | - // settings.setJavaScriptEnabled(true); | ||
| 316 | - // settings.setLoadWithOverviewMode(true); | ||
| 317 | - // settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); | ||
| 318 | - // settings.setSupportZoom(true); | ||
| 319 | } | 299 | } |
| 320 | 300 | ||
| 321 | } | 301 | } |
app/src/main/res/layout/fragment_zi_xun.xml
| @@ -6,79 +6,87 @@ | @@ -6,79 +6,87 @@ | ||
| 6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
| 7 | tools:context="com.shunzhi.parent.ui.fragment.ConsultFragment"> | 7 | tools:context="com.shunzhi.parent.ui.fragment.ConsultFragment"> |
| 8 | 8 | ||
| 9 | - <include layout="@layout/layout_search"/> | 9 | + <include layout="@layout/layout_search" /> |
| 10 | 10 | ||
| 11 | - <com.stx.xhb.xbanner.XBanner | ||
| 12 | - android:id="@+id/xBanner" | 11 | + <android.support.v4.widget.NestedScrollView |
| 13 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 14 | - android:layout_height="0dp" | ||
| 15 | - android:layout_weight="2"></com.stx.xhb.xbanner.XBanner> | 13 | + android:layout_height="match_parent"> |
| 16 | 14 | ||
| 17 | - | ||
| 18 | -<include layout="@layout/layout_textandimgshow" | ||
| 19 | - /> | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - <LinearLayout | ||
| 23 | - android:layout_width="match_parent" | ||
| 24 | - android:layout_height="0dp" | ||
| 25 | - android:paddingLeft="@dimen/size_dp_10" | ||
| 26 | - android:paddingRight="@dimen/size_dp_10" | ||
| 27 | - android:layout_weight="3" | ||
| 28 | - android:orientation="vertical"> | ||
| 29 | - | ||
| 30 | - <TextView | ||
| 31 | - android:layout_width="match_parent" | ||
| 32 | - android:layout_height="wrap_content" | ||
| 33 | - android:text="@string/consult_huati" | ||
| 34 | - android:textColor="@color/xueqing_blue" | ||
| 35 | - android:textSize="@dimen/textSize16" /> | ||
| 36 | - | ||
| 37 | - <!--<include layout="@layout/layout_consult_content"/>--> | ||
| 38 | <LinearLayout | 15 | <LinearLayout |
| 39 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
| 40 | - android:layout_height="wrap_content"> | 17 | + android:layout_height="match_parent" |
| 18 | + android:orientation="vertical"> | ||
| 41 | 19 | ||
| 42 | - <com.jcodecraeer.xrecyclerview.XRecyclerView | ||
| 43 | - android:id="@+id/recycler_content" | 20 | + |
| 21 | + <com.stx.xhb.xbanner.XBanner | ||
| 22 | + android:id="@+id/xBanner" | ||
| 44 | android:layout_width="match_parent" | 23 | android:layout_width="match_parent" |
| 45 | - android:layout_height="wrap_content"> | ||
| 46 | - </com.jcodecraeer.xrecyclerview.XRecyclerView> | ||
| 47 | - </LinearLayout> | ||
| 48 | - </LinearLayout> | 24 | + android:layout_height="0dp" |
| 25 | + android:layout_weight="2"></com.stx.xhb.xbanner.XBanner> | ||
| 49 | 26 | ||
| 50 | 27 | ||
| 51 | - <FrameLayout | ||
| 52 | - android:layout_width="match_parent" | ||
| 53 | - android:visibility="gone" | ||
| 54 | - android:layout_height="0dp" | ||
| 55 | - android:layout_margin="@dimen/size_dp_10" | ||
| 56 | - android:layout_weight="2"> | 28 | + <include layout="@layout/layout_textandimgshow" /> |
| 57 | 29 | ||
| 58 | - <cn.jzvd.JZVideoPlayerStandard | ||
| 59 | - android:id="@+id/videoplayer" | ||
| 60 | - android:layout_width="match_parent" | ||
| 61 | - android:layout_height="match_parent" | ||
| 62 | - ></cn.jzvd.JZVideoPlayerStandard> | ||
| 63 | - | ||
| 64 | - <TextView | ||
| 65 | - android:id="@+id/tvVideoTitle" | ||
| 66 | - style="@style/TextView_Wrap_16" | ||
| 67 | - android:layout_gravity="bottom" | ||
| 68 | - android:layout_margin="@dimen/size_dp_5" | ||
| 69 | - android:text="视频:关于图形工具的使用" | ||
| 70 | - android:textColor="@color/white" | ||
| 71 | - android:textSize="@dimen/textSize14" /> | ||
| 72 | - | ||
| 73 | - <TextView | ||
| 74 | - android:id="@+id/tvVideoPingluns" | ||
| 75 | - style="@style/TextView_Wrap_16" | ||
| 76 | - android:layout_gravity="right|bottom" | ||
| 77 | - android:layout_margin="@dimen/size_dp_5" | ||
| 78 | - android:text="评论:30" | ||
| 79 | - android:textColor="@color/white" | ||
| 80 | - android:textSize="@dimen/textSize14" /> | ||
| 81 | - | ||
| 82 | - </FrameLayout> | ||
| 83 | 30 | ||
| 31 | + <LinearLayout | ||
| 32 | + android:layout_width="match_parent" | ||
| 33 | + android:layout_height="0dp" | ||
| 34 | + android:layout_weight="3" | ||
| 35 | + android:orientation="vertical" | ||
| 36 | + android:paddingLeft="@dimen/size_dp_10" | ||
| 37 | + android:paddingRight="@dimen/size_dp_10"> | ||
| 38 | + | ||
| 39 | + <TextView | ||
| 40 | + android:layout_width="match_parent" | ||
| 41 | + android:layout_height="wrap_content" | ||
| 42 | + android:text="@string/consult_huati" | ||
| 43 | + android:textColor="@color/xueqing_blue" | ||
| 44 | + android:textSize="@dimen/textSize16" /> | ||
| 45 | + | ||
| 46 | + <!--<include layout="@layout/layout_consult_content"/>--> | ||
| 47 | + <LinearLayout | ||
| 48 | + android:layout_width="match_parent" | ||
| 49 | + android:layout_height="wrap_content"> | ||
| 50 | + | ||
| 51 | + <com.jcodecraeer.xrecyclerview.XRecyclerView | ||
| 52 | + android:id="@+id/recycler_content" | ||
| 53 | + android:layout_width="match_parent" | ||
| 54 | + android:layout_height="wrap_content"></com.jcodecraeer.xrecyclerview.XRecyclerView> | ||
| 55 | + </LinearLayout> | ||
| 56 | + </LinearLayout> | ||
| 57 | + | ||
| 58 | + | ||
| 59 | + <FrameLayout | ||
| 60 | + android:layout_width="match_parent" | ||
| 61 | + android:layout_height="0dp" | ||
| 62 | + android:layout_margin="@dimen/size_dp_10" | ||
| 63 | + android:layout_weight="2" | ||
| 64 | + android:visibility="gone"> | ||
| 65 | + | ||
| 66 | + <cn.jzvd.JZVideoPlayerStandard | ||
| 67 | + android:id="@+id/videoplayer" | ||
| 68 | + android:layout_width="match_parent" | ||
| 69 | + android:layout_height="match_parent"></cn.jzvd.JZVideoPlayerStandard> | ||
| 70 | + | ||
| 71 | + <TextView | ||
| 72 | + android:id="@+id/tvVideoTitle" | ||
| 73 | + style="@style/TextView_Wrap_16" | ||
| 74 | + android:layout_gravity="bottom" | ||
| 75 | + android:layout_margin="@dimen/size_dp_5" | ||
| 76 | + android:text="视频:关于图形工具的使用" | ||
| 77 | + android:textColor="@color/white" | ||
| 78 | + android:textSize="@dimen/textSize14" /> | ||
| 79 | + | ||
| 80 | + <TextView | ||
| 81 | + android:id="@+id/tvVideoPingluns" | ||
| 82 | + style="@style/TextView_Wrap_16" | ||
| 83 | + android:layout_gravity="right|bottom" | ||
| 84 | + android:layout_margin="@dimen/size_dp_5" | ||
| 85 | + android:text="评论:30" | ||
| 86 | + android:textColor="@color/white" | ||
| 87 | + android:textSize="@dimen/textSize14" /> | ||
| 88 | + | ||
| 89 | + </FrameLayout> | ||
| 90 | + </LinearLayout> | ||
| 91 | + </android.support.v4.widget.NestedScrollView> | ||
| 84 | </LinearLayout> | 92 | </LinearLayout> |