Commit bfc68ef2c50fef642dc2aef536bf89cd0b990fc3

Authored by 陶汉栋
1 parent b181dda4

no message

app/src/main/AndroidManifest.xml
... ... @@ -109,7 +109,8 @@
109 109 android:name=".ui.activity.binding.InviteCodeActivity"
110 110 android:screenOrientation="portrait" />
111 111 <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity" />
112   - <activity android:name=".ui.activity.orderdetail.OrderDetailActivity"></activity>
  112 + <activity android:name=".ui.activity.orderdetail.OrderDetailActivity" />
  113 + <activity android:name=".ui.activity.WebViewActivity"></activity>
113 114 </application>
114 115  
115 116 </manifest>
116 117 \ No newline at end of file
... ...
app/src/main/java/com/shunzhi/parent/AppConfig.java
... ... @@ -23,6 +23,7 @@ public class AppConfig {
23 23 public static String USER_IMAGE = "user_image";
24 24 public static String PARENT_ID = "parent_id";
25 25 public static String USER_ID="user_id";
  26 + public static String APP_IS_START="app_is_start";
26 27  
27 28 //http://campus.myjxt.com/
28 29 public static String BASE_URL="http://60.190.202.57:1000/";
... ...
app/src/main/java/com/shunzhi/parent/AppContext.java
... ... @@ -19,7 +19,7 @@ public class AppContext extends GlobalApplication {
19 19  
20 20 public final static int LOCATION_CITYNAME=0x00;
21 21  
22   - public String cityName="";
  22 + public String cityName="",district="";
23 23  
24 24 public static AppContext getInstance() {
25 25 return appContext;
... ... @@ -99,15 +99,15 @@ public class AppContext extends GlobalApplication {
99 99  
100 100 if (aMapLocation.getErrorCode()==0){
101 101 cityName=aMapLocation.getCity();
  102 + district=aMapLocation.getDistrict();
102 103 aMapLocation.getCityCode();
103   - Log.d("mlocation:","handler="+handler);
104 104 Intent intent=new Intent();
105 105 intent.setAction(LOCATION_CITYNAME+"");
106 106 sendBroadcast(intent);
107 107 stopLocation();
108 108 }else {
109 109 cityName="定位失败";
110   - Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo());
  110 +// Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo());
111 111 }
112 112  
113 113 }
... ...
app/src/main/java/com/shunzhi/parent/contract/ceping/CepingContract.java
... ... @@ -31,6 +31,8 @@ public interface CepingContract {
31 31  
32 32 interface ICePingView extends IBaseFragment{
33 33  
  34 + void showTools();
  35 +
34 36 }
35 37  
36 38 }
... ...
app/src/main/java/com/shunzhi/parent/presenter/ceping/CePingPresenter.java
1 1 package com.shunzhi.parent.presenter.ceping;
2 2  
  3 +import android.util.Log;
3 4 import android.view.View;
4 5 import android.widget.LinearLayout;
5 6  
... ... @@ -10,6 +11,7 @@ import com.shunzhi.parent.R;
10 11 import com.shunzhi.parent.bean.ToolBean;
11 12 import com.shunzhi.parent.contract.ceping.CepingContract;
12 13 import com.shunzhi.parent.model.CePingModel;
  14 +import com.shunzhi.parent.ui.activity.WebViewActivity;
13 15 import com.shunzhi.parent.util.AttrsUtils;
14 16 import com.shunzhi.parent.views.TextAndImgShowView;
15 17  
... ... @@ -42,22 +44,26 @@ public class CePingPresenter extends CepingContract.CePingPresenter {
42 44 public void accept(JsonObject jsonObject) throws Exception {
43 45 if (jsonObject.get("status").getAsString().equals("1")){
44 46 JsonArray jsonArray=jsonObject.getAsJsonArray("data");
  47 + layout_control.removeAllViews();
45 48 for (int i = 0; i < jsonArray.size(); i++) {
46 49 ToolBean toolBean=new Gson().fromJson(jsonArray.get(i).getAsJsonObject(),ToolBean.class);
47 50 TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity());
48 51 textAndImgShowView.setTextColor(R.color.textColor);
49 52 textAndImgShowView.setText(toolBean.toolName);
50   - textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBean.toolImage));
  53 + textAndImgShowView.addImgs(toolBean.toolImage);
51 54 textAndImgShowView.setSelect(true);
52 55 textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control);
53 56 textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0));
  57 + textAndImgShowView.setTag(toolBean);
