Commit b181dda45a87176934426edec17cfb129d4e5e17

Authored by 陶汉栋
2 parents 7143f4b6 a97b79d9

no message

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
... ... @@ -37,5 +37,9 @@ public interface MineApi {
37 37  
38 38 @GET("/api/ParentHelper/GetClassOrGrade")
39 39 Observable<GradeBean>getGradeAndClass(@Query("state") int state,@Query("schoolid") int schoolId,@Query("gradeid") int gradeId);
  40 +
  41 +
  42 + @GET("/api/ParentHelper/UnBindStudent")
  43 + Observable<JsonObject>unBinding(@Query("parentId") int parentId,@Query("studentId") int studentId);
40 44 }
41 45  
... ...
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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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&lt;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;
... ... @@ -41,13 +38,15 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment&lt;LoginAndRegist
41 38 implements LoginAndRegisterContract.ILoginView, View.OnClickListener {
42 39  
43 40 public RoundedImageView roundedImageView;
44   - public EditText phoneNumber, idCode, password;
45   - public TextView get_idCode, loginAndRegister, tv_info, tv_goto;
46   - public LinearLayout phoneLayout, idCodeLayout, passwordLayout, main_login;
47   - public ImageView img_eye;
  41 + public EditText phoneNumber, idCode, password, et_password_new;
  42 + public TextView get_idCode, loginAndRegister, tv_info, tv_goto, tv_goto_zhuce, tv_goto_mima;
  43 + public LinearLayout phoneLayout, idCodeLayout, passwordLayout, main_login, passwordLayout_new;
  44 + public ImageView img_eye, img_eye_new, back_login;
48 45 public static String typepage;
49 46 public boolean open = false;
  47 + public boolean opennew = false;
50 48 public static MyProcessDialog progressDialog;
  49 + LinearLayout denglu, zhuce;
51 50  
52 51  
53 52 public static LoginAndRegistFragment getInstance(String type) {
... ... @@ -71,6 +70,11 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment&lt;LoginAndRegist
71 70 @Override
72 71 public void initUI(View view, @Nullable Bundle savedInstanceState) {
73 72 progressDialog = new MyProcessDialog(getActivity());
  73 + tv_goto_zhuce = view.findViewById(R.id.tv_goto_zhuce);
  74 + tv_goto_mima = view.findViewById(R.id.tv_goto_mima);
  75 + back_login = view.findViewById(R.id.back_login);
  76 + denglu = view.findViewById(R.id.denglu);
  77 + zhuce = view.findViewById(R.id.zhuce);
74 78 main_login = view.findViewById(R.id.main_login);
75 79 roundedImageView = view.findViewById(R.id.photoImage);
76 80 phoneNumber = view.findViewById(R.id.et_phoneNumber);
... ... @@ -84,24 +88,45 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment&lt;LoginAndRegist
84 88 idCodeLayout = view.findViewById(R.id.idCodeLayout);
85 89 passwordLayout = view.findViewById(R.id.passwordLayout);
86 90 img_eye = view.findViewById(R.id.img_eye);
  91 + img_eye_new = view.findViewById(R.id.img_eye_new);
87 92 get_idCode.setOnClickListener(this);
  93 + tv_goto_zhuce.setOnClickListener(this);
  94 + tv_goto_mima.setOnClickListener(this);
88 95 tv_goto.setOnClickListener(this);
89 96 loginAndRegister.setOnClickListener(this);
90 97 img_eye.setOnClickListener(this);
  98 + img_eye_new.setOnClickListener(this);
  99 + back_login.setOnClickListener(this);
91 100 phoneNumber.addTextChangedListener(textWatcher);
92 101 idCode.addTextChangedListener(textWatcher);
93 102 password.addTextChangedListener(textWatcher);
94 103 mPresenter.loginResult("18358585335", "575335");
  104 +
  105 + passwordLayout_new = view.findViewById(R.id.passwordLayout_new);
  106 + et_password_new = view.findViewById(R.id.et_password_new);
  107 + et_password_new.addTextChangedListener(textWatcher);
  108 +
95 109 if ("登录".equals(typepage)) {
96 110 idCodeLayout.setVisibility(View.GONE);
  111 + passwordLayout_new.setVisibility(View.GONE);
97 112 loginAndRegister.setText("登录");
98   - tv_info.setText("还没有账号");
99   - tv_goto.setText("注册");
  113 + denglu.setVisibility(View.VISIBLE);
  114 + zhuce.setVisibility(View.GONE);
  115 + back_login.setVisibility(View.INVISIBLE);
100 116 } else if ("注册".equals(typepage)) {
101 117 idCodeLayout.setVisibility(View.VISIBLE);
  118 + passwordLayout_new.setVisibility(View.GONE);
102 119 loginAndRegister.setText("注册");
103   - tv_info.setText("已注册,直接登录");
104   - tv_goto.setText("登录");
  120 + denglu.setVisibility(View.GONE);
  121 + zhuce.setVisibility(View.VISIBLE);
  122 + back_login.setVisibility(View.INVISIBLE);
  123 + } else if ("找回密码".equals(typepage)) {
  124 + idCodeLayout.setVisibility(View.VISIBLE);
  125 + passwordLayout_new.setVisibility(View.VISIBLE);
  126 + loginAndRegister.setText("确定");
  127 + denglu.setVisibility(View.GONE);
  128 + zhuce.setVisibility(View.GONE);
  129 + back_login.setVisibility(View.VISIBLE);
105 130 }
106 131  
107 132 roundedImageView.setOnClickListener(new View.OnClickListener() {
... ... @@ -124,12 +149,15 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment&lt;LoginAndRegist
124 149 popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
125 150 popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
126 151 View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_view, null);
  152 + TextView dialogInfo = view.findViewById(R.id.dialog_info);
  153 + dialogInfo.setText("注册成功");
127 154 TextView right_btn = view.findViewById(R.id.right_btn);
  155 + right_btn.setText("进入首页");
128 156 right_btn.setOnClickListener(new View.OnClickListener() {
129 157 @Override
130 158 public void onClick(View v) {
131 159 progressDialog.show();
132   - mPresenter.loginResult(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME),AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_PWD));
  160 + mPresenter.loginResult(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME), AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_PWD));
133 161 }
134 162 });
135 163 TextView cancel_btn = view.findViewById(R.id.cancel_btn);
... ... @@ -147,28 +175,29 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment&lt;LoginAndRegist
147 175 }
148 176  
149 177  
150   -
151 178 }
152 179  
153   - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
154 180 @Override
155 181 public void onClick(View v) {
156 182 if (v == loginAndRegister) {
157 183 progressDialog.show();
158   - Date l = Calendar.getInstance().getTime();
159 184 // Log.e("1111--==", l.getTime() + "");
160 185 if (loginAndRegister.getText().toString().trim().equals("登录")) {
161 186 mPresenter.loginResult(phoneNumber.getText().toString(), password.getText().toString());
162 187 } else if (loginAndRegister.getText().toString().trim().equals("注册")) {
163 188 mPresenter.registerResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString());
  189 + } else if (loginAndRegister.getText().toString().trim().equals("确定")) {
  190 + //修改密码
164 191 }
165 192  
166 193 } 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   - }
  194 + startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class));
  195 + getActivity().finish();
  196 + } else if (v == tv_goto_zhuce) {
  197 + startActivity(new Intent().putExtra("type", "注册").setClass(getActivity(), LoginAndRegistActivity.class));
  198 + getActivity().finish();
  199 + } else if (v == tv_goto_mima) {
  200 + startActivity(new Intent().putExtra("type", "找回密码").setClass(getActivity(), LoginAndRegistActivity.class));
172 201 getActivity().finish();
173 202 } else if (v == get_idCode) {
174 203 mPresenter.idCodeResult(phoneNumber.getText().toString());
... ... @@ -183,6 +212,19 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment&lt;LoginAndRegist
183 212 open = true;
184 213 }
185 214 password.setSelection(password.getText().toString().length());
  215 + } else if (v == img_eye_new) {
  216 + if (opennew) {
  217 + img_eye_new.setImageResource(R.drawable.eye_close);
  218 + et_password_new.setInputType(0x81);
  219 + opennew = false;
  220 + } else {
  221 + img_eye_new.setImageResource(R.drawable.eye_open);
  222 + et_password_new.setInputType(0x90);
  223 + opennew = true;
  224 + }
  225 + } else if (v == back_login) {
  226 + startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class));
  227 + getActivity().finish();
