diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 01e6008..ff43c7c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -121,6 +121,11 @@ android:theme="@style/myErrorDialogTheme" android:screenOrientation="portrait" /> + 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 diff --git a/app/src/main/java/com/sl/house_property/WebActivitytwo.java b/app/src/main/java/com/sl/house_property/WebActivitytwo.java new file mode 100644 index 0000000..3f6ffe0 --- /dev/null +++ b/app/src/main/java/com/sl/house_property/WebActivitytwo.java @@ -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; + } + } +} diff --git a/app/src/main/java/http/ApiConfig.java b/app/src/main/java/http/ApiConfig.java index 9600fa5..5f8fda3 100644 --- a/app/src/main/java/http/ApiConfig.java +++ b/app/src/main/java/http/ApiConfig.java @@ -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/"; diff --git a/app/src/main/res/drawable/progress_bar_states.xml b/app/src/main/res/drawable/progress_bar_states.xml new file mode 100644 index 0000000..8f46869 --- /dev/null +++ b/app/src/main/res/drawable/progress_bar_states.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_webtwo.xml b/app/src/main/res/layout/activity_webtwo.xml new file mode 100644 index 0000000..0ccd2cd --- /dev/null +++ b/app/src/main/res/layout/activity_webtwo.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/app/src/main/res/layout/fragment_main4.xml b/app/src/main/res/layout/fragment_main4.xml index 81dca0b..8dac1c4 100644 --- a/app/src/main/res/layout/fragment_main4.xml +++ b/app/src/main/res/layout/fragment_main4.xml @@ -250,6 +250,47 @@ android:layout_height="1dp" + android:background="@color/light" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-xxhdpi/clound_code.png b/app/src/main/res/mipmap-xxhdpi/clound_code.png new file mode 100644 index 0000000..be6438a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/clound_code.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_back.png b/app/src/main/res/mipmap-xxhdpi/icon_back.png new file mode 100644 index 0000000..b6fd092 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_back.png differ