Commit 073283471f8a8611fcb9919302103ba45c47b7d6
Exists in
yxb_dev
and in
2 other branches
Merge branch 'yxb_dev' of http://git.shunzhi.net/taohd/parentwork into developer
Showing
26 changed files
with
573 additions
and
129 deletions
Show diff stats
app/src/main/AndroidManifest.xml
| @@ -101,6 +101,10 @@ | @@ -101,6 +101,10 @@ | ||
| 101 | android:name=".ui.activity.binding.CheckInfoActivity" | 101 | android:name=".ui.activity.binding.CheckInfoActivity" |
| 102 | android:screenOrientation="portrait" | 102 | android:screenOrientation="portrait" |
| 103 | android:windowSoftInputMode="adjustPan|stateHidden" /> | 103 | android:windowSoftInputMode="adjustPan|stateHidden" /> |
| 104 | + <activity | ||
| 105 | + android:name=".ui.activity.binding.InviteCodeActivity" | ||
| 106 | + android:screenOrientation="portrait" | ||
| 107 | + /> | ||
| 104 | <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity"></activity> | 108 | <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity"></activity> |
| 105 | 109 | ||
| 106 | </application> | 110 | </application> |
app/src/main/java/com/shunzhi/parent/AppConfig.java
| @@ -21,6 +21,7 @@ public class AppConfig { | @@ -21,6 +21,7 @@ public class AppConfig { | ||
| 21 | public static String USER_NAME = "user_name"; | 21 | public static String USER_NAME = "user_name"; |
| 22 | public static String USER_SEX = "user_sex"; | 22 | public static String USER_SEX = "user_sex"; |
| 23 | public static String USER_IMAGE = "user_image"; | 23 | public static String USER_IMAGE = "user_image"; |
| 24 | + public static String PARENT_ID = "parent_id"; | ||
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | //默认日志保存的路径 | 27 | //默认日志保存的路径 |
app/src/main/java/com/shunzhi/parent/api/MineApi.java
| 1 | package com.shunzhi.parent.api; | 1 | package com.shunzhi.parent.api; |
| 2 | 2 | ||
| 3 | import com.google.gson.JsonObject; | 3 | import com.google.gson.JsonObject; |
| 4 | +import com.shunzhi.parent.bean.GradeBean; | ||
| 4 | 5 | ||
| 5 | import io.reactivex.Observable; | 6 | import io.reactivex.Observable; |
| 6 | import retrofit2.http.Field; | 7 | import retrofit2.http.Field; |
| 7 | import retrofit2.http.FormUrlEncoded; | 8 | import retrofit2.http.FormUrlEncoded; |
| 9 | +import retrofit2.http.GET; | ||
| 8 | import retrofit2.http.POST; | 10 | import retrofit2.http.POST; |
| 11 | +import retrofit2.http.Query; | ||
| 9 | 12 | ||
| 10 | /** | 13 | /** |
| 11 | * Created by Administrator on 2018/3/7 0007. | 14 | * Created by Administrator on 2018/3/7 0007. |
| @@ -31,5 +34,7 @@ public interface MineApi { | @@ -31,5 +34,7 @@ public interface MineApi { | ||
| 31 | @Field("parentId") int parentId, @Field("mobileFlag") boolean mobileFlag, @Field("cooperateFlag") boolean cooperateFlag | 34 | @Field("parentId") int parentId, @Field("mobileFlag") boolean mobileFlag, @Field("cooperateFlag") boolean cooperateFlag |
| 32 | , @Field("schoolId") int schoolId, @Field("classId") int classId, @Field("studentId") int studentId, @Field("studentUserId") String studentUserId); | 35 | , @Field("schoolId") int schoolId, @Field("classId") int classId, @Field("studentId") int studentId, @Field("studentUserId") String studentUserId); |
| 33 | 36 | ||
| 37 | + @GET("/api/ParentHelper/GetClassOrGrade") | ||
| 38 | + Observable<GradeBean>getGradeAndClass(@Query("state") int state,@Query("schoolid") int schoolId,@Query("gradeid") int gradeId); | ||
| 34 | } | 39 | } |
| 35 | 40 |
app/src/main/java/com/shunzhi/parent/bean/ChildClass.java
0 → 100644
| @@ -0,0 +1,63 @@ | @@ -0,0 +1,63 @@ | ||
| 1 | +package com.shunzhi.parent.bean; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by Administrator on 2018/3/15 0015. | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +public class ChildClass implements Serializable{ | ||
| 10 | + private int gradeId; | ||
| 11 | + private String gradeName; | ||
| 12 | + private int classId; | ||
| 13 | + private String className; | ||
| 14 | + | ||
| 15 | + public int getGradeId() { | ||
| 16 | + return gradeId; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setGradeId(int gradeId) { | ||
| 20 | + this.gradeId = gradeId; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public String getGradeName() { | ||
| 24 | + return gradeName; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public void setGradeName(String gradeName) { | ||
| 28 | + this.gradeName = gradeName; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public int getClassId() { | ||
| 32 | + return classId; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public void setClassId(int classId) { | ||
| 36 | + this.classId = classId; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public String getClassName() { | ||
| 40 | + return className; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public void setClassName(String className) { | ||
| 44 | + this.className = className; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public String toString() { | ||
| 50 | + return "ChildClass{" + | ||
| 51 | + "gradeId='" + gradeId + '\'' + | ||
| 52 | + ",gradeName='" + gradeName + '\'' + | ||
| 53 | + ",classId='" + classId + '\'' + | ||
| 54 | + ", className=" + className + | ||
| 55 | + "}"; | ||
| 56 | + } | ||
| 57 | +} | ||
| 58 | +/** | ||
| 59 | + gradeId (integer, optional): 年段id , | ||
| 60 | + gradeName (string, optional): 年段名 , | ||
| 61 | + classId (integer, optional): 班级编号 , | ||
| 62 | + className (string, | ||
| 63 | + * */ | ||
| 0 | \ No newline at end of file | 64 | \ No newline at end of file |
app/src/main/java/com/shunzhi/parent/bean/CurrentBean.java
| @@ -15,10 +15,19 @@ public class CurrentBean implements Serializable{ | @@ -15,10 +15,19 @@ public class CurrentBean implements Serializable{ | ||
| 15 | private boolean bindSchoolFlag; | 15 | private boolean bindSchoolFlag; |
| 16 | private boolean bindingChildrenFlag; | 16 | private boolean bindingChildrenFlag; |
| 17 | private int parentId; | 17 | private int parentId; |
| 18 | + private int isNew; | ||
| 18 | private int sex; | 19 | private int sex; |
| 19 | private List<ChildBean> studentClass; | 20 | private List<ChildBean> studentClass; |
| 20 | 21 | ||
| 21 | 22 | ||
| 23 | + public int isNew() { | ||
| 24 | + return isNew; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public void setNew(int aNew) { | ||
| 28 | + isNew = aNew; | ||
| 29 | + } | ||
| 30 | + | ||
| 22 | public int getParentId() { | 31 | public int getParentId() { |
| 23 | return parentId; | 32 | return parentId; |
| 24 | } | 33 | } |
| @@ -98,6 +107,7 @@ public class CurrentBean implements Serializable{ | @@ -98,6 +107,7 @@ public class CurrentBean implements Serializable{ | ||
| 98 | ", name='" + name + '\'' + | 107 | ", name='" + name + '\'' + |
| 99 | ", image='" + image + '\'' + | 108 | ", image='" + image + '\'' + |
| 100 | ", mobile='" + mobile + '\'' + | 109 | ", mobile='" + mobile + '\'' + |
| 110 | + ", isNew='" + isNew + '\'' + | ||
| 101 | ", parentId='" + parentId + '\'' + | 111 | ", parentId='" + parentId + '\'' + |
| 102 | ", bindSchoolFlag='" + bindSchoolFlag + '\'' + | 112 | ", bindSchoolFlag='" + bindSchoolFlag + '\'' + |
| 103 | ", bindingChildrenFlag='" + bindingChildrenFlag + '\'' + | 113 | ", bindingChildrenFlag='" + bindingChildrenFlag + '\'' + |
app/src/main/java/com/shunzhi/parent/bean/GradeBean.java
0 → 100644
app/src/main/java/com/shunzhi/parent/contract/mine/MyChildContract.java
| @@ -4,7 +4,9 @@ import com.google.gson.JsonObject; | @@ -4,7 +4,9 @@ import com.google.gson.JsonObject; | ||
| 4 | import com.share.mvpsdk.base.BasePresenter; | 4 | import com.share.mvpsdk.base.BasePresenter; |
| 5 | import com.share.mvpsdk.base.IBaseActivity; | 5 | import com.share.mvpsdk.base.IBaseActivity; |
| 6 | import com.share.mvpsdk.base.IBaseModel; | 6 | import com.share.mvpsdk.base.IBaseModel; |
| 7 | -import com.shunzhi.parent.bean.ChildBean; | 7 | +import com.shunzhi.parent.bean.ChildClass; |
| 8 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 9 | +import com.shunzhi.parent.bean.GradeBean; | ||
| 8 | import com.shunzhi.parent.bean.UserInfo; | 10 | import com.shunzhi.parent.bean.UserInfo; |
| 9 | 11 | ||
| 10 | import java.util.List; | 12 | import java.util.List; |
| @@ -21,6 +23,7 @@ public interface MyChildContract { | @@ -21,6 +23,7 @@ public interface MyChildContract { | ||
| 21 | public abstract void loadChildList(String mobile, int school_id, String captcha); | 23 | public abstract void loadChildList(String mobile, int school_id, String captcha); |
| 22 | public abstract void addChild(int parentId, boolean mobileFlag,boolean cooperateFlag | 24 | public abstract void addChild(int parentId, boolean mobileFlag,boolean cooperateFlag |
| 23 | , int schoolId,int classId,int studentId,String studentUserId); | 25 | , int schoolId,int classId,int studentId,String studentUserId); |
| 26 | + public abstract void gradeAndClassResult(int state, int schooId,int gradeId); | ||
| 24 | 27 | ||
| 25 | } | 28 | } |
| 26 | 29 | ||
| @@ -28,12 +31,16 @@ public interface MyChildContract { | @@ -28,12 +31,16 @@ public interface MyChildContract { | ||
| 28 | Observable<UserInfo> getUserInfo(String mobile, int school_id, String captcha); | 31 | Observable<UserInfo> getUserInfo(String mobile, int school_id, String captcha); |
| 29 | Observable<JsonObject> addChildResult(int parentId, boolean mobileFlag,boolean cooperateFlag | 32 | Observable<JsonObject> addChildResult(int parentId, boolean mobileFlag,boolean cooperateFlag |
| 30 | , int schoolId,int classId,int studentId,String studentUserId); | 33 | , int schoolId,int classId,int studentId,String studentUserId); |
| 34 | + Observable<GradeBean> getGradeAndClass(int state, int schooId,int gradeId); | ||
| 31 | 35 | ||
| 32 | 36 | ||
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | interface IMyChildView extends IBaseActivity { | 39 | interface IMyChildView extends IBaseActivity { |
| 36 | - void updateChilsList(List<ChildBean> list); | 40 | + void updateChilsList(CurrentBean currentBean); |
| 41 | + void addChildSuccess(); | ||
| 42 | + void showClass(List<ChildClass>list); | ||
| 43 | + void showError(String error); | ||
| 37 | 44 | ||
| 38 | } | 45 | } |
| 39 | 46 |
app/src/main/java/com/shunzhi/parent/contract/mine/SchoolListContract.java
| @@ -4,7 +4,9 @@ import com.google.gson.JsonObject; | @@ -4,7 +4,9 @@ import com.google.gson.JsonObject; | ||
| 4 | import com.share.mvpsdk.base.BasePresenter; | 4 | import com.share.mvpsdk.base.BasePresenter; |
| 5 | import com.share.mvpsdk.base.IBaseActivity; | 5 | import com.share.mvpsdk.base.IBaseActivity; |
| 6 | import com.share.mvpsdk.base.IBaseModel; | 6 | import com.share.mvpsdk.base.IBaseModel; |
| 7 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 7 | import com.shunzhi.parent.bean.SchoolBean; | 8 | import com.shunzhi.parent.bean.SchoolBean; |
| 9 | +import com.shunzhi.parent.bean.UserInfo; | ||
| 8 | 10 | ||
| 9 | import java.util.List; | 11 | import java.util.List; |
| 10 | 12 | ||
| @@ -16,16 +18,18 @@ import io.reactivex.Observable; | @@ -16,16 +18,18 @@ import io.reactivex.Observable; | ||
| 16 | 18 | ||
| 17 | public interface SchoolListContract { | 19 | public interface SchoolListContract { |
| 18 | abstract class SchoolListPrasenter extends BasePresenter<ISchoolListModel,ISchoolListView> { | 20 | abstract class SchoolListPrasenter extends BasePresenter<ISchoolListModel,ISchoolListView> { |
| 21 | + public abstract void showChildInfo(String mobile, int school_id, String captcha); | ||
| 19 | public abstract void schoolListResult(String areaName, String key); | 22 | public abstract void schoolListResult(String areaName, String key); |
| 20 | } | 23 | } |
| 21 | 24 | ||
| 22 | interface ISchoolListModel extends IBaseModel { | 25 | interface ISchoolListModel extends IBaseModel { |
| 23 | Observable<JsonObject> getSchoolListResult(String areaName, String key); | 26 | Observable<JsonObject> getSchoolListResult(String areaName, String key); |
| 24 | - | 27 | + Observable<UserInfo> getUserInfo(String mobile, int school_id, String captcha); |
| 25 | 28 | ||
| 26 | } | 29 | } |
| 27 | interface ISchoolListView extends IBaseActivity { | 30 | interface ISchoolListView extends IBaseActivity { |
| 28 | void showList(List<SchoolBean> list); | 31 | void showList(List<SchoolBean> list); |
| 32 | + void showChild(CurrentBean currentBean); | ||
| 29 | } | 33 | } |
| 30 | 34 | ||
| 31 | } | 35 | } |
app/src/main/java/com/shunzhi/parent/model/mine/MyChildModel.java
| @@ -6,6 +6,7 @@ import com.share.mvpsdk.helper.RetrofitCreateHelper; | @@ -6,6 +6,7 @@ import com.share.mvpsdk.helper.RetrofitCreateHelper; | ||
| 6 | import com.share.mvpsdk.helper.RxHelper; | 6 | import com.share.mvpsdk.helper.RxHelper; |
| 7 | import com.shunzhi.parent.api.LoginRegisterApi; | 7 | import com.shunzhi.parent.api.LoginRegisterApi; |
| 8 | import com.shunzhi.parent.api.MineApi; | 8 | import com.shunzhi.parent.api.MineApi; |
| 9 | +import com.shunzhi.parent.bean.GradeBean; | ||
| 9 | import com.shunzhi.parent.bean.UserInfo; | 10 | import com.shunzhi.parent.bean.UserInfo; |
| 10 | import com.shunzhi.parent.contract.mine.MyChildContract; | 11 | import com.shunzhi.parent.contract.mine.MyChildContract; |
| 11 | 12 | ||
| @@ -34,4 +35,9 @@ public class MyChildModel extends BaseModel implements MyChildContract.IMyChildM | @@ -34,4 +35,9 @@ public class MyChildModel extends BaseModel implements MyChildContract.IMyChildM | ||
| 34 | return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).addChildResult(parentId,mobileFlag,cooperateFlag,schoolId | 35 | return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).addChildResult(parentId,mobileFlag,cooperateFlag,schoolId |
| 35 | ,classId,studentId,studentUserId).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 36 | ,classId,studentId,studentUserId).compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
| 36 | } | 37 | } |
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Observable<GradeBean> getGradeAndClass(int state, int schooId, int gradeId) { | ||
| 41 | + return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).getGradeAndClass(state,schooId,gradeId).compose(RxHelper.<GradeBean>rxSchedulerHelper()); | ||
| 42 | + } | ||
| 37 | } | 43 | } |
app/src/main/java/com/shunzhi/parent/model/mine/SchoolListModel.java
| @@ -4,7 +4,9 @@ import com.google.gson.JsonObject; | @@ -4,7 +4,9 @@ import com.google.gson.JsonObject; | ||
| 4 | import com.share.mvpsdk.base.BaseModel; | 4 | import com.share.mvpsdk.base.BaseModel; |
| 5 | import com.share.mvpsdk.helper.RetrofitCreateHelper; | 5 | import com.share.mvpsdk.helper.RetrofitCreateHelper; |
| 6 | import com.share.mvpsdk.helper.RxHelper; | 6 | import com.share.mvpsdk.helper.RxHelper; |
| 7 | +import com.shunzhi.parent.api.LoginRegisterApi; | ||
| 7 | import com.shunzhi.parent.api.MineApi; | 8 | import com.shunzhi.parent.api.MineApi; |
| 9 | +import com.shunzhi.parent.bean.UserInfo; | ||
| 8 | import com.shunzhi.parent.contract.mine.SchoolListContract; | 10 | import com.shunzhi.parent.contract.mine.SchoolListContract; |
| 9 | 11 | ||
| 10 | import io.reactivex.Observable; | 12 | import io.reactivex.Observable; |
| @@ -23,4 +25,10 @@ public class SchoolListModel extends BaseModel implements SchoolListContract.ISc | @@ -23,4 +25,10 @@ public class SchoolListModel extends BaseModel implements SchoolListContract.ISc | ||
| 23 | return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).getSchoolListResult(areaName,key) | 25 | return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).getSchoolListResult(areaName,key) |
| 24 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 26 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
| 25 | } | 27 | } |
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public Observable<UserInfo> getUserInfo(String mobile, int school_id, String captcha) { | ||
| 31 | + return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).getUserInfo(mobile,school_id,captcha) | ||
| 32 | + .compose(RxHelper.<UserInfo>rxSchedulerHelper()); | ||
| 33 | + } | ||
| 26 | } | 34 | } |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
| @@ -137,6 +137,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | @@ -137,6 +137,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre | ||
| 137 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_NAME, currentBean.getName()); | 137 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_NAME, currentBean.getName()); |
| 138 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_IMAGE, currentBean.getImage()); | 138 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_IMAGE, currentBean.getImage()); |
| 139 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_SEX, String.valueOf(currentBean.getSex())); | 139 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_SEX, String.valueOf(currentBean.getSex())); |
| 140 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.PARENT_ID, String.valueOf(currentBean.getParentId())); | ||
| 140 | mIView.getUserInfo(0); | 141 | mIView.getUserInfo(0); |
| 141 | 142 | ||
| 142 | } else { | 143 | } else { |
app/src/main/java/com/shunzhi/parent/presenter/mine/MyChildPresenter.java
| 1 | package com.shunzhi.parent.presenter.mine; | 1 | package com.shunzhi.parent.presenter.mine; |
| 2 | 2 | ||
| 3 | -import android.util.Log; | ||
| 4 | - | ||
| 5 | import com.google.gson.JsonObject; | 3 | import com.google.gson.JsonObject; |
| 6 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; | 4 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; |
| 7 | import com.share.mvpsdk.utils.ToastUtils; | 5 | import com.share.mvpsdk.utils.ToastUtils; |
| 8 | -import com.shunzhi.parent.bean.ChildBean; | 6 | +import com.shunzhi.parent.bean.ChildClass; |
| 9 | import com.shunzhi.parent.bean.CurrentBean; | 7 | import com.shunzhi.parent.bean.CurrentBean; |
| 8 | +import com.shunzhi.parent.bean.GradeBean; | ||
| 10 | import com.shunzhi.parent.bean.UserInfo; | 9 | import com.shunzhi.parent.bean.UserInfo; |
| 11 | import com.shunzhi.parent.contract.mine.MyChildContract; | 10 | import com.shunzhi.parent.contract.mine.MyChildContract; |
| 12 | import com.shunzhi.parent.model.mine.MyChildModel; | 11 | import com.shunzhi.parent.model.mine.MyChildModel; |
| @@ -38,13 +37,14 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { | @@ -38,13 +37,14 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { | ||
| 38 | @Override | 37 | @Override |
| 39 | public void accept(UserInfo userInfo) throws Exception { | 38 | public void accept(UserInfo userInfo) throws Exception { |
| 40 | CurrentBean currentBean = userInfo.getData(); | 39 | CurrentBean currentBean = userInfo.getData(); |
| 41 | - List<ChildBean> list = currentBean.getStudentClass(); | ||
| 42 | - mIView.updateChilsList(list); | 40 | +// List<ChildBean> list = currentBean.getStudentClass(); |
| 41 | + mIView.updateChilsList(currentBean); | ||
| 43 | } | 42 | } |
| 44 | }, new Consumer<Throwable>() { | 43 | }, new Consumer<Throwable>() { |
| 45 | @Override | 44 | @Override |
| 46 | public void accept(Throwable throwable) throws Exception { | 45 | public void accept(Throwable throwable) throws Exception { |
| 47 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | 46 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
| 47 | + mIView.showError("邀请码错误"); | ||
| 48 | } | 48 | } |
| 49 | })); | 49 | })); |
| 50 | 50 | ||
| @@ -55,16 +55,33 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { | @@ -55,16 +55,33 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { | ||
| 55 | mRxManager.register(mIModel.addChildResult(parentId, mobileFlag, cooperateFlag, schoolId, classId, studentId, studentUserId).subscribe(new Consumer<JsonObject>() { | 55 | mRxManager.register(mIModel.addChildResult(parentId, mobileFlag, cooperateFlag, schoolId, classId, studentId, studentUserId).subscribe(new Consumer<JsonObject>() { |
| 56 | @Override | 56 | @Override |
| 57 | public void accept(JsonObject jsonObject) throws Exception { | 57 | public void accept(JsonObject jsonObject) throws Exception { |
| 58 | - ToastUtils.showToast(jsonObject.toString()); | 58 | + ToastUtils.showToast("绑定孩子成功"); |
| 59 | + mIView.addChildSuccess(); | ||
| 59 | } | 60 | } |
| 60 | }, new Consumer<Throwable>() { | 61 | }, new Consumer<Throwable>() { |
| 61 | @Override | 62 | @Override |
| 62 | public void accept(Throwable throwable) throws Exception { | 63 | public void accept(Throwable throwable) throws Exception { |
| 63 | - | 64 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
| 64 | } | 65 | } |
| 65 | })); | 66 | })); |
| 66 | 67 | ||
| 67 | 68 | ||
| 68 | } | 69 | } |
| 69 | 70 | ||
| 71 | + @Override | ||
| 72 | + public void gradeAndClassResult(int state, int schooId, int gradeId) { | ||
| 73 | + mRxManager.register(mIModel.getGradeAndClass(state, schooId, gradeId).subscribe(new Consumer<GradeBean>() { | ||
| 74 | + @Override | ||
| 75 | + public void accept(GradeBean gradeBean) throws Exception { | ||
| 76 | + List<ChildClass> list=gradeBean.getData(); | ||
| 77 | + mIView.showClass(list); | ||
| 78 | + } | ||
| 79 | + }, new Consumer<Throwable>() { | ||
| 80 | + @Override | ||
| 81 | + public void accept(Throwable throwable) throws Exception { | ||
| 82 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | ||
| 83 | + } | ||
| 84 | + })); | ||
| 85 | + } | ||
| 86 | + | ||
| 70 | } | 87 | } |
app/src/main/java/com/shunzhi/parent/presenter/mine/SchoolListPrasenter.java
| @@ -4,7 +4,9 @@ import com.google.gson.Gson; | @@ -4,7 +4,9 @@ import com.google.gson.Gson; | ||
| 4 | import com.google.gson.JsonArray; | 4 | import com.google.gson.JsonArray; |
| 5 | import com.google.gson.JsonObject; | 5 | import com.google.gson.JsonObject; |
| 6 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; | 6 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; |
| 7 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 7 | import com.shunzhi.parent.bean.SchoolBean; | 8 | import com.shunzhi.parent.bean.SchoolBean; |
| 9 | +import com.shunzhi.parent.bean.UserInfo; | ||
| 8 | import com.shunzhi.parent.contract.mine.SchoolListContract; | 10 | import com.shunzhi.parent.contract.mine.SchoolListContract; |
| 9 | import com.shunzhi.parent.model.mine.SchoolListModel; | 11 | import com.shunzhi.parent.model.mine.SchoolListModel; |
| 10 | 12 | ||
| @@ -31,6 +33,23 @@ public class SchoolListPrasenter extends SchoolListContract.SchoolListPrasenter | @@ -31,6 +33,23 @@ public class SchoolListPrasenter extends SchoolListContract.SchoolListPrasenter | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | @Override | 35 | @Override |
| 36 | + public void showChildInfo(String mobile, int school_id, String captcha) { | ||
| 37 | + mRxManager.register(mIModel.getUserInfo(mobile, school_id, captcha).subscribe(new Consumer<UserInfo>() { | ||
| 38 | + @Override | ||
| 39 | + public void accept(UserInfo userInfo) throws Exception { | ||
| 40 | + CurrentBean currentBean = userInfo.getData(); | ||
| 41 | +// List<ChildBean> list = currentBean.getStudentClass(); | ||
| 42 | + mIView.showChild(currentBean); | ||
| 43 | + } | ||
| 44 | + }, new Consumer<Throwable>() { | ||
| 45 | + @Override | ||
| 46 | + public void accept(Throwable throwable) throws Exception { | ||
| 47 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | ||
| 48 | + } | ||
| 49 | + })); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 34 | public void schoolListResult(String areaName, String key) { | 53 | public void schoolListResult(String areaName, String key) { |
| 35 | mRxManager.register(mIModel.getSchoolListResult(areaName, key).subscribe(new Consumer<JsonObject>() { | 54 | mRxManager.register(mIModel.getSchoolListResult(areaName, key).subscribe(new Consumer<JsonObject>() { |
| 36 | @Override | 55 | @Override |
app/src/main/java/com/shunzhi/parent/ui/MainActivity.java
| @@ -5,7 +5,6 @@ import android.support.annotation.NonNull; | @@ -5,7 +5,6 @@ import android.support.annotation.NonNull; | ||
| 5 | import android.support.design.widget.BottomNavigationView; | 5 | import android.support.design.widget.BottomNavigationView; |
| 6 | import android.support.v4.app.Fragment; | 6 | import android.support.v4.app.Fragment; |
| 7 | import android.support.v4.app.FragmentTransaction; | 7 | import android.support.v4.app.FragmentTransaction; |
| 8 | -import android.util.Log; | ||
| 9 | import android.view.MenuItem; | 8 | import android.view.MenuItem; |
| 10 | 9 | ||
| 11 | import com.share.mvpsdk.base.activity.BaseCompatActivity; | 10 | import com.share.mvpsdk.base.activity.BaseCompatActivity; |
| @@ -18,9 +17,6 @@ import com.shunzhi.parent.ui.fragment.ConsultFragment; | @@ -18,9 +17,6 @@ import com.shunzhi.parent.ui.fragment.ConsultFragment; | ||
| 18 | import com.shunzhi.parent.ui.fragment.MineFragment; | 17 | import com.shunzhi.parent.ui.fragment.MineFragment; |
| 19 | import com.shunzhi.parent.ui.fragment.ReportFragment; | 18 | import com.shunzhi.parent.ui.fragment.ReportFragment; |
| 20 | 19 | ||
| 21 | -import java.util.Calendar; | ||
| 22 | -import java.util.Date; | ||
| 23 | - | ||
| 24 | public class MainActivity extends BaseCompatActivity implements PermissionUtils.PermissionGrant { | 20 | public class MainActivity extends BaseCompatActivity implements PermissionUtils.PermissionGrant { |
| 25 | 21 | ||
| 26 | BottomNavigationView bottom_navigationView; | 22 | BottomNavigationView bottom_navigationView; |
| @@ -89,10 +85,10 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. | @@ -89,10 +85,10 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. | ||
| 89 | .add(R.id.frame, consultFragment) | 85 | .add(R.id.frame, consultFragment) |
| 90 | .add(R.id.frame, reportFragment) | 86 | .add(R.id.frame, reportFragment) |
| 91 | .add(R.id.frame, mineFragment) | 87 | .add(R.id.frame, mineFragment) |
| 92 | - .show(cePingFragment) | 88 | + .show(mineFragment) |
| 93 | .hide(consultFragment) | 89 | .hide(consultFragment) |
| 94 | .hide(reportFragment) | 90 | .hide(reportFragment) |
| 95 | - .hide(mineFragment) | 91 | + .hide(cePingFragment) |
| 96 | .commit(); | 92 | .commit(); |
| 97 | } | 93 | } |
| 98 | 94 | ||
| @@ -124,7 +120,5 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. | @@ -124,7 +120,5 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. | ||
| 124 | @Override | 120 | @Override |
| 125 | protected void onResume() { | 121 | protected void onResume() { |
| 126 | super.onResume(); | 122 | super.onResume(); |
| 127 | - Date l= Calendar.getInstance().getTime(); | ||
| 128 | - Log.e("2222--==",l.getTime()+""); | ||
| 129 | } | 123 | } |
| 130 | } | 124 | } |
app/src/main/java/com/shunzhi/parent/ui/activity/MyChildActivity.java
| @@ -21,8 +21,11 @@ import com.shunzhi.parent.AppContext; | @@ -21,8 +21,11 @@ import com.shunzhi.parent.AppContext; | ||
| 21 | import com.shunzhi.parent.R; | 21 | import com.shunzhi.parent.R; |
| 22 | import com.shunzhi.parent.adapter.ChildAdapter; | 22 | import com.shunzhi.parent.adapter.ChildAdapter; |
| 23 | import com.shunzhi.parent.bean.ChildBean; | 23 | import com.shunzhi.parent.bean.ChildBean; |
| 24 | +import com.shunzhi.parent.bean.ChildClass; | ||
| 25 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 24 | import com.shunzhi.parent.contract.mine.MyChildContract; | 26 | import com.shunzhi.parent.contract.mine.MyChildContract; |
| 25 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; | 27 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; |
| 28 | +import com.shunzhi.parent.ui.MainActivity; | ||
| 26 | import com.shunzhi.parent.ui.activity.binding.SelectSchoolActivity; | 29 | import com.shunzhi.parent.ui.activity.binding.SelectSchoolActivity; |
| 27 | import com.yanzhenjie.recyclerview.swipe.SwipeMenu; | 30 | import com.yanzhenjie.recyclerview.swipe.SwipeMenu; |
| 28 | import com.yanzhenjie.recyclerview.swipe.SwipeMenuBridge; | 31 | import com.yanzhenjie.recyclerview.swipe.SwipeMenuBridge; |
| @@ -108,6 +111,7 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi | @@ -108,6 +111,7 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi | ||
| 108 | @Override | 111 | @Override |
| 109 | public void onClick(View v) { | 112 | public void onClick(View v) { |
| 110 | if (v == back) { | 113 | if (v == back) { |
| 114 | + startActivity(new Intent().setClass(MyChildActivity.this, MainActivity.class)); | ||
| 111 | finish(); | 115 | finish(); |
| 112 | } else if (v == add_child) { | 116 | } else if (v == add_child) { |
| 113 | startActivity(new Intent().setClass(MyChildActivity.this, SelectSchoolActivity.class)); | 117 | startActivity(new Intent().setClass(MyChildActivity.this, SelectSchoolActivity.class)); |
| @@ -115,13 +119,29 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi | @@ -115,13 +119,29 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi | ||
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | @Override | 121 | @Override |
| 118 | - public void updateChilsList(List<ChildBean> list) { | 122 | + public void updateChilsList(CurrentBean currentBean) { |
| 123 | + List<ChildBean>list=currentBean.getStudentClass(); | ||
| 119 | childAdapter = new ChildAdapter(this); | 124 | childAdapter = new ChildAdapter(this); |
| 120 | childAdapter.addAll(list); | 125 | childAdapter.addAll(list); |
| 121 | child_recycle.setAdapter(childAdapter); | 126 | child_recycle.setAdapter(childAdapter); |
| 122 | 127 | ||
| 123 | } | 128 | } |
| 124 | 129 | ||
| 130 | + @Override | ||
| 131 | + public void addChildSuccess() { | ||
| 132 | + | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + @Override | ||
| 136 | + public void showClass(List<ChildClass> list) { | ||
| 137 | + | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + @Override | ||
| 141 | + public void showError(String error) { | ||
| 142 | + | ||
| 143 | + } | ||
| 144 | + | ||
| 125 | private SwipeMenuCreator swipeMenuCreator = new SwipeMenuCreator() { | 145 | private SwipeMenuCreator swipeMenuCreator = new SwipeMenuCreator() { |
| 126 | @Override | 146 | @Override |
| 127 | public void onCreateMenu(SwipeMenu swipeLeftMenu, SwipeMenu swipeRightMenu, int viewType) { | 147 | public void onCreateMenu(SwipeMenu swipeLeftMenu, SwipeMenu swipeRightMenu, int viewType) { |
app/src/main/java/com/shunzhi/parent/ui/activity/PersonInfoActivity.java
| @@ -26,7 +26,7 @@ import com.shunzhi.parent.presenter.mine.PersonInfoPrasenter; | @@ -26,7 +26,7 @@ import com.shunzhi.parent.presenter.mine.PersonInfoPrasenter; | ||
| 26 | public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract.PersonInfoPresenter, PersonInfoContract.IPersonInfoModel> | 26 | public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract.PersonInfoPresenter, PersonInfoContract.IPersonInfoModel> |
| 27 | implements PersonInfoContract.IPersonInfoView, View.OnClickListener { | 27 | implements PersonInfoContract.IPersonInfoView, View.OnClickListener { |
| 28 | RoundedImageView user_image; | 28 | RoundedImageView user_image; |
| 29 | - TextView user_name, user_mobile, change_info; | 29 | + TextView user_name, user_mobile, change_info,center_title,back; |
| 30 | EditText et_name; | 30 | EditText et_name; |
| 31 | RadioButton man, women; | 31 | RadioButton man, women; |
| 32 | 32 | ||
| @@ -44,6 +44,9 @@ public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract | @@ -44,6 +44,9 @@ public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract | ||
| 44 | user_mobile = findViewById(R.id.user_mobile); | 44 | user_mobile = findViewById(R.id.user_mobile); |
| 45 | et_name = findViewById(R.id.et_name); | 45 | et_name = findViewById(R.id.et_name); |
| 46 | et_name.setOnClickListener(this); | 46 | et_name.setOnClickListener(this); |
| 47 | + back = findViewById(R.id.back_top); | ||
| 48 | + center_title = findViewById(R.id.center_title); | ||
| 49 | + center_title.setText("选择孩子学校"); | ||
| 47 | man = findViewById(R.id.man); | 50 | man = findViewById(R.id.man); |
| 48 | women = findViewById(R.id.women); | 51 | women = findViewById(R.id.women); |
| 49 | change_info = findViewById(R.id.change_info); | 52 | change_info = findViewById(R.id.change_info); |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/CheckInfoActivity.java
| 1 | package com.shunzhi.parent.ui.activity.binding; | 1 | package com.shunzhi.parent.ui.activity.binding; |
| 2 | 2 | ||
| 3 | +import android.content.Intent; | ||
| 3 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 4 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
| 5 | -import android.util.Log; | 6 | +import android.text.TextUtils; |
| 7 | +import android.view.Gravity; | ||
| 8 | +import android.view.LayoutInflater; | ||
| 6 | import android.view.View; | 9 | import android.view.View; |
| 10 | +import android.view.ViewGroup; | ||
| 11 | +import android.view.WindowManager; | ||
| 7 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
| 13 | +import android.widget.PopupWindow; | ||
| 8 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 9 | 15 | ||
| 10 | import com.share.mvpsdk.base.BasePresenter; | 16 | import com.share.mvpsdk.base.BasePresenter; |
| @@ -14,8 +20,11 @@ import com.shunzhi.parent.AppConfig; | @@ -14,8 +20,11 @@ import com.shunzhi.parent.AppConfig; | ||
| 14 | import com.shunzhi.parent.AppContext; | 20 | import com.shunzhi.parent.AppContext; |
| 15 | import com.shunzhi.parent.R; | 21 | import com.shunzhi.parent.R; |
| 16 | import com.shunzhi.parent.bean.ChildBean; | 22 | import com.shunzhi.parent.bean.ChildBean; |
| 23 | +import com.shunzhi.parent.bean.ChildClass; | ||
| 24 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 17 | import com.shunzhi.parent.contract.mine.MyChildContract; | 25 | import com.shunzhi.parent.contract.mine.MyChildContract; |
| 18 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; | 26 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; |
| 27 | +import com.shunzhi.parent.ui.activity.MyChildActivity; | ||
| 19 | 28 | ||
| 20 | import java.util.List; | 29 | import java.util.List; |
| 21 | 30 | ||
| @@ -25,9 +34,10 @@ import java.util.List; | @@ -25,9 +34,10 @@ import java.util.List; | ||
| 25 | 34 | ||
| 26 | public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel> | 35 | public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel> |
| 27 | implements MyChildContract.IMyChildView, View.OnClickListener { | 36 | implements MyChildContract.IMyChildView, View.OnClickListener { |
| 28 | - int school_id; | 37 | + int school_id = 0, isNew, classId, studentId; |
| 38 | + String captcha = ""; | ||
| 29 | LinearLayout iphone_layout; | 39 | LinearLayout iphone_layout; |
| 30 | - TextView child_name, child_sex, child_grade, child_class, add_child, user_mobile; | 40 | + TextView child_name, child_sex, child_grade, child_class, add_child, user_mobile, back, center_title; |
| 31 | ChildBean childBean; | 41 | ChildBean childBean; |
| 32 | 42 | ||
| 33 | @NonNull | 43 | @NonNull |
| @@ -39,6 +49,9 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | @@ -39,6 +49,9 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | ||
| 39 | @Override | 49 | @Override |
| 40 | protected void initView(Bundle savedInstanceState) { | 50 | protected void initView(Bundle savedInstanceState) { |
| 41 | iphone_layout = findViewById(R.id.iphone_layout); | 51 | iphone_layout = findViewById(R.id.iphone_layout); |
| 52 | + back = findViewById(R.id.back_top); | ||
| 53 | + center_title = findViewById(R.id.center_title); | ||
| 54 | + center_title.setText("信息核对"); | ||
| 42 | child_name = findViewById(R.id.child_name); | 55 | child_name = findViewById(R.id.child_name); |
| 43 | child_sex = findViewById(R.id.child_sex); | 56 | child_sex = findViewById(R.id.child_sex); |
| 44 | child_grade = findViewById(R.id.child_grade); | 57 | child_grade = findViewById(R.id.child_grade); |
| @@ -46,10 +59,10 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | @@ -46,10 +59,10 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | ||
| 46 | add_child = findViewById(R.id.add_child); | 59 | add_child = findViewById(R.id.add_child); |
| 47 | add_child.setOnClickListener(this); | 60 | add_child.setOnClickListener(this); |
| 48 | user_mobile = findViewById(R.id.user_mobile); | 61 | user_mobile = findViewById(R.id.user_mobile); |
| 62 | + school_id = getIntent().getIntExtra("school_id", 0); | ||
| 63 | + captcha = getIntent().getStringExtra("captcha"); | ||
| 64 | + mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), school_id, captcha); | ||
| 49 | 65 | ||
| 50 | -// school_id = getIntent().getIntExtra("school_id", 0); | ||
| 51 | -// Log.e("aaaa--==",school_id+""); | ||
| 52 | - mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 1, ""); | ||
| 53 | } | 66 | } |
| 54 | 67 | ||
| 55 | @Override | 68 | @Override |
| @@ -59,16 +72,54 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | @@ -59,16 +72,54 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | ||
| 59 | 72 | ||
| 60 | @Override | 73 | @Override |
| 61 | public void onClick(View v) { | 74 | public void onClick(View v) { |
| 62 | - Log.e("qqqq--==",childBean.getStudentUserId()); | ||
| 63 | - mPresenter.addChild(0, true, true, 0, 0, 0, childBean.getStudentUserId()); | 75 | + if (!TextUtils.isEmpty(child_name.getText()) && !TextUtils.isEmpty(child_sex.getText()) |
| 76 | + && !TextUtils.isEmpty(child_grade.getText()) && !TextUtils.isEmpty(child_class.getText())) { | ||
| 77 | + if (isNew == 0) { | ||
| 78 | + mPresenter.addChild(0, true, true, 0, 0, 0, childBean.getStudentUserId()); | ||
| 79 | + } else { | ||
| 80 | + mPresenter.addChild(Integer.parseInt(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.PARENT_ID)), false, true, 0, classId, studentId, ""); | ||
| 81 | + } | ||
| 82 | + } else { | ||
| 83 | + final PopupWindow popupWindow = new PopupWindow(); | ||
| 84 | + popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 85 | + popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 86 | + backgroundAlpha(0.5f); | ||
| 87 | + View view = LayoutInflater.from(this).inflate(R.layout.dialog_view, null); | ||
| 88 | + TextView dialog_info = view.findViewById(R.id.dialog_info); | ||
| 89 | + dialog_info.setText("当前无可绑定孩子,点击确认返回孩子列表"); | ||
| 90 | + dialog_info.setGravity(Gravity.CENTER); | ||
| 91 | + TextView right_btn = view.findViewById(R.id.right_btn); | ||
| 92 | + right_btn.setOnClickListener(new View.OnClickListener() { | ||
| 93 | + @Override | ||
| 94 | + public void onClick(View v) { | ||
| 95 | + startActivity(new Intent().setClass(CheckInfoActivity.this, MyChildActivity.class)); | ||
| 96 | + finish(); | ||
| 97 | + } | ||
| 98 | + }); | ||
| 99 | + TextView cancel_btn = view.findViewById(R.id.cancel_btn); | ||
| 100 | + cancel_btn.setOnClickListener(new View.OnClickListener() { | ||
| 101 | + @Override | ||
| 102 | + public void onClick(View v) { | ||
| 103 | + popupWindow.dismiss(); | ||
| 104 | + backgroundAlpha(1f); | ||
| 105 | + } | ||
| 106 | + }); | ||
| 107 | + | ||
| 108 | + popupWindow.setContentView(view); | ||
| 109 | + popupWindow.showAtLocation(iphone_layout, Gravity.CENTER, 0, 0); | ||
| 110 | + } | ||
| 64 | } | 111 | } |
| 65 | 112 | ||
| 66 | @Override | 113 | @Override |
| 67 | - public void updateChilsList(List<ChildBean> list) { | ||
| 68 | - if (list != null&&list.size()>0) { | 114 | + public void updateChilsList(CurrentBean currentBean) { |
| 115 | + List<ChildBean> list = currentBean.getStudentClass(); | ||
| 116 | + isNew = currentBean.isNew(); | ||
| 117 | + user_mobile.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); | ||
| 118 | + if (list.size() > 0 && list != null) { | ||
| 69 | childBean = list.get(0); | 119 | childBean = list.get(0); |
| 120 | + classId = childBean.getClassId(); | ||
| 121 | + studentId = childBean.getStudentId(); | ||
| 70 | iphone_layout.setVisibility(View.VISIBLE); | 122 | iphone_layout.setVisibility(View.VISIBLE); |
| 71 | - user_mobile.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); | ||
| 72 | child_name.setText(childBean.getStudentName()); | 123 | child_name.setText(childBean.getStudentName()); |
| 73 | int sex = childBean.getSex(); | 124 | int sex = childBean.getSex(); |
| 74 | String sexStr = "未知"; | 125 | String sexStr = "未知"; |
| @@ -82,8 +133,62 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | @@ -82,8 +133,62 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC | ||
| 82 | child_grade.setText(childBean.getGradename()); | 133 | child_grade.setText(childBean.getGradename()); |
| 83 | child_class.setText(childBean.getClassName()); | 134 | child_class.setText(childBean.getClassName()); |
| 84 | } else { | 135 | } else { |
| 136 | + ToastUtils.showToast("该账号下无需要绑定的孩子"); | ||
| 137 | + } | ||
| 138 | + if (currentBean.isNew() == 1) { | ||
| 139 | + iphone_layout.setVisibility(View.INVISIBLE); | ||
| 85 | 140 | ||
| 86 | - ToastUtils.showToast("1111111"); | ||
| 87 | } | 141 | } |
| 88 | } | 142 | } |
| 143 | + | ||
| 144 | + @Override | ||
| 145 | + public void addChildSuccess() { | ||
| 146 | + startActivity(new Intent().setClass(CheckInfoActivity.this, MyChildActivity.class)); | ||
| 147 | + finish(); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + @Override | ||
| 151 | + public void showClass(List<ChildClass> list) { | ||
| 152 | + | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + @Override | ||
| 156 | + public void showError(String error) { | ||
| 157 | + final PopupWindow popupWindow = new PopupWindow(); | ||
| 158 | + popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 159 | + popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 160 | + backgroundAlpha(0.5f); | ||
| 161 | + View view = LayoutInflater.from(this).inflate(R.layout.dialog_view, null); | ||
| 162 | + TextView dialog_info = view.findViewById(R.id.dialog_info); | ||
| 163 | + dialog_info.setText(error); | ||
| 164 | + dialog_info.setGravity(Gravity.CENTER); | ||
| 165 | + TextView right_btn = view.findViewById(R.id.right_btn); | ||
| 166 | + right_btn.setText("退出绑定"); | ||
| 167 | + right_btn.setOnClickListener(new View.OnClickListener() { | ||
| 168 | + @Override | ||
| 169 | + public void onClick(View v) { | ||
| 170 | + startActivity(new Intent().setClass(CheckInfoActivity.this, MyChildActivity.class)); | ||
| 171 | + finish(); | ||
| 172 | + } | ||
| 173 | + }); | ||
| 174 | + TextView cancel_btn = view.findViewById(R.id.cancel_btn); | ||
| 175 | + cancel_btn.setText("返回"); | ||
| 176 | + cancel_btn.setOnClickListener(new View.OnClickListener() { | ||
| 177 | + @Override | ||
| 178 | + public void onClick(View v) { | ||
| 179 | + popupWindow.dismiss(); | ||
| 180 | + startActivity(new Intent().putExtra("school_id", school_id).setClass(CheckInfoActivity.this, InviteCodeActivity.class)); | ||
| 181 | + finish(); | ||
| 182 | + } | ||
| 183 | + }); | ||
| 184 | + | ||
| 185 | + popupWindow.setContentView(view); | ||
| 186 | + popupWindow.showAtLocation(iphone_layout, Gravity.CENTER, 0, 0); | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + public void backgroundAlpha(float bgAlpha) { | ||
| 190 | + WindowManager.LayoutParams lp = getWindow().getAttributes(); | ||
| 191 | + lp.alpha = bgAlpha; //0.0-1.0 | ||
| 192 | + getWindow().setAttributes(lp); | ||
| 193 | + } | ||
| 89 | } | 194 | } |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/CreateChildInfoActivity.java
| 1 | package com.shunzhi.parent.ui.activity.binding; | 1 | package com.shunzhi.parent.ui.activity.binding; |
| 2 | 2 | ||
| 3 | +import android.content.Intent; | ||
| 3 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 4 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
| 6 | +import android.support.v4.util.ArrayMap; | ||
| 7 | +import android.text.TextUtils; | ||
| 8 | +import android.view.ContextMenu; | ||
| 9 | +import android.view.MenuItem; | ||
| 10 | +import android.view.View; | ||
| 11 | +import android.widget.EditText; | ||
| 12 | +import android.widget.TextView; | ||
| 5 | 13 | ||
| 6 | import com.share.mvpsdk.base.BasePresenter; | 14 | import com.share.mvpsdk.base.BasePresenter; |
| 7 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | 15 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
| 16 | +import com.share.mvpsdk.utils.ToastUtils; | ||
| 17 | +import com.shunzhi.parent.AppConfig; | ||
| 18 | +import com.shunzhi.parent.AppContext; | ||
| 8 | import com.shunzhi.parent.R; | 19 | import com.shunzhi.parent.R; |
| 20 | +import com.shunzhi.parent.bean.ChildClass; | ||
| 21 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 22 | +import com.shunzhi.parent.contract.mine.MyChildContract; | ||
| 23 | +import com.shunzhi.parent.presenter.mine.MyChildPresenter; | ||
| 24 | +import com.shunzhi.parent.ui.activity.MyChildActivity; | ||
| 25 | + | ||
| 26 | +import java.util.ArrayList; | ||
| 27 | +import java.util.List; | ||
| 28 | +import java.util.Map; | ||
| 9 | 29 | ||
| 10 | /** | 30 | /** |
| 11 | * Created by Administrator on 2018/3/13 0013. | 31 | * Created by Administrator on 2018/3/13 0013. |
| 12 | */ | 32 | */ |
| 13 | 33 | ||
| 14 | -public class CreateChildInfoActivity extends BaseMVPCompatActivity{ | 34 | +public class CreateChildInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel> |
| 35 | + implements MyChildContract.IMyChildView, View.OnClickListener { | ||
| 36 | + | ||
| 37 | + int type, school_id, sexId, gradeId, classId; | ||
| 38 | + TextView select_sex, select_grade, select_class, add_child, center_title, back; | ||
| 39 | + EditText child_name; | ||
| 40 | + Map<String, Integer> currMap = new ArrayMap<>(); | ||
| 41 | + List<ChildClass> gradeList = new ArrayList<>(); | ||
| 42 | + List<ChildClass> classList = new ArrayList<>(); | ||
| 43 | + List<String> sexList = new ArrayList<>(); | ||
| 44 | + | ||
| 15 | @NonNull | 45 | @NonNull |
| 16 | @Override | 46 | @Override |
| 17 | public BasePresenter initPresenter() { | 47 | public BasePresenter initPresenter() { |
| 18 | - return null; | 48 | + return new MyChildPresenter(); |
| 19 | } | 49 | } |
| 20 | 50 | ||
| 21 | @Override | 51 | @Override |
| 22 | protected void initView(Bundle savedInstanceState) { | 52 | protected void initView(Bundle savedInstanceState) { |
| 53 | + school_id = getIntent().getIntExtra("school_id", 0); | ||
| 54 | + initGrade(school_id); | ||
| 55 | + center_title = findViewById(R.id.center_title); | ||
| 56 | + center_title.setText("填写孩子信息"); | ||
| 57 | + back = findViewById(R.id.back_top); | ||
| 58 | + add_child = findViewById(R.id.add_child); | ||
| 59 | + child_name = findViewById(R.id.child_name); | ||
| 60 | + select_sex = findViewById(R.id.select_sex); | ||
| 61 | + select_grade = findViewById(R.id.select_grade); | ||
| 62 | + select_class = findViewById(R.id.select_class); | ||
| 63 | + select_sex.setOnClickListener(this); | ||
| 64 | + select_grade.setOnClickListener(this); | ||
| 65 | + select_class.setOnClickListener(this); | ||
| 66 | + registerForContextMenu(select_sex); | ||
| 67 | + sexList.add("男"); | ||
| 68 | + sexList.add("女"); | ||
| 69 | + | ||
| 70 | + } | ||
| 23 | 71 | ||
| 72 | + private void initGrade(int school_id) { | ||
| 73 | + mPresenter.gradeAndClassResult(1, school_id, 0); | ||
| 24 | } | 74 | } |
| 25 | 75 | ||
| 26 | @Override | 76 | @Override |
| 27 | protected int getLayoutId() { | 77 | protected int getLayoutId() { |
| 28 | return R.layout.activity_create_childinfo; | 78 | return R.layout.activity_create_childinfo; |
| 29 | } | 79 | } |
| 30 | -} | 80 | + |
| 81 | + @Override | ||
| 82 | + public void onClick(View v) { | ||
| 83 | + currMap.clear(); | ||
| 84 | + if (v == add_child) { | ||
| 85 | + if (!TextUtils.isEmpty(child_name.getText()) && !TextUtils.isEmpty(select_sex.getText()) | ||
| 86 | + && !TextUtils.isEmpty(select_grade.getText()) && !TextUtils.isEmpty(select_class.getText())) { | ||
| 87 | + mPresenter.addChild(Integer.parseInt(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.PARENT_ID)) | ||
| 88 | + , true, false, school_id, classId, 0, ""); | ||
| 89 | + } else { | ||
| 90 | + ToastUtils.showToast("请填写完整的孩子信息"); | ||
| 91 | + } | ||
| 92 | + } else { | ||
| 93 | + if (v == select_sex) { | ||
| 94 | + type = 0; | ||
| 95 | + currMap.put("男", 1); | ||
| 96 | + currMap.put("女", 2); | ||
| 97 | + } else if (v == select_grade) { | ||
| 98 | + type = 1; | ||
| 99 | + for (int i = 0; i < gradeList.size(); i++) { | ||
| 100 | + currMap.put(gradeList.get(i).getGradeName(), gradeList.get(i).getGradeId()); | ||
| 101 | + } | ||
| 102 | + } else if (v == select_class) { | ||
| 103 | + type = 2; | ||
| 104 | + if (!TextUtils.isEmpty(select_grade.getText().toString())) { | ||
| 105 | + for (int i = 0; i < classList.size(); i++) { | ||
| 106 | + currMap.put(classList.get(i).getClassName(), classList.get(i).getClassId()); | ||
| 107 | + } | ||
| 108 | + } else { | ||
| 109 | + ToastUtils.showToast("请先选择年级"); | ||
| 110 | + return; | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + openContextMenu(v); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + @Override | ||
| 119 | + public void updateChilsList(CurrentBean currentBean) { | ||
| 120 | + | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @Override | ||
| 124 | + public void addChildSuccess() { | ||
| 125 | + startActivity(new Intent().setClass(CreateChildInfoActivity.this, MyChildActivity.class)); | ||
| 126 | + finish(); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + @Override | ||
| 130 | + public void showClass(List<ChildClass> list) { | ||
| 131 | + if (list.size() > 0 && list != null) { | ||
| 132 | + if (list.get(0).getGradeId() == 0) { | ||
| 133 | + //班级列表 | ||
| 134 | + classList = list; | ||
| 135 | + } else { | ||
| 136 | + //年级列表 | ||
| 137 | + gradeList = list; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + @Override | ||
| 144 | + public void showError(String error) { | ||
| 145 | + | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + | ||
| 149 | + @Override | ||
| 150 | + public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { | ||
| 151 | + super.onCreateContextMenu(menu, v, menuInfo); | ||
| 152 | + if (type == 0) { | ||
| 153 | + for (int i = 0; i < sexList.size(); i++) { | ||
| 154 | + try { | ||
| 155 | + final String title = sexList.get(i); | ||
| 156 | + menu.add(0, i, 0, title).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { | ||
| 157 | + @Override | ||
| 158 | + public boolean onMenuItemClick(MenuItem item) { | ||
| 159 | + select_sex.setText(item.getTitle()); | ||
| 160 | + sexId = currMap.get(item.getTitle()); | ||
| 161 | + return false; | ||
| 162 | + } | ||
| 163 | + }); | ||
| 164 | + } catch (NumberFormatException e) { | ||
| 165 | + e.printStackTrace(); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + } else if (type == 1) { | ||
| 170 | + for (int i = 0; i < gradeList.size(); i++) { | ||
| 171 | + try { | ||
| 172 | + final String title = gradeList.get(i).getClassName(); | ||
| 173 | + menu.add(0, i, 0, title).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { | ||
| 174 | + @Override | ||
| 175 | + public boolean onMenuItemClick(MenuItem item) { | ||
| 176 | + select_grade.setText(item.getTitle()); | ||
| 177 | + gradeId = currMap.get(item.getTitle()); | ||
| 178 | + showGrade(currMap.get(item.getTitle())); | ||
| 179 | + return false; | ||
| 180 | + } | ||
| 181 | + }); | ||
| 182 | + } catch (NumberFormatException e) { | ||
| 183 | + e.printStackTrace(); | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + } else if (type == 2) { | ||
| 187 | + for (int i = 0; i < classList.size(); i++) { | ||
| 188 | + try { | ||
| 189 | + final String title = classList.get(i).getGradeName(); | ||
| 190 | + menu.add(0, i, 0, title).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { | ||
| 191 | + @Override | ||
| 192 | + public boolean onMenuItemClick(MenuItem item) { | ||
| 193 | + select_class.setText(item.getTitle()); | ||
| 194 | + classId = currMap.get(item.getTitle()); | ||
| 195 | + return false; | ||
| 196 | + } | ||
| 197 | + }); | ||
| 198 | + } catch (NumberFormatException e) { | ||
| 199 | + e.printStackTrace(); | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + | ||
| 209 | + private void showGrade(int gradeId) { | ||
| 210 | + mPresenter.gradeAndClassResult(2, school_id, gradeId); | ||
| 211 | + } | ||
| 212 | +} | ||
| 31 | \ No newline at end of file | 213 | \ No newline at end of file |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/InviteCodeActivity.java
| 1 | package com.shunzhi.parent.ui.activity.binding; | 1 | package com.shunzhi.parent.ui.activity.binding; |
| 2 | 2 | ||
| 3 | +import android.content.Intent; | ||
| 3 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 4 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
| 5 | import android.view.View; | 6 | import android.view.View; |
| 7 | +import android.widget.EditText; | ||
| 8 | +import android.widget.TextView; | ||
| 6 | 9 | ||
| 7 | import com.share.mvpsdk.base.BasePresenter; | 10 | import com.share.mvpsdk.base.BasePresenter; |
| 8 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | 11 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
| 9 | import com.shunzhi.parent.R; | 12 | import com.shunzhi.parent.R; |
| 10 | -import com.shunzhi.parent.bean.ChildBean; | ||
| 11 | -import com.shunzhi.parent.contract.mine.MyChildContract; | ||
| 12 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; | 13 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; |
| 13 | 14 | ||
| 14 | -import java.util.List; | ||
| 15 | - | ||
| 16 | /** | 15 | /** |
| 17 | * Created by Administrator on 2018/3/14 0014. | 16 | * Created by Administrator on 2018/3/14 0014. |
| 18 | */ | 17 | */ |
| 19 | 18 | ||
| 20 | -public class InviteCodeActivity extends BaseMVPCompatActivity<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel> | ||
| 21 | - implements MyChildContract.IMyChildView, View.OnClickListener { | 19 | +public class InviteCodeActivity extends BaseMVPCompatActivity { |
| 20 | + TextView add_child,center_title,back; | ||
| 21 | + EditText et_invite_code; | ||
| 22 | + int school_id; | ||
| 22 | 23 | ||
| 23 | @NonNull | 24 | @NonNull |
| 24 | @Override | 25 | @Override |
| @@ -27,12 +28,25 @@ public class InviteCodeActivity extends BaseMVPCompatActivity<MyChildContract.My | @@ -27,12 +28,25 @@ public class InviteCodeActivity extends BaseMVPCompatActivity<MyChildContract.My | ||
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | @Override | 30 | @Override |
| 30 | - public void updateChilsList(List<ChildBean> list) { | ||
| 31 | - | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - @Override | ||
| 35 | protected void initView(Bundle savedInstanceState) { | 31 | protected void initView(Bundle savedInstanceState) { |
| 32 | + school_id=getIntent().getIntExtra("school_id",0); | ||
| 33 | + add_child = findViewById(R.id.add_child); | ||
| 34 | + back = findViewById(R.id.back_top); | ||
| 35 | + back.setOnClickListener(new View.OnClickListener() { | ||
| 36 | + @Override | ||
| 37 | + public void onClick(View v) { | ||
| 38 | + finish(); | ||
| 39 | + } | ||
| 40 | + }); | ||
| 41 | + center_title = findViewById(R.id.center_title); | ||
| 42 | + center_title.setText("邀请码验证"); | ||
| 43 | + et_invite_code = findViewById(R.id.et_invite_code); | ||
| 44 | + add_child.setOnClickListener(new View.OnClickListener() { | ||
| 45 | + @Override | ||
| 46 | + public void onClick(View v) { | ||
| 47 | + startActivity(new Intent().putExtra("school_id",school_id).putExtra("captcha", et_invite_code.getText().toString().trim()).setClass(InviteCodeActivity.this, CheckInfoActivity.class)); | ||
| 48 | + } | ||
| 49 | + }); | ||
| 36 | 50 | ||
| 37 | } | 51 | } |
| 38 | 52 | ||
| @@ -41,8 +55,4 @@ public class InviteCodeActivity extends BaseMVPCompatActivity<MyChildContract.My | @@ -41,8 +55,4 @@ public class InviteCodeActivity extends BaseMVPCompatActivity<MyChildContract.My | ||
| 41 | return R.layout.activity_invitecode; | 55 | return R.layout.activity_invitecode; |
| 42 | } | 56 | } |
| 43 | 57 | ||
| 44 | - @Override | ||
| 45 | - public void onClick(View v) { | ||
| 46 | - | ||
| 47 | - } | ||
| 48 | } | 58 | } |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/SelectSchoolActivity.java
| @@ -5,16 +5,17 @@ import android.os.Bundle; | @@ -5,16 +5,17 @@ import android.os.Bundle; | ||
| 5 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
| 6 | import android.support.v7.widget.LinearLayoutManager; | 6 | import android.support.v7.widget.LinearLayoutManager; |
| 7 | import android.support.v7.widget.RecyclerView; | 7 | import android.support.v7.widget.RecyclerView; |
| 8 | -import android.util.Log; | ||
| 9 | import android.view.View; | 8 | import android.view.View; |
| 10 | import android.widget.TextView; | 9 | import android.widget.TextView; |
| 11 | 10 | ||
| 12 | import com.share.mvpsdk.base.BasePresenter; | 11 | import com.share.mvpsdk.base.BasePresenter; |
| 13 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | 12 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
| 14 | import com.share.mvpsdk.utils.ToastUtils; | 13 | import com.share.mvpsdk.utils.ToastUtils; |
| 14 | +import com.shunzhi.parent.AppConfig; | ||
| 15 | import com.shunzhi.parent.AppContext; | 15 | import com.shunzhi.parent.AppContext; |
| 16 | import com.shunzhi.parent.R; | 16 | import com.shunzhi.parent.R; |
| 17 | import com.shunzhi.parent.adapter.SchoolListAdapter; | 17 | import com.shunzhi.parent.adapter.SchoolListAdapter; |
| 18 | +import com.shunzhi.parent.bean.CurrentBean; | ||
| 18 | import com.shunzhi.parent.bean.SchoolBean; | 19 | import com.shunzhi.parent.bean.SchoolBean; |
| 19 | import com.shunzhi.parent.bean.SortBean; | 20 | import com.shunzhi.parent.bean.SortBean; |
| 20 | import com.shunzhi.parent.contract.mine.SchoolListContract; | 21 | import com.shunzhi.parent.contract.mine.SchoolListContract; |
| @@ -35,15 +36,16 @@ import me.leefeng.citypicker.CityPickerListener; | @@ -35,15 +36,16 @@ import me.leefeng.citypicker.CityPickerListener; | ||
| 35 | */ | 36 | */ |
| 36 | 37 | ||
| 37 | public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContract.SchoolListPrasenter, SchoolListContract.ISchoolListModel> implements | 38 | public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContract.SchoolListPrasenter, SchoolListContract.ISchoolListModel> implements |
| 38 | - View.OnClickListener, SchoolListContract.ISchoolListView,CityPickerListener { | 39 | + View.OnClickListener, SchoolListContract.ISchoolListView, CityPickerListener { |
| 39 | 40 | ||
| 40 | private SideBar sideBar; | 41 | private SideBar sideBar; |
| 41 | - private TextView dialog, go_next, tvLocalAddress; | 42 | + private TextView dialog, go_next, tvLocalAddress, center_title, back; |
| 42 | private RecyclerView schoollist; | 43 | private RecyclerView schoollist; |
| 43 | private List<String> list = new ArrayList<>(); | 44 | private List<String> list = new ArrayList<>(); |
| 44 | SchoolListAdapter schoolListAdapter; | 45 | SchoolListAdapter schoolListAdapter; |
| 46 | + int schoolId; | ||
| 47 | + CityPicker cityPicker = null; | ||
| 45 | 48 | ||
| 46 | - CityPicker cityPicker=null; | ||
| 47 | @NonNull | 49 | @NonNull |
| 48 | @Override | 50 | @Override |
| 49 | public BasePresenter initPresenter() { | 51 | public BasePresenter initPresenter() { |
| @@ -55,6 +57,9 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -55,6 +57,9 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
| 55 | sideBar = findViewById(R.id.sidrbar); | 57 | sideBar = findViewById(R.id.sidrbar); |
| 56 | dialog = findViewById(R.id.dialog); | 58 | dialog = findViewById(R.id.dialog); |
| 57 | go_next = findViewById(R.id.go_next); | 59 | go_next = findViewById(R.id.go_next); |
| 60 | + back = findViewById(R.id.back_top); | ||
| 61 | + center_title = findViewById(R.id.center_title); | ||
| 62 | + center_title.setText("选择孩子学校"); | ||
| 58 | go_next.setOnClickListener(this); | 63 | go_next.setOnClickListener(this); |
| 59 | tvLocalAddress = findViewById(R.id.tvLocalAddress); | 64 | tvLocalAddress = findViewById(R.id.tvLocalAddress); |
| 60 | tvLocalAddress.setOnClickListener(this); | 65 | tvLocalAddress.setOnClickListener(this); |
| @@ -154,19 +159,18 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -154,19 +159,18 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
| 154 | if (v == go_next) { | 159 | if (v == go_next) { |
| 155 | SortBean currentSortBean = schoolListAdapter.getCurrentSortBean(); | 160 | SortBean currentSortBean = schoolListAdapter.getCurrentSortBean(); |
| 156 | if (currentSortBean != null) { | 161 | if (currentSortBean != null) { |
| 162 | + schoolId = Integer.parseInt(currentSortBean.getSchool_id()); | ||
| 157 | if (currentSortBean.getIsNew().equals("0")) { | 163 | if (currentSortBean.getIsNew().equals("0")) { |
| 158 | - Log.e("1111-===",currentSortBean.getSchool_id()); | ||
| 159 | - startActivity(new Intent().putExtra("school_id",currentSortBean.getSchool_id()).setClass(SelectSchoolActivity.this, CheckInfoActivity.class)); | 164 | + mPresenter.showChildInfo(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), schoolId, ""); |
| 160 | } else { | 165 | } else { |
| 161 | - startActivity(new Intent().setClass(SelectSchoolActivity.this,CreateChildInfoActivity.class)); | 166 | + startActivity(new Intent().putExtra("school_id", schoolId).setClass(SelectSchoolActivity.this, CreateChildInfoActivity.class)); |
| 162 | } | 167 | } |
| 163 | - | ||
| 164 | } else { | 168 | } else { |
| 165 | ToastUtils.showToast("请选择学校"); | 169 | ToastUtils.showToast("请选择学校"); |
| 166 | } | 170 | } |
| 167 | - }else if (v==tvLocalAddress){ | ||
| 168 | - if (null==cityPicker)cityPicker=new CityPicker(SelectSchoolActivity.this,this); | ||
| 169 | - if (cityPicker.isShow())cityPicker.close(); | 171 | + } else if (v == tvLocalAddress) { |
| 172 | + if (null == cityPicker) cityPicker = new CityPicker(SelectSchoolActivity.this, this); | ||
| 173 | + if (cityPicker.isShow()) cityPicker.close(); | ||
| 170 | else cityPicker.show(); | 174 | else cityPicker.show(); |
| 171 | } | 175 | } |
| 172 | 176 | ||
| @@ -175,59 +179,6 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -175,59 +179,6 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
| 175 | 179 | ||
| 176 | @Override | 180 | @Override |
| 177 | public void showList(List<SchoolBean> list) { | 181 | public void showList(List<SchoolBean> list) { |
| 178 | -// list.add("阿尔卑斯"); | ||
| 179 | -// list.add("阿尔卑斯"); | ||
| 180 | -// list.add("阿尔卑斯"); | ||
| 181 | -// list.add("贝克街"); | ||
| 182 | -// list.add("贝克街"); | ||
| 183 | -// list.add("贝克街"); | ||
| 184 | -// list.add("贝克街"); | ||
| 185 | -// list.add("贝克街"); | ||
| 186 | -// list.add("阿尔卑斯"); | ||
| 187 | -// list.add("阿尔卑斯"); | ||
| 188 | -// list.add("贝克街"); | ||
| 189 | -// list.add("贝克街"); | ||
| 190 | -// list.add("阿尔卑斯"); | ||
| 191 | -// list.add("阿尔卑斯"); | ||
| 192 | -// list.add("阿尔卑斯"); | ||
| 193 | -// list.add("贝克街"); | ||
| 194 | -// list.add("贝克街"); | ||
| 195 | -// list.add("血色城堡"); | ||
| 196 | -// list.add("血色城堡"); | ||
| 197 | -// list.add("血色城堡"); | ||
| 198 | -// list.add("血色城堡"); | ||
| 199 | -// list.add("贝克街"); | ||
| 200 | -// list.add("贝克街"); | ||
| 201 | -// list.add("贝克街"); | ||
| 202 | -// list.add("贝克街"); | ||
| 203 | -// list.add("贝克街"); | ||
| 204 | -// list.add("贝克街"); | ||
| 205 | -// list.add("贝克街"); | ||
| 206 | -// list.add("贝克街"); | ||
| 207 | -// list.add("贝克街"); | ||
| 208 | -// list.add("血色城堡"); | ||
| 209 | -// list.add("血色城堡"); | ||
| 210 | -// list.add("血色城堡"); | ||
| 211 | -// list.add("血色城堡"); | ||
| 212 | -// list.add("贝克街"); | ||
| 213 | -// list.add("贝克街"); | ||
| 214 | -// list.add("贝克街"); | ||
| 215 | -// list.add("贝克街"); | ||
| 216 | -// list.add("贝克街"); | ||
| 217 | -// list.add("血色城堡"); | ||
| 218 | -// list.add("贝克街"); | ||
| 219 | -// list.add("贝克街"); | ||
| 220 | -// list.add("贝克街"); | ||
| 221 | -// list.add("贝克街"); | ||
| 222 | -// list.add("贝克街"); | ||
| 223 | -// list.add("贝克街"); | ||
| 224 | -// list.add("贝克街"); | ||
| 225 | -// list.add("贝克街"); | ||
| 226 | -// list.add("贝克街"); | ||
| 227 | -// list.add("血色城堡"); | ||
| 228 | -// list.add("血色城堡"); | ||
| 229 | -// list.add("血色城堡"); | ||
| 230 | -// list.add("血色城堡"); | ||
| 231 | final List<SortBean> schoolList = OrderedSortSmodel(list); | 182 | final List<SortBean> schoolList = OrderedSortSmodel(list); |
| 232 | schoolListAdapter = new SchoolListAdapter(this, schoolList); | 183 | schoolListAdapter = new SchoolListAdapter(this, schoolList); |
| 233 | schoolListAdapter.addAll(schoolList); | 184 | schoolListAdapter.addAll(schoolList); |
| @@ -235,9 +186,18 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -235,9 +186,18 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
| 235 | } | 186 | } |
| 236 | 187 | ||
| 237 | @Override | 188 | @Override |
| 189 | + public void showChild(CurrentBean currentBean) { | ||
| 190 | + if (currentBean.isNew() == 0) { | ||
| 191 | + startActivity(new Intent().putExtra("school_id", schoolId).setClass(SelectSchoolActivity.this, CheckInfoActivity.class)); | ||
| 192 | + } else { | ||
| 193 | + startActivity(new Intent().putExtra("school_id",schoolId).setClass(SelectSchoolActivity.this, InviteCodeActivity.class)); | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + @Override | ||
| 238 | protected void onDestroy() { | 198 | protected void onDestroy() { |
| 239 | super.onDestroy(); | 199 | super.onDestroy(); |
| 240 | - if (null!=cityPicker)cityPicker.cancle(); | 200 | + if (null != cityPicker) cityPicker.cancle(); |
| 241 | } | 201 | } |
| 242 | 202 | ||
| 243 | @Override | 203 | @Override |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
| @@ -90,7 +90,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | @@ -90,7 +90,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist | ||
| 90 | phoneNumber.addTextChangedListener(textWatcher); | 90 | phoneNumber.addTextChangedListener(textWatcher); |
| 91 | idCode.addTextChangedListener(textWatcher); | 91 | idCode.addTextChangedListener(textWatcher); |
| 92 | password.addTextChangedListener(textWatcher); | 92 | password.addTextChangedListener(textWatcher); |
| 93 | - mPresenter.loginResult("18358585335", "123456"); | 93 | + mPresenter.loginResult("18358575338", "575338"); |
| 94 | if ("登录".equals(typepage)) { | 94 | if ("登录".equals(typepage)) { |
| 95 | idCodeLayout.setVisibility(View.GONE); | 95 | idCodeLayout.setVisibility(View.GONE); |
| 96 | loginAndRegister.setText("登录"); | 96 | loginAndRegister.setText("登录"); |
460 Bytes
app/src/main/res/layout/activity_check_info.xml
| @@ -33,7 +33,6 @@ | @@ -33,7 +33,6 @@ | ||
| 33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
| 34 | android:layout_marginTop="10dp" | 34 | android:layout_marginTop="10dp" |
| 35 | android:gravity="center_horizontal" | 35 | android:gravity="center_horizontal" |
| 36 | - android:text="15245252542" | ||
| 37 | android:textColor="@color/textRed" | 36 | android:textColor="@color/textRed" |
| 38 | android:textSize="@dimen/sp_18" /> | 37 | android:textSize="@dimen/sp_18" /> |
| 39 | </LinearLayout> | 38 | </LinearLayout> |
| @@ -65,7 +64,6 @@ | @@ -65,7 +64,6 @@ | ||
| 65 | android:layout_weight="1" | 64 | android:layout_weight="1" |
| 66 | android:background="@drawable/rudio_bord" | 65 | android:background="@drawable/rudio_bord" |
| 67 | android:gravity="center" | 66 | android:gravity="center" |
| 68 | - android:text="李小明" | ||
| 69 | android:textColor="@color/textColor" /> | 67 | android:textColor="@color/textColor" /> |
| 70 | 68 | ||
| 71 | </LinearLayout> | 69 | </LinearLayout> |
| @@ -90,7 +88,6 @@ | @@ -90,7 +88,6 @@ | ||
| 90 | android:layout_weight="1" | 88 | android:layout_weight="1" |
| 91 | android:background="@drawable/rudio_bord" | 89 | android:background="@drawable/rudio_bord" |
| 92 | android:gravity="center" | 90 | android:gravity="center" |
| 93 | - android:text="男" | ||
| 94 | android:textColor="@color/textColor" /> | 91 | android:textColor="@color/textColor" /> |
| 95 | 92 | ||
| 96 | </LinearLayout> | 93 | </LinearLayout> |
| @@ -115,7 +112,6 @@ | @@ -115,7 +112,6 @@ | ||
| 115 | android:layout_weight="1" | 112 | android:layout_weight="1" |
| 116 | android:background="@drawable/rudio_bord" | 113 | android:background="@drawable/rudio_bord" |
| 117 | android:gravity="center" | 114 | android:gravity="center" |
| 118 | - android:text="初一" | ||
| 119 | android:textColor="@color/textColor" /> | 115 | android:textColor="@color/textColor" /> |
| 120 | 116 | ||
| 121 | </LinearLayout> | 117 | </LinearLayout> |
| @@ -140,7 +136,6 @@ | @@ -140,7 +136,6 @@ | ||
| 140 | android:layout_weight="1" | 136 | android:layout_weight="1" |
| 141 | android:background="@drawable/rudio_bord" | 137 | android:background="@drawable/rudio_bord" |
| 142 | android:gravity="center" | 138 | android:gravity="center" |
| 143 | - android:text="初一(3)班" | ||
| 144 | android:textColor="@color/textColor" /> | 139 | android:textColor="@color/textColor" /> |
| 145 | 140 | ||
| 146 | </LinearLayout> | 141 | </LinearLayout> |
app/src/main/res/layout/activity_create_childinfo.xml
| @@ -43,12 +43,14 @@ | @@ -43,12 +43,14 @@ | ||
| 43 | android:textSize="@dimen/sp_16" /> | 43 | android:textSize="@dimen/sp_16" /> |
| 44 | 44 | ||
| 45 | <EditText | 45 | <EditText |
| 46 | + android:id="@+id/child_name" | ||
| 46 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
| 47 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
| 48 | android:layout_weight="1" | 49 | android:layout_weight="1" |
| 49 | android:background="@drawable/rudio_bord" | 50 | android:background="@drawable/rudio_bord" |
| 50 | android:gravity="center" | 51 | android:gravity="center" |
| 51 | - android:text="李小明" | 52 | + android:hint="请输入孩子姓名" |
| 53 | + android:drawableRight="@drawable/arrow_white" | ||
| 52 | android:textColor="@color/textColor" /> | 54 | android:textColor="@color/textColor" /> |
| 53 | 55 | ||
| 54 | </LinearLayout> | 56 | </LinearLayout> |
| @@ -66,14 +68,15 @@ | @@ -66,14 +68,15 @@ | ||
| 66 | android:text="性 别:" | 68 | android:text="性 别:" |
| 67 | android:textSize="@dimen/sp_16" /> | 69 | android:textSize="@dimen/sp_16" /> |
| 68 | 70 | ||
| 69 | - <EditText | 71 | + <TextView |
| 72 | + android:id="@+id/select_sex" | ||
| 70 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
| 71 | android:layout_height="match_parent" | 74 | android:layout_height="match_parent" |
| 72 | android:layout_weight="1" | 75 | android:layout_weight="1" |
| 73 | android:background="@drawable/rudio_bord" | 76 | android:background="@drawable/rudio_bord" |
| 74 | - android:gravity="center" | ||
| 75 | android:drawableRight="@drawable/arrow_down" | 77 | android:drawableRight="@drawable/arrow_down" |
| 76 | - android:text="男" | 78 | + android:gravity="center" |
| 79 | + android:hint="请选择性别" | ||
| 77 | android:textColor="@color/textColor" /> | 80 | android:textColor="@color/textColor" /> |
| 78 | 81 | ||
| 79 | </LinearLayout> | 82 | </LinearLayout> |
| @@ -91,13 +94,14 @@ | @@ -91,13 +94,14 @@ | ||
| 91 | android:text="年 级:" | 94 | android:text="年 级:" |
| 92 | android:textSize="@dimen/sp_16" /> | 95 | android:textSize="@dimen/sp_16" /> |
| 93 | 96 | ||
| 94 | - <EditText | 97 | + <TextView |
| 98 | + android:id="@+id/select_grade" | ||
| 95 | android:layout_width="wrap_content" | 99 | android:layout_width="wrap_content" |
| 96 | android:layout_height="match_parent" | 100 | android:layout_height="match_parent" |
| 97 | android:layout_weight="1" | 101 | android:layout_weight="1" |
| 98 | android:background="@drawable/rudio_bord" | 102 | android:background="@drawable/rudio_bord" |
| 99 | android:gravity="center" | 103 | android:gravity="center" |
| 100 | - android:text="初一" | 104 | + android:hint="请选择年级" |
| 101 | android:drawableRight="@drawable/arrow_down" | 105 | android:drawableRight="@drawable/arrow_down" |
| 102 | android:textColor="@color/textColor" /> | 106 | android:textColor="@color/textColor" /> |
| 103 | 107 | ||
| @@ -116,13 +120,14 @@ | @@ -116,13 +120,14 @@ | ||
| 116 | android:text="班 级:" | 120 | android:text="班 级:" |
| 117 | android:textSize="@dimen/sp_16" /> | 121 | android:textSize="@dimen/sp_16" /> |
| 118 | 122 | ||
| 119 | - <EditText | 123 | + <TextView |
| 124 | + android:id="@+id/select_class" | ||
| 120 | android:layout_width="wrap_content" | 125 | android:layout_width="wrap_content" |
| 121 | android:layout_height="match_parent" | 126 | android:layout_height="match_parent" |
| 122 | android:layout_weight="1" | 127 | android:layout_weight="1" |
| 123 | android:background="@drawable/rudio_bord" | 128 | android:background="@drawable/rudio_bord" |
| 124 | android:gravity="center" | 129 | android:gravity="center" |
| 125 | - android:text="初一(3)班" | 130 | + android:hint="请选择班级" |
| 126 | android:drawableRight="@drawable/arrow_down" | 131 | android:drawableRight="@drawable/arrow_down" |
| 127 | android:textColor="@color/textColor" /> | 132 | android:textColor="@color/textColor" /> |
| 128 | 133 |
app/src/main/res/layout/activity_invitecode.xml
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | android:layout_height="40dp" /> | 11 | android:layout_height="40dp" /> |
| 12 | 12 | ||
| 13 | <EditText | 13 | <EditText |
| 14 | + android:id="@+id/et_invite_code" | ||
| 14 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
| 15 | android:layout_height="60dp" | 16 | android:layout_height="60dp" |
| 16 | android:layout_margin="20dp" | 17 | android:layout_margin="20dp" |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + android:layout_width="match_parent" | ||
| 4 | + android:layout_height="match_parent"> | ||
| 5 | + <android.support.v7.widget.RecyclerView | ||
| 6 | + android:id="@+id/recycle_grade" | ||
| 7 | + android:layout_width="match_parent" | ||
| 8 | + android:layout_height="match_parent"> | ||
| 9 | + | ||
| 10 | + </android.support.v7.widget.RecyclerView> | ||
| 11 | + | ||
| 12 | +</LinearLayout> |