54 58 textAndImgShowView.setOnClickListener(new View.OnClickListener() {
55 59 @Override
56 60 public void onClick(View view) {
57   -
  61 + ToolBean toolBean1= (ToolBean) view.getTag();
  62 + WebViewActivity.getInstance(mIView.getBindActivity(),toolBean1.toolUrl);
58 63 }
59 64 });
60 65 layout_control.addView(textAndImgShowView);
  66 + mIView.showTools();
61 67 }
62 68 }else {
63 69  
... ... @@ -89,7 +95,7 @@ public class CePingPresenter extends CepingContract.CePingPresenter {
89 95 }
90 96 });
91 97 layout_control.addView(textAndImgShowView);
92   - }
93   - mIView.showTools(toolBeanList);*/
  98 + }*/
  99 +// mIView.showTools(toolBeanList);
94 100 }
95 101 }
... ...
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
... ... @@ -40,7 +40,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter {
40 40 TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity());
41 41 textAndImgShowView.setTextColor(R.color.textColor);
42 42 textAndImgShowView.setText(toolBeanList.get(i).toolName);
43   - textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg));
  43 + textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImage));
44 44 textAndImgShowView.setSelect(true);
45 45 textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control);
46 46 textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0));
... ...
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
... ... @@ -38,7 +38,7 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{
38 38 TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity());
39 39 textAndImgShowView.setTextColor(R.color.textColor);
40 40 textAndImgShowView.setText(toolBeanList.get(i).toolName);
41   - textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg));
  41 + textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImage));
42 42 textAndImgShowView.setSelect(true);
43 43 textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control);
44 44 textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0));
... ...
app/src/main/java/com/shunzhi/parent/ui/activity/StartActivity.java
1 1 package com.shunzhi.parent.ui.activity;
2 2  
3 3 import android.os.Bundle;
  4 +import android.support.v4.app.FragmentTransaction;
4 5 import android.support.v4.view.ViewPager;
5 6 import android.view.View;
6 7 import android.widget.ImageView;
... ... @@ -8,6 +9,7 @@ import android.widget.ImageView;
8 9 import com.bumptech.glide.Glide;
9 10 import com.share.mvpsdk.base.activity.BaseCompatActivity;
10 11 import com.shunzhi.parent.R;
  12 +import com.shunzhi.parent.ui.fragment.StartFragment;
11 13 import com.stx.xhb.xbanner.XBanner;
12 14  
13 15 import java.util.ArrayList;
... ... @@ -15,44 +17,19 @@ import java.util.List;
15 17  
16 18 public class StartActivity extends BaseCompatActivity {
17 19  
18   - XBanner xBanner;
19   - List<String> imgUrl=new ArrayList<>();
20   - @Override
21   - protected void initView(Bundle savedInstanceState) {
22   -
23   - xBanner=findViewById(R.id.xBanner);
24   -
25   - imgUrl.add(getClass().getResource("/assets/yindao1.png").toString());
26   - imgUrl.add(getClass().getResource("/assets/yindao2.png").toString());
27   - imgUrl.add(getClass().getResource("/assets/yindao3.png").toString());
28   - imgUrl.add(getClass().getResource("/assets/yindao4.png").toString());
29   - xBanner.setData(imgUrl,null);
30   - xBanner.setmAutoPlayAble(false);
  20 + FragmentTransaction fragmentTransaction=null;
31 21  
32   - xBanner.setmAdapter(new XBanner.XBannerAdapter() {
33   - @Override
34   - public void loadBanner(XBanner banner, Object model, View view, int position) {
35   - Glide.with(StartActivity.this).load(imgUrl.get(position)).placeholder(R.drawable.ic_launcher_background)
36   - .into((ImageView) view);
37   - }
38   - });
  22 + StartFragment startFragment=null;
39 23  
40   - xBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
41   - @Override
42   - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
43   -
44   - }
  24 + @Override
  25 + protected void initView(Bundle savedInstanceState) {
45 26  
46   - @Override
47   - public void onPageSelected(int position) {
  27 + fragmentTransaction=getSupportFragmentManager().beginTransaction();
48 28  
49   - }
  29 + startFragment=new StartFragment();
50 30  
51   - @Override
52   - public void onPageScrollStateChanged(int state) {
  31 + fragmentTransaction.add(R.id.frame_start,startFragment).show(startFragment).commit();
53 32  
54   - }
55   - });
56 33 }
57 34  
58 35 @Override
... ...
app/src/main/java/com/shunzhi/parent/ui/activity/WebViewActivity.java 0 → 100644
... ... @@ -0,0 +1,200 @@
  1 +package com.shunzhi.parent.ui.activity;
  2 +
  3 +import android.content.Context;
  4 +import android.content.Intent;
  5 +import android.graphics.Bitmap;
  6 +import android.os.Bundle;
  7 +import android.view.View;
  8 +import android.webkit.JavascriptInterface;
  9 +import android.webkit.WebChromeClient;
  10 +import android.webkit.WebSettings;
  11 +import android.webkit.WebView;
  12 +import android.webkit.WebViewClient;
  13 +import android.widget.ProgressBar;
  14 +
  15 +import com.share.mvpsdk.base.activity.BaseCompatActivity;
  16 +import com.share.mvpsdk.utils.AppUtils;
  17 +import com.share.mvpsdk.utils.NetworkConnectionUtils;
  18 +import com.share.mvpsdk.widgets.NestedScrollWebView;
  19 +import com.shunzhi.parent.R;
  20 +
  21 +public class WebViewActivity extends BaseCompatActivity {
  22 +
  23 + NestedScrollWebView nesteScrollWebView;
  24 +
  25 + private ProgressBar pvWeb;
  26 +
  27 + public static void getInstance(Context context,String url){
  28 + Intent intent=new Intent(context,WebViewActivity.class);
  29 + intent.putExtra("url",url);
  30 + context.startActivity(intent);
  31 + }
  32 +
  33 + @Override
  34 + protected void initView(Bundle savedInstanceState) {
  35 + nesteScrollWebView=findViewById(R.id.nesteScrollWebView);
  36 + pvWeb=findViewById(R.id.pb_web);
  37 + initWebView();
  38 + initWebSetting(nesteScrollWebView.getSettings());
  39 + nesteScrollWebView.loadUrl(getIntent().getStringExtra("url"));
  40 + }
  41 +
  42 + @Override
  43 + protected int getLayoutId() {
  44 + return R.layout.activity_web_view;
  45 + }
  46 +
  47 + @Override
  48 + public void onBackPressedSupport() {
  49 + if (nesteScrollWebView.canGoBack()){
  50 + nesteScrollWebView.goBack();
  51 + }else {
  52 + super.onBackPressedSupport();
  53 + }
  54 + }
  55 +
  56 + /**
  57 + * js接口
  58 + */
  59 + public class SupportJavascriptInterface {
  60 + private Context context;
  61 +
  62 + public SupportJavascriptInterface(Context context) {
  63 + this.context = context;
  64 + }
  65 +
  66 + @JavascriptInterface
  67 + public void openImage(final String img) {
  68 + AppUtils.runOnUIThread(new Runnable() {
  69 + @Override
  70 + public void run() {
  71 +// gotoImageBrowse(img);
  72 + }
  73 + });
  74 + }
  75 + }
  76 +
  77 + protected void initWebView() {
  78 + // 添加js交互接口类,并起别名 imagelistner
  79 + nesteScrollWebView.addJavascriptInterface(new SupportJavascriptInterface(this),
  80 + "imagelistner");
  81 + nesteScrollWebView.setWebViewClient(new WebViewClient() {
  82 + @Override
  83 + public boolean shouldOverrideUrlLoading(WebView view, String url) {
  84 + view.loadUrl(url);
  85 + return true;
  86 + }
  87 +
  88 + @Override
  89 + public void onPageFinished(WebView view, String url) {
  90 + view.getSettings().setJavaScriptEnabled(true);
  91 + super.onPageFinished(view, url);
  92 + // html加载完成之后,添加监听图片的点击js函数
  93 + addWebImageClickListner(view);
  94 +// toolbar.setTitle(getToolbarTitle());
  95 + }
  96 +
  97 + @Override
  98 + public void onPageStarted(WebView view, String url, Bitmap favicon) {
  99 + view.getSettings().setJavaScriptEnabled(true);
  100 + super.onPageStarted(view, url, favicon);
  101 + }
  102 +
  103 + // 注入js函数监听
  104 + protected void addWebImageClickListner(WebView webView) {
  105 + // 这段js函数的功能就是,遍历所有的img节点,并添加onclick函数,
  106 + // 函数的功能是在图片点击的时候调用本地java接口并传递url过去
  107 + webView.loadUrl("javascript:(function(){" +
  108 + "var objs = document.getElementsByTagName(\"img\"); " +
  109 + "for(var i=0;i<objs.length;i++) " +
  110 + "{"
  111 + + " objs[i].onclick=function() " +
  112 + " { "
  113 + + " window.imagelistner.openImage(this.src); " +
  114 + " } " +
  115 + "}" +
  116 + "})()");
  117 + }
  118 + });
  119 +
  120 + nesteScrollWebView.setWebChromeClient(new WebChromeClient() {
  121 + @Override
  122 + public void onProgressChanged(WebView view, int newProgress) {
  123 + if (newProgress == 100) {
  124 + pvWeb.setVisibility(View.GONE);//加载完网页进度条消失
  125 + } else {
  126 + pvWeb.setVisibility(View.VISIBLE);//开始加载网页时显示进度条
  127 + pvWeb.setProgress(newProgress);//设置进度值
  128 + }
  129 + }
  130 + });
  131 +
  132 + nesteScrollWebView.setOnLongClickListener(new View.OnLongClickListener() {
  133 + @Override
  134 + public boolean onLongClick(View v) {
  135 + WebView.HitTestResult result = ((WebView) v).getHitTestResult();
  136 + if (null == result)
  137 + return false;
  138 +
  139 +// mPresenter.imageLongClicked(result);
  140 +// mImgurl = result.getExtra();
  141 +
  142 + return true;
  143 + }
  144 + });
  145 +
  146 +// nswvDetailContent.setOnTouchListener(WebViewOnTouchListener);
  147 + }
  148 +
  149 +
  150 + /**
  151 + * 初始化WebSetting
  152 + *
  153 + * @param settings WebSetting
  154 + */
  155 + protected void initWebSetting(WebSettings settings) {
  156 + // 缩放至屏幕的大小
  157 + settings.setLoadWithOverviewMode(true);
  158 + // 保存表单数据
  159 + settings.setSaveFormData(true);
  160 + // 是否应该支持使用其屏幕缩放控件和手势缩放
  161 + settings.setSupportZoom(true);
  162 + // //是否支持手势缩放控制
  163 + // settings.setBuiltInZoomControls(true);
  164 + // 是否隐藏原生的缩放控件
  165 + // settings.setDisplayZoomControls(false);
  166 + // 启动应用缓存
  167 + settings.setAppCacheEnabled(true);
  168 + // 排版适应屏幕,只显示一列
  169 + settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
  170 + // settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
  171 + // 页面加载好以后,再放开图片
  172 + settings.setBlockNetworkImage(false);
  173 + // 使用localStorage则必须打开
  174 + settings.setDomStorageEnabled(true);
  175 + settings.setDatabaseEnabled(true);
  176 + // WebView启用JavaScript执行。默认的是false。
  177 + settings.setJavaScriptEnabled(true); // 设置支持javascript脚本
  178 + settings.setJavaScriptCanOpenWindowsAutomatically(true);//设置支持js脚本
  179 + if (NetworkConnectionUtils.isConnected(mContext)) {
  180 + settings.setCacheMode(WebSettings.LOAD_DEFAULT);
  181 + } else {
  182 + settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY);
  183 + }
  184 +
  185 + // settings.setBlockNetworkImage(false);
  186 + // settings.setAppCacheEnabled(true);
  187 + // settings.setDomStorageEnabled(true);
  188 + // settings.setDatabaseEnabled(true);
  189 + // if (NetworkConnectionUtils.isConnected(mContext)) {
  190 + // settings.setCacheMode(WebSettings.LOAD_DEFAULT);
  191 + // } else {
  192 + // settings.setCacheMode(WebSettings.LOAD_CACHE_ONLY);
  193 + // }
  194 + // settings.setJavaScriptEnabled(true);
  195 + // settings.setLoadWithOverviewMode(true);
  196 + // settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
  197 + // settings.setSupportZoom(true);
  198 + }
  199 +
  200 +}
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
... ... @@ -93,7 +93,7 @@ public class CePingFragment extends BaseMVPCompatFragment&lt;CepingContract.CePingP
93 93  
94 94 private void addTools() {
95 95 layout_control.measure(0,0);
96   - mPresenter.getTools(layout_control,"");
  96 + mPresenter.getTools(layout_control,AppContext.getInstance().district);
97 97  
98 98 }
99 99  
... ... @@ -140,7 +140,7 @@ public class CePingFragment extends BaseMVPCompatFragment&lt;CepingContract.CePingP
140 140 ToastUtils.showToast("remen3");
141 141 break;
142 142 case R.id.tvLocalAddress:
143   - AppContext.getInstance().startLocation();
  143 +// AppContext.getInstance().startLocation();
