This commit is contained in:
2021-03-30 18:05:53 +08:00
parent 5ec80641a6
commit 0aee221564
10 changed files with 297 additions and 1 deletions

View File

@@ -121,6 +121,11 @@
android:theme="@style/myErrorDialogTheme"
android:screenOrientation="portrait"
/>
<activity
android:name="com.sl.house_property.WebActivitytwo"
android:screenOrientation="portrait"
android:theme="@style/TAppTheme"
/>
<activity
android:name="com.sl.house_property.MainTabActivity"
android:launchMode="standard"

View File

@@ -120,6 +120,12 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
startActivity(intent);
}
});
mDataBinding.ll5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
WebActivitytwo.runActivity(getActivity(), "", "https://wy.dou1.net/articlemobile/index/detail?article_id=19");
}
});
//mDataBinding.myRecyView;
mDataBinding.userImage.setOnClickListener(new View.OnClickListener() {
@Override

View File

@@ -0,0 +1,105 @@
package com.sl.house_property;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class WebActivitytwo extends AppCompatActivity implements View.OnClickListener {
public final static String URL = "url";
public final static String TITLE = "title";
private WebView webView;
private ProgressBar pb;
private RelativeLayout mLayTopLeftTv;
private TextView mLayTopTitle;
private TextView mRight;
private ImageView mIvCode;
private ProgressBar mPb;
private WebView mWebView;
public static void runActivity(Context context, String title, String url) {
Intent intent = new Intent(context, WebActivitytwo.class);
intent.putExtra(URL, url);
intent.putExtra(TITLE, title);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webtwo);
String url = getIntent().getStringExtra(URL);
String title = getIntent().getStringExtra(TITLE);
initView();
pb.setMax(100);
WebSettings webSettings = webView.getSettings();
webSettings.setDomStorageEnabled(true);//主要是这句
webSettings.setJavaScriptEnabled(true);//启用js
webSettings.setBlockNetworkImage(false);//解决图片不显示
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setLoadsImagesAutomatically(true);
webSettings.setAppCacheEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
// webView.getSettings().setJavaScriptEnabled(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
pb.setProgress(newProgress);
if (newProgress >= 100) {
pb.setVisibility(View.GONE);
}
}
});
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl(url);
}
private void initView() {
webView = (WebView) findViewById(R.id.webView);
webView.setOnClickListener(this);
pb = (ProgressBar) findViewById(R.id.pb);
mLayTopLeftTv = (RelativeLayout) findViewById(R.id.layTop_left_tv);
mLayTopLeftTv.setOnClickListener(this);
mLayTopTitle = (TextView) findViewById(R.id.layTop_title);
mRight = (TextView) findViewById(R.id.right);
mIvCode = (ImageView) findViewById(R.id.iv_code);
mPb = (ProgressBar) findViewById(R.id.pb);
mWebView = (WebView) findViewById(R.id.webView);
mLayTopTitle.setText("智慧豆豆");
}
@Override
public void onClick(View v) {
switch (v.getId()) {
default:
break;
case R.id.webView:
break;
case R.id.layTop_left_tv:
finish();
break;
}
}
}

View File

@@ -9,7 +9,7 @@ public class ApiConfig {
public static String APPID="szo007";
public static String webUrl="https://www.dafaok88.com";*/
public static String BASE_PARENT_URL="http://wy.dou1.net/";
public static String BASE_PARENT_URL="https://wy.dou1.net/";
public static String BASE_URL= BASE_PARENT_URL + "api/";
public static String APPID="api/";

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 jeasonlzy(廖子尧)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<gradient
android:angle="270"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:startColor="#ff9d9e9d"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<gradient
android:angle="270"
android:centerColor="#a046801b"
android:centerY="0.75"
android:endColor="#a046c01b"
android:startColor="#a046c01b"/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:angle="270"
android:centerColor="#46bb1b"
android:centerY="0.75"
android:endColor="#46cc1b"
android:startColor="#46cc1b"/>
</shape>
</clip>
</item>
</layer-list>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/title_top" />
<ProgressBar
android:id="@+id/pb"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="false"
android:minHeight="3dp"
android:progressDrawable="@drawable/progress_bar_states"/>
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@@ -250,6 +250,47 @@
android:layout_height="1dp"
android:background="@color/light" />
<LinearLayout
android:id="@+id/ll_5"
android:background="@color/white"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="50dp">
<ImageView
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fangchan"
/>
<TextView
android:layout_marginLeft="16dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:textSize="16sp"
android:textColor="#000"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="隐私政策"
/>
<ImageView
android:layout_marginRight="16dp"
android:layout_gravity="center_vertical"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/returnme"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/light" />
<LinearLayout

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="#ffffff"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="@+id/layTop_left_tv"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:layout_marginLeft="12dp"
android:gravity="center">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:background="@mipmap/icon_back"
android:textColor="#000000" />
</RelativeLayout>
<TextView
android:id="@+id/layTop_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text=""
android:textColor="#000000"
android:textSize="17sp" />
<TextView
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#ff333333"
android:textSize="14sp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone"
android:layout_marginRight="13dp"/>
<ImageView
android:id="@+id/iv_code"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="13dp"
android:visibility="gone"
android:src="@mipmap/clound_code"/>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB