Commit 45b64f1c0a99c01b464cde3cc9081228b917fe23
1 parent
105e0366
Exists in
yxb_dev
and in
2 other branches
no message
Showing
10 changed files
with
90 additions
and
251 deletions
Show diff stats
app/libs/processor.jar
No preview for this file type
app/src/main/java/com/shunzhi/parent/AppContext.java
| @@ -19,7 +19,6 @@ import com.share.mvpsdk.global.GlobalApplication; | @@ -19,7 +19,6 @@ import com.share.mvpsdk.global.GlobalApplication; | ||
| 19 | import com.share.mvpsdk.helper.RetrofitCreateHelper; | 19 | import com.share.mvpsdk.helper.RetrofitCreateHelper; |
| 20 | import com.shunzhi.parent.bean.message.DaoMaster; | 20 | import com.shunzhi.parent.bean.message.DaoMaster; |
| 21 | import com.shunzhi.parent.bean.message.DaoSession; | 21 | import com.shunzhi.parent.bean.message.DaoSession; |
| 22 | -import com.shunzhi.parent.db.DBControl; | ||
| 23 | import com.shunzhi.parent.dbhelper.GreenDaoDatabaseOpenHelper; | 22 | import com.shunzhi.parent.dbhelper.GreenDaoDatabaseOpenHelper; |
| 24 | import com.shunzhi.parent.manager.MessageManager; | 23 | import com.shunzhi.parent.manager.MessageManager; |
| 25 | import com.shunzhi.parent.ui.MainActivity; | 24 | import com.shunzhi.parent.ui.MainActivity; |
| @@ -63,7 +62,6 @@ public class AppContext extends GlobalApplication { | @@ -63,7 +62,6 @@ public class AppContext extends GlobalApplication { | ||
| 63 | appContext = this; | 62 | appContext = this; |
| 64 | super.onCreate(); | 63 | super.onCreate(); |
| 65 | 64 | ||
| 66 | - DBControl.init(appContext); | ||
| 67 | NIMClient.init(this, loginInfo(), options()); | 65 | NIMClient.init(this, loginInfo(), options()); |
| 68 | if (inMainProcess(this)) { | 66 | if (inMainProcess(this)) { |
| 69 | //开启地图地位 | 67 | //开启地图地位 |
app/src/main/java/com/shunzhi/parent/db/ChildInfoDao.java
| @@ -1,89 +0,0 @@ | @@ -1,89 +0,0 @@ | ||
| 1 | -package com.shunzhi.parent.db; | ||
| 2 | - | ||
| 3 | -import android.content.Context; | ||
| 4 | - | ||
| 5 | -import com.j256.ormlite.dao.Dao; | ||
| 6 | -import com.j256.ormlite.stmt.DeleteBuilder; | ||
| 7 | -import com.j256.ormlite.stmt.QueryBuilder; | ||
| 8 | -import com.shunzhi.parent.bean.ChildBean; | ||
| 9 | -import com.shunzhi.parent.util.DatabaseHelper; | ||
| 10 | - | ||
| 11 | -import java.sql.SQLException; | ||
| 12 | -import java.util.ArrayList; | ||
| 13 | -import java.util.List; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * Created by Administrator on 2018/4/19 0019. | ||
| 17 | - */ | ||
| 18 | - | ||
| 19 | -public class ChildInfoDao { | ||
| 20 | - private Context context; | ||
| 21 | - private DatabaseHelper databaseHelper; | ||
| 22 | - private Dao<ChildBean, Integer> dao; | ||
| 23 | - | ||
| 24 | - public ChildInfoDao(Context context) { | ||
| 25 | - this.context = context; | ||
| 26 | - try { | ||
| 27 | - databaseHelper = DatabaseHelper.getHelper(context); | ||
| 28 | - dao = databaseHelper.getDao(ChildBean.class); | ||
| 29 | - } catch (SQLException e) { | ||
| 30 | - e.printStackTrace(); | ||
| 31 | - } | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - public boolean createOrUpdate(ChildBean childBean){ | ||
| 35 | - try { | ||
| 36 | - return dao.createOrUpdate(childBean).getNumLinesChanged() > 0; | ||
| 37 | - } catch (SQLException e) { | ||
| 38 | - e.printStackTrace(); | ||
| 39 | - return false; | ||
| 40 | - } | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - public boolean onCreate(ChildBean childBean) { | ||
| 45 | - try { | ||
| 46 | - return dao.create(childBean) > 0; | ||
| 47 | - } catch (SQLException e) { | ||
| 48 | - e.printStackTrace(); | ||
| 49 | - return false; | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - public boolean deleteAll(){ | ||
| 54 | - try { | ||
| 55 | - DeleteBuilder builder = dao.deleteBuilder(); | ||
| 56 | - return dao.delete(builder.prepare())>0; | ||
| 57 | - } catch (SQLException e) { | ||
| 58 | - e.printStackTrace(); | ||
| 59 | - return false; | ||
| 60 | - } | ||
| 61 | - } | ||
| 62 | - public synchronized List<ChildBean> getAllChildren() { | ||
| 63 | - List<ChildBean> children = null; | ||
| 64 | - try { | ||
| 65 | - children = dao.queryForAll(); | ||
| 66 | - if (children != null && children.size() > 0) return children; | ||
| 67 | - } catch (SQLException e) { | ||
| 68 | - e.printStackTrace(); | ||
| 69 | - return new ArrayList<>(); | ||
| 70 | - } | ||
| 71 | - return new ArrayList<>(); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - public synchronized ChildBean getChildBystudentId(int studentId) { | ||
| 76 | - QueryBuilder queryBuilder = dao.queryBuilder(); | ||
| 77 | - try { | ||
| 78 | - queryBuilder.where().eq("studentId", studentId); | ||
| 79 | - List<ChildBean> list = dao.query(queryBuilder.prepare()); | ||
| 80 | - ChildBean studentInfo = list.get(0); | ||
| 81 | - return studentInfo; | ||
| 82 | -// return dao.queryForFirst(queryBuilder.prepare()); | ||
| 83 | - } catch (SQLException e) { | ||
| 84 | - e.printStackTrace(); | ||
| 85 | - return null; | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - } |
app/src/main/java/com/shunzhi/parent/db/DBControl.java
| @@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
| 1 | -package com.shunzhi.parent.db; | ||
| 2 | - | ||
| 3 | -import android.content.Context; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * Created by Administrator on 2018/4/19 0019. | ||
| 7 | - */ | ||
| 8 | - | ||
| 9 | -public class DBControl { | ||
| 10 | - public static ChildInfoDao childInfoDao; | ||
| 11 | - | ||
| 12 | - public static void init(Context context){ | ||
| 13 | - childInfoDao=new ChildInfoDao(context); | ||
| 14 | - } | ||
| 15 | -} |
app/src/main/java/com/shunzhi/parent/ui/activity/MyChildActivity.java
| @@ -22,7 +22,6 @@ import com.shunzhi.parent.bean.ChildBean; | @@ -22,7 +22,6 @@ import com.shunzhi.parent.bean.ChildBean; | ||
| 22 | import com.shunzhi.parent.bean.ChildClass; | 22 | import com.shunzhi.parent.bean.ChildClass; |
| 23 | import com.shunzhi.parent.bean.CurrentBean; | 23 | import com.shunzhi.parent.bean.CurrentBean; |
| 24 | import com.shunzhi.parent.contract.mine.MyChildContract; | 24 | import com.shunzhi.parent.contract.mine.MyChildContract; |
| 25 | -import com.shunzhi.parent.db.DBControl; | ||
| 26 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; | 25 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; |
| 27 | import com.shunzhi.parent.ui.activity.binding.SelectSchoolActivity; | 26 | import com.shunzhi.parent.ui.activity.binding.SelectSchoolActivity; |
| 28 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; | 27 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
| @@ -103,10 +102,6 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi | @@ -103,10 +102,6 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi | ||
| 103 | public void updateChildList(CurrentBean currentBean) { | 102 | public void updateChildList(CurrentBean currentBean) { |
| 104 | currlist.clear(); | 103 | currlist.clear(); |
| 105 | List<ChildBean> list = currentBean.getStudentClass(); | 104 | List<ChildBean> list = currentBean.getStudentClass(); |
| 106 | - for(int i=0;i<list.size();i++){ | ||
| 107 | - DBControl.childInfoDao.createOrUpdate(list.get(i)); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | currlist.addAll(list); | 105 | currlist.addAll(list); |
| 111 | if (childAdapter == null) { | 106 | if (childAdapter == null) { |
| 112 | childAdapter = new ChildAdapter(this); | 107 | childAdapter = new ChildAdapter(this); |
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
| @@ -4,35 +4,40 @@ package com.shunzhi.parent.ui.fragment; | @@ -4,35 +4,40 @@ package com.shunzhi.parent.ui.fragment; | ||
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | import android.os.Message; | 6 | import android.os.Message; |
| 7 | +import android.support.annotation.NonNull; | ||
| 7 | import android.support.annotation.Nullable; | 8 | import android.support.annotation.Nullable; |
| 8 | import android.support.design.widget.TabLayout; | 9 | import android.support.design.widget.TabLayout; |
| 9 | import android.support.v4.app.Fragment; | 10 | import android.support.v4.app.Fragment; |
| 10 | import android.support.v4.app.FragmentManager; | 11 | import android.support.v4.app.FragmentManager; |
| 11 | import android.support.v4.app.FragmentPagerAdapter; | 12 | import android.support.v4.app.FragmentPagerAdapter; |
| 12 | import android.support.v4.view.ViewPager; | 13 | import android.support.v4.view.ViewPager; |
| 13 | -import android.support.v7.widget.PopupMenu; | ||
| 14 | import android.text.TextUtils; | 14 | import android.text.TextUtils; |
| 15 | import android.view.Menu; | 15 | import android.view.Menu; |
| 16 | import android.view.MenuItem; | 16 | import android.view.MenuItem; |
| 17 | import android.view.View; | 17 | import android.view.View; |
| 18 | +import android.widget.PopupMenu; | ||
| 19 | +import android.widget.RelativeLayout; | ||
| 18 | import android.widget.TextView; | 20 | import android.widget.TextView; |
| 19 | -import android.widget.Toast; | ||
| 20 | 21 | ||
| 21 | import com.google.gson.Gson; | 22 | import com.google.gson.Gson; |
| 22 | -import com.share.mvpsdk.base.fragment.BaseCompatFragment; | ||
| 23 | -import com.share.mvpsdk.utils.ToastUtils; | 23 | +import com.share.mvpsdk.base.BasePresenter; |
| 24 | +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
| 24 | import com.shunzhi.parent.AppConfig; | 25 | import com.shunzhi.parent.AppConfig; |
| 25 | import com.shunzhi.parent.AppContext; | 26 | import com.shunzhi.parent.AppContext; |
| 26 | import com.shunzhi.parent.R; | 27 | import com.shunzhi.parent.R; |
| 27 | import com.shunzhi.parent.bean.ChildBean; | 28 | import com.shunzhi.parent.bean.ChildBean; |
| 28 | -import com.shunzhi.parent.db.DBControl; | 29 | +import com.shunzhi.parent.bean.ChildClass; |
| 30 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 31 | +import com.shunzhi.parent.contract.mine.MyChildContract; | ||
| 29 | import com.shunzhi.parent.popu.ShaiXuanPop; | 32 | import com.shunzhi.parent.popu.ShaiXuanPop; |
| 33 | +import com.shunzhi.parent.presenter.mine.MyChildPresenter; | ||
| 30 | import com.shunzhi.parent.ui.fragment.report.ChengZhangFragment; | 34 | import com.shunzhi.parent.ui.fragment.report.ChengZhangFragment; |
| 31 | 35 | ||
| 32 | import java.util.ArrayList; | 36 | import java.util.ArrayList; |
| 33 | import java.util.List; | 37 | import java.util.List; |
| 34 | 38 | ||
| 35 | -public class ReportFragment extends BaseCompatFragment implements View.OnClickListener { | 39 | +public class ReportFragment extends BaseMVPCompatFragment<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel> |
| 40 | + implements MyChildContract.IMyChildView, View.OnClickListener { | ||
| 36 | ViewPager viewPager; | 41 | ViewPager viewPager; |
| 37 | 42 | ||
| 38 | TextView tvDate, tvShaiXuan, tvNoData, tvName; | 43 | TextView tvDate, tvShaiXuan, tvNoData, tvName; |
| @@ -41,6 +46,8 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | @@ -41,6 +46,8 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | ||
| 41 | 46 | ||
| 42 | TabLayout tabLayout; | 47 | TabLayout tabLayout; |
| 43 | 48 | ||
| 49 | + RelativeLayout rl_noData; | ||
| 50 | + | ||
| 44 | ChengZhangFragment chengZhangFragment1 = null, chengZhangFragment2 = null;//成长、报告页面 | 51 | ChengZhangFragment chengZhangFragment1 = null, chengZhangFragment2 = null;//成长、报告页面 |
| 45 | 52 | ||
| 46 | ShaiXuanPop shaiXuanPop = null; | 53 | ShaiXuanPop shaiXuanPop = null; |
| @@ -62,25 +69,11 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | @@ -62,25 +69,11 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | ||
| 62 | tvShaiXuan = view.findViewById(R.id.tvShaiXuan); | 69 | tvShaiXuan = view.findViewById(R.id.tvShaiXuan); |
| 63 | tvNoData = view.findViewById(R.id.tvNoData); | 70 | tvNoData = view.findViewById(R.id.tvNoData); |
| 64 | tabLayout = view.findViewById(R.id.tabLayout); | 71 | tabLayout = view.findViewById(R.id.tabLayout); |
| 72 | + rl_noData = view.findViewById(R.id.rl_noData); | ||
| 65 | tvName.setOnClickListener(this); | 73 | tvName.setOnClickListener(this); |
| 66 | tvName.setEllipsize(TextUtils.TruncateAt.END); | 74 | tvName.setEllipsize(TextUtils.TruncateAt.END); |
| 67 | tvShaiXuan.setOnClickListener(this); | 75 | tvShaiXuan.setOnClickListener(this); |
| 68 | - | ||
| 69 | myFragmentAdapter = new MyFragmentAdapter(getChildFragmentManager()); | 76 | myFragmentAdapter = new MyFragmentAdapter(getChildFragmentManager()); |
| 70 | - | ||
| 71 | - childlist = DBControl.childInfoDao.getAllChildren(); | ||
| 72 | - createSchoolMenu(); | ||
| 73 | - String currChildStr = AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.CURRCHILDJSONSTR); | ||
| 74 | - if (TextUtils.isEmpty(currChildStr)) { | ||
| 75 | - if (childlist != null && childlist.size() > 0) { | ||
| 76 | - tvName.setText(childlist.get(0).getStudentName()); | ||
| 77 | - jsonStr = g.toJson(childlist.get(0), ChildBean.class); | ||
| 78 | - } | ||
| 79 | - } else { | ||
| 80 | - ChildBean childBean = g.fromJson(currChildStr, ChildBean.class); | ||
| 81 | - tvName.setText(childBean.getStudentName()); | ||
| 82 | - jsonStr = currChildStr; | ||
| 83 | - } | ||
| 84 | viewPager.setAdapter(myFragmentAdapter); | 77 | viewPager.setAdapter(myFragmentAdapter); |
| 85 | tabLayout.setupWithViewPager(viewPager); | 78 | tabLayout.setupWithViewPager(viewPager); |
| 86 | tabLayout.removeAllTabs(); | 79 | tabLayout.removeAllTabs(); |
| @@ -106,6 +99,13 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | @@ -106,6 +99,13 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | ||
| 106 | 99 | ||
| 107 | } | 100 | } |
| 108 | 101 | ||
| 102 | + | ||
| 103 | + @Override | ||
| 104 | + public void onResume() { | ||
| 105 | + super.onResume(); | ||
| 106 | + mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 0, ""); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | @Override | 109 | @Override |
| 110 | public void onClick(View view) { | 110 | public void onClick(View view) { |
| 111 | switch (view.getId()) { | 111 | switch (view.getId()) { |
| @@ -138,6 +138,7 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | @@ -138,6 +138,7 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | ||
| 138 | tvName.setText(item.getTitle()); | 138 | tvName.setText(item.getTitle()); |
| 139 | jsonStr = g.toJson(childlist.get(finalI), ChildBean.class); | 139 | jsonStr = g.toJson(childlist.get(finalI), ChildBean.class); |
| 140 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.CURRCHILDJSONSTR, jsonStr); | 140 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.CURRCHILDJSONSTR, jsonStr); |
| 141 | + myFragmentAdapter.notifyDataSetChanged(); | ||
| 141 | return false; | 142 | return false; |
| 142 | } | 143 | } |
| 143 | }); | 144 | }); |
| @@ -160,6 +161,64 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | @@ -160,6 +161,64 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi | ||
| 160 | if (handler != null) handler = null; | 161 | if (handler != null) handler = null; |
| 161 | } | 162 | } |
| 162 | 163 | ||
| 164 | + @NonNull | ||
| 165 | + @Override | ||
| 166 | + public BasePresenter initPresenter() { | ||
| 167 | + return new MyChildPresenter(); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + | ||
| 171 | + @Override | ||
| 172 | + public void updateChildList(CurrentBean currentBean) { | ||
| 173 | + childlist.clear(); | ||
| 174 | + if (currentBean != null) { | ||
| 175 | + List<ChildBean> list = currentBean.getStudentClass(); | ||
| 176 | + String currChildStr = AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.CURRCHILDJSONSTR); | ||
| 177 | + childlist.addAll(list); | ||
| 178 | + | ||
| 179 | + if (childlist == null || childlist.size() == 0) { | ||
| 180 | + rl_noData.setVisibility(View.VISIBLE); | ||
| 181 | + viewPager.setVisibility(View.GONE); | ||
| 182 | + } | ||
| 183 | + if (TextUtils.isEmpty(currChildStr)) { | ||
| 184 | + if (childlist != null && childlist.size() > 0) { | ||
| 185 | + tvName.setText(childlist.get(0).getStudentName()); | ||
| 186 | + jsonStr = g.toJson(childlist.get(0), ChildBean.class); | ||
| 187 | + } | ||
| 188 | + } else { | ||
| 189 | + ChildBean childBean = g.fromJson(currChildStr, ChildBean.class); | ||
| 190 | + for (int i = 0; i < childlist.size(); i++) { | ||
| 191 | + if (childBean.getStudentId() == childlist.get(i).getStudentId()) { | ||
| 192 | + jsonStr = g.toJson(childlist.get(i), ChildBean.class); | ||
| 193 | + break; | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + tvName.setText(childBean.getStudentName()); | ||
| 197 | + } | ||
| 198 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.CURRCHILDJSONSTR, jsonStr); | ||
| 199 | + createSchoolMenu(); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + @Override | ||
| 205 | + public void addChildSuccess(String account, String password) { | ||
| 206 | + | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + @Override | ||
| 210 | + public void showClass(List<ChildClass> list) { | ||
| 211 | + | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + @Override | ||
| 215 | + public void showError(String error) { | ||
| 216 | + if (error.equals("访问的接口要求登录")) { | ||
| 217 | + rl_noData.setVisibility(View.VISIBLE); | ||
| 218 | + viewPager.setVisibility(View.GONE); | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | + | ||
| 163 | private class MyFragmentAdapter extends FragmentPagerAdapter { | 222 | private class MyFragmentAdapter extends FragmentPagerAdapter { |
| 164 | 223 | ||
| 165 | public MyFragmentAdapter(FragmentManager fm) { | 224 | public MyFragmentAdapter(FragmentManager fm) { |
app/src/main/java/com/shunzhi/parent/ui/fragment/apply/ApplySigninFragment.java
| 1 | package com.shunzhi.parent.ui.fragment.apply; | 1 | package com.shunzhi.parent.ui.fragment.apply; |
| 2 | 2 | ||
| 3 | -import android.app.DatePickerDialog; | ||
| 4 | import android.os.Build; | 3 | import android.os.Build; |
| 5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 6 | import android.support.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
| @@ -10,16 +9,11 @@ import android.support.v7.widget.RecyclerView; | @@ -10,16 +9,11 @@ import android.support.v7.widget.RecyclerView; | ||
| 10 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
| 11 | import android.util.Log; | 10 | import android.util.Log; |
| 12 | import android.view.View; | 11 | import android.view.View; |
| 13 | -import android.widget.CheckBox; | ||
| 14 | -import android.widget.CompoundButton; | ||
| 15 | -import android.widget.DatePicker; | ||
| 16 | import android.widget.ImageView; | 12 | import android.widget.ImageView; |
| 17 | import android.widget.LinearLayout; | 13 | import android.widget.LinearLayout; |
| 18 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 19 | -import android.widget.Toast; | ||
| 20 | 15 | ||
| 21 | import com.bigkoo.pickerview.builder.TimePickerBuilder; | 16 | import com.bigkoo.pickerview.builder.TimePickerBuilder; |
| 22 | -import com.bigkoo.pickerview.listener.CustomListener; | ||
| 23 | import com.bigkoo.pickerview.listener.OnTimeSelectChangeListener; | 17 | import com.bigkoo.pickerview.listener.OnTimeSelectChangeListener; |
| 24 | import com.bigkoo.pickerview.listener.OnTimeSelectListener; | 18 | import com.bigkoo.pickerview.listener.OnTimeSelectListener; |
| 25 | import com.bigkoo.pickerview.view.TimePickerView; | 19 | import com.bigkoo.pickerview.view.TimePickerView; |
| @@ -27,16 +21,13 @@ import com.google.gson.Gson; | @@ -27,16 +21,13 @@ import com.google.gson.Gson; | ||
| 27 | import com.share.mvpsdk.base.BasePresenter; | 21 | import com.share.mvpsdk.base.BasePresenter; |
| 28 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | 22 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 29 | import com.share.mvpsdk.utils.ToastUtils; | 23 | import com.share.mvpsdk.utils.ToastUtils; |
| 30 | -import com.shunzhi.parent.AppContext; | ||
| 31 | import com.shunzhi.parent.R; | 24 | import com.shunzhi.parent.R; |
| 32 | import com.shunzhi.parent.adapter.AttendanceAdapter; | 25 | import com.shunzhi.parent.adapter.AttendanceAdapter; |
| 33 | import com.shunzhi.parent.bean.ChildBean; | 26 | import com.shunzhi.parent.bean.ChildBean; |
| 34 | -import com.shunzhi.parent.bean.ToolBean; | ||
| 35 | import com.shunzhi.parent.bean.apply.AttendanceBean; | 27 | import com.shunzhi.parent.bean.apply.AttendanceBean; |
| 36 | import com.shunzhi.parent.contract.apply.ApplySigninContract; | 28 | import com.shunzhi.parent.contract.apply.ApplySigninContract; |
| 37 | import com.shunzhi.parent.presenter.apply.ApplySigninPresenter; | 29 | import com.shunzhi.parent.presenter.apply.ApplySigninPresenter; |
| 38 | 30 | ||
| 39 | -import java.sql.Time; | ||
| 40 | import java.text.SimpleDateFormat; | 31 | import java.text.SimpleDateFormat; |
| 41 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
| 42 | import java.util.Calendar; | 33 | import java.util.Calendar; |
| @@ -81,10 +72,10 @@ public class ApplySigninFragment extends BaseMVPCompatFragment<ApplySigninContra | @@ -81,10 +72,10 @@ public class ApplySigninFragment extends BaseMVPCompatFragment<ApplySigninContra | ||
| 81 | String jsonStr = getArguments().getString("childStr"); | 72 | String jsonStr = getArguments().getString("childStr"); |
| 82 | if (!TextUtils.isEmpty(jsonStr)) | 73 | if (!TextUtils.isEmpty(jsonStr)) |
| 83 | currChildBean = g.fromJson(jsonStr, ChildBean.class); | 74 | currChildBean = g.fromJson(jsonStr, ChildBean.class); |
| 84 | - | ||
| 85 | initLunarPicker(); | 75 | initLunarPicker(); |
| 86 | iv_calendar.setOnClickListener(this); | 76 | iv_calendar.setOnClickListener(this); |
| 87 | - | 77 | + tv_kaoqin_user.setText(currChildBean.getStudentName()); |
| 78 | + tv_tips.setText(currChildBean.getStudentName() + "今日无刷卡记录"); | ||
| 88 | currdate = getNowTime(); | 79 | currdate = getNowTime(); |
| 89 | tv_kaoqin_date.setText(getNowTime()); | 80 | tv_kaoqin_date.setText(getNowTime()); |
| 90 | recycle_attendance = view.findViewById(R.id.recycle_attendance); | 81 | recycle_attendance = view.findViewById(R.id.recycle_attendance); |
| @@ -183,8 +174,10 @@ public class ApplySigninFragment extends BaseMVPCompatFragment<ApplySigninContra | @@ -183,8 +174,10 @@ public class ApplySigninFragment extends BaseMVPCompatFragment<ApplySigninContra | ||
| 183 | 174 | ||
| 184 | if (list.size() == 0) { | 175 | if (list.size() == 0) { |
| 185 | layout_tv.setVisibility(View.VISIBLE); | 176 | layout_tv.setVisibility(View.VISIBLE); |
| 177 | + recycle_attendance.setVisibility(View.GONE); | ||
| 186 | } else { | 178 | } else { |
| 187 | recycle_attendance.setVisibility(View.VISIBLE); | 179 | recycle_attendance.setVisibility(View.VISIBLE); |
| 180 | + layout_tv.setVisibility(View.GONE); | ||
| 188 | signinlist.clear(); | 181 | signinlist.clear(); |
| 189 | signinlist.addAll(list); | 182 | signinlist.addAll(list); |
| 190 | attendanceAdapter.addAll(signinlist); | 183 | attendanceAdapter.addAll(signinlist); |
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ChengZhangFragment.java
| 1 | package com.shunzhi.parent.ui.fragment.report; | 1 | package com.shunzhi.parent.ui.fragment.report; |
| 2 | 2 | ||
| 3 | -import android.content.Intent; | ||
| 4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 4 | import android.os.Handler; |
| 6 | import android.os.Message; | 5 | import android.os.Message; |
| @@ -8,7 +7,6 @@ import android.support.annotation.NonNull; | @@ -8,7 +7,6 @@ import android.support.annotation.NonNull; | ||
| 8 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
| 9 | import android.support.v7.widget.RecyclerView; | 8 | import android.support.v7.widget.RecyclerView; |
| 10 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
| 11 | -import android.util.Log; | ||
| 12 | import android.view.Gravity; | 10 | import android.view.Gravity; |
| 13 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
| 14 | import android.view.View; | 12 | import android.view.View; |
| @@ -33,13 +31,10 @@ import com.shunzhi.parent.bean.ReportBean; | @@ -33,13 +31,10 @@ import com.shunzhi.parent.bean.ReportBean; | ||
| 33 | import com.shunzhi.parent.contract.report.ReportContract; | 31 | import com.shunzhi.parent.contract.report.ReportContract; |
| 34 | import com.shunzhi.parent.presenter.report.ReportPresenter; | 32 | import com.shunzhi.parent.presenter.report.ReportPresenter; |
| 35 | import com.shunzhi.parent.ui.activity.BankActivity; | 33 | import com.shunzhi.parent.ui.activity.BankActivity; |
| 36 | -import com.shunzhi.parent.ui.activity.MyChildActivity; | ||
| 37 | import com.shunzhi.parent.ui.activity.apply.ApplyReplaceCardActivity; | 34 | import com.shunzhi.parent.ui.activity.apply.ApplyReplaceCardActivity; |
| 38 | import com.shunzhi.parent.ui.activity.apply.ApplySigninActivity; | 35 | import com.shunzhi.parent.ui.activity.apply.ApplySigninActivity; |
| 39 | -import com.shunzhi.parent.ui.activity.binding.CheckInfoActivity; | ||
| 40 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; | 36 | import com.shunzhi.parent.ui.activity.mywebview.WebViewActivity; |
| 41 | 37 | ||
| 42 | - | ||
| 43 | import java.util.List; | 38 | import java.util.List; |
| 44 | 39 | ||
| 45 | /** | 40 | /** |
| @@ -102,12 +97,9 @@ public class ChengZhangFragment extends BaseMVPCompatFragment<ReportContract.Rep | @@ -102,12 +97,9 @@ public class ChengZhangFragment extends BaseMVPCompatFragment<ReportContract.Rep | ||
| 102 | layout_kaoqin.setOnClickListener(this); | 97 | layout_kaoqin.setOnClickListener(this); |
| 103 | layout_buka.setOnClickListener(this); | 98 | layout_buka.setOnClickListener(this); |
| 104 | layout_qingjia.setOnClickListener(this); | 99 | layout_qingjia.setOnClickListener(this); |
| 105 | - | ||
| 106 | type = getArguments().getString("type"); | 100 | type = getArguments().getString("type"); |
| 107 | jsonStr = getArguments().getString("jsonStr"); | 101 | jsonStr = getArguments().getString("jsonStr"); |
| 108 | Gson g = new Gson(); | 102 | Gson g = new Gson(); |
| 109 | - | ||
| 110 | - | ||
| 111 | if (type.equals(TYPE_CHENGZHANG)) { | 103 | if (type.equals(TYPE_CHENGZHANG)) { |
| 112 | layout_chengzhang.setVisibility(View.VISIBLE); | 104 | layout_chengzhang.setVisibility(View.VISIBLE); |
| 113 | layout_report.setVisibility(View.GONE); | 105 | layout_report.setVisibility(View.GONE); |
| @@ -123,6 +115,11 @@ public class ChengZhangFragment extends BaseMVPCompatFragment<ReportContract.Rep | @@ -123,6 +115,11 @@ public class ChengZhangFragment extends BaseMVPCompatFragment<ReportContract.Rep | ||
| 123 | } | 115 | } |
| 124 | } | 116 | } |
| 125 | 117 | ||
| 118 | + @Override | ||
| 119 | + public void onResume() { | ||
| 120 | + super.onResume(); | ||
| 121 | + } | ||
| 122 | + | ||
| 126 | private void initCalendarView() { | 123 | private void initCalendarView() { |
| 127 | 124 | ||
| 128 | showDate(); | 125 | showDate(); |
| @@ -225,7 +222,6 @@ public class ChengZhangFragment extends BaseMVPCompatFragment<ReportContract.Rep | @@ -225,7 +222,6 @@ public class ChengZhangFragment extends BaseMVPCompatFragment<ReportContract.Rep | ||
| 225 | switch (view.getId()) { | 222 | switch (view.getId()) { |
| 226 | 223 | ||
| 227 | case R.id.layout_kaoqin: | 224 | case R.id.layout_kaoqin: |
| 228 | - | ||
| 229 | ApplySigninActivity.getInstance(getActivity(), jsonStr); | 225 | ApplySigninActivity.getInstance(getActivity(), jsonStr); |
| 230 | break; | 226 | break; |
| 231 | case R.id.layout_buka: | 227 | case R.id.layout_buka: |
app/src/main/java/com/shunzhi/parent/util/DatabaseHelper.java
| @@ -1,99 +0,0 @@ | @@ -1,99 +0,0 @@ | ||
| 1 | -package com.shunzhi.parent.util; | ||
| 2 | - | ||
| 3 | -import android.content.Context; | ||
| 4 | -import android.database.sqlite.SQLiteDatabase; | ||
| 5 | - | ||
| 6 | -import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper; | ||
| 7 | -import com.j256.ormlite.dao.Dao; | ||
| 8 | -import com.j256.ormlite.support.ConnectionSource; | ||
| 9 | -import com.j256.ormlite.table.TableUtils; | ||
| 10 | -import com.shunzhi.parent.bean.ChildBean; | ||
| 11 | - | ||
| 12 | -import java.sql.SQLException; | ||
| 13 | -import java.util.HashMap; | ||
| 14 | -import java.util.Map; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * Created by ToaHanDong on 2017/3/24. | ||
| 18 | - */ | ||
| 19 | - | ||
| 20 | -public class DatabaseHelper extends OrmLiteSqliteOpenHelper { | ||
| 21 | - private static final String TABLE_NAME = "parent.db"; | ||
| 22 | - private Map<String, Dao> daos = new HashMap<String, Dao>(); | ||
| 23 | - private static DatabaseHelper instance; | ||
| 24 | - | ||
| 25 | - public DatabaseHelper(Context context){ | ||
| 26 | - super(context,TABLE_NAME,null,1); | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - /* | ||
| 30 | - 创建数据库 | ||
| 31 | - */ | ||
| 32 | - @Override | ||
| 33 | - public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) { | ||
| 34 | - try { | ||
| 35 | - TableUtils.createTableIfNotExists(connectionSource, ChildBean.class); | ||
| 36 | - } catch (SQLException e) { | ||
| 37 | - e.printStackTrace(); | ||
| 38 | - } | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - @Override | ||
| 42 | - public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) { | ||
| 43 | - try { | ||
| 44 | - TableUtils.dropTable(connectionSource,ChildBean.class,true); | ||
| 45 | - onCreate(database,connectionSource); | ||
| 46 | - } catch (SQLException e) { | ||
| 47 | - e.printStackTrace(); | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - //删除数据库 | ||
| 52 | - public void deleteAll(){ | ||
| 53 | - try { | ||
| 54 | - TableUtils.dropTable(connectionSource,ChildBean.class,true); | ||
| 55 | - } catch (SQLException e) { | ||
| 56 | - e.printStackTrace(); | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - public static synchronized DatabaseHelper getHelper(Context context){ | ||
| 61 | - context=context.getApplicationContext(); | ||
| 62 | - if (null==instance){ | ||
| 63 | - synchronized (DatabaseHelper.class){ | ||
| 64 | - if (null==instance){ | ||
| 65 | - instance=new DatabaseHelper(context); | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - } | ||
| 69 | - return instance; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public synchronized Dao getDao(Class clazz) throws SQLException { | ||
| 73 | - Dao dao = null; | ||
| 74 | - String className = clazz.getSimpleName(); | ||
| 75 | - | ||
| 76 | - if (daos.containsKey(className)) { | ||
| 77 | - dao = daos.get(className); | ||
| 78 | - } | ||
| 79 | - if (dao == null) { | ||
| 80 | - dao = super.getDao(clazz); | ||
| 81 | - daos.put(className, dao); | ||
| 82 | - } | ||
| 83 | - return dao; | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - /** | ||
| 87 | - * 释放资源 | ||
| 88 | - */ | ||
| 89 | - @Override | ||
| 90 | - public void close() { | ||
| 91 | - super.close(); | ||
| 92 | - | ||
| 93 | - for (String key : daos.keySet()) | ||
| 94 | - { | ||
| 95 | - Dao dao = daos.get(key); | ||
| 96 | - dao = null; | ||
| 97 | - } | ||
| 98 | - } | ||
| 99 | -} |
app/src/main/res/layout/fragment_report.xml
| @@ -66,6 +66,7 @@ | @@ -66,6 +66,7 @@ | ||
| 66 | </FrameLayout> | 66 | </FrameLayout> |
| 67 | 67 | ||
| 68 | <RelativeLayout | 68 | <RelativeLayout |
| 69 | + android:id="@+id/rl_noData" | ||
| 69 | android:layout_width="match_parent" | 70 | android:layout_width="match_parent" |
| 70 | android:layout_height="match_parent" | 71 | android:layout_height="match_parent" |
| 71 | android:background="@color/white" | 72 | android:background="@color/white" |