Commit 53e2d7b76cfbdadf3116702daa0a7ec2cad20738

Authored by 陶汉栋
2 parents 0225fa8f 9097b24e
Exists in yxb_dev and in 1 other branch developer

Merge branch 'yxb_dev' of http://git.shunzhi.net/taohd/parentwork into developer

.idea/modules.xml
... ... @@ -4,7 +4,6 @@
4 4 <modules>
5 5 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
6 6 <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" />
7   - <module fileurl="file://F:/parentwork/parentWorkHolper.iml" filepath="F:/parentwork/parentWorkHolper.iml" />
8 7 <module fileurl="file://$PROJECT_DIR$/parentWorkHolper.iml" filepath="$PROJECT_DIR$/parentWorkHolper.iml" />
9 8 <module fileurl="file://$PROJECT_DIR$/parentwork.iml" filepath="$PROJECT_DIR$/parentwork.iml" />
10 9 <module fileurl="file://F:/parentWorkHolper/parentwork.iml" filepath="F:/parentWorkHolper/parentwork.iml" />
... ...
app/libs/processor.jar
No preview for this file type
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
... ... @@ -11,16 +11,11 @@ import android.support.v4.app.Fragment;
11 11 import android.support.v4.app.FragmentManager;
12 12 import android.support.v4.app.FragmentPagerAdapter;
13 13 import android.support.v4.view.ViewPager;
14   -import android.text.Spannable;
15   -import android.text.SpannableString;
16 14 import android.text.TextUtils;
17   -import android.text.style.ForegroundColorSpan;
18   -import android.util.Log;
19 15 import android.view.Menu;
20 16 import android.view.MenuItem;
21 17 import android.view.View;
22 18 import android.widget.PopupMenu;
23   -import android.widget.RelativeLayout;
24 19 import android.widget.TextView;
25 20  
26 21 import com.google.gson.Gson;
... ... @@ -77,7 +72,7 @@ public class ReportFragment extends BaseMVPCompatFragment&lt;MyChildContract.MyChil
77 72 viewPager.setAdapter(myFragmentAdapter);
78 73 tabLayout.setupWithViewPager(viewPager);
79 74 tabLayout.removeAllTabs();
80   - tabLayout.addTab(tabLayout.newTab().setText("成长"));
  75 + tabLayout.addTab(tabLayout.newTab().setText("应用"));
81 76 tabLayout.addTab(tabLayout.newTab().setText("报告"));
82 77 viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
83 78 @Override
... ... @@ -97,13 +92,14 @@ public class ReportFragment extends BaseMVPCompatFragment&lt;MyChildContract.MyChil
97 92 }
98 93 });
99 94 //在viewpager初始化之后加载
100   - mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 0, "");
  95 +// mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 0, "");
101 96 }
102 97  
103 98  
104 99 @Override
105 100 public void onResume() {
106 101 super.onResume();
  102 + mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 0, "");
107 103 }
108 104  
109 105 @Override
... ... @@ -111,15 +107,16 @@ public class ReportFragment extends BaseMVPCompatFragment&lt;MyChildContract.MyChil
111 107 switch (view.getId()) {
112 108 case R.id.tvShaiXuan:
113 109 if (null == shaiXuanPop) shaiXuanPop = new ShaiXuanPop(getActivity());
114   - if (null!=chengZhangFragment2)chengZhangFragment2.showShaixuan(handler);
  110 + if (null != chengZhangFragment2) chengZhangFragment2.showShaixuan(handler);
115 111 break;
116 112 case R.id.tvName:
117   - showChildName();
  113 + if(childlist!=null&&childlist.size()>0)
  114 + showChildName();
118 115 break;
119 116 }
120 117 }
121 118  
122   - public void refreshChild(){
  119 + public void refreshChild() {
123 120 mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 0, "");
124 121 }
125 122  
... ... @@ -179,28 +176,33 @@ public class ReportFragment extends BaseMVPCompatFragment&lt;MyChildContract.MyChil
179 176 List<ChildBean> list = currentBean.getStudentClass();
180 177 String currChildStr = AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.CURRCHILDJSONSTR);
181 178 childlist.addAll(list);
182   -
183 179 if (childlist == null || childlist.size() == 0) {
184   - if(null!=chengZhangFragment1)chengZhangFragment1.showNoData();
185   - if(null!=chengZhangFragment2)chengZhangFragment2.showNoData();
186   - }
187   - if (TextUtils.isEmpty(currChildStr)) {
188   - if (childlist != null && childlist.size() > 0) {
189   - tvName.setText(childlist.get(0).getStudentName());
190   - jsonStr = g.toJson(childlist.get(0), ChildBean.class);
191   - }
  180 + if (null != chengZhangFragment1) chengZhangFragment1.showNoData();
  181 + if (null != chengZhangFragment2) chengZhangFragment2.showNoData();
  182 + tvName.setText("未绑定");
  183 + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.CURRCHILDJSONSTR, "");
192 184 } else {
193   - ChildBean childBean = g.fromJson(currChildStr, ChildBean.class);
194   - for (int i = 0; i < childlist.size(); i++) {
195   - if (childBean.getStudentId() == childlist.get(i).getStudentId()) {
196   - jsonStr = g.toJson(childlist.get(i), ChildBean.class);
197   - break;
  185 + if (TextUtils.isEmpty(currChildStr)) {
  186 + if (childlist != null && childlist.size() > 0) {
  187 + tvName.setText(childlist.get(0).getStudentName());
  188 + jsonStr = g.toJson(childlist.get(0), ChildBean.class);
  189 + }
  190 + } else {
  191 + ChildBean childBean = g.fromJson(currChildStr, ChildBean.class);
  192 + for (int i = 0; i < childlist.size(); i++) {
  193 + if (childBean.getStudentId() == childlist.get(i).getStudentId()) {
  194 + jsonStr = g.toJson(childlist.get(i), ChildBean.class);
  195 + break;
  196 + }
198 197 }
  198 +
  199 + tvName.setText(childBean.getStudentName());
199 200 }
200   - tvName.setText(childBean.getStudentName());
  201 +
  202 + if (null != chengZhangFragment1) chengZhangFragment1.setChildJson(jsonStr);
  203 +
  204 + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.CURRCHILDJSONSTR, jsonStr);
201 205 }
202   - if (null != chengZhangFragment1) chengZhangFragment1.setChildJson(jsonStr);
203   - AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.CURRCHILDJSONSTR, jsonStr);
204 206 createSchoolMenu();
205 207 }
206 208  
... ... @@ -219,8 +221,8 @@ public class ReportFragment extends BaseMVPCompatFragment&lt;MyChildContract.MyChil
219 221 @Override
220 222 public void showError(String error) {
221 223 if (error.equals("访问的接口要求登录")) {
222   - if(null!=chengZhangFragment1)chengZhangFragment1.showNoData();
223   - if(null!=chengZhangFragment2)chengZhangFragment2.showNoData();
  224 + if (null != chengZhangFragment1) chengZhangFragment1.showNoData();
  225 + if (null != chengZhangFragment2) chengZhangFragment2.showNoData();
224 226 }
225 227 }
226 228  
... ... @@ -232,9 +234,9 @@ public class ReportFragment extends BaseMVPCompatFragment&lt;MyChildContract.MyChil
232 234  
233 235 @Override
234 236 public CharSequence getPageTitle(int position) {
235   - if (position==0){
  237 + if (position == 0) {
236 238 return "应用";
237   - }else {
  239 + } else {
238 240 return "报告";
239 241 }
240 242 }
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ChengZhangFragment.java
... ... @@ -22,8 +22,6 @@ import android.widget.TextView;
22 22  
23 23 import com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView;
24 24 import com.google.gson.Gson;
25   -import com.netease.nimlib.sdk.NIMClient;
26   -import com.netease.nimlib.sdk.mixpush.NIMPushClient;
27 25 import com.prolificinteractive.materialcalendarview.CalendarDay;
28 26 import com.prolificinteractive.materialcalendarview.MaterialCalendarView;
29 27 import com.share.mvpsdk.base.BasePresenter;
... ... @@ -100,7 +98,7 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep
100 98 layout_kaoqin = view.findViewById(R.id.layout_kaoqin);
101 99 layout_buka = view.findViewById(R.id.layout_buka);
102 100 layout_qingjia = view.findViewById(R.id.layout_qingjia);
103   - tvNoData=view.findViewById(R.id.tvNoData);
  101 + tvNoData = view.findViewById(R.id.tvNoData);
104 102 calendarView_month_mode = view.findViewById(R.id.calendarView_month_mode);
105 103 monthWeekMaterialCalendarView = view.findViewById(R.id.slidelayout);
106 104 layout_chengzhang = view.findViewById(R.id.layout_chengzhang);
... ... @@ -112,11 +110,12 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep
112 110 show();
113 111 }
114 112  
115   - private void show() {
  113 + public void show() {
116 114 Gson g = new Gson();
117 115 if (type.equals(TYPE_CHENGZHANG)) {
118 116 layout_chengzhang.setVisibility(View.VISIBLE);
119 117 layout_report.setVisibility(View.GONE);
  118 + rl_noData.setVisibility(View.GONE);
120 119 childBean = g.fromJson(jsonStr, ChildBean.class);
121 120  
122 121 } else {
... ... @@ -184,16 +183,16 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep
184 183  
185 184 @Override
186 185 public void onClick(View view) {
187   -
  186 + if(showOrderPopu())
  187 + return;
188 188 switch (view.getId()) {
189 189  
190 190 case R.id.layout_kaoqin:
191   -// ApplySigninActivity.getInstance(getActivity(), jsonStr);
192   - showOrderPopu();
  191 + ApplySigninActivity.getInstance(getActivity(), jsonStr);
  192 +
193 193 break;
194 194 case R.id.layout_buka:
195   -// ApplyReplaceCardActivity.getInstance(getActivity(), jsonStr);
196   - showOrderPopu();
  195 + ApplyReplaceCardActivity.getInstance(getActivity(), jsonStr);
197 196 break;
198 197 case R.id.layout_qingjia:
199 198 ToastUtils.showToast("正在努力开发中,敬请期待");
... ... @@ -201,17 +200,17 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep
201 200 }
202 201 }
203 202  
204   - private void showOrderPopu(){
205   - if (null==childBean||childBean.getCount() == 0) {
  203 + private boolean showOrderPopu() {
  204 + if (null == childBean || childBean.getCount() == 0) {
206 205 final PopupWindow popupWindow = new PopupWindow();
207 206 popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
208 207 popupWindow.setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
209 208 backgroundAlpha(0.5f);
210 209 View view1 = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_view, null);
211 210 TextView dialog_info = view1.findViewById(R.id.dialog_info);
212   - String text="请前往订购中心\n订购“智能校卫”\n才能够使用相关应用功能";
  211 + String text = "请前往订购中心\n订购“智能校卫”\n才能够使用相关应用功能";
213 212 Spannable span = new SpannableString(text);
214   - span.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.xueqing_blue)),3,7,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  213 + span.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.xueqing_blue)), 3, 7, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
215 214 dialog_info.setText(span);
216 215 dialog_info.setGravity(Gravity.CENTER);
217 216 TextView right_btn = view1.findViewById(R.id.right_btn);
... ... @@ -240,15 +239,17 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep
240 239  
241 240 popupWindow.setContentView(view1);
242 241 popupWindow.showAtLocation(recyclerView, Gravity.CENTER, 0, 0);
243   - return;
  242 + return true;
244 243 }
245 244  
246 245 if (TextUtils.isEmpty(childBean.getCardNumber())) {
247 246 BankActivity.newInstance(getActivity(), "如果使用该应用,请前往激活孩子校园卡");
248   - return;
  247 + return true;
249 248  
250 249 }
  250 + return false;
251 251 }
  252 +
252 253 @NonNull
253 254 @Override
254 255 public BasePresenter initPresenter() {
... ... @@ -277,18 +278,23 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep
277 278 * 显示没有数据
278 279 */
279 280 public void showNoData() {
280   - if (type.equals(TYPE_REPORT)){
  281 + layout_chengzhang.setVisibility(View.GONE);
  282 + layout_report.setVisibility(View.GONE);
  283 + rl_noData.setVisibility(View.VISIBLE);
  284 + if (type.equals(TYPE_REPORT)) {
281 285 tvNoData.setBackgroundDrawable(getResources().getDrawable(R.drawable.baogao_back));
  286 + rl_noData.setGravity(Gravity.CENTER);
  287 + tvNoData.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
282 288 tvNoData.setText("");
283   - }else
284   - setTextColor();
  289 + } else
  290 + setTextColor();
285 291  
286 292 }
287 293  
288 294 private void setTextColor() {
289   - String text="如需使用该模块,请先前往\n个人中心—我的孩子\n绑定孩子账号";
  295 + String text = "如需使用该模块,请先前往\n个人中心—我的孩子\n绑定孩子账号";
290 296 Spannable span = new SpannableString(text);
291   - span.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.xueqing_blue)),13,22,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  297 + span.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.xueqing_blue)), 13, 22, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
292 298 tvNoData.setText(span);
293 299 }
294 300  
... ...