144 144 if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this);
145 145 if (cityPicker.isShow())cityPicker.close();
146 146 else cityPicker.show();
... ... @@ -169,6 +169,13 @@ public class CePingFragment extends BaseMVPCompatFragment&lt;CepingContract.CePingP
169 169  
170 170 @Override
171 171 public void getCity(String name) {
172   - ToastUtils.showToast(name);
  172 + tvLocalAddress.setText(name.split(" ")[1]);
  173 + mPresenter.getTools(layout_control,name.split(" ")[2]);
  174 + ToastUtils.showToast(name.split(" ")[2]);
  175 + }
  176 +
  177 + @Override
  178 + public void showTools() {
  179 +
173 180 }
174 181 }
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
... ... @@ -84,15 +84,6 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
84 84 }
85 85  
86 86 private void initBanners() {
87   -// InputStream inputStream = getClass().getResourceAsStream("/assets/banners.png");
88   -// try {
89   -// imgesUrl.add(new String(InputStreamToByte(inputStream)));
90   -// imgesUrl.add(new String(InputStreamToByte(inputStream)));
91   -// imgesUrl.add(new String(InputStreamToByte(inputStream)));
92   -// imgesUrl.add(new String(InputStreamToByte(inputStream)));
93   -// } catch (IOException e) {
94   -// e.printStackTrace();
95   -// }
96 87 xBanner.setData(imgesUrl, describeList);
97 88 xBanner.setmAdapter(new XBanner.XBannerAdapter() {
98 89 @Override
... ... @@ -110,18 +101,6 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
110 101 return new ConsultPresenter();
111 102 }
112 103  
113   - private byte[] InputStreamToByte(InputStream is) throws IOException {
114   - ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
115   - int ch;
116   - while ((ch = is.read()) != -1) {
117   - bytestream.write(ch);
118   - }
119   - byte imgdata[] = bytestream.toByteArray();
120   - bytestream.close();
121   - return imgdata;
122   -
123   - }
124   -
125 104 @Override
126 105 public void onResume() {
127 106 super.onResume();
... ... @@ -138,7 +117,7 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
138 117 public void onClick(View view) {
139 118 switch (view.getId()) {
140 119 case R.id.tvLocalAddress:
141   - AppContext.getInstance().startLocation();
  120 +// AppContext.getInstance().startLocation();
142 121 if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this);
143 122 if (cityPicker.isShow())cityPicker.close();
144 123 else cityPicker.show();
... ... @@ -190,6 +169,6 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
190 169  
191 170 @Override
192 171 public void getCity(String name) {
193   -
  172 + tvLocalAddress.setText(name.split(" ")[1]);
194 173 }
195 174 }
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java 0 → 100644
... ... @@ -0,0 +1,99 @@
  1 +package com.shunzhi.parent.ui.fragment;
  2 +
  3 +import android.os.Bundle;
  4 +import android.support.annotation.NonNull;
  5 +import android.support.annotation.Nullable;
  6 +import android.support.v4.view.ViewPager;
  7 +import android.text.TextUtils;
  8 +import android.view.View;
  9 +import android.widget.ImageView;
  10 +
  11 +import com.bumptech.glide.Glide;
  12 +import com.share.mvpsdk.base.BasePresenter;
  13 +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment;
  14 +import com.shunzhi.parent.AppConfig;
  15 +import com.shunzhi.parent.R;
  16 +import com.shunzhi.parent.bean.GuangGaoBean;
  17 +import com.shunzhi.parent.contract.consult.ConsultContract;
  18 +import com.shunzhi.parent.presenter.consult.ConsultPresenter;
  19 +import com.shunzhi.parent.ui.MainActivity;
  20 +import com.stx.xhb.xbanner.XBanner;
  21 +
  22 +import java.util.ArrayList;
  23 +import java.util.List;
  24 +
  25 +public class StartFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel>
  26 + implements ConsultContract.IConsultView {
  27 +
  28 + XBanner xBanner;
  29 +
  30 + @Override
  31 + public int getLayoutId() {
  32 + return R.layout.fragment_start;
  33 + }
  34 +
  35 + @Override
  36 + public void initUI(View view, @Nullable Bundle savedInstanceState) {
  37 + xBanner = view.findViewById(R.id.xBanner);
  38 + if (!TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.APP_IS_START))) {
  39 + mPresenter.getBanners("0");
  40 + AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1");
  41 + } else mPresenter.getBanners("1");
  42 + }
  43 +
  44 + @NonNull
  45 + @Override
  46 + public BasePresenter initPresenter() {
  47 + return new ConsultPresenter();
  48 + }
  49 +
  50 + @Override
  51 + public void showTools() {
  52 +
  53 + }
  54 +
  55 + @Override
  56 + public void showBanners(List<GuangGaoBean> guangGaoBeanList) {
  57 + initBannes(guangGaoBeanList);
  58 + }
  59 +
  60 + private void initBannes(List<GuangGaoBean> guangGaoBeanList) {
  61 + final List<String> imgUrl = new ArrayList<>();
  62 + List<String> describeList = new ArrayList<>();
  63 + for (int i = 0; i < guangGaoBeanList.size(); i++) {
  64 + imgUrl.add(guangGaoBeanList.get(i).fileSrc);
  65 + describeList.add(guangGaoBeanList.get(i).describe);
  66 + }
  67 + xBanner.setData(imgUrl, describeList);
  68 + xBanner.setmAutoPlayAble(false);
  69 + xBanner.setSlideScrollMode(View.OVER_SCROLL_NEVER);
  70 +
  71 + xBanner.setmAdapter(new XBanner.XBannerAdapter() {
  72 + @Override
  73 + public void loadBanner(XBanner banner, Object model, View view, int position) {
  74 + Glide.with(getActivity()).load(imgUrl.get(position)).placeholder(R.drawable.ic_launcher_background)
  75 + .into((ImageView) view);
  76 + }
  77 + });
  78 +
  79 + xBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
  80 + @Override
  81 + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
  82 + if (position == imgUrl.size() - 1) {
  83 + startNewActivity(MainActivity.class);
  84 + }
  85 + }
  86 +
  87 + @Override
  88 + public void onPageSelected(int position) {
  89 +
  90 + }
  91 +
  92 + @Override
  93 + public void onPageScrollStateChanged(int state) {
  94 +
  95 + }
  96 + });
  97 +
  98 + }
  99 +}