186 228 }
187 229 }
188 230  
... ... @@ -210,6 +252,14 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment&lt;LoginAndRegist
210 252 loginAndRegister.setEnabled(false);
211 253 loginAndRegister.setBackgroundResource(R.drawable.rudiobtn_unclick);
212 254 }
  255 + } else if (loginAndRegister.getText().toString().trim().equals("确定")) {
  256 + if (!TextUtils.isEmpty(phoneNumber.getText().toString()) && !TextUtils.isEmpty(idCode.getText().toString()) && !TextUtils.isEmpty(password.getText().toString()) && !TextUtils.isEmpty(et_password_new.getText().toString())) {
  257 + loginAndRegister.setEnabled(true);
  258 + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn);
  259 + } else {
  260 + loginAndRegister.setEnabled(false);
  261 + loginAndRegister.setBackgroundResource(R.drawable.rudiobtn_unclick);
  262 + }
213 263 }
214 264 }
215 265  
... ...
app/src/main/res/drawable-xhdpi/arrow_left.png

578 Bytes | W: | H:

1.56 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xhdpi/arrow_right.png

506 Bytes | W: | H:

1.25 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
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"
... ... @@ -235,7 +247,7 @@
235 247 android:textSize="@dimen/sp_16" />
236 248  
237 249 <TextView
238   - android:id="@+id/tv_goto_login"
  250 + android:id="@+id/tv_goto_zhuce"
239 251 android:layout_width="wrap_content"
240 252 android:layout_height="wrap_content"
241 253 android:text="注册"
... ... @@ -247,6 +259,7 @@
247 259 android:layout_weight="1"
248 260 />
249 261 <TextView
  262 + android:id="@+id/tv_goto_mima"
250 263 android:layout_width="wrap_content"
251 264 android:layout_height="wrap_content"
252 265 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
... ... @@ -4,6 +4,7 @@
4 4 android:layout_height="wrap_content">
5 5  
6 6 <LinearLayout
  7 + android:id="@+id/item_view"
7 8 android:layout_margin="10dp"
8 9 android:layout_width="match_parent"
9 10 android:layout_height="wrap_content">
... ...