Commit a97b79d9eb095f4b143457b4cd79940003f870bc
1 parent
bcb57ba9
Exists in
yxb_dev
and in
2 other branches
no message
Showing
19 changed files
with
284 additions
and
79 deletions
Show diff stats
app/src/main/AndroidManifest.xml
| ... | ... | @@ -84,6 +84,9 @@ |
| 84 | 84 | android:name=".ui.activity.StartActivity" |
| 85 | 85 | android:screenOrientation="portrait" /> |
| 86 | 86 | <activity |
| 87 | + android:name=".ui.activity.ChildDetialActivity" | |
| 88 | + android:screenOrientation="portrait" /> | |
| 89 | + <activity | |
| 87 | 90 | android:name=".ui.activity.binding.CreateChildInfoActivity" |
| 88 | 91 | android:screenOrientation="portrait" |
| 89 | 92 | android:windowSoftInputMode="adjustPan|stateHidden" /> | ... | ... |
app/src/main/java/com/shunzhi/parent/adapter/ChildAdapter.java
| ... | ... | @@ -2,50 +2,61 @@ package com.shunzhi.parent.adapter; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import android.content.Context; |
| 5 | +import android.content.Intent; | |
| 5 | 6 | import android.view.LayoutInflater; |
| 6 | 7 | import android.view.View; |
| 7 | 8 | import android.view.ViewGroup; |
| 8 | 9 | import android.widget.TextView; |
| 9 | 10 | |
| 11 | +import com.google.gson.Gson; | |
| 10 | 12 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
| 11 | 13 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
| 12 | 14 | import com.shunzhi.parent.R; |
| 13 | 15 | import com.shunzhi.parent.bean.ChildBean; |
| 16 | +import com.shunzhi.parent.ui.activity.ChildDetialActivity; | |
| 14 | 17 | |
| 15 | 18 | /** |
| 16 | 19 | * Created by Administrator on 2018/3/9 0009. |
| 17 | 20 | */ |
| 18 | 21 | |
| 19 | -public class ChildAdapter extends BaseRecyclerViewAdapter<ChildBean>{ | |
| 22 | +public class ChildAdapter extends BaseRecyclerViewAdapter<ChildBean> { | |
| 20 | 23 | |
| 21 | 24 | Context context; |
| 22 | - public ChildAdapter(Context context){ | |
| 23 | - this.context=context; | |
| 25 | + | |
| 26 | + public ChildAdapter(Context context) { | |
| 27 | + this.context = context; | |
| 24 | 28 | } |
| 25 | 29 | |
| 26 | 30 | |
| 27 | 31 | @Override |
| 28 | 32 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
| 29 | - View view= LayoutInflater.from(context).inflate(R.layout.item_childlist,null); | |
| 33 | + View view = LayoutInflater.from(context).inflate(R.layout.item_childlist, null); | |
| 30 | 34 | return new MyViewHolder(view); |
| 31 | 35 | } |
| 32 | 36 | |
| 33 | - private class MyViewHolder extends BaseRecyclerViewHolder<ChildBean>{ | |
| 37 | + private class MyViewHolder extends BaseRecyclerViewHolder<ChildBean> { | |
| 34 | 38 | |
| 35 | - TextView txt_childname,txt_childclass; | |
| 39 | + TextView txt_childname, txt_childclass; | |
| 36 | 40 | |
| 37 | 41 | |
| 38 | 42 | public MyViewHolder(View view) { |
| 39 | 43 | super(view); |
| 40 | - txt_childname=view.findViewById(R.id.txt_childname); | |
| 41 | - txt_childclass=view.findViewById(R.id.txt_childclass); | |
| 44 | + txt_childname = view.findViewById(R.id.txt_childname); | |
| 45 | + txt_childclass = view.findViewById(R.id.txt_childclass); | |
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | @Override |
| 45 | - public void onBindViewHolder(ChildBean object, int position) { | |
| 49 | + public void onBindViewHolder(final ChildBean object, int position) { | |
| 46 | 50 | txt_childname.setText(object.getStudentName()); |
| 47 | - txt_childclass.setText(object.getSchoolName()+" "+object.getClassName()); | |
| 48 | - | |
| 51 | + txt_childclass.setText(object.getSchoolName() + " " + object.getClassName()); | |
| 52 | + itemView.setOnClickListener(new View.OnClickListener() { | |
| 53 | + @Override | |
| 54 | + public void onClick(View v) { | |
| 55 | + Gson g = new Gson(); | |
| 56 | + String jsonString = g.toJson(object, ChildBean.class).toString(); | |
| 57 | + context.startActivity(new Intent().putExtra("childJson", jsonString).setClass(context, ChildDetialActivity.class)); | |
| 58 | + } | |
| 59 | + }); | |
| 49 | 60 | } |
| 50 | 61 | |
| 51 | 62 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/api/MineApi.java
| ... | ... | @@ -36,5 +36,9 @@ public interface MineApi { |
| 36 | 36 | |
| 37 | 37 | @GET("/api/ParentHelper/GetClassOrGrade") |
| 38 | 38 | Observable<GradeBean>getGradeAndClass(@Query("state") int state,@Query("schoolid") int schoolId,@Query("gradeid") int gradeId); |
| 39 | + | |
| 40 | + | |
| 41 | + @GET("/api/ParentHelper/UnBindStudent") | |
| 42 | + Observable<JsonObject>unBinding(@Query("parentId") int parentId,@Query("studentId") int studentId); | |
| 39 | 43 | } |
| 40 | 44 | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/ChildBean.java
| ... | ... | @@ -6,8 +6,8 @@ import java.io.Serializable; |
| 6 | 6 | * Created by Administrator on 2018/3/9 0009. |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -public class ChildBean implements Serializable{ | |
| 10 | - private String studentUserId; | |
| 9 | +public class ChildBean implements Serializable { | |
| 10 | + private String studentUserId; | |
| 11 | 11 | private int parentMobile; |
| 12 | 12 | private int parentId; |
| 13 | 13 | private boolean mobileFlag; |
| ... | ... | @@ -17,13 +17,33 @@ public class ChildBean implements Serializable{ |
| 17 | 17 | private String schoolName; |
| 18 | 18 | private int grade; |
| 19 | 19 | private String gradename; |
| 20 | + private String areaName; | |
| 21 | + private String studentCode; | |
| 20 | 22 | private int classId; |
| 21 | 23 | private String className; |
| 22 | 24 | private int studentId; |
| 23 | 25 | private String studentName; |
| 24 | 26 | private String photo; |
| 27 | + private String cityName; | |
| 25 | 28 | private int sex; |
| 26 | 29 | |
| 30 | + | |
| 31 | + public String getAreaName() { | |
| 32 | + return areaName; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setAreaName(String areaName) { | |
| 36 | + this.areaName = areaName; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public String getStudentCode() { | |
| 40 | + return studentCode; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setStudentCode(String studentCode) { | |
| 44 | + this.studentCode = studentCode; | |
| 45 | + } | |
| 46 | + | |
| 27 | 47 | public String getStudentName() { |
| 28 | 48 | return studentName; |
| 29 | 49 | } |
| ... | ... | @@ -128,7 +148,7 @@ public class ChildBean implements Serializable{ |
| 128 | 148 | this.studentId = studentId; |
| 129 | 149 | } |
| 130 | 150 | |
| 131 | - public String getStudentUserId() { | |
| 151 | + public String getStudentUserId() { | |
| 132 | 152 | return studentUserId; |
| 133 | 153 | } |
| 134 | 154 | |
| ... | ... | @@ -170,6 +190,8 @@ public class ChildBean implements Serializable{ |
| 170 | 190 | ",studentName='" + studentName + '\'' + |
| 171 | 191 | ",studentUserId='" + studentUserId + '\'' + |
| 172 | 192 | ",photo='" + photo + '\'' + |
| 193 | + ",studentCode='" + studentCode + '\'' + | |
| 194 | + ",areaName='" + areaName + '\'' + | |
| 173 | 195 | ", sex=" + sex + |
| 174 | 196 | "}"; |
| 175 | 197 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/mine/MyChildContract.java
| ... | ... | @@ -25,6 +25,8 @@ public interface MyChildContract { |
| 25 | 25 | , int schoolId,int classId,int studentId,String studentUserId); |
| 26 | 26 | public abstract void gradeAndClassResult(int state, int schooId,int gradeId); |
| 27 | 27 | |
| 28 | + public abstract void unBinndingResult(int parentId,int studentId); | |
| 29 | + | |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | interface IMyChildModel extends IBaseModel { |
| ... | ... | @@ -32,12 +34,13 @@ public interface MyChildContract { |
| 32 | 34 | Observable<JsonObject> addChildResult(int parentId, boolean mobileFlag,boolean cooperateFlag |
| 33 | 35 | , int schoolId,int classId,int studentId,String studentUserId); |
| 34 | 36 | Observable<GradeBean> getGradeAndClass(int state, int schooId,int gradeId); |
| 37 | + Observable<JsonObject>unBinnding(int parentId,int studentId); | |
| 35 | 38 | |
| 36 | 39 | |
| 37 | 40 | } |
| 38 | 41 | |
| 39 | 42 | interface IMyChildView extends IBaseActivity { |
| 40 | - void updateChilsList(CurrentBean currentBean); | |
| 43 | + void updateChildList(CurrentBean currentBean); | |
| 41 | 44 | void addChildSuccess(); |
| 42 | 45 | void showClass(List<ChildClass>list); |
| 43 | 46 | void showError(String error); | ... | ... |
app/src/main/java/com/shunzhi/parent/model/mine/MyChildModel.java
| ... | ... | @@ -40,4 +40,9 @@ public class MyChildModel extends BaseModel implements MyChildContract.IMyChildM |
| 40 | 40 | public Observable<GradeBean> getGradeAndClass(int state, int schooId, int gradeId) { |
| 41 | 41 | return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).getGradeAndClass(state,schooId,gradeId).compose(RxHelper.<GradeBean>rxSchedulerHelper()); |
| 42 | 42 | } |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public Observable<JsonObject> unBinnding(int parentId, int studentId) { | |
| 46 | + return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).unBinding(parentId,studentId).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
| 47 | + } | |
| 43 | 48 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/mine/MyChildPresenter.java
| ... | ... | @@ -10,10 +10,14 @@ import com.shunzhi.parent.bean.UserInfo; |
| 10 | 10 | import com.shunzhi.parent.contract.mine.MyChildContract; |
| 11 | 11 | import com.shunzhi.parent.model.mine.MyChildModel; |
| 12 | 12 | |
| 13 | +import org.json.JSONObject; | |
| 14 | + | |
| 13 | 15 | import java.util.List; |
| 14 | 16 | |
| 15 | 17 | import io.reactivex.functions.Consumer; |
| 18 | +import okhttp3.ResponseBody; | |
| 16 | 19 | import retrofit2.HttpException; |
| 20 | +import retrofit2.Response; | |
| 17 | 21 | |
| 18 | 22 | /** |
| 19 | 23 | * Created by Administrator on 2018/3/8 0008. |
| ... | ... | @@ -38,13 +42,22 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { |
| 38 | 42 | public void accept(UserInfo userInfo) throws Exception { |
| 39 | 43 | CurrentBean currentBean = userInfo.getData(); |
| 40 | 44 | // List<ChildBean> list = currentBean.getStudentClass(); |
| 41 | - mIView.updateChilsList(currentBean); | |
| 45 | + mIView.updateChildList(currentBean); | |
| 42 | 46 | } |
| 43 | 47 | }, new Consumer<Throwable>() { |
| 44 | 48 | @Override |
| 45 | 49 | public void accept(Throwable throwable) throws Exception { |
| 46 | - OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
| 47 | - mIView.showError("邀请码错误"); | |
| 50 | + Response response = ((HttpException)throwable).response(); | |
| 51 | + if (response==null)return; | |
| 52 | + ResponseBody responseBody = response.errorBody(); | |
| 53 | + if (responseBody==null)return; | |
| 54 | + try { | |
| 55 | + JSONObject json = new JSONObject(responseBody.string()); | |
| 56 | + mIView.showError(json.optString("message")); | |
| 57 | + } catch (Exception e1) { | |
| 58 | + e1.printStackTrace(); | |
| 59 | + } | |
| 60 | + | |
| 48 | 61 | } |
| 49 | 62 | })); |
| 50 | 63 | |
| ... | ... | @@ -73,7 +86,7 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { |
| 73 | 86 | mRxManager.register(mIModel.getGradeAndClass(state, schooId, gradeId).subscribe(new Consumer<GradeBean>() { |
| 74 | 87 | @Override |
| 75 | 88 | public void accept(GradeBean gradeBean) throws Exception { |
| 76 | - List<ChildClass> list=gradeBean.getData(); | |
| 89 | + List<ChildClass> list = gradeBean.getData(); | |
| 77 | 90 | mIView.showClass(list); |
| 78 | 91 | } |
| 79 | 92 | }, new Consumer<Throwable>() { |
| ... | ... | @@ -84,4 +97,20 @@ public class MyChildPresenter extends MyChildContract.MyChildPresenter { |
| 84 | 97 | })); |
| 85 | 98 | } |
| 86 | 99 | |
| 100 | + @Override | |
| 101 | + public void unBinndingResult(int parentId, int studentId) { | |
| 102 | + mRxManager.register(mIModel.unBinnding(parentId, studentId).subscribe(new Consumer<JsonObject>() { | |
| 103 | + @Override | |
| 104 | + public void accept(JsonObject jsonObject) throws Exception { | |
| 105 | + ToastUtils.showToast(jsonObject.toString()); | |
| 106 | + mIView.showError("123"); | |
| 107 | + } | |
| 108 | + }, new Consumer<Throwable>() { | |
| 109 | + @Override | |
| 110 | + public void accept(Throwable throwable) throws Exception { | |
| 111 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
| 112 | + } | |
| 113 | + })); | |
| 114 | + } | |
| 115 | + | |
| 87 | 116 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/ChildDetialActivity.java
0 → 100644
| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | +package com.shunzhi.parent.ui.activity; | |
| 2 | + | |
| 3 | +import android.os.Bundle; | |
| 4 | +import android.text.TextUtils; | |
| 5 | +import android.view.View; | |
| 6 | +import android.widget.TextView; | |
| 7 | + | |
| 8 | +import com.google.gson.Gson; | |
| 9 | +import com.share.mvpsdk.base.activity.BaseCompatActivity; | |
| 10 | +import com.shunzhi.parent.R; | |
| 11 | +import com.shunzhi.parent.bean.ChildBean; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by Administrator on 2018/3/16 0016. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +public class ChildDetialActivity extends BaseCompatActivity { | |
| 18 | + TextView child_name, child_school, child_class, school_area, student_code,center_title,back; | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + protected void initView(Bundle savedInstanceState) { | |
| 22 | + String childJson=getIntent().getStringExtra("childJson"); | |
| 23 | + child_name = findViewById(R.id.child_name); | |
| 24 | + child_school = findViewById(R.id.child_school); | |
| 25 | + child_class = findViewById(R.id.child_class); | |
| 26 | + school_area = findViewById(R.id.school_area); | |
| 27 | + student_code = findViewById(R.id.student_code); | |
| 28 | + center_title = findViewById(R.id.center_title); | |
| 29 | + center_title.setText("我的孩子"); | |
| 30 | + back = findViewById(R.id.back_top); | |
| 31 | + back.setOnClickListener(new View.OnClickListener() { | |
| 32 | + @Override | |
| 33 | + public void onClick(View v) { | |
| 34 | + finish(); | |
| 35 | + } | |
| 36 | + }); | |
| 37 | + if(!TextUtils.isEmpty(childJson)) | |
| 38 | + initChild(childJson); | |
| 39 | + } | |
| 40 | + | |
| 41 | + private void initChild(String childJson) { | |
| 42 | + Gson g=new Gson(); | |
| 43 | + ChildBean childBean=g.fromJson(childJson, ChildBean.class); | |
| 44 | + child_name.setText(childBean.getStudentName()); | |
| 45 | + child_school.setText(childBean.getSchoolName()); | |
| 46 | + child_class.setText(childBean.getClassName()); | |
| 47 | + school_area.setText(childBean.getAreaName()); | |
| 48 | + student_code.setText(childBean.getStudentCode()); | |
| 49 | + | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + protected int getLayoutId() { | |
| 54 | + return R.layout.activity_child_detail; | |
| 55 | + } | |
| 56 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/MyChildActivity.java
| ... | ... | @@ -25,7 +25,6 @@ import com.shunzhi.parent.bean.ChildClass; |
| 25 | 25 | import com.shunzhi.parent.bean.CurrentBean; |
| 26 | 26 | import com.shunzhi.parent.contract.mine.MyChildContract; |
| 27 | 27 | import com.shunzhi.parent.presenter.mine.MyChildPresenter; |
| 28 | -import com.shunzhi.parent.ui.MainActivity; | |
| 29 | 28 | import com.shunzhi.parent.ui.activity.binding.SelectSchoolActivity; |
| 30 | 29 | import com.yanzhenjie.recyclerview.swipe.SwipeMenu; |
| 31 | 30 | import com.yanzhenjie.recyclerview.swipe.SwipeMenuBridge; |
| ... | ... | @@ -34,6 +33,7 @@ import com.yanzhenjie.recyclerview.swipe.SwipeMenuItem; |
| 34 | 33 | import com.yanzhenjie.recyclerview.swipe.SwipeMenuItemClickListener; |
| 35 | 34 | import com.yanzhenjie.recyclerview.swipe.SwipeMenuRecyclerView; |
| 36 | 35 | |
| 36 | +import java.util.ArrayList; | |
| 37 | 37 | import java.util.List; |
| 38 | 38 | |
| 39 | 39 | /** |
| ... | ... | @@ -45,6 +45,7 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 45 | 45 | SwipeMenuRecyclerView child_recycle; |
| 46 | 46 | TextView back, center_title, add_child; |
| 47 | 47 | ChildAdapter childAdapter; |
| 48 | + List<ChildBean> currlist = new ArrayList<>(); | |
| 48 | 49 | |
| 49 | 50 | @NonNull |
| 50 | 51 | @Override |
| ... | ... | @@ -72,7 +73,7 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 72 | 73 | child_recycle.setSwipeMenuCreator(swipeMenuCreator); |
| 73 | 74 | child_recycle.setSwipeMenuItemClickListener(new SwipeMenuItemClickListener() { |
| 74 | 75 | @Override |
| 75 | - public void onItemClick(SwipeMenuBridge menuBridge) { | |
| 76 | + public void onItemClick(final SwipeMenuBridge menuBridge) { | |
| 76 | 77 | final PopupWindow popupWindow = new PopupWindow(); |
| 77 | 78 | popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); |
| 78 | 79 | popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); |
| ... | ... | @@ -92,7 +93,9 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 92 | 93 | btn_right.setOnClickListener(new View.OnClickListener() { |
| 93 | 94 | @Override |
| 94 | 95 | public void onClick(View v) { |
| 95 | - | |
| 96 | + popupWindow.dismiss(); | |
| 97 | + mPresenter.unBinndingResult(Integer.parseInt(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.PARENT_ID)) | |
| 98 | + , currlist.get(menuBridge.getPosition()).getStudentId()); | |
| 96 | 99 | } |
| 97 | 100 | }); |
| 98 | 101 | popupWindow.setContentView(view); |
| ... | ... | @@ -100,7 +103,7 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 100 | 103 | |
| 101 | 104 | } |
| 102 | 105 | }); |
| 103 | - mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME),0,""); | |
| 106 | + mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 0, ""); | |
| 104 | 107 | } |
| 105 | 108 | |
| 106 | 109 | @Override |
| ... | ... | @@ -111,7 +114,7 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 111 | 114 | @Override |
| 112 | 115 | public void onClick(View v) { |
| 113 | 116 | if (v == back) { |
| 114 | - startActivity(new Intent().setClass(MyChildActivity.this, MainActivity.class)); | |
| 117 | +// startActivity(new Intent().setClass(MyChildActivity.this, MainActivity.class)); | |
| 115 | 118 | finish(); |
| 116 | 119 | } else if (v == add_child) { |
| 117 | 120 | startActivity(new Intent().setClass(MyChildActivity.this, SelectSchoolActivity.class)); |
| ... | ... | @@ -119,9 +122,12 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 119 | 122 | } |
| 120 | 123 | |
| 121 | 124 | @Override |
| 122 | - public void updateChilsList(CurrentBean currentBean) { | |
| 123 | - List<ChildBean>list=currentBean.getStudentClass(); | |
| 124 | - childAdapter = new ChildAdapter(this); | |
| 125 | + public void updateChildList(CurrentBean currentBean) { | |
| 126 | + List<ChildBean> list = currentBean.getStudentClass(); | |
| 127 | + currlist.addAll(list); | |
| 128 | + if (childAdapter == null) { | |
| 129 | + childAdapter = new ChildAdapter(this); | |
| 130 | + } | |
| 125 | 131 | childAdapter.addAll(list); |
| 126 | 132 | child_recycle.setAdapter(childAdapter); |
| 127 | 133 | |
| ... | ... | @@ -139,7 +145,8 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 139 | 145 | |
| 140 | 146 | @Override |
| 141 | 147 | public void showError(String error) { |
| 142 | - | |
| 148 | + if (error.equals("解绑成功")) ; | |
| 149 | + mPresenter.loadChildList(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), 0, ""); | |
| 143 | 150 | } |
| 144 | 151 | |
| 145 | 152 | private SwipeMenuCreator swipeMenuCreator = new SwipeMenuCreator() { |
| ... | ... | @@ -160,11 +167,9 @@ public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChi |
| 160 | 167 | }; |
| 161 | 168 | |
| 162 | 169 | |
| 163 | - | |
| 164 | - public void backgroundAlpha(float bgAlpha) | |
| 165 | - { | |
| 170 | + public void backgroundAlpha(float bgAlpha) { | |
| 166 | 171 | WindowManager.LayoutParams lp = getWindow().getAttributes(); |
| 167 | - lp.alpha = bgAlpha; //0.0-1.0 | |
| 172 | + lp.alpha = bgAlpha; //0.0-1.0 | |
| 168 | 173 | getWindow().setAttributes(lp); |
| 169 | 174 | } |
| 170 | 175 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/CheckInfoActivity.java
| ... | ... | @@ -50,6 +50,12 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC |
| 50 | 50 | protected void initView(Bundle savedInstanceState) { |
| 51 | 51 | iphone_layout = findViewById(R.id.iphone_layout); |
| 52 | 52 | back = findViewById(R.id.back_top); |
| 53 | + back.setOnClickListener(new View.OnClickListener() { | |
| 54 | + @Override | |
| 55 | + public void onClick(View v) { | |
| 56 | + finish(); | |
| 57 | + } | |
| 58 | + }); | |
| 53 | 59 | center_title = findViewById(R.id.center_title); |
| 54 | 60 | center_title.setText("信息核对"); |
| 55 | 61 | child_name = findViewById(R.id.child_name); |
| ... | ... | @@ -111,7 +117,7 @@ public class CheckInfoActivity extends BaseMVPCompatActivity<MyChildContract.MyC |
| 111 | 117 | } |
| 112 | 118 | |
| 113 | 119 | @Override |
| 114 | - public void updateChilsList(CurrentBean currentBean) { | |
| 120 | + public void updateChildList(CurrentBean currentBean) { | |
| 115 | 121 | List<ChildBean> list = currentBean.getStudentClass(); |
| 116 | 122 | isNew = currentBean.isNew(); |
| 117 | 123 | user_mobile.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/CreateChildInfoActivity.java
| ... | ... | @@ -55,6 +55,12 @@ public class CreateChildInfoActivity extends BaseMVPCompatActivity<MyChildContra |
| 55 | 55 | center_title = findViewById(R.id.center_title); |
| 56 | 56 | center_title.setText("填写孩子信息"); |
| 57 | 57 | back = findViewById(R.id.back_top); |
| 58 | + back.setOnClickListener(new View.OnClickListener() { | |
| 59 | + @Override | |
| 60 | + public void onClick(View v) { | |
| 61 | + finish(); | |
| 62 | + } | |
| 63 | + }); | |
| 58 | 64 | add_child = findViewById(R.id.add_child); |
| 59 | 65 | child_name = findViewById(R.id.child_name); |
| 60 | 66 | select_sex = findViewById(R.id.select_sex); |
| ... | ... | @@ -116,7 +122,7 @@ public class CreateChildInfoActivity extends BaseMVPCompatActivity<MyChildContra |
| 116 | 122 | } |
| 117 | 123 | |
| 118 | 124 | @Override |
| 119 | - public void updateChilsList(CurrentBean currentBean) { | |
| 125 | + public void updateChildList(CurrentBean currentBean) { | |
| 120 | 126 | |
| 121 | 127 | } |
| 122 | 128 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/SelectSchoolActivity.java
| ... | ... | @@ -58,6 +58,12 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra |
| 58 | 58 | dialog = findViewById(R.id.dialog); |
| 59 | 59 | go_next = findViewById(R.id.go_next); |
| 60 | 60 | back = findViewById(R.id.back_top); |
| 61 | + back.setOnClickListener(new View.OnClickListener() { | |
| 62 | + @Override | |
| 63 | + public void onClick(View v) { | |
| 64 | + finish(); | |
| 65 | + } | |
| 66 | + }); | |
| 61 | 67 | center_title = findViewById(R.id.center_title); |
| 62 | 68 | center_title.setText("选择孩子学校"); |
| 63 | 69 | go_next.setOnClickListener(this); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
| 1 | 1 | package com.shunzhi.parent.ui.fragment.loginandregistfragment; |
| 2 | 2 | |
| 3 | 3 | import android.content.Intent; |
| 4 | -import android.os.Build; | |
| 5 | 4 | import android.os.Bundle; |
| 6 | 5 | import android.support.annotation.NonNull; |
| 7 | 6 | import android.support.annotation.Nullable; |
| 8 | -import android.support.annotation.RequiresApi; | |
| 9 | 7 | import android.text.Editable; |
| 10 | 8 | import android.text.TextUtils; |
| 11 | 9 | import android.text.TextWatcher; |
| 12 | -import android.util.Log; | |
| 13 | 10 | import android.view.Gravity; |
| 14 | 11 | import android.view.LayoutInflater; |
| 15 | 12 | import android.view.View; |
| ... | ... | @@ -32,21 +29,20 @@ import com.shunzhi.parent.ui.MainActivity; |
| 32 | 29 | import com.shunzhi.parent.ui.activity.LoginAndRegistActivity; |
| 33 | 30 | import com.shunzhi.parent.views.MyProcessDialog; |
| 34 | 31 | |
| 35 | -import java.util.Calendar; | |
| 36 | -import java.util.Date; | |
| 37 | - | |
| 38 | 32 | |
| 39 | 33 | public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegisterContract.LoginPresenter, LoginAndRegisterContract.ILoginModel> |
| 40 | 34 | implements LoginAndRegisterContract.ILoginView, View.OnClickListener { |
| 41 | 35 | |
| 42 | 36 | public RoundedImageView roundedImageView; |
| 43 | - public EditText phoneNumber, idCode, password; | |
| 44 | - public TextView get_idCode, loginAndRegister, tv_info, tv_goto; | |
| 45 | - public LinearLayout phoneLayout, idCodeLayout, passwordLayout, main_login; | |
| 46 | - public ImageView img_eye; | |
| 37 | + public EditText phoneNumber, idCode, password, et_password_new; | |
| 38 | + public TextView get_idCode, loginAndRegister, tv_info, tv_goto, tv_goto_zhuce, tv_goto_mima; | |
| 39 | + public LinearLayout phoneLayout, idCodeLayout, passwordLayout, main_login, passwordLayout_new; | |
| 40 | + public ImageView img_eye, img_eye_new, back_login; | |
| 47 | 41 | public static String typepage; |
| 48 | 42 | public boolean open = false; |
| 43 | + public boolean opennew = false; | |
| 49 | 44 | public static MyProcessDialog progressDialog; |
| 45 | + LinearLayout denglu, zhuce; | |
| 50 | 46 | |
| 51 | 47 | |
| 52 | 48 | public static LoginAndRegistFragment getInstance(String type) { |
| ... | ... | @@ -70,6 +66,11 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
| 70 | 66 | @Override |
| 71 | 67 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
| 72 | 68 | progressDialog = new MyProcessDialog(getActivity()); |
| 69 | + tv_goto_zhuce = view.findViewById(R.id.tv_goto_zhuce); | |
| 70 | + tv_goto_mima = view.findViewById(R.id.tv_goto_mima); | |
| 71 | + back_login = view.findViewById(R.id.back_login); | |
| 72 | + denglu = view.findViewById(R.id.denglu); | |
| 73 | + zhuce = view.findViewById(R.id.zhuce); | |
| 73 | 74 | main_login = view.findViewById(R.id.main_login); |
| 74 | 75 | roundedImageView = view.findViewById(R.id.photoImage); |
| 75 | 76 | phoneNumber = view.findViewById(R.id.et_phoneNumber); |
| ... | ... | @@ -83,24 +84,46 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
| 83 | 84 | idCodeLayout = view.findViewById(R.id.idCodeLayout); |
| 84 | 85 | passwordLayout = view.findViewById(R.id.passwordLayout); |
| 85 | 86 | img_eye = view.findViewById(R.id.img_eye); |
| 87 | + img_eye_new = view.findViewById(R.id.img_eye_new); | |
| 86 | 88 | get_idCode.setOnClickListener(this); |
| 89 | + tv_goto_zhuce.setOnClickListener(this); | |
| 90 | + tv_goto_mima.setOnClickListener(this); | |
| 87 | 91 | tv_goto.setOnClickListener(this); |
| 88 | 92 | loginAndRegister.setOnClickListener(this); |
| 89 | 93 | img_eye.setOnClickListener(this); |
| 94 | + img_eye_new.setOnClickListener(this); | |
| 95 | + back_login.setOnClickListener(this); | |
| 90 | 96 | phoneNumber.addTextChangedListener(textWatcher); |
| 91 | 97 | idCode.addTextChangedListener(textWatcher); |
| 92 | 98 | password.addTextChangedListener(textWatcher); |
| 99 | + | |
| 100 | + | |
| 101 | + passwordLayout_new = view.findViewById(R.id.passwordLayout_new); | |
| 102 | + et_password_new = view.findViewById(R.id.et_password_new); | |
| 103 | + et_password_new.addTextChangedListener(textWatcher); | |
| 104 | + | |
| 93 | 105 | mPresenter.loginResult("18358575338", "575338"); |
| 94 | 106 | if ("登录".equals(typepage)) { |
| 95 | 107 | idCodeLayout.setVisibility(View.GONE); |
| 108 | + passwordLayout_new.setVisibility(View.GONE); | |
| 96 | 109 | loginAndRegister.setText("登录"); |
| 97 | - tv_info.setText("还没有账号"); | |
| 98 | - tv_goto.setText("注册"); | |
| 110 | + denglu.setVisibility(View.VISIBLE); | |
| 111 | + zhuce.setVisibility(View.GONE); | |
| 112 | + back_login.setVisibility(View.INVISIBLE); | |
| 99 | 113 | } else if ("注册".equals(typepage)) { |
| 100 | 114 | idCodeLayout.setVisibility(View.VISIBLE); |
| 115 | + passwordLayout_new.setVisibility(View.GONE); | |
| 101 | 116 | loginAndRegister.setText("注册"); |
| 102 | - tv_info.setText("已注册,直接登录"); | |
| 103 | - tv_goto.setText("登录"); | |
| 117 | + denglu.setVisibility(View.GONE); | |
| 118 | + zhuce.setVisibility(View.VISIBLE); | |
| 119 | + back_login.setVisibility(View.INVISIBLE); | |
| 120 | + } else if ("找回密码".equals(typepage)) { | |
| 121 | + idCodeLayout.setVisibility(View.VISIBLE); | |
| 122 | + passwordLayout_new.setVisibility(View.VISIBLE); | |
| 123 | + loginAndRegister.setText("确定"); | |
| 124 | + denglu.setVisibility(View.GONE); | |
| 125 | + zhuce.setVisibility(View.GONE); | |
| 126 | + back_login.setVisibility(View.VISIBLE); | |
| 104 | 127 | } |
| 105 | 128 | |
| 106 | 129 | roundedImageView.setOnClickListener(new View.OnClickListener() { |
| ... | ... | @@ -123,12 +146,15 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
| 123 | 146 | popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); |
| 124 | 147 | popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); |
| 125 | 148 | View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_view, null); |
| 149 | + TextView dialogInfo = view.findViewById(R.id.dialog_info); | |
| 150 | + dialogInfo.setText("注册成功"); | |
| 126 | 151 | TextView right_btn = view.findViewById(R.id.right_btn); |
| 152 | + right_btn.setText("进入首页"); | |
| 127 | 153 | right_btn.setOnClickListener(new View.OnClickListener() { |
| 128 | 154 | @Override |
| 129 | 155 | public void onClick(View v) { |
| 130 | 156 | progressDialog.show(); |
| 131 | - mPresenter.loginResult(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME),AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_PWD)); | |
| 157 | + mPresenter.loginResult(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_PWD)); | |
| 132 | 158 | } |
| 133 | 159 | }); |
| 134 | 160 | TextView cancel_btn = view.findViewById(R.id.cancel_btn); |
| ... | ... | @@ -146,29 +172,28 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
| 146 | 172 | } |
| 147 | 173 | |
| 148 | 174 | |
| 149 | - | |
| 150 | 175 | } |
| 151 | 176 | |
| 152 | - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) | |
| 153 | 177 | @Override |
| 154 | 178 | public void onClick(View v) { |
| 155 | 179 | if (v == loginAndRegister) { |
| 156 | 180 | progressDialog.show(); |
| 157 | - Date l = Calendar.getInstance().getTime(); | |
| 158 | - | |
| 159 | - Log.e("1111--==", l.getTime() + ""); | |
| 160 | 181 | if (loginAndRegister.getText().toString().trim().equals("登录")) { |
| 161 | 182 | mPresenter.loginResult(phoneNumber.getText().toString(), password.getText().toString()); |
| 162 | 183 | } else if (loginAndRegister.getText().toString().trim().equals("注册")) { |
| 163 | 184 | mPresenter.registerResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString()); |
| 185 | + } else if (loginAndRegister.getText().toString().trim().equals("确定")) { | |
| 186 | + //修改密码 | |
| 164 | 187 | } |
| 165 | 188 | |
| 166 | 189 | } else if (v == tv_goto) { |
| 167 | - if (tv_goto.getText().toString().equals("登录")) { | |
| 168 | - startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class)); | |
| 169 | - } else if (tv_goto.getText().toString().equals("注册")) { | |
| 170 | - startActivity(new Intent().putExtra("type", "注册").setClass(getActivity(), LoginAndRegistActivity.class)); | |
| 171 | - } | |
| 190 | + startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class)); | |
| 191 | + getActivity().finish(); | |
| 192 | + } else if (v == tv_goto_zhuce) { | |
| 193 | + startActivity(new Intent().putExtra("type", "注册").setClass(getActivity(), LoginAndRegistActivity.class)); | |
| 194 | + getActivity().finish(); | |
| 195 | + } else if (v == tv_goto_mima) { | |
| 196 | + startActivity(new Intent().putExtra("type", "找回密码").setClass(getActivity(), LoginAndRegistActivity.class)); | |
| 172 | 197 | getActivity().finish(); |
| 173 | 198 | } else if (v == get_idCode) { |
| 174 | 199 | mPresenter.idCodeResult(phoneNumber.getText().toString()); |
| ... | ... | @@ -183,6 +208,19 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
| 183 | 208 | open = true; |
| 184 | 209 | } |
| 185 | 210 | password.setSelection(password.getText().toString().length()); |
| 211 | + } else if (v == img_eye_new) { | |
| 212 | + if (opennew) { | |
| 213 | + img_eye_new.setImageResource(R.drawable.eye_close); | |
| 214 | + et_password_new.setInputType(0x81); | |
| 215 | + opennew = false; | |
| 216 | + } else { | |
| 217 | + img_eye_new.setImageResource(R.drawable.eye_open); | |
| 218 | + et_password_new.setInputType(0x90); | |
| 219 | + opennew = true; | |
| 220 | + } | |
| 221 | + } else if (v == back_login) { | |
| 222 | + startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class)); | |
| 223 | + getActivity().finish(); | |
| 186 | 224 | } |
| 187 | 225 | } |
| 188 | 226 | |
| ... | ... | @@ -210,6 +248,14 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
| 210 | 248 | loginAndRegister.setEnabled(false); |
| 211 | 249 | loginAndRegister.setBackgroundResource(R.drawable.rudiobtn_unclick); |
| 212 | 250 | } |
| 251 | + } else if (loginAndRegister.getText().toString().trim().equals("确定")) { | |
| 252 | + if (!TextUtils.isEmpty(phoneNumber.getText().toString()) && !TextUtils.isEmpty(idCode.getText().toString()) && !TextUtils.isEmpty(password.getText().toString()) && !TextUtils.isEmpty(et_password_new.getText().toString())) { | |
| 253 | + loginAndRegister.setEnabled(true); | |
| 254 | + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn); | |
| 255 | + } else { | |
| 256 | + loginAndRegister.setEnabled(false); | |
| 257 | + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn_unclick); | |
| 258 | + } | |
| 213 | 259 | } |
| 214 | 260 | } |
| 215 | 261 | ... | ... |
app/src/main/res/drawable-xhdpi/arrow_left.png
app/src/main/res/drawable-xhdpi/arrow_right.png
app/src/main/res/layout/activity_child_detail.xml
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | <TextView |
| 39 | 39 | android:layout_width="wrap_content" |
| 40 | 40 | android:layout_height="wrap_content" |
| 41 | - android:text="孩子姓名:" | |
| 41 | + android:text=" 孩子姓名:" | |
| 42 | 42 | android:textSize="@dimen/sp_16" /> |
| 43 | 43 | |
| 44 | 44 | <TextView |
| ... | ... | @@ -62,7 +62,7 @@ |
| 62 | 62 | <TextView |
| 63 | 63 | android:layout_width="wrap_content" |
| 64 | 64 | android:layout_height="wrap_content" |
| 65 | - android:text="学 校:" | |
| 65 | + android:text=" 学 校:" | |
| 66 | 66 | android:textSize="@dimen/sp_16" /> |
| 67 | 67 | |
| 68 | 68 | <TextView |
| ... | ... | @@ -88,7 +88,7 @@ |
| 88 | 88 | <TextView |
| 89 | 89 | android:layout_width="wrap_content" |
| 90 | 90 | android:layout_height="wrap_content" |
| 91 | - android:text="班 级:" | |
| 91 | + android:text=" 班 级:" | |
| 92 | 92 | android:textSize="@dimen/sp_16" /> |
| 93 | 93 | |
| 94 | 94 | <TextView |
| ... | ... | @@ -134,30 +134,19 @@ |
| 134 | 134 | <TextView |
| 135 | 135 | android:layout_width="wrap_content" |
| 136 | 136 | android:layout_height="wrap_content" |
| 137 | - android:text="学生账号:" | |
| 137 | + android:text=" 学生账号:" | |
| 138 | 138 | android:textSize="@dimen/sp_16" /> |
| 139 | 139 | |
| 140 | 140 | <TextView |
| 141 | - android:id="@+id/" | |
| 141 | + android:id="@+id/student_code" | |
| 142 | 142 | android:layout_width="wrap_content" |
| 143 | 143 | android:layout_height="match_parent" |
| 144 | 144 | android:layout_weight="1" |
| 145 | 145 | android:background="@drawable/rudio_bord" |
| 146 | 146 | android:gravity="center" |
| 147 | 147 | android:textColor="@color/textColor" /> |
| 148 | - | |
| 149 | 148 | </LinearLayout> |
| 150 | - <TextView | |
| 151 | - android:id="@+id/add_child" | |
| 152 | - android:layout_width="220dp" | |
| 153 | - android:layout_height="40dp" | |
| 154 | - android:layout_gravity="center_horizontal" | |
| 155 | - android:layout_marginTop="20dp" | |
| 156 | - android:background="@drawable/rudiobtn" | |
| 157 | - android:gravity="center" | |
| 158 | - android:text="确定" | |
| 159 | - android:textColor="@color/white" | |
| 160 | - android:textSize="@dimen/txtsize_title" /> | |
| 149 | + | |
| 161 | 150 | </LinearLayout> |
| 162 | 151 | |
| 163 | 152 | ... | ... |
app/src/main/res/layout/fragment_login_and_regist.xml
| ... | ... | @@ -11,6 +11,18 @@ |
| 11 | 11 | android:layout_width="match_parent" |
| 12 | 12 | android:layout_height="match_parent" |
| 13 | 13 | android:orientation="vertical"> |
| 14 | + <LinearLayout | |
| 15 | + android:layout_width="match_parent" | |
| 16 | + android:layout_height="wrap_content"> | |
| 17 | + <ImageView | |
| 18 | + android:layout_marginTop="10dp" | |
| 19 | + android:id="@+id/back_login" | |
| 20 | + android:layout_width="60dp" | |
| 21 | + android:layout_height="20dp" | |
| 22 | + android:visibility="invisible" | |
| 23 | + android:src="@drawable/arrow_left" | |
| 24 | + /> | |
| 25 | + </LinearLayout> | |
| 14 | 26 | |
| 15 | 27 | <com.makeramen.roundedimageview.RoundedImageView |
| 16 | 28 | android:id="@+id/photoImage" |
| ... | ... | @@ -236,7 +248,7 @@ |
| 236 | 248 | android:textSize="@dimen/sp_16" /> |
| 237 | 249 | |
| 238 | 250 | <TextView |
| 239 | - android:id="@+id/tv_goto_login" | |
| 251 | + android:id="@+id/tv_goto_zhuce" | |
| 240 | 252 | android:layout_width="wrap_content" |
| 241 | 253 | android:layout_height="wrap_content" |
| 242 | 254 | android:text="注册" |
| ... | ... | @@ -248,6 +260,7 @@ |
| 248 | 260 | android:layout_weight="1" |
| 249 | 261 | /> |
| 250 | 262 | <TextView |
| 263 | + android:id="@+id/tv_goto_mima" | |
| 251 | 264 | android:layout_width="wrap_content" |
| 252 | 265 | android:layout_height="wrap_content" |
| 253 | 266 | android:text="忘记密码" | ... | ... |
app/src/main/res/layout/fragment_mine.xml
| ... | ... | @@ -71,8 +71,8 @@ |
| 71 | 71 | </LinearLayout> |
| 72 | 72 | |
| 73 | 73 | <ImageView |
| 74 | - android:layout_width="40dp" | |
| 75 | - android:layout_height="40dp" | |
| 74 | + android:layout_width="30dp" | |
| 75 | + android:layout_height="30dp" | |
| 76 | 76 | android:layout_marginRight="20dp" |
| 77 | 77 | android:layout_gravity="center_vertical" |
| 78 | 78 | android:src="@drawable/arrow_right" /> | ... | ... |
app/src/main/res/layout/item_childlist.xml