... ...
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
... ... @@ -13,6 +13,7 @@ import android.widget.ImageView;
13 13 import android.widget.LinearLayout;
14 14 import android.widget.TextView;
15 15  
  16 +import com.bumptech.glide.Glide;
16 17 import com.share.mvpsdk.utils.DisplayUtils;
17 18 import com.shunzhi.parent.R;
18 19  
... ... @@ -54,6 +55,10 @@ public class TextAndImgShowView extends LinearLayout {
54 55 imgs = new int[]{normalDrawable, selectDrawable};
55 56 }
56 57  
  58 + public void addImgs(String imgUrl){
  59 + Glide.with(getContext()).load(imgUrl).error(R.drawable.gxzt).into(image);
  60 + }
  61 +
57 62 public void setSelect(boolean isSelect) {
58 63 if (isSelect) {
59 64 if (imgs != null && imgs.length > 1)
... ...
app/src/main/res/drawable-xhdpi/header_icon.jpg 0 → 100644

13 KB

app/src/main/res/drawable/shape_corner_bg.xml 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <solid android:color="@color/white" />
  4 + <corners android:topLeftRadius="3dp"
  5 + android:topRightRadius="3dp"
  6 + android:bottomRightRadius="3dp"
  7 + android:bottomLeftRadius="3dp"/>
  8 + <stroke android:width="1dp" android:color="@color/bg_gray" />
  9 +</shape>
0 10 \ No newline at end of file
... ...
app/src/main/res/drawable/web_progress_bar_bg.xml 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
  3 + <item android:id="@android:id/background">
  4 + <shape>
  5 + <corners android:radius="2dp" />
  6 + <gradient
  7 + android:angle="270"
  8 + android:centerColor="#E3E3E3"
  9 + android:endColor="#E6E6E6"
  10 + android:startColor="#C8C8C8" />
  11 + </shape>
  12 + </item>
  13 + <item android:id="@android:id/progress">
  14 + <clip>
  15 + <shape>
  16 + <corners android:radius="2dp" />
  17 + <gradient
  18 + android:centerColor="#03a9f4"
  19 + android:endColor="#0288d1"
  20 + android:startColor="#03a9f4" />
  21 + </shape>
  22 + </clip>
  23 + </item>
  24 +</layer-list>
0 25 \ No newline at end of file
... ...
app/src/main/res/layout/activity_start.xml
... ... @@ -4,12 +4,8 @@
4 4 xmlns:tools="http://schemas.android.com/tools"
5 5 android:layout_width="match_parent"
6 6 android:layout_height="match_parent"
  7 + android:id="@+id/frame_start"
7 8 tools:context="com.shunzhi.parent.ui.activity.StartActivity">
8 9  
9   - <com.stx.xhb.xbanner.XBanner
10   - android:layout_width="match_parent"
11   - android:layout_height="match_parent"
12   - android:id="@+id/xBanner"
13   - ></com.stx.xhb.xbanner.XBanner>
14 10  
15 11 </FrameLayout>
... ...
app/src/main/res/layout/activity_web_view.xml 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + xmlns:tools="http://schemas.android.com/tools"
  5 + android:layout_width="match_parent"
  6 + android:layout_height="match_parent"
  7 + android:orientation="vertical"
  8 + android:background="@color/bgColor"
  9 + tools:context="com.shunzhi.parent.ui.activity.WebViewActivity">
  10 + <ProgressBar
  11 + android:id="@+id/pb_web"
  12 + style="?android:attr/progressBarStyleHorizontal"
  13 + android:layout_width="match_parent"
  14 + android:layout_height="3dp"
  15 + android:progressDrawable="@drawable/web_progress_bar_bg"
  16 + android:visibility="gone"/>
  17 + <com.share.mvpsdk.widgets.NestedScrollWebView
  18 + android:layout_width="match_parent"
  19 + android:layout_height="match_parent"
  20 + android:id="@+id/nesteScrollWebView"
  21 + ></com.share.mvpsdk.widgets.NestedScrollWebView>
  22 +
  23 +</LinearLayout>
... ...
app/src/main/res/layout/fragment_start.xml 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + tools:context="com.shunzhi.parent.ui.fragment.StartFragment">
  6 +
  7 + <com.stx.xhb.xbanner.XBanner
  8 + android:layout_width="match_parent"
  9 + android:layout_height="match_parent"
  10 + android:id="@+id/xBanner"
  11 + ></com.stx.xhb.xbanner.XBanner>
  12 +</FrameLayout>
... ...
app/src/main/res/layout/popup_pic_longclick.xml 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:id="@+id/ll_popup_root"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="wrap_content"
  6 + android:background="@drawable/shape_corner_bg"
  7 + android:layout_margin="10dp"
  8 + android:orientation="vertical">
  9 +
  10 + <TextView
  11 + android:id="@+id/item_go_image_browse"
  12 + android:layout_width="match_parent"
  13 + android:layout_height="40dp"
  14 + android:gravity="center"
  15 + android:text="查看图片"
  16 + android:textColor="@color/md_grey_700"
  17 + android:textSize="16sp"/>
  18 +
  19 + <View
  20 + android:layout_width="match_parent"
  21 + android:layout_height="1dp"
  22 + android:layout_marginRight="@dimen/size_dp_5"
  23 + android:layout_marginLeft="@dimen/size_dp_5"
  24 + android:background="@color/md_grey_500"/>
  25 +
  26 + <TextView
  27 + android:id="@+id/item_save_image"
  28 + android:layout_width="match_parent"
  29 + android:layout_height="40dp"
  30 + android:gravity="center"
  31 + android:text="保存图片"
  32 + android:textColor="@color/md_grey_700"
  33 + android:textSize="16sp"/>
  34 +
  35 +</LinearLayout>
0 36 \ No newline at end of file
... ...
app/src/main/res/layout/sub_net_status.xml 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent">
  5 +
  6 + <include
  7 + android:id="@+id/v_empty"
  8 + layout="@layout/view_empty"
  9 + android:layout_width="match_parent"
  10 + android:layout_height="match_parent"
  11 + android:visibility="gone"/>
  12 +
  13 + <include
  14 + android:id="@+id/v_network_error"
  15 + layout="@layout/view_network_error"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="match_parent"
  18 + android:visibility="gone"/>
  19 +
  20 + <include
  21 + android:id="@+id/v_loading"
  22 + layout="@layout/view_loading"
  23 + android:layout_width="match_parent"
  24 + android:layout_height="match_parent"
  25 + android:visibility="gone"/>
  26 +</FrameLayout>
0 27 \ No newline at end of file
... ...
app/src/main/res/values/dimens.xml
... ... @@ -11,6 +11,7 @@
11 11 <dimen name="margin_large">32dp</dimen>
12 12 <dimen name="margin_huge">64dp</dimen>
13 13 <dimen name="margin_only_txt">48dp</dimen>
  14 + <dimen name="detail_image_height">260dp</dimen>
14 15  
15 16 <!-- txtsize -->
16 17 <dimen name="txtsize_display1">34dp</dimen>
... ...
app/src/main/res/values/styles.xml
... ... @@ -41,4 +41,18 @@
41 41 <item name="android:backgroundDimEnabled">true</item>
42 42 </style>
43 43  
  44 + <style name="AppTheme.ToolbarPopupOverlay" parent="ThemeOverlay.AppCompat.Light">
  45 + <item name="overlapAnchor">false</item>
  46 + </style>
  47 +
  48 + <style name="TextAppearance.ExpandedTitle" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
  49 + <item name="android:textSize">26sp</item>
  50 + </style>
  51 +
  52 + <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
  53 + <!--<item name="colorPrimary">@color/colorPrimary</item>-->
  54 + <!--<item name="colorPrimaryDark">@color/colorPrimaryDark</item>-->
  55 + <!--<item name="colorAccent">@color/colorAccent</item>-->
  56 + </style>
  57 +
44 58 </resources>
... ...
mvpsdk/build.gradle
... ... @@ -39,6 +39,7 @@ dependencies {
39 39 implementation fileTree(dir: 'libs', include: ['*.jar'])
40 40  
41 41 implementation 'com.android.support:appcompat-v7:26.1.0'
  42 + implementation 'com.android.support.constraint:constraint-layout:1.0.2'
42 43 testImplementation 'junit:junit:4.12'
43 44 androidTestImplementation 'com.android.support.test:runner:1.0.1'
44 45 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
... ... @@ -103,7 +104,6 @@ dependencies {
103 104 compile 'cn.jzvd:jiaozivideoplayer:6.2.7'
104 105 // compile(name: 'jiaozivideoplayer-6.2.3', ext: 'aar')
105 106  
106   -
107 107 //轮播图XBanner
108 108 compile 'com.xhb:xbanner:1.3.1'
109 109  
... ...
mvpsdk/src/main/AndroidManifest.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
1 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2   - package="com.share.mvpsdk" />
  3 + package="com.share.mvpsdk">
  4 +
  5 + <application></application>
  6 +
  7 +</manifest>
3 8 \ No newline at end of file
... ...
mvpsdk/src/main/res/values/strings.xml
... ... @@ -4,7 +4,7 @@
4 4 <string name="loading">Loading……</string>
5 5 <string name="load_failed">Load failed. Please click me again</string>
6 6 <string name="press_again">Press again to exit</string>
7   -<string name="report">报告</string>
  7 + <string name="report">报告</string>
8 8 <!--历史数据界面-->
9 9 <string name="history_day">Day</string>
10 10 <string name="history_week">Week</string>
... ...