Commit de62641eb119e3ad5ea4d4055e83e3e96dc2864d
1 parent
87ab95b8
Exists in
yxb_dev
and in
2 other branches
no message
Showing
42 changed files
with
1046 additions
and
169 deletions
Show diff stats
app/build.gradle
app/src/main/AndroidManifest.xml
... | ... | @@ -71,7 +71,8 @@ |
71 | 71 | <category android:name="android.intent.category.LAUNCHER" /> |
72 | 72 | </intent-filter> |
73 | 73 | </activity> |
74 | - <!-- <activity android:name=".ui.activity.LoginAndRegistActivity" /> --> | |
74 | + <activity android:name=".ui.MainActivity" | |
75 | + android:screenOrientation="portrait" /> | |
75 | 76 | <activity |
76 | 77 | android:name=".ui.activity.MyChildActivity" |
77 | 78 | android:screenOrientation="portrait" /> |
... | ... | @@ -81,6 +82,10 @@ |
81 | 82 | android:name=".ui.activity.StartActivity" |
82 | 83 | android:screenOrientation="portrait" /> |
83 | 84 | <activity |
85 | + android:name=".ui.activity.binding.CreateChildInfoActivity" | |
86 | + android:screenOrientation="portrait" | |
87 | + android:windowSoftInputMode="adjustPan|stateHidden"/> | |
88 | + <activity | |
84 | 89 | android:name=".ui.activity.binding.SelectSchoolActivity" |
85 | 90 | android:screenOrientation="portrait" |
86 | 91 | android:windowSoftInputMode="adjustPan|stateHidden" /> | ... | ... |
app/src/main/java/com/shunzhi/parent/AppConfig.java
... | ... | @@ -18,6 +18,10 @@ public class AppConfig { |
18 | 18 | public static String LOGIN_NAME = "login_name"; |
19 | 19 | public static String LOGIN_PWD = "login_pwd"; |
20 | 20 | public static String ACCESS_TOKEN = "access_token"; |
21 | + public static String USER_NAME = "user_name"; | |
22 | + public static String USER_SEX = "user_sex"; | |
23 | + public static String USER_IMAGE = "user_image"; | |
24 | + | |
21 | 25 | |
22 | 26 | //默认日志保存的路径 |
23 | 27 | public final static String DEFAULT_SAVE_LOG_PATH = Environment |
... | ... | @@ -29,7 +33,6 @@ public class AppConfig { |
29 | 33 | + File.separator; |
30 | 34 | |
31 | 35 | |
32 | - | |
33 | 36 | private static AppConfig appConfig = null; |
34 | 37 | private static Context mContext = null; |
35 | 38 | |
... | ... | @@ -71,6 +74,4 @@ public class AppConfig { |
71 | 74 | } |
72 | 75 | |
73 | 76 | |
74 | - | |
75 | - | |
76 | 77 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/AppContext.java
... | ... | @@ -99,6 +99,7 @@ public class AppContext extends GlobalApplication { |
99 | 99 | |
100 | 100 | if (aMapLocation.getErrorCode()==0){ |
101 | 101 | cityName=aMapLocation.getCity(); |
102 | + aMapLocation.getCityCode(); | |
102 | 103 | Log.d("mlocation:","handler="+handler); |
103 | 104 | Intent intent=new Intent(); |
104 | 105 | intent.setAction(LOCATION_CITYNAME+""); | ... | ... |
app/src/main/java/com/shunzhi/parent/adapter/SchoolListAdapter.java
... | ... | @@ -6,12 +6,13 @@ import android.view.LayoutInflater; |
6 | 6 | import android.view.View; |
7 | 7 | import android.view.ViewGroup; |
8 | 8 | import android.widget.ImageView; |
9 | +import android.widget.RelativeLayout; | |
9 | 10 | import android.widget.TextView; |
10 | 11 | |
11 | 12 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
12 | 13 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
13 | 14 | import com.shunzhi.parent.R; |
14 | -import com.shunzhi.parent.bean.SchoolBean; | |
15 | +import com.shunzhi.parent.bean.SortBean; | |
15 | 16 | |
16 | 17 | import java.util.List; |
17 | 18 | |
... | ... | @@ -19,14 +20,22 @@ import java.util.List; |
19 | 20 | * Created by Administrator on 2018/3/9 0009. |
20 | 21 | */ |
21 | 22 | |
22 | -public class SchoolListAdapter extends BaseRecyclerViewAdapter<SchoolBean> { | |
23 | +public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | |
23 | 24 | |
24 | 25 | Context context; |
25 | - List<SchoolBean>list; | |
26 | + List<SortBean> list; | |
27 | + boolean[] ischeck; | |
28 | + int currentPosition=-1; | |
29 | + public static SortBean currentSortBean; | |
26 | 30 | |
27 | - public SchoolListAdapter(Context context,List<SchoolBean>list) { | |
31 | + public SchoolListAdapter(Context context, List<SortBean> list) { | |
28 | 32 | this.context = context; |
29 | - this.list=list; | |
33 | + this.list = list; | |
34 | + ischeck = new boolean[list.size()]; | |
35 | + for (int i=0;i<ischeck.length;i++){ | |
36 | + ischeck[i]=false; | |
37 | + } | |
38 | + | |
30 | 39 | } |
31 | 40 | |
32 | 41 | |
... | ... | @@ -36,20 +45,26 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SchoolBean> { |
36 | 45 | return new MyViewHolder(view); |
37 | 46 | } |
38 | 47 | |
39 | - private class MyViewHolder extends BaseRecyclerViewHolder<SchoolBean> { | |
48 | + private class MyViewHolder extends BaseRecyclerViewHolder<SortBean> { | |
40 | 49 | TextView school_name; |
41 | 50 | ImageView select_school; |
42 | 51 | TextView tvLetter; |
52 | + RelativeLayout item_view; | |
43 | 53 | |
44 | 54 | public MyViewHolder(View view) { |
45 | 55 | super(view); |
46 | 56 | school_name = view.findViewById(R.id.school_name); |
47 | 57 | select_school = view.findViewById(R.id.select_school); |
48 | 58 | tvLetter = view.findViewById(R.id.uiPPLetter); |
59 | + item_view = view.findViewById(R.id.item_view); | |
49 | 60 | } |
50 | 61 | |
51 | 62 | @Override |
52 | - public void onBindViewHolder(SchoolBean object, int position) { | |
63 | + public void onBindViewHolder(final SortBean object, final int position) { | |
64 | + select_school.setVisibility(View.INVISIBLE); | |
65 | + if (ischeck[position] ==true) { | |
66 | + select_school.setVisibility(View.VISIBLE); | |
67 | + } | |
53 | 68 | int section = getSectionForPosition(position); |
54 | 69 | //如果当前位置等于该分类首字母的Char的位置 ,则认为是第一次出现,并且不是老师 |
55 | 70 | if (position == getPositionForSection(section)) { |
... | ... | @@ -62,35 +77,49 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SchoolBean> { |
62 | 77 | tvLetter.setVisibility(View.GONE); |
63 | 78 | } |
64 | 79 | |
65 | - school_name.setText(object.getSchoolname()); | |
80 | + school_name.setText(object.getSchool_name()); | |
81 | + item_view.setOnClickListener(new View.OnClickListener() { | |
82 | + @Override | |
83 | + public void onClick(View v) { | |
84 | + ischeck[position] = true; | |
85 | + if(currentPosition!=-1) { | |
86 | + ischeck[currentPosition] = false; | |
87 | + } | |
88 | + currentPosition = position; | |
89 | + currentSortBean=object; | |
90 | + notifyDataSetChanged(); | |
91 | + } | |
92 | + }); | |
66 | 93 | |
67 | 94 | |
68 | 95 | } |
69 | 96 | |
70 | 97 | |
71 | - | |
72 | - | |
73 | 98 | } |
99 | + | |
74 | 100 | public int getPositionForSection(int section) { |
75 | 101 | for (int i = 0; i < getCount(); i++) { |
76 | - String sortStr = list.get(i).getSortLetters(); | |
77 | - char firstChar = sortStr.toUpperCase().charAt(0); | |
78 | - if (firstChar == section) { | |
79 | - return i; | |
102 | + String sortStr = list.get(i).getSortLetters(); | |
103 | + char firstChar = sortStr.toUpperCase().charAt(0); | |
104 | + if (firstChar == section) { | |
105 | + return i; | |
80 | 106 | } |
81 | 107 | } |
82 | 108 | |
83 | 109 | return -1; |
84 | 110 | } |
111 | + | |
85 | 112 | public int getCount() { |
86 | 113 | return list.size(); |
87 | 114 | } |
88 | 115 | |
89 | 116 | public int getSectionForPosition(int position) { |
90 | 117 | |
91 | - return list.get(position).getSortLetters().charAt(0); | |
118 | + return list.get(position).getSortLetters().charAt(0); | |
92 | 119 | |
93 | 120 | } |
94 | 121 | |
95 | - | |
122 | + public static SortBean getCurrentSortBean() { | |
123 | + return currentSortBean; | |
124 | + } | |
96 | 125 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/api/LoginRegisterApi.java
1 | 1 | package com.shunzhi.parent.api; |
2 | 2 | |
3 | 3 | import com.google.gson.JsonObject; |
4 | -import com.shunzhi.parent.bean.CurrentBean; | |
4 | +import com.shunzhi.parent.bean.UserInfo; | |
5 | 5 | |
6 | 6 | import io.reactivex.Observable; |
7 | 7 | import retrofit2.http.Field; |
... | ... | @@ -38,6 +38,6 @@ public interface LoginRegisterApi { |
38 | 38 | |
39 | 39 | @FormUrlEncoded |
40 | 40 | @POST("/api/ParentHelper/GetParentInfo") |
41 | - Observable<CurrentBean> getUserInfo(); | |
41 | + Observable<UserInfo> getUserInfo(@Field("mobile") String mobile, @Field("school_id") int school_id, @Field("captcha") String captcha); | |
42 | 42 | |
43 | 43 | } | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +package com.shunzhi.parent.api; | |
2 | + | |
3 | +import com.google.gson.JsonObject; | |
4 | + | |
5 | +import io.reactivex.Observable; | |
6 | +import retrofit2.http.Field; | |
7 | +import retrofit2.http.FormUrlEncoded; | |
8 | +import retrofit2.http.POST; | |
9 | + | |
10 | +/** | |
11 | + * Created by Administrator on 2018/3/7 0007. | |
12 | + */ | |
13 | + | |
14 | +public interface MineApi { | |
15 | +// String url="http://campus.myjxt.com/"; | |
16 | + String url="http://60.190.202.57:1000/"; | |
17 | + | |
18 | +@FormUrlEncoded | |
19 | + @POST("/api/ParentHelper/GetAreaSchool") | |
20 | + Observable<JsonObject> getSchoolListResult( | |
21 | + @Field("areaName") String areaName, @Field("Keyword") String Keyword); | |
22 | + | |
23 | +@FormUrlEncoded | |
24 | +@POST("/api/ParentHelper/UpdateParentInfo") | |
25 | + Observable<JsonObject> getChangeInfoResult( | |
26 | + @Field("parentName") String parentName, @Field("sex") int sex,@Field("mobile")String mobile); | |
27 | + | |
28 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/ChildBean.java
... | ... | @@ -5,4 +5,160 @@ package com.shunzhi.parent.bean; |
5 | 5 | */ |
6 | 6 | |
7 | 7 | public class ChildBean { |
8 | -} | |
8 | + private int parentMobile; | |
9 | + private int parentId; | |
10 | + private boolean mobileFlag; | |
11 | + private boolean bindingState; | |
12 | + private boolean cooperateFlag; | |
13 | + private int schoolId; | |
14 | + private String schoolName; | |
15 | + private int grade; | |
16 | + private String gradename; | |
17 | + private int classId; | |
18 | + private String className; | |
19 | + private int studentId; | |
20 | + private int studentUserId; | |
21 | + private String photo; | |
22 | + private int sex; | |
23 | + | |
24 | + public int getParentMobile() { | |
25 | + return parentMobile; | |
26 | + } | |
27 | + | |
28 | + public void setParentMobile(int parentMobile) { | |
29 | + this.parentMobile = parentMobile; | |
30 | + } | |
31 | + | |
32 | + public int getParentId() { | |
33 | + return parentId; | |
34 | + } | |
35 | + | |
36 | + public void setParentId(int parentId) { | |
37 | + this.parentId = parentId; | |
38 | + } | |
39 | + | |
40 | + public boolean isMobileFlag() { | |
41 | + return mobileFlag; | |
42 | + } | |
43 | + | |
44 | + public void setMobileFlag(boolean mobileFlag) { | |
45 | + this.mobileFlag = mobileFlag; | |
46 | + } | |
47 | + | |
48 | + public boolean isBindingState() { | |
49 | + return bindingState; | |
50 | + } | |
51 | + | |
52 | + public void setBindingState(boolean bindingState) { | |
53 | + this.bindingState = bindingState; | |
54 | + } | |
55 | + | |
56 | + public boolean isCooperateFlag() { | |
57 | + return cooperateFlag; | |
58 | + } | |
59 | + | |
60 | + public void setCooperateFlag(boolean cooperateFlag) { | |
61 | + this.cooperateFlag = cooperateFlag; | |
62 | + } | |
63 | + | |
64 | + public int getSchoolId() { | |
65 | + return schoolId; | |
66 | + } | |
67 | + | |
68 | + public void setSchoolId(int schoolId) { | |
69 | + this.schoolId = schoolId; | |
70 | + } | |
71 | + | |
72 | + public String getSchoolName() { | |
73 | + return schoolName; | |
74 | + } | |
75 | + | |
76 | + public void setSchoolName(String schoolName) { | |
77 | + this.schoolName = schoolName; | |
78 | + } | |
79 | + | |
80 | + public int getGrade() { | |
81 | + return grade; | |
82 | + } | |
83 | + | |
84 | + public void setGrade(int grade) { | |
85 | + this.grade = grade; | |
86 | + } | |
87 | + | |
88 | + public String getGradename() { | |
89 | + return gradename; | |
90 | + } | |
91 | + | |
92 | + public void setGradename(String gradename) { | |
93 | + this.gradename = gradename; | |
94 | + } | |
95 | + | |
96 | + public int getClassId() { | |
97 | + return classId; | |
98 | + } | |
99 | + | |
100 | + public void setClassId(int classId) { | |
101 | + this.classId = classId; | |
102 | + } | |
103 | + | |
104 | + public String getClassName() { | |
105 | + return className; | |
106 | + } | |
107 | + | |
108 | + public void setClassName(String className) { | |
109 | + this.className = className; | |
110 | + } | |
111 | + | |
112 | + public int getStudentId() { | |
113 | + return studentId; | |
114 | + } | |
115 | + | |
116 | + public void setStudentId(int studentId) { | |
117 | + this.studentId = studentId; | |
118 | + } | |
119 | + | |
120 | + public int getStudentUserId() { | |
121 | + return studentUserId; | |
122 | + } | |
123 | + | |
124 | + public void setStudentUserId(int studentUserId) { | |
125 | + this.studentUserId = studentUserId; | |
126 | + } | |
127 | + | |
128 | + public String getPhoto() { | |
129 | + return photo; | |
130 | + } | |
131 | + | |
132 | + public void setPhoto(String photo) { | |
133 | + this.photo = photo; | |
134 | + } | |
135 | + | |
136 | + public int getSex() { | |
137 | + return sex; | |
138 | + } | |
139 | + | |
140 | + public void setSex(int sex) { | |
141 | + this.sex = sex; | |
142 | + } | |
143 | + | |
144 | + @Override | |
145 | + public String toString() { | |
146 | + return "ChildBean{" + | |
147 | + "parentMobile='" + parentMobile + '\'' + | |
148 | + "parentId='" + parentId + '\'' + | |
149 | + "mobileFlag='" + mobileFlag + '\'' + | |
150 | + "bindingState='" + bindingState + '\'' + | |
151 | + "cooperateFlag='" + cooperateFlag + '\'' + | |
152 | + "schoolId='" + schoolId + '\'' + | |
153 | + "schoolName='" + schoolName + '\'' + | |
154 | + "grade='" + grade + '\'' + | |
155 | + "gradename='" + gradename + '\'' + | |
156 | + "classId='" + classId + '\'' + | |
157 | + "className='" + className + '\'' + | |
158 | + "studentId='" + studentId + '\'' + | |
159 | + "studentUserId='" + studentUserId + '\'' + | |
160 | + "photo='" + photo + '\'' + | |
161 | + ", sex=" + sex + | |
162 | + "}"; | |
163 | + } | |
164 | +} | |
9 | 165 | \ No newline at end of file | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/CurrentBean.java
1 | 1 | package com.shunzhi.parent.bean; |
2 | 2 | |
3 | +import java.io.Serializable; | |
4 | +import java.util.List; | |
5 | + | |
3 | 6 | /** |
4 | 7 | * Created by Administrator on 2018/3/13 0013. |
5 | 8 | */ |
6 | 9 | |
7 | -public class CurrentBean { | |
10 | +public class CurrentBean implements Serializable{ | |
11 | + private String userid; | |
12 | + private String name; | |
13 | + private String image; | |
14 | + private String mobile; | |
15 | + private boolean bindSchoolFlag; | |
16 | + private boolean bindingChildrenFlag; | |
17 | + private int sex; | |
18 | + private List<ChildBean> data; | |
19 | + | |
20 | + public int getSex() { | |
21 | + return sex; | |
22 | + } | |
23 | + | |
24 | + public void setSex(int sex) { | |
25 | + this.sex = sex; | |
26 | + } | |
27 | + | |
28 | + public String getUserid() { | |
29 | + return userid; | |
30 | + } | |
31 | + | |
32 | + public void setUserid(String userid) { | |
33 | + this.userid = userid; | |
34 | + } | |
35 | + | |
36 | + public String getName() { | |
37 | + return name; | |
38 | + } | |
39 | + | |
40 | + public void setName(String name) { | |
41 | + this.name = name; | |
42 | + } | |
43 | + | |
44 | + public String getImage() { | |
45 | + return image; | |
46 | + } | |
47 | + | |
48 | + public void setImage(String image) { | |
49 | + this.image = image; | |
50 | + } | |
51 | + | |
52 | + public String getMobile() { | |
53 | + return mobile; | |
54 | + } | |
55 | + | |
56 | + public void setMobile(String mobile) { | |
57 | + this.mobile = mobile; | |
58 | + } | |
59 | + | |
60 | + public boolean isBindSchoolFlag() { | |
61 | + return bindSchoolFlag; | |
62 | + } | |
63 | + | |
64 | + public void setBindSchoolFlag(boolean bindSchoolFlag) { | |
65 | + this.bindSchoolFlag = bindSchoolFlag; | |
66 | + } | |
67 | + | |
68 | + public boolean isBindingChildrenFlag() { | |
69 | + return bindingChildrenFlag; | |
70 | + } | |
71 | + | |
72 | + public void setBindingChildrenFlag(boolean bindingChildrenFlag) { | |
73 | + this.bindingChildrenFlag = bindingChildrenFlag; | |
74 | + } | |
8 | 75 | |
76 | + public List<ChildBean> getData() { | |
77 | + return data; | |
78 | + } | |
9 | 79 | |
80 | + public void setData(List<ChildBean> data) { | |
81 | + this.data = data; | |
82 | + } | |
10 | 83 | |
84 | + @Override | |
85 | + public String toString() { | |
86 | + return "CurrentBean{" + | |
87 | + "userid='" + userid + '\'' + | |
88 | + "name='" + name + '\'' + | |
89 | + "image='" + image + '\'' + | |
90 | + "mobile='" + mobile + '\'' + | |
91 | + "bindSchoolFlag='" + bindSchoolFlag + '\'' + | |
92 | + "bindingChildrenFlag='" + bindingChildrenFlag + '\'' + | |
93 | + "sex='" + sex + '\'' + | |
94 | + ", data=" + data + | |
95 | + '}'; | |
96 | + } | |
11 | 97 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/SchoolBean.java
1 | 1 | package com.shunzhi.parent.bean; |
2 | 2 | |
3 | +import org.json.JSONObject; | |
4 | + | |
3 | 5 | /** |
4 | 6 | * Created by Administrator on 2018/3/9 0009. |
5 | 7 | */ |
6 | 8 | |
7 | 9 | public class SchoolBean { |
8 | - String schoolname; | |
9 | - String SortLetters; | |
10 | + public String school_name; | |
11 | + public String school_area; | |
12 | + public String school_id; | |
13 | + public String isNew; | |
10 | 14 | |
11 | - public String getSchoolname() { | |
12 | - return schoolname; | |
13 | - } | |
15 | + public SchoolBean(JSONObject data){ | |
16 | + this.school_name=data.optString("school_name"); | |
17 | + this.school_area =data.optString("school_area"); | |
18 | + this.school_id =data.optString("school_id"); | |
19 | + this.isNew =data.optString("isNew"); | |
14 | 20 | |
15 | - public void setSchoolname(String schoolname) { | |
16 | - this.schoolname = schoolname; | |
17 | 21 | } |
18 | 22 | |
19 | - public String getSortLetters() { | |
20 | - return SortLetters; | |
21 | - } | |
22 | - | |
23 | - public void setSortLetters(String sortLetters) { | |
24 | - SortLetters = sortLetters; | |
25 | - } | |
26 | 23 | } | ... | ... |
... | ... | @@ -0,0 +1,52 @@ |
1 | +package com.shunzhi.parent.bean; | |
2 | + | |
3 | +/** | |
4 | + * Created by Administrator on 2018/3/9 0009. | |
5 | + */ | |
6 | + | |
7 | +public class SortBean { | |
8 | + String school_name; | |
9 | + String SortLetters; | |
10 | + String school_area; | |
11 | + String school_id; | |
12 | + String isNew; | |
13 | + | |
14 | + public String getSchool_name() { | |
15 | + return school_name; | |
16 | + } | |
17 | + | |
18 | + public void setSchool_name(String school_name) { | |
19 | + this.school_name = school_name; | |
20 | + } | |
21 | + | |
22 | + public String getSchool_area() { | |
23 | + return school_area; | |
24 | + } | |
25 | + | |
26 | + public void setSchool_area(String school_area) { | |
27 | + this.school_area = school_area; | |
28 | + } | |
29 | + | |
30 | + public String getSchool_id() { | |
31 | + return school_id; | |
32 | + } | |
33 | + | |
34 | + public void setSchool_id(String school_id) { | |
35 | + this.school_id = school_id; | |
36 | + } | |
37 | + | |
38 | + public String getIsNew() { | |
39 | + return isNew; | |
40 | + } | |
41 | + | |
42 | + public void setIsNew(String isNew) { | |
43 | + this.isNew = isNew; | |
44 | + } | |
45 | + public String getSortLetters() { | |
46 | + return SortLetters; | |
47 | + } | |
48 | + | |
49 | + public void setSortLetters(String sortLetters) { | |
50 | + SortLetters = sortLetters; | |
51 | + } | |
52 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/loginandregister/LoginAndRegisterContract.java
... | ... | @@ -4,7 +4,7 @@ import com.google.gson.JsonObject; |
4 | 4 | import com.share.mvpsdk.base.BasePresenter; |
5 | 5 | import com.share.mvpsdk.base.IBaseFragment; |
6 | 6 | import com.share.mvpsdk.base.IBaseModel; |
7 | -import com.shunzhi.parent.bean.CurrentBean; | |
7 | +import com.shunzhi.parent.bean.UserInfo; | |
8 | 8 | |
9 | 9 | import io.reactivex.Observable; |
10 | 10 | |
... | ... | @@ -21,7 +21,7 @@ public interface LoginAndRegisterContract { |
21 | 21 | |
22 | 22 | public abstract void idCodeResult(String phoneNumber); |
23 | 23 | |
24 | - public abstract void getUserInfo(); | |
24 | + public abstract void getUserInfo(String mobile,int school_id,String captcha); | |
25 | 25 | } |
26 | 26 | |
27 | 27 | interface ILoginModel extends IBaseModel{ |
... | ... | @@ -32,12 +32,12 @@ public interface LoginAndRegisterContract { |
32 | 32 | Observable<JsonObject> getidCodeResult(String phoneNumber); |
33 | 33 | |
34 | 34 | //获取登录用户信息 |
35 | - Observable<CurrentBean> getUserInfo(); | |
35 | + Observable<UserInfo> getUserInfo(String mobile, int school_id, String captcha); | |
36 | 36 | } |
37 | 37 | interface ILoginView extends IBaseFragment { |
38 | 38 | |
39 | 39 | //更新用户信息 |
40 | - void getUserInfo(); | |
40 | + void getUserInfo(int type); | |
41 | 41 | |
42 | 42 | } |
43 | 43 | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/mine/PersonInfoContract.java
1 | 1 | package com.shunzhi.parent.contract.mine; |
2 | 2 | |
3 | +import com.google.gson.JsonObject; | |
3 | 4 | import com.share.mvpsdk.base.BasePresenter; |
4 | 5 | import com.share.mvpsdk.base.IBaseActivity; |
5 | 6 | import com.share.mvpsdk.base.IBaseModel; |
6 | 7 | |
8 | +import io.reactivex.Observable; | |
9 | + | |
7 | 10 | /** |
8 | 11 | * Created by Administrator on 2018/3/10 0010. |
9 | 12 | */ |
10 | 13 | |
11 | 14 | public interface PersonInfoContract { |
12 | 15 | |
13 | - abstract class PersonInfoPresenter extends BasePresenter<IPersonInfoModel,IPersonInfoView> { | |
14 | - | |
16 | + abstract class PersonInfoPresenter extends BasePresenter<IPersonInfoModel, IPersonInfoView> { | |
17 | + public abstract void ChangeInfoResult(String parentName, int sex, String mobile); | |
15 | 18 | } |
16 | 19 | |
17 | 20 | |
18 | 21 | interface IPersonInfoModel extends IBaseModel { |
19 | - | |
22 | + Observable<JsonObject> getChangeInfoResult(String parentName, int sex, String mobile); | |
20 | 23 | |
21 | 24 | } |
22 | - interface IPersonInfoView extends IBaseActivity { | |
23 | 25 | |
26 | + interface IPersonInfoView extends IBaseActivity { | |
27 | + void updateInfo(); | |
24 | 28 | |
25 | 29 | } |
26 | 30 | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/mine/SchoolListContract.java
0 → 100644
... | ... | @@ -0,0 +1,31 @@ |
1 | +package com.shunzhi.parent.contract.mine; | |
2 | + | |
3 | +import com.google.gson.JsonObject; | |
4 | +import com.share.mvpsdk.base.BasePresenter; | |
5 | +import com.share.mvpsdk.base.IBaseActivity; | |
6 | +import com.share.mvpsdk.base.IBaseModel; | |
7 | +import com.shunzhi.parent.bean.SchoolBean; | |
8 | + | |
9 | +import java.util.List; | |
10 | + | |
11 | +import io.reactivex.Observable; | |
12 | + | |
13 | +/** | |
14 | + * Created by Administrator on 2018/3/13 0013. | |
15 | + */ | |
16 | + | |
17 | +public interface SchoolListContract { | |
18 | + abstract class SchoolListPrasenter extends BasePresenter<ISchoolListModel,ISchoolListView> { | |
19 | + public abstract void schoolListResult(String areaName, String key); | |
20 | + } | |
21 | + | |
22 | + interface ISchoolListModel extends IBaseModel { | |
23 | + Observable<JsonObject> getSchoolListResult(String areaName, String key); | |
24 | + | |
25 | + | |
26 | + } | |
27 | + interface ISchoolListView extends IBaseActivity { | |
28 | + void showList(List<SchoolBean> list); | |
29 | + } | |
30 | + | |
31 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/model/loginandregister/LoginAndRegisterModel.java
... | ... | @@ -5,7 +5,7 @@ import com.share.mvpsdk.base.BaseModel; |
5 | 5 | import com.share.mvpsdk.helper.RetrofitCreateHelper; |
6 | 6 | import com.share.mvpsdk.helper.RxHelper; |
7 | 7 | import com.shunzhi.parent.api.LoginRegisterApi; |
8 | -import com.shunzhi.parent.bean.CurrentBean; | |
8 | +import com.shunzhi.parent.bean.UserInfo; | |
9 | 9 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
10 | 10 | |
11 | 11 | import io.reactivex.Observable; |
... | ... | @@ -42,9 +42,9 @@ public class LoginAndRegisterModel extends BaseModel implements LoginAndRegiste |
42 | 42 | } |
43 | 43 | |
44 | 44 | @Override |
45 | - public Observable<CurrentBean> getUserInfo() { | |
46 | - return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).getUserInfo() | |
47 | - .compose(RxHelper.<CurrentBean>rxSchedulerHelper()); | |
45 | + public Observable<UserInfo> getUserInfo(String mobile, int school_id, String captcha) { | |
46 | + return RetrofitCreateHelper.getInstance().createApi(LoginRegisterApi.class,LoginRegisterApi.url).getUserInfo(mobile,school_id,captcha) | |
47 | + .compose(RxHelper.<UserInfo>rxSchedulerHelper()); | |
48 | 48 | } |
49 | 49 | |
50 | 50 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/model/mine/PersonInfoModel.java
1 | 1 | package com.shunzhi.parent.model.mine; |
2 | 2 | |
3 | +import com.google.gson.JsonObject; | |
3 | 4 | import com.share.mvpsdk.base.BaseModel; |
5 | +import com.share.mvpsdk.helper.RetrofitCreateHelper; | |
6 | +import com.share.mvpsdk.helper.RxHelper; | |
7 | +import com.shunzhi.parent.api.MineApi; | |
4 | 8 | import com.shunzhi.parent.contract.mine.PersonInfoContract; |
5 | 9 | |
10 | +import io.reactivex.Observable; | |
11 | + | |
6 | 12 | /** |
7 | 13 | * Created by Administrator on 2018/3/10 0010. |
8 | 14 | */ |
... | ... | @@ -11,4 +17,10 @@ public class PersonInfoModel extends BaseModel implements PersonInfoContract.IPe |
11 | 17 | public static PersonInfoModel newInstance() { |
12 | 18 | return new PersonInfoModel(); |
13 | 19 | } |
20 | + | |
21 | + @Override | |
22 | + public Observable<JsonObject> getChangeInfoResult(String parentName, int sex, String mobile) { | |
23 | + return RetrofitCreateHelper.getInstance().createApi(MineApi.class, MineApi.url).getChangeInfoResult(parentName, sex, mobile) | |
24 | + .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
25 | + } | |
14 | 26 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/model/mine/SchoolListModel.java
0 → 100644
... | ... | @@ -0,0 +1,26 @@ |
1 | +package com.shunzhi.parent.model.mine; | |
2 | + | |
3 | +import com.google.gson.JsonObject; | |
4 | +import com.share.mvpsdk.base.BaseModel; | |
5 | +import com.share.mvpsdk.helper.RetrofitCreateHelper; | |
6 | +import com.share.mvpsdk.helper.RxHelper; | |
7 | +import com.shunzhi.parent.api.MineApi; | |
8 | +import com.shunzhi.parent.contract.mine.SchoolListContract; | |
9 | + | |
10 | +import io.reactivex.Observable; | |
11 | + | |
12 | +/** | |
13 | + * Created by Administrator on 2018/3/13 0013. | |
14 | + */ | |
15 | + | |
16 | +public class SchoolListModel extends BaseModel implements SchoolListContract.ISchoolListModel { | |
17 | + public static SchoolListModel newInstance() { | |
18 | + return new SchoolListModel(); | |
19 | + } | |
20 | + | |
21 | + @Override | |
22 | + public Observable<JsonObject> getSchoolListResult(String areaName, String key) { | |
23 | + return RetrofitCreateHelper.getInstance().createApi(MineApi.class,MineApi.url).getSchoolListResult(areaName,key) | |
24 | + .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
25 | + } | |
26 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
... | ... | @@ -9,8 +9,11 @@ import com.share.mvpsdk.utils.OkHttpExceptionUtil; |
9 | 9 | import com.share.mvpsdk.utils.ToastUtils; |
10 | 10 | import com.shunzhi.parent.AppConfig; |
11 | 11 | import com.shunzhi.parent.AppContext; |
12 | +import com.shunzhi.parent.bean.CurrentBean; | |
13 | +import com.shunzhi.parent.bean.UserInfo; | |
12 | 14 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
13 | 15 | import com.shunzhi.parent.model.loginandregister.LoginAndRegisterModel; |
16 | +import com.shunzhi.parent.ui.fragment.loginandregistfragment.LoginAndRegistFragment; | |
14 | 17 | |
15 | 18 | import java.util.regex.Matcher; |
16 | 19 | import java.util.regex.Pattern; |
... | ... | @@ -45,7 +48,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
45 | 48 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, loginName); |
46 | 49 | AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, loginPwd); |
47 | 50 | RetrofitCreateHelper.getInstance().setAuthorization("Bearer " + jsonObject.get("access_token").getAsString()); |
48 | - getUserInfo(); | |
51 | + getUserInfo(loginName, 0, ""); | |
49 | 52 | } else { |
50 | 53 | ToastUtils.showToast(jsonObject.get("error").getAsString()); |
51 | 54 | } |
... | ... | @@ -66,12 +69,14 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
66 | 69 | } |
67 | 70 | |
68 | 71 | @Override |
69 | - public void registerResult(String adminName, String idCode, String password) { | |
72 | + public void registerResult(final String adminName, String idCode, final String password) { | |
70 | 73 | if (!isMate(adminName, REGEX_MOBILE)) { |
71 | 74 | ToastUtils.showToast("请输入正确的手机号!!"); |
75 | + LoginAndRegistFragment.progressDialog.dismiss(); | |
72 | 76 | return; |
73 | 77 | } |
74 | 78 | if (mIModel == null || mIView == null) { |
79 | + LoginAndRegistFragment.progressDialog.dismiss(); | |
75 | 80 | return; |
76 | 81 | } |
77 | 82 | |
... | ... | @@ -80,12 +85,14 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
80 | 85 | public void accept(JsonObject jsonObject) throws Exception { |
81 | 86 | //TODO 注册成功返回 |
82 | 87 | Log.e("1111", jsonObject.toString()); |
83 | - mIView.getUserInfo(); | |
88 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, adminName); | |
89 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_PWD, password); | |
90 | + mIView.getUserInfo(1); | |
84 | 91 | } |
85 | 92 | }, new Consumer<Throwable>() { |
86 | 93 | @Override |
87 | 94 | public void accept(Throwable throwable) throws Exception { |
88 | - ToastUtils.showToast(throwable.getMessage()); | |
95 | + LoginAndRegistFragment.progressDialog.dismiss(); | |
89 | 96 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
90 | 97 | } |
91 | 98 | })); |
... | ... | @@ -93,7 +100,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
93 | 100 | } |
94 | 101 | |
95 | 102 | @Override |
96 | - public void idCodeResult(String phoneNumber) { | |
103 | + public void idCodeResult(final String phoneNumber) { | |
97 | 104 | if (!isMate(phoneNumber, REGEX_MOBILE)) { |
98 | 105 | ToastUtils.showToast("请输入正确的手机号!!"); |
99 | 106 | return; |
... | ... | @@ -110,7 +117,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
110 | 117 | }, new Consumer<Throwable>() { |
111 | 118 | @Override |
112 | 119 | public void accept(Throwable throwable) throws Exception { |
113 | - ToastUtils.showToast(throwable.getMessage()); | |
120 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
114 | 121 | } |
115 | 122 | })); |
116 | 123 | |
... | ... | @@ -118,8 +125,31 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre |
118 | 125 | } |
119 | 126 | |
120 | 127 | @Override |
121 | - public void getUserInfo() { | |
122 | - Log.d("77777", "getUserInfo="); | |
128 | + public void getUserInfo(final String mobile, int school_id, String captcha) { | |
129 | + mRxManager.register(mIModel.getUserInfo(mobile, school_id, captcha).subscribe(new Consumer<UserInfo>() { | |
130 | + @Override | |
131 | + public void accept(UserInfo userInfo) throws Exception { | |
132 | + | |
133 | + if (userInfo != null) { | |
134 | + CurrentBean currentBean = userInfo.getData(); | |
135 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.LOGIN_NAME, currentBean.getMobile()); | |
136 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_NAME, currentBean.getName()); | |
137 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_IMAGE, currentBean.getImage()); | |
138 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_SEX, String.valueOf(currentBean.getSex())); | |
139 | + mIView.getUserInfo(0); | |
140 | + | |
141 | + } else { | |
142 | + LoginAndRegistFragment.progressDialog.dismiss(); | |
143 | + ToastUtils.showToast("错误"); | |
144 | + } | |
145 | + } | |
146 | + }, new Consumer<Throwable>() { | |
147 | + @Override | |
148 | + public void accept(Throwable throwable) throws Exception { | |
149 | + LoginAndRegistFragment.progressDialog.dismiss(); | |
150 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
151 | + } | |
152 | + })); | |
123 | 153 | } |
124 | 154 | |
125 | 155 | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/mine/PersonInfoPrasenter.java
1 | 1 | package com.shunzhi.parent.presenter.mine; |
2 | 2 | |
3 | +import com.google.gson.JsonObject; | |
4 | +import com.share.mvpsdk.utils.OkHttpExceptionUtil; | |
5 | +import com.share.mvpsdk.utils.ToastUtils; | |
6 | +import com.shunzhi.parent.AppConfig; | |
7 | +import com.shunzhi.parent.AppContext; | |
3 | 8 | import com.shunzhi.parent.contract.mine.PersonInfoContract; |
9 | +import com.shunzhi.parent.model.mine.PersonInfoModel; | |
10 | + | |
11 | +import io.reactivex.functions.Consumer; | |
12 | +import retrofit2.HttpException; | |
4 | 13 | |
5 | 14 | /** |
6 | 15 | * Created by Administrator on 2018/3/10 0010. |
... | ... | @@ -9,11 +18,40 @@ import com.shunzhi.parent.contract.mine.PersonInfoContract; |
9 | 18 | public class PersonInfoPrasenter extends PersonInfoContract.PersonInfoPresenter { |
10 | 19 | @Override |
11 | 20 | public PersonInfoContract.IPersonInfoModel getModel() { |
12 | - return null; | |
21 | + return PersonInfoModel.newInstance(); | |
13 | 22 | } |
14 | 23 | |
15 | 24 | @Override |
16 | 25 | public void onStart() { |
17 | 26 | |
18 | 27 | } |
28 | + | |
29 | + @Override | |
30 | + public void ChangeInfoResult(final String parentName, final int sex, String mobile) { | |
31 | + | |
32 | + mRxManager.register(mIModel.getChangeInfoResult(parentName, sex, mobile).subscribe(new Consumer<JsonObject>() { | |
33 | + @Override | |
34 | + public void accept(JsonObject jsonObject) throws Exception { | |
35 | + try { | |
36 | + if(jsonObject!=null&&jsonObject.get("data").getAsBoolean()) { | |
37 | + ToastUtils.showToast(jsonObject.toString()); | |
38 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_NAME, parentName); | |
39 | + AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.USER_SEX, String.valueOf(sex)); | |
40 | + mIView.updateInfo(); | |
41 | + } | |
42 | + } catch (Exception e) { | |
43 | + ToastUtils.showToast(e.toString()); | |
44 | + } | |
45 | + | |
46 | + } | |
47 | + }, new Consumer<Throwable>() { | |
48 | + @Override | |
49 | + public void accept(Throwable throwable) throws Exception { | |
50 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
51 | + mIView.updateInfo(); | |
52 | + } | |
53 | + })); | |
54 | + | |
55 | + | |
56 | + } | |
19 | 57 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/mine/SchoolListPrasenter.java
0 → 100644
... | ... | @@ -0,0 +1,56 @@ |
1 | +package com.shunzhi.parent.presenter.mine; | |
2 | + | |
3 | +import com.google.gson.Gson; | |
4 | +import com.google.gson.JsonArray; | |
5 | +import com.google.gson.JsonObject; | |
6 | +import com.share.mvpsdk.utils.OkHttpExceptionUtil; | |
7 | +import com.shunzhi.parent.bean.SchoolBean; | |
8 | +import com.shunzhi.parent.contract.mine.SchoolListContract; | |
9 | +import com.shunzhi.parent.model.mine.SchoolListModel; | |
10 | + | |
11 | +import java.util.ArrayList; | |
12 | +import java.util.Iterator; | |
13 | +import java.util.List; | |
14 | + | |
15 | +import io.reactivex.functions.Consumer; | |
16 | +import retrofit2.HttpException; | |
17 | + | |
18 | +/** | |
19 | + * Created by Administrator on 2018/3/13 0013. | |
20 | + */ | |
21 | + | |
22 | +public class SchoolListPrasenter extends SchoolListContract.SchoolListPrasenter { | |
23 | + @Override | |
24 | + public SchoolListContract.ISchoolListModel getModel() { | |
25 | + return SchoolListModel.newInstance(); | |
26 | + } | |
27 | + | |
28 | + @Override | |
29 | + public void onStart() { | |
30 | + | |
31 | + } | |
32 | + | |
33 | + @Override | |
34 | + public void schoolListResult(String areaName, String key) { | |
35 | + mRxManager.register(mIModel.getSchoolListResult(areaName, key).subscribe(new Consumer<JsonObject>() { | |
36 | + @Override | |
37 | + public void accept(JsonObject jsonObject) throws Exception { | |
38 | + List<SchoolBean> list = new ArrayList(); | |
39 | + Gson gson = new Gson(); | |
40 | + JsonArray jsonArray = jsonObject.getAsJsonArray("data"); | |
41 | + Iterator it = jsonArray.iterator(); //Iterator处理 | |
42 | + while (it.hasNext()) { //循环 | |
43 | + SchoolBean person = gson.fromJson(it.next().toString(), SchoolBean.class); //String转化成JavaBean | |
44 | + list.add(person); //加入Listlist | |
45 | + } | |
46 | + mIView.showList(list); | |
47 | + } | |
48 | + }, new Consumer<Throwable>() { | |
49 | + @Override | |
50 | + public void accept(Throwable throwable) throws Exception { | |
51 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
52 | + } | |
53 | + })); | |
54 | + | |
55 | + } | |
56 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/MainActivity.java
... | ... | @@ -5,6 +5,7 @@ import android.support.annotation.NonNull; |
5 | 5 | import android.support.design.widget.BottomNavigationView; |
6 | 6 | import android.support.v4.app.Fragment; |
7 | 7 | import android.support.v4.app.FragmentTransaction; |
8 | +import android.util.Log; | |
8 | 9 | import android.view.MenuItem; |
9 | 10 | |
10 | 11 | import com.share.mvpsdk.base.activity.BaseCompatActivity; |
... | ... | @@ -17,6 +18,9 @@ import com.shunzhi.parent.ui.fragment.ConsultFragment; |
17 | 18 | import com.shunzhi.parent.ui.fragment.MineFragment; |
18 | 19 | import com.shunzhi.parent.ui.fragment.ReportFragment; |
19 | 20 | |
21 | +import java.util.Calendar; | |
22 | +import java.util.Date; | |
23 | + | |
20 | 24 | public class MainActivity extends BaseCompatActivity implements PermissionUtils.PermissionGrant { |
21 | 25 | |
22 | 26 | BottomNavigationView bottom_navigationView; |
... | ... | @@ -37,6 +41,8 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. |
37 | 41 | |
38 | 42 | @Override |
39 | 43 | protected void initView(Bundle savedInstanceState) { |
44 | + | |
45 | + | |
40 | 46 | PermissionUtils.requestMultiPermissions(this, this); |
41 | 47 | bottom_navigationView = findViewById(R.id.bottom_navigationView); |
42 | 48 | |
... | ... | @@ -114,4 +120,11 @@ public class MainActivity extends BaseCompatActivity implements PermissionUtils. |
114 | 120 | public void onPermissionGranted(int requestCode) { |
115 | 121 | |
116 | 122 | } |
123 | + | |
124 | + @Override | |
125 | + protected void onResume() { | |
126 | + super.onResume(); | |
127 | + Date l= Calendar.getInstance().getTime(); | |
128 | + Log.e("2222--==",l.getTime()+""); | |
129 | + } | |
117 | 130 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/PersonInfoActivity.java
... | ... | @@ -3,10 +3,18 @@ package com.shunzhi.parent.ui.activity; |
3 | 3 | |
4 | 4 | import android.os.Bundle; |
5 | 5 | import android.support.annotation.NonNull; |
6 | +import android.text.TextUtils; | |
6 | 7 | import android.view.View; |
8 | +import android.widget.EditText; | |
9 | +import android.widget.RadioButton; | |
10 | +import android.widget.TextView; | |
7 | 11 | |
12 | +import com.bumptech.glide.Glide; | |
13 | +import com.makeramen.roundedimageview.RoundedImageView; | |
8 | 14 | import com.share.mvpsdk.base.BasePresenter; |
9 | 15 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
16 | +import com.shunzhi.parent.AppConfig; | |
17 | +import com.shunzhi.parent.AppContext; | |
10 | 18 | import com.shunzhi.parent.R; |
11 | 19 | import com.shunzhi.parent.contract.mine.PersonInfoContract; |
12 | 20 | import com.shunzhi.parent.presenter.mine.PersonInfoPrasenter; |
... | ... | @@ -15,8 +23,14 @@ import com.shunzhi.parent.presenter.mine.PersonInfoPrasenter; |
15 | 23 | * Created by Administrator on 2018/3/10 0010. |
16 | 24 | */ |
17 | 25 | |
18 | -public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract.PersonInfoPresenter,PersonInfoContract.IPersonInfoModel> | |
19 | -implements PersonInfoContract.IPersonInfoView,View.OnClickListener{ | |
26 | +public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract.PersonInfoPresenter, PersonInfoContract.IPersonInfoModel> | |
27 | + implements PersonInfoContract.IPersonInfoView, View.OnClickListener { | |
28 | + RoundedImageView user_image; | |
29 | + TextView user_name, user_mobile, change_info; | |
30 | + EditText et_name; | |
31 | + RadioButton man, women; | |
32 | + | |
33 | + | |
20 | 34 | @NonNull |
21 | 35 | @Override |
22 | 36 | public BasePresenter initPresenter() { |
... | ... | @@ -25,6 +39,43 @@ implements PersonInfoContract.IPersonInfoView,View.OnClickListener{ |
25 | 39 | |
26 | 40 | @Override |
27 | 41 | protected void initView(Bundle savedInstanceState) { |
42 | + user_image = findViewById(R.id.user_photo); | |
43 | + user_name = findViewById(R.id.user_name); | |
44 | + user_mobile = findViewById(R.id.user_mobile); | |
45 | + et_name = findViewById(R.id.et_name); | |
46 | + et_name.setOnClickListener(this); | |
47 | + man = findViewById(R.id.man); | |
48 | + women = findViewById(R.id.women); | |
49 | + change_info = findViewById(R.id.change_info); | |
50 | + change_info.setOnClickListener(this); | |
51 | + initInfo(); | |
52 | + | |
53 | + | |
54 | + } | |
55 | + | |
56 | + private void initInfo() { | |
57 | + String url = AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_IMAGE); | |
58 | + if (!TextUtils.isEmpty(url)) { | |
59 | + Glide.with(this).load(url).asBitmap().error(R.drawable.test).centerCrop().into(user_image); | |
60 | + } else { | |
61 | + Glide.with(this).load(R.drawable.test).centerCrop().into(user_image); | |
62 | + } | |
63 | + user_image.setCornerRadius(20); | |
64 | + user_image.setOval(true); | |
65 | + user_name.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_NAME)); | |
66 | + user_mobile.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); | |
67 | + et_name.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_NAME)); | |
68 | + int sex = Integer.parseInt(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_SEX)); | |
69 | + if (sex == 0) { | |
70 | + man.setChecked(false); | |
71 | + women.setChecked(false); | |
72 | + } else if (sex == 1) { | |
73 | + man.setChecked(true); | |
74 | + women.setChecked(false); | |
75 | + } else if (sex == 2) { | |
76 | + man.setChecked(false); | |
77 | + women.setChecked(true); | |
78 | + } | |
28 | 79 | |
29 | 80 | } |
30 | 81 | |
... | ... | @@ -35,6 +86,24 @@ implements PersonInfoContract.IPersonInfoView,View.OnClickListener{ |
35 | 86 | |
36 | 87 | @Override |
37 | 88 | public void onClick(View v) { |
89 | + if (v == et_name) { | |
38 | 90 | |
91 | + } else if (v == change_info) { | |
92 | + int sex = 0; | |
93 | + if (man.isChecked()) { | |
94 | + sex = 1; | |
95 | + } | |
96 | + if (women.isChecked()) { | |
97 | + sex = 2; | |
98 | + } | |
99 | + | |
100 | + mPresenter.ChangeInfoResult(et_name.getText().toString().trim(), sex, user_mobile.getText().toString().trim()); | |
101 | + | |
102 | + } | |
103 | + } | |
104 | + | |
105 | + @Override | |
106 | + public void updateInfo() { | |
107 | + finish(); | |
39 | 108 | } |
40 | 109 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/CreateChildInfoActivity.java
0 → 100644
... | ... | @@ -0,0 +1,30 @@ |
1 | +package com.shunzhi.parent.ui.activity.binding; | |
2 | + | |
3 | +import android.os.Bundle; | |
4 | +import android.support.annotation.NonNull; | |
5 | + | |
6 | +import com.share.mvpsdk.base.BasePresenter; | |
7 | +import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | |
8 | +import com.shunzhi.parent.R; | |
9 | + | |
10 | +/** | |
11 | + * Created by Administrator on 2018/3/13 0013. | |
12 | + */ | |
13 | + | |
14 | +public class CreateChildInfoActivity extends BaseMVPCompatActivity{ | |
15 | + @NonNull | |
16 | + @Override | |
17 | + public BasePresenter initPresenter() { | |
18 | + return null; | |
19 | + } | |
20 | + | |
21 | + @Override | |
22 | + protected void initView(Bundle savedInstanceState) { | |
23 | + | |
24 | + } | |
25 | + | |
26 | + @Override | |
27 | + protected int getLayoutId() { | |
28 | + return R.layout.activity_create_childinfo; | |
29 | + } | |
30 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/SelectSchoolActivity.java
... | ... | @@ -10,9 +10,14 @@ import android.widget.TextView; |
10 | 10 | |
11 | 11 | import com.share.mvpsdk.base.BasePresenter; |
12 | 12 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
13 | +import com.share.mvpsdk.utils.ToastUtils; | |
14 | +import com.shunzhi.parent.AppContext; | |
13 | 15 | import com.shunzhi.parent.R; |
14 | 16 | import com.shunzhi.parent.adapter.SchoolListAdapter; |
15 | 17 | import com.shunzhi.parent.bean.SchoolBean; |
18 | +import com.shunzhi.parent.bean.SortBean; | |
19 | +import com.shunzhi.parent.contract.mine.SchoolListContract; | |
20 | +import com.shunzhi.parent.presenter.mine.SchoolListPrasenter; | |
16 | 21 | import com.shunzhi.parent.util.CharacterParser; |
17 | 22 | import com.shunzhi.parent.views.SideBar; |
18 | 23 | |
... | ... | @@ -25,10 +30,11 @@ import java.util.List; |
25 | 30 | * Created by Administrator on 2018/3/12 0012. |
26 | 31 | */ |
27 | 32 | |
28 | -public class SelectSchoolActivity extends BaseMVPCompatActivity implements View.OnClickListener{ | |
33 | +public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContract.SchoolListPrasenter, SchoolListContract.ISchoolListModel> implements | |
34 | + View.OnClickListener, SchoolListContract.ISchoolListView { | |
29 | 35 | |
30 | 36 | private SideBar sideBar; |
31 | - private TextView dialog,go_next; | |
37 | + private TextView dialog, go_next, tvLocalAddress; | |
32 | 38 | private RecyclerView schoollist; |
33 | 39 | private List<String> list = new ArrayList<>(); |
34 | 40 | SchoolListAdapter schoolListAdapter; |
... | ... | @@ -36,78 +42,23 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity implements View. |
36 | 42 | @NonNull |
37 | 43 | @Override |
38 | 44 | public BasePresenter initPresenter() { |
39 | - return null; | |
45 | + return new SchoolListPrasenter(); | |
40 | 46 | } |
41 | 47 | |
42 | 48 | @Override |
43 | 49 | protected void initView(Bundle savedInstanceState) { |
44 | 50 | sideBar = findViewById(R.id.sidrbar); |
45 | 51 | dialog = findViewById(R.id.dialog); |
46 | - go_next=findViewById(R.id.go_next); | |
52 | + go_next = findViewById(R.id.go_next); | |
47 | 53 | go_next.setOnClickListener(this); |
54 | + tvLocalAddress = findViewById(R.id.tvLocalAddress); | |
55 | + tvLocalAddress.setText(AppContext.getInstance().cityName); | |
56 | + setSchoolList(); | |
48 | 57 | |
49 | 58 | |
50 | - | |
51 | - | |
52 | - list.add("阿尔卑斯"); | |
53 | - list.add("阿尔卑斯"); | |
54 | - list.add("阿尔卑斯"); | |
55 | - list.add("贝克街"); | |
56 | - list.add("贝克街"); | |
57 | - list.add("贝克街"); | |
58 | - list.add("贝克街"); | |
59 | - list.add("贝克街"); | |
60 | - list.add("阿尔卑斯"); | |
61 | - list.add("阿尔卑斯"); | |
62 | - list.add("贝克街"); | |
63 | - list.add("贝克街"); | |
64 | - list.add("阿尔卑斯"); | |
65 | - list.add("阿尔卑斯"); | |
66 | - list.add("阿尔卑斯"); | |
67 | - list.add("贝克街"); | |
68 | - list.add("贝克街"); | |
69 | - list.add("血色城堡"); | |
70 | - list.add("血色城堡"); | |
71 | - list.add("血色城堡"); | |
72 | - list.add("血色城堡"); | |
73 | - list.add("贝克街"); | |
74 | - list.add("贝克街"); | |
75 | - list.add("贝克街"); | |
76 | - list.add("贝克街"); | |
77 | - list.add("贝克街"); | |
78 | - list.add("贝克街"); | |
79 | - list.add("贝克街"); | |
80 | - list.add("贝克街"); | |
81 | - list.add("贝克街"); | |
82 | - list.add("血色城堡"); | |
83 | - list.add("血色城堡"); | |
84 | - list.add("血色城堡"); | |
85 | - list.add("血色城堡"); | |
86 | - list.add("贝克街"); | |
87 | - list.add("贝克街"); | |
88 | - list.add("贝克街"); | |
89 | - list.add("贝克街"); | |
90 | - list.add("贝克街"); | |
91 | - list.add("血色城堡"); | |
92 | - list.add("贝克街"); | |
93 | - list.add("贝克街"); | |
94 | - list.add("贝克街"); | |
95 | - list.add("贝克街"); | |
96 | - list.add("贝克街"); | |
97 | - list.add("贝克街"); | |
98 | - list.add("贝克街"); | |
99 | - list.add("贝克街"); | |
100 | - list.add("贝克街"); | |
101 | - list.add("血色城堡"); | |
102 | - list.add("血色城堡"); | |
103 | - list.add("血色城堡"); | |
104 | - list.add("血色城堡"); | |
105 | 59 | schoollist = findViewById(R.id.schoollist); |
106 | 60 | schoollist.setLayoutManager(new LinearLayoutManager(this)); |
107 | - final List<SchoolBean>schoolList=OrderedSortSmodel(list); | |
108 | - schoolListAdapter = new SchoolListAdapter(this,schoolList); | |
109 | - schoolListAdapter.addAll(schoolList); | |
110 | - schoollist.setAdapter(schoolListAdapter); | |
61 | + | |
111 | 62 | sideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() { |
112 | 63 | @Override |
113 | 64 | public void onTouchingLetterChanged(String s) { |
... | ... | @@ -125,21 +76,28 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity implements View. |
125 | 76 | |
126 | 77 | } |
127 | 78 | |
79 | + private void setSchoolList() { | |
80 | + mPresenter.schoolListResult("杭州", ""); | |
81 | + } | |
82 | + | |
128 | 83 | @Override |
129 | 84 | protected int getLayoutId() { |
130 | 85 | return R.layout.activity_select_school; |
131 | 86 | } |
132 | 87 | |
133 | 88 | |
134 | - List<SchoolBean> OrderedSortSmodel(List<String> list) { | |
135 | - List<SchoolBean> schoolList = new ArrayList<>(); | |
89 | + List<SortBean> OrderedSortSmodel(List<SchoolBean> list) { | |
90 | + List<SortBean> schoolList = new ArrayList<>(); | |
136 | 91 | CharacterParser characterParser = CharacterParser.getInstance(); |
137 | - for (String c : list) { | |
138 | - SchoolBean s = new SchoolBean(); | |
139 | - s.setSchoolname(c); | |
92 | + for (SchoolBean c : list) { | |
93 | + SortBean s = new SortBean(); | |
94 | + s.setSchool_name(c.school_name); | |
95 | + s.setSchool_area(c.school_area); | |
96 | + s.setSchool_id(c.school_id); | |
97 | + s.setIsNew(c.isNew); | |
140 | 98 | |
141 | 99 | //汉字转换成拼音 |
142 | - String pinyin = characterParser.getSelling(s.getSchoolname()); | |
100 | + String pinyin = characterParser.getSelling(s.getSchool_name()); | |
143 | 101 | String sortString = ""; |
144 | 102 | try { |
145 | 103 | sortString = pinyin.substring(0, 1).toUpperCase(); |
... | ... | @@ -147,7 +105,7 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity implements View. |
147 | 105 | continue; |
148 | 106 | } |
149 | 107 | // 正则表达式,判断首字母是否是英文字母 |
150 | - if (sortString.matches("[A-Z]") ) { | |
108 | + if (sortString.matches("[A-Z]")) { | |
151 | 109 | s.setSortLetters(sortString.toUpperCase()); |
152 | 110 | } else { |
153 | 111 | s.setSortLetters("#"); |
... | ... | @@ -159,10 +117,10 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity implements View. |
159 | 117 | } |
160 | 118 | |
161 | 119 | |
162 | - public static List<SchoolBean> orderByNameIndexAndIndentity(List<SchoolBean> sortModels) { | |
163 | - Collections.sort(sortModels, new Comparator<SchoolBean>() { | |
120 | + public static List<SortBean> orderByNameIndexAndIndentity(List<SortBean> sortModels) { | |
121 | + Collections.sort(sortModels, new Comparator<SortBean>() { | |
164 | 122 | @Override |
165 | - public int compare(SchoolBean o1, SchoolBean o2) { | |
123 | + public int compare(SortBean o1, SortBean o2) { | |
166 | 124 | if (o1.getSortLetters().equals("#") && o2.getSortLetters().matches("[A-Z]")) { |
167 | 125 | return -1; |
168 | 126 | } else if (o1.getSortLetters().equals("#") && !o2.getSortLetters().matches("[A-Z]")) { |
... | ... | @@ -187,10 +145,81 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity implements View. |
187 | 145 | |
188 | 146 | @Override |
189 | 147 | public void onClick(View v) { |
190 | - if(v==go_next){ | |
191 | - startActivity(new Intent().setClass(SelectSchoolActivity.this,CheckInfoActivity.class)); | |
148 | + if (v == go_next) { | |
149 | + SortBean currentSortBean = schoolListAdapter.getCurrentSortBean(); | |
150 | + if (currentSortBean != null) { | |
151 | + if (currentSortBean.getIsNew().equals("0")) { | |
152 | + startActivity(new Intent().setClass(SelectSchoolActivity.this, CheckInfoActivity.class)); | |
153 | + } else { | |
154 | + startActivity(new Intent().setClass(SelectSchoolActivity.this,CreateChildInfoActivity.class)); | |
155 | + } | |
192 | 156 | |
157 | + } else { | |
158 | + ToastUtils.showToast("请选择学校"); | |
159 | + } | |
193 | 160 | } |
194 | 161 | |
195 | 162 | } |
163 | + | |
164 | + | |
165 | + @Override | |
166 | + public void showList(List<SchoolBean> list) { | |
167 | +// list.add("阿尔卑斯"); | |
168 | +// list.add("阿尔卑斯"); | |
169 | +// list.add("阿尔卑斯"); | |
170 | +// list.add("贝克街"); | |
171 | +// list.add("贝克街"); | |
172 | +// list.add("贝克街"); | |
173 | +// list.add("贝克街"); | |
174 | +// list.add("贝克街"); | |
175 | +// list.add("阿尔卑斯"); | |
176 | +// list.add("阿尔卑斯"); | |
177 | +// list.add("贝克街"); | |
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 | + final List<SortBean> schoolList = OrderedSortSmodel(list); | |
221 | + schoolListAdapter = new SchoolListAdapter(this, schoolList); | |
222 | + schoolListAdapter.addAll(schoolList); | |
223 | + schoollist.setAdapter(schoolListAdapter); | |
224 | + } | |
196 | 225 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
... | ... | @@ -4,11 +4,18 @@ import android.content.Intent; |
4 | 4 | import android.os.Bundle; |
5 | 5 | import android.support.annotation.NonNull; |
6 | 6 | import android.support.annotation.Nullable; |
7 | +import android.text.TextUtils; | |
7 | 8 | import android.view.View; |
8 | 9 | import android.widget.LinearLayout; |
10 | +import android.widget.TextView; | |
9 | 11 | |
12 | +import com.bumptech.glide.Glide; | |
13 | +import com.makeramen.roundedimageview.RoundedImageView; | |
10 | 14 | import com.share.mvpsdk.base.BasePresenter; |
11 | 15 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
16 | +import com.share.mvpsdk.utils.ToastUtils; | |
17 | +import com.shunzhi.parent.AppConfig; | |
18 | +import com.shunzhi.parent.AppContext; | |
12 | 19 | import com.shunzhi.parent.R; |
13 | 20 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
14 | 21 | import com.shunzhi.parent.contract.mine.MineContract; |
... | ... | @@ -18,7 +25,9 @@ import com.shunzhi.parent.ui.activity.PersonInfoActivity; |
18 | 25 | |
19 | 26 | public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract.LoginPresenter, LoginAndRegisterContract.ILoginModel> |
20 | 27 | implements MineContract.IMineView, View.OnClickListener { |
21 | - LinearLayout childlayout,personinfo; | |
28 | + LinearLayout childlayout, personinfo; | |
29 | + RoundedImageView user_photo; | |
30 | + TextView user_name, user_mobile; | |
22 | 31 | |
23 | 32 | @NonNull |
24 | 33 | @Override |
... | ... | @@ -37,6 +46,25 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract |
37 | 46 | personinfo = view.findViewById(R.id.personinfo); |
38 | 47 | childlayout.setOnClickListener(this); |
39 | 48 | personinfo.setOnClickListener(this); |
49 | + user_photo = view.findViewById(R.id.user_photo); | |
50 | + user_name = view.findViewById(R.id.user_name); | |
51 | + user_mobile = view.findViewById(R.id.user_mobile); | |
52 | + | |
53 | + } | |
54 | + | |
55 | + private void setPersonInfo() { | |
56 | + String url = AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_IMAGE); | |
57 | + ToastUtils.showToast(url); | |
58 | + if (!TextUtils.isEmpty(url)) { | |
59 | + Glide.with(getActivity()).load(url).asBitmap().error(R.drawable.test).centerCrop().into(user_photo); | |
60 | + } else { | |
61 | + Glide.with(getActivity()).load(R.drawable.test).centerCrop().into(user_photo); | |
62 | + user_photo.setCornerRadius(20); | |
63 | + } | |
64 | + user_photo.setCornerRadius(20); | |
65 | + user_photo.setOval(true); | |
66 | + user_name.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_NAME)); | |
67 | + user_mobile.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); | |
40 | 68 | |
41 | 69 | } |
42 | 70 | |
... | ... | @@ -54,6 +82,11 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract |
54 | 82 | break; |
55 | 83 | } |
56 | 84 | |
85 | + } | |
57 | 86 | |
87 | + @Override | |
88 | + public void onResume() { | |
89 | + super.onResume(); | |
90 | + setPersonInfo(); | |
58 | 91 | } |
59 | 92 | } | ... | ... |
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; | |
4 | 5 | import android.os.Bundle; |
5 | 6 | import android.support.annotation.NonNull; |
6 | 7 | import android.support.annotation.Nullable; |
8 | +import android.support.annotation.RequiresApi; | |
7 | 9 | import android.text.Editable; |
8 | 10 | import android.text.TextUtils; |
9 | 11 | import android.text.TextWatcher; |
12 | +import android.util.Log; | |
10 | 13 | import android.view.Gravity; |
11 | 14 | import android.view.LayoutInflater; |
12 | 15 | import android.view.View; |
... | ... | @@ -20,11 +23,17 @@ import android.widget.TextView; |
20 | 23 | import com.makeramen.roundedimageview.RoundedImageView; |
21 | 24 | import com.share.mvpsdk.base.BasePresenter; |
22 | 25 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
23 | -import com.share.mvpsdk.utils.ToastUtils; | |
26 | +import com.shunzhi.parent.AppConfig; | |
27 | +import com.shunzhi.parent.AppContext; | |
24 | 28 | import com.shunzhi.parent.R; |
25 | 29 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
26 | 30 | import com.shunzhi.parent.presenter.loginandregister.LoginAndRegisterPresenter; |
31 | +import com.shunzhi.parent.ui.MainActivity; | |
27 | 32 | import com.shunzhi.parent.ui.activity.LoginAndRegistActivity; |
33 | +import com.shunzhi.parent.views.MyProcessDialog; | |
34 | + | |
35 | +import java.util.Calendar; | |
36 | +import java.util.Date; | |
28 | 37 | |
29 | 38 | |
30 | 39 | public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegisterContract.LoginPresenter, LoginAndRegisterContract.ILoginModel> |
... | ... | @@ -33,10 +42,11 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
33 | 42 | public RoundedImageView roundedImageView; |
34 | 43 | public EditText phoneNumber, idCode, password; |
35 | 44 | public TextView get_idCode, loginAndRegister, tv_info, tv_goto; |
36 | - public LinearLayout phoneLayout, idCodeLayout, passwordLayout,main_login; | |
45 | + public LinearLayout phoneLayout, idCodeLayout, passwordLayout, main_login; | |
37 | 46 | public ImageView img_eye; |
38 | 47 | public static String typepage; |
39 | 48 | public boolean open = false; |
49 | + public static MyProcessDialog progressDialog; | |
40 | 50 | |
41 | 51 | |
42 | 52 | public static LoginAndRegistFragment getInstance(String type) { |
... | ... | @@ -59,6 +69,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
59 | 69 | |
60 | 70 | @Override |
61 | 71 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
72 | + progressDialog = new MyProcessDialog(getActivity()); | |
62 | 73 | main_login = view.findViewById(R.id.main_login); |
63 | 74 | roundedImageView = view.findViewById(R.id.photoImage); |
64 | 75 | phoneNumber = view.findViewById(R.id.et_phoneNumber); |
... | ... | @@ -79,6 +90,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
79 | 90 | phoneNumber.addTextChangedListener(textWatcher); |
80 | 91 | idCode.addTextChangedListener(textWatcher); |
81 | 92 | password.addTextChangedListener(textWatcher); |
93 | + mPresenter.loginResult("18358585335", "123456"); | |
82 | 94 | if ("登录".equals(typepage)) { |
83 | 95 | idCodeLayout.setVisibility(View.GONE); |
84 | 96 | loginAndRegister.setText("登录"); |
... | ... | @@ -94,32 +106,59 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
94 | 106 | |
95 | 107 | |
96 | 108 | @Override |
97 | - public void getUserInfo() { | |
98 | - PopupWindow popupWindow=new PopupWindow(); | |
99 | - popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); | |
100 | - popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); | |
101 | - View view= LayoutInflater.from(getActivity()).inflate(R.layout.dialog_view,null); | |
102 | - popupWindow.setContentView(view); | |
103 | - popupWindow.showAtLocation(main_login, Gravity.CENTER,0,0); | |
109 | + public void getUserInfo(int type) { | |
110 | + progressDialog.dismiss(); | |
111 | + if (type == 0) { | |
112 | + startActivity(new Intent().setClass(getActivity(), MainActivity.class)); | |
113 | + getActivity().finish(); | |
114 | + } else if (type == 1) { | |
115 | + PopupWindow popupWindow = new PopupWindow(); | |
116 | + popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); | |
117 | + popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); | |
118 | + View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_view, null); | |
119 | + TextView right_btn = view.findViewById(R.id.right_btn); | |
120 | + right_btn.setOnClickListener(new View.OnClickListener() { | |
121 | + @Override | |
122 | + public void onClick(View v) { | |
123 | + progressDialog.show(); | |
124 | + mPresenter.loginResult(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME),AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_PWD)); | |
125 | + } | |
126 | + }); | |
127 | + TextView cancel_btn = view.findViewById(R.id.cancel_btn); | |
128 | + cancel_btn.setOnClickListener(new View.OnClickListener() { | |
129 | + @Override | |
130 | + public void onClick(View v) { | |
131 | + startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class)); | |
132 | + phoneNumber.setText(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.LOGIN_NAME)); | |
133 | + password.setFocusable(true); | |
134 | + } | |
135 | + }); | |
136 | + | |
137 | + popupWindow.setContentView(view); | |
138 | + popupWindow.showAtLocation(main_login, Gravity.CENTER, 0, 0); | |
139 | + } | |
104 | 140 | |
105 | 141 | |
106 | 142 | |
107 | 143 | } |
108 | 144 | |
145 | + @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) | |
109 | 146 | @Override |
110 | 147 | public void onClick(View v) { |
111 | 148 | if (v == loginAndRegister) { |
112 | - ToastUtils.showToast("onClick"); | |
149 | + progressDialog.show(); | |
150 | + Date l = Calendar.getInstance().getTime(); | |
151 | + | |
152 | + Log.e("1111--==", l.getTime() + ""); | |
113 | 153 | if (loginAndRegister.getText().toString().trim().equals("登录")) { |
114 | - mPresenter.loginResult(phoneNumber.getText().toString(), password.getText().toString()); | |
154 | + mPresenter.loginResult(phoneNumber.getText().toString(), password.getText().toString()); | |
115 | 155 | } else if (loginAndRegister.getText().toString().trim().equals("注册")) { |
116 | - mPresenter.registerResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString()); | |
156 | + mPresenter.registerResult(phoneNumber.getText().toString(), idCode.getText().toString(), password.getText().toString()); | |
117 | 157 | } |
118 | 158 | |
119 | 159 | } else if (v == tv_goto) { |
120 | 160 | if (tv_goto.getText().toString().equals("登录")) { |
121 | 161 | startActivity(new Intent().putExtra("type", "登录").setClass(getActivity(), LoginAndRegistActivity.class)); |
122 | - | |
123 | 162 | } else if (tv_goto.getText().toString().equals("注册")) { |
124 | 163 | startActivity(new Intent().putExtra("type", "注册").setClass(getActivity(), LoginAndRegistActivity.class)); |
125 | 164 | } |
... | ... | @@ -139,6 +178,7 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
139 | 178 | password.setSelection(password.getText().toString().length()); |
140 | 179 | } |
141 | 180 | } |
181 | + | |
142 | 182 | TextWatcher textWatcher = new TextWatcher() { |
143 | 183 | @Override |
144 | 184 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ... | ... |
app/src/main/java/com/shunzhi/parent/views/MyProcessDialog.java
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +package com.shunzhi.parent.views; | |
2 | + | |
3 | + | |
4 | +import android.app.Dialog; | |
5 | +import android.content.Context; | |
6 | +import android.widget.TextView; | |
7 | + | |
8 | +import com.shunzhi.parent.R; | |
9 | + | |
10 | + | |
11 | +public class MyProcessDialog extends Dialog { | |
12 | + private TextView txt_info; | |
13 | + | |
14 | + public MyProcessDialog(Context context) { | |
15 | + super(context, R.style.MyProgressDialog); | |
16 | + this.setContentView(R.layout.ui_progress_dialog); | |
17 | + txt_info = (TextView)this.findViewById(R.id.txt_wait); | |
18 | + } | |
19 | + | |
20 | + public void setMsg(String msg){ | |
21 | + if(null != txt_info){ | |
22 | + txt_info.setText(msg); | |
23 | + } | |
24 | + } | |
25 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/views/ProgressView.java
... | ... | @@ -55,7 +55,7 @@ public class ProgressView extends View { |
55 | 55 | super.onDraw(canvas); |
56 | 56 | initPaint(); |
57 | 57 | RectF rectBlackBg = new RectF(20, 20, mWidth - 20, mHeight - 20); |
58 | - canvas.drawArc(rectBlackBg, 0, 275, false, mPaint); | |
58 | + canvas.drawArc(rectBlackBg, 0, 270, false, mPaint); | |
59 | 59 | mPaint.setColor(getColor(score)); |
60 | 60 | canvas.drawText(score + "%", mWidth / 2, mHeight / 2, mTextPaint); |
61 | 61 | mTextPaint.setTextSize(40); |
... | ... | @@ -70,7 +70,7 @@ public class ProgressView extends View { |
70 | 70 | mPaint.setShader(sweepGradient); |
71 | 71 | mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP)); |
72 | 72 | mPaint.setStyle(Style.STROKE); |
73 | - canvas.drawArc(rectBlackBg, 135, section * 275, false, mPaint); | |
73 | + canvas.drawArc(rectBlackBg, 135, section * 270, false, mPaint); | |
74 | 74 | } |
75 | 75 | |
76 | 76 | ... | ... |
1.56 KB
... | ... | @@ -0,0 +1,13 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | |
3 | + <item> | |
4 | + <rotate | |
5 | + android:drawable="@drawable/ic_loading_white" | |
6 | + android:duration="1000" | |
7 | + android:fromDegrees="0.0" | |
8 | + android:interpolator="@android:anim/linear_interpolator" | |
9 | + android:pivotX="50.0%" | |
10 | + android:pivotY="50.0%" | |
11 | + android:toDegrees="360.0" /> | |
12 | + </item> | |
13 | +</layer-list> | |
0 | 14 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_check_info.xml
... | ... | @@ -78,7 +78,7 @@ |
78 | 78 | <TextView |
79 | 79 | android:layout_width="wrap_content" |
80 | 80 | android:layout_height="wrap_content" |
81 | - android:text="性 别:" | |
81 | + android:text="性 别:" | |
82 | 82 | android:textSize="@dimen/sp_16" /> |
83 | 83 | |
84 | 84 | <EditText |
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | <TextView |
103 | 103 | android:layout_width="wrap_content" |
104 | 104 | android:layout_height="wrap_content" |
105 | - android:text="年 级:" | |
105 | + android:text="年 级:" | |
106 | 106 | android:textSize="@dimen/sp_16" /> |
107 | 107 | |
108 | 108 | <EditText |
... | ... | @@ -126,7 +126,7 @@ |
126 | 126 | <TextView |
127 | 127 | android:layout_width="wrap_content" |
128 | 128 | android:layout_height="wrap_content" |
129 | - android:text="班 级:" | |
129 | + android:text="班 级:" | |
130 | 130 | android:textSize="@dimen/sp_16" /> |
131 | 131 | |
132 | 132 | <EditText | ... | ... |
app/src/main/res/layout/activity_create_childinfo.xml
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | <TextView |
64 | 64 | android:layout_width="wrap_content" |
65 | 65 | android:layout_height="wrap_content" |
66 | - android:text="性 别:" | |
66 | + android:text="性 别:" | |
67 | 67 | android:textSize="@dimen/sp_16" /> |
68 | 68 | |
69 | 69 | <EditText |
... | ... | @@ -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 | <EditText |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 | <TextView |
114 | 114 | android:layout_width="wrap_content" |
115 | 115 | android:layout_height="wrap_content" |
116 | - android:text="班 级:" | |
116 | + android:text="班 级:" | |
117 | 117 | android:textSize="@dimen/sp_16" /> |
118 | 118 | |
119 | 119 | <EditText | ... | ... |
app/src/main/res/layout/activity_personinfo.xml
... | ... | @@ -48,10 +48,13 @@ |
48 | 48 | android:layout_centerInParent="true"> |
49 | 49 | |
50 | 50 | <com.makeramen.roundedimageview.RoundedImageView |
51 | + android:id="@+id/user_photo" | |
51 | 52 | android:layout_width="100dp" |
52 | 53 | android:layout_height="100dp" |
53 | 54 | android:src="@color/white" |
54 | - app:riv_corner_radius="20dp" /> | |
55 | + app:riv_corner_radius="20dp" | |
56 | + app:riv_oval="false" | |
57 | + /> | |
55 | 58 | </FrameLayout> |
56 | 59 | |
57 | 60 | <LinearLayout |
... | ... | @@ -65,12 +68,14 @@ |
65 | 68 | android:orientation="vertical"> |
66 | 69 | |
67 | 70 | <TextView |
71 | + android:id="@+id/user_name" | |
68 | 72 | android:layout_width="wrap_content" |
69 | 73 | android:layout_height="wrap_content" |
70 | 74 | android:text="马铂骞" |
71 | 75 | android:textSize="@dimen/txtsize_title" /> |
72 | 76 | |
73 | 77 | <TextView |
78 | + android:id="@+id/user_mobile" | |
74 | 79 | android:layout_width="wrap_content" |
75 | 80 | android:layout_height="wrap_content" |
76 | 81 | android:text="账号:12345678991" |
... | ... | @@ -95,6 +100,8 @@ |
95 | 100 | android:layout_width="match_parent" |
96 | 101 | android:layout_height="wrap_content" |
97 | 102 | android:background="@color/white" |
103 | + android:focusable="true" | |
104 | + android:focusableInTouchMode="true" | |
98 | 105 | android:orientation="vertical"> |
99 | 106 | |
100 | 107 | <LinearLayout |
... | ... | @@ -126,7 +133,6 @@ |
126 | 133 | android:layout_gravity="center_vertical" |
127 | 134 | android:layout_marginRight="15dp" |
128 | 135 | android:background="@null" |
129 | - android:focusable="false" | |
130 | 136 | android:text="马铂骞" |
131 | 137 | android:textColor="@color/text_color" |
132 | 138 | android:textSize="@dimen/txtsize_title" /> |
... | ... | @@ -168,6 +174,7 @@ |
168 | 174 | android:orientation="horizontal"> |
169 | 175 | |
170 | 176 | <RadioButton |
177 | + android:id="@+id/man" | |
171 | 178 | android:layout_width="wrap_content" |
172 | 179 | android:layout_height="wrap_content" |
173 | 180 | android:button="@null" |
... | ... | @@ -178,6 +185,7 @@ |
178 | 185 | android:textSize="@dimen/txtsize_title" /> |
179 | 186 | |
180 | 187 | <RadioButton |
188 | + android:id="@+id/women" | |
181 | 189 | android:layout_width="wrap_content" |
182 | 190 | android:layout_height="wrap_content" |
183 | 191 | android:layout_marginLeft="10dp" |
... | ... | @@ -203,6 +211,7 @@ |
203 | 211 | </LinearLayout> |
204 | 212 | |
205 | 213 | <TextView |
214 | + android:id="@+id/change_info" | |
206 | 215 | android:layout_width="match_parent" |
207 | 216 | android:layout_height="40dp" |
208 | 217 | android:layout_margin="20dp" | ... | ... |
app/src/main/res/layout/fragment_login_and_regist.xml
... | ... | @@ -44,6 +44,7 @@ |
44 | 44 | android:layout_height="50dp" |
45 | 45 | android:background="@null" |
46 | 46 | android:hint="请输入手机号码" |
47 | + android:text="18358585335" | |
47 | 48 | android:maxLength="11" |
48 | 49 | android:textColorHint="@color/hintTextColor" |
49 | 50 | android:textSize="@dimen/sp_16" /> |
... | ... | @@ -116,6 +117,7 @@ |
116 | 117 | android:layout_weight="1" |
117 | 118 | android:background="@null" |
118 | 119 | android:hint="请设置密码:6~16个字符" |
120 | + android:text="123456" | |
119 | 121 | android:maxLength="16" |
120 | 122 | android:inputType="textPassword" |
121 | 123 | android:textColorHint="@color/hintTextColor" |
... | ... | @@ -197,7 +199,6 @@ |
197 | 199 | android:layout_height="wrap_content" |
198 | 200 | android:layout_marginTop="30dp" |
199 | 201 | android:gravity="center" |
200 | - android:visibility="gone" | |
201 | 202 | android:orientation="horizontal"> |
202 | 203 | |
203 | 204 | <TextView |
... | ... | @@ -222,6 +223,7 @@ |
222 | 223 | android:id="@+id/denglu" |
223 | 224 | android:layout_width="match_parent" |
224 | 225 | android:layout_height="wrap_content" |
226 | + android:visibility="gone" | |
225 | 227 | android:layout_marginTop="30dp" |
226 | 228 | android:orientation="horizontal"> |
227 | 229 | |
... | ... | @@ -240,6 +242,17 @@ |
240 | 242 | android:text="注册" |
241 | 243 | android:textColor="#acc9fc" |
242 | 244 | android:textSize="@dimen/sp_16" /> |
245 | + <TextView | |
246 | + android:layout_width="0dp" | |
247 | + android:layout_height="wrap_content" | |
248 | + android:layout_weight="1" | |
249 | + /> | |
250 | + <TextView | |
251 | + android:layout_width="wrap_content" | |
252 | + android:layout_height="wrap_content" | |
253 | + android:text="忘记密码" | |
254 | + android:textColor="#acc9fc" | |
255 | + android:textSize="@dimen/sp_16" /> | |
243 | 256 | |
244 | 257 | |
245 | 258 | </LinearLayout> | ... | ... |
app/src/main/res/layout/fragment_mine.xml
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 | android:orientation="horizontal"> |
37 | 37 | |
38 | 38 | <com.makeramen.roundedimageview.RoundedImageView |
39 | + android:id="@+id/user_photo" | |
39 | 40 | android:layout_width="60dp" |
40 | 41 | android:layout_height="60dp" |
41 | 42 | android:layout_margin="20dp" |
... | ... | @@ -50,6 +51,7 @@ |
50 | 51 | android:orientation="vertical"> |
51 | 52 | |
52 | 53 | <TextView |
54 | + android:id="@+id/user_name" | |
53 | 55 | android:layout_width="wrap_content" |
54 | 56 | android:layout_height="wrap_content" |
55 | 57 | android:text="马铂賽" |
... | ... | @@ -57,6 +59,7 @@ |
57 | 59 | android:textSize="@dimen/txtsize_headline" /> |
58 | 60 | |
59 | 61 | <TextView |
62 | + android:id="@+id/user_mobile" | |
60 | 63 | android:layout_width="wrap_content" |
61 | 64 | android:layout_height="wrap_content" |
62 | 65 | android:text="账号:12345678991" | ... | ... |
app/src/main/res/layout/item_school.xml
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | android:textColor="#454545" /> |
20 | 20 | </LinearLayout> |
21 | 21 | <RelativeLayout |
22 | + android:id="@+id/item_view" | |
22 | 23 | android:layout_width="match_parent" |
23 | 24 | android:layout_height="wrap_content"> |
24 | 25 | |
... | ... | @@ -38,6 +39,7 @@ |
38 | 39 | android:layout_width="20dp" |
39 | 40 | android:layout_height="40dp" |
40 | 41 | android:layout_marginRight="40dp" |
42 | + android:visibility="invisible" | |
41 | 43 | android:gravity="center_vertical" |
42 | 44 | android:src="@drawable/select_ok" /> |
43 | 45 | </RelativeLayout> | ... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + android:layout_width="fill_parent" | |
4 | + android:layout_height="fill_parent" | |
5 | + android:background="@drawable/progress_bg" | |
6 | + android:layout_gravity="center" | |
7 | + android:gravity="center" | |
8 | + android:orientation="vertical"> | |
9 | + | |
10 | + <ProgressBar | |
11 | + android:layout_width="wrap_content" | |
12 | + android:layout_height="wrap_content" | |
13 | + android:layout_gravity="center" | |
14 | + android:focusable="false" | |
15 | + android:indeterminateDrawable="@drawable/ic_progressbar" | |
16 | + /> | |
17 | + | |
18 | + <TextView | |
19 | + android:id="@+id/txt_wait" | |
20 | + android:layout_width="wrap_content" | |
21 | + android:layout_height="wrap_content" | |
22 | + android:layout_gravity="center" | |
23 | + android:layout_marginTop="8.0dip" | |
24 | + android:focusable="false" | |
25 | + android:singleLine="true" | |
26 | + android:textColor="@color/white" | |
27 | + android:text="加载中..." | |
28 | + android:textSize="12.0sp" /> | |
29 | + | |
30 | +</LinearLayout> | |
0 | 31 | \ No newline at end of file | ... | ... |
app/src/main/res/values/colors.xml
app/src/main/res/values/styles.xml
... | ... | @@ -32,5 +32,13 @@ |
32 | 32 | <item name="android:layout_height">match_parent</item> |
33 | 33 | <item name="android:textSize">@dimen/textSize16</item> |
34 | 34 | </style> |
35 | + <style name="MyProgressDialog" parent="@android:style/Theme.Dialog"> | |
36 | + <item name="android:windowBackground">@color/transparent</item> | |
37 | + <item name="android:windowFrame">@color/transparent</item> | |
38 | + <item name="android:windowNoTitle">true</item> | |
39 | + <item name="android:windowIsFloating">true</item> | |
40 | + <item name="android:windowIsTranslucent">true</item> | |
41 | + <item name="android:backgroundDimEnabled">true</item> | |
42 | + </style> | |
35 | 43 | |
36 | 44 | </resources> | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/helper/RetrofitCreateHelper.java
1 | 1 | package com.share.mvpsdk.helper; |
2 | 2 | |
3 | 3 | |
4 | -import android.util.Log; | |
5 | - | |
6 | 4 | import com.share.mvpsdk.helper.okhttp.CacheInterceptor; |
7 | -import com.share.mvpsdk.helper.okhttp.HttpCache; | |
8 | -import com.share.mvpsdk.helper.okhttp.TrustManager; | |
9 | 5 | import com.share.mvpsdk.utils.StringUtils; |
10 | -import com.share.mvpsdk.utils.ToastUtils; | |
11 | 6 | |
12 | 7 | import java.io.IOException; |
13 | 8 | import java.util.concurrent.TimeUnit; | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/utils/OkHttpExceptionUtil.java
1 | 1 | package com.share.mvpsdk.utils; |
2 | 2 | |
3 | 3 | import android.support.annotation.NonNull; |
4 | -import android.util.Log; | |
5 | 4 | |
6 | 5 | import org.json.JSONObject; |
7 | 6 | |
... | ... | @@ -21,7 +20,7 @@ public class OkHttpExceptionUtil { |
21 | 20 | if (responseBody==null)return; |
22 | 21 | try { |
23 | 22 | JSONObject json = new JSONObject(responseBody.string()); |
24 | - ToastUtils.showToast(json.optString("error")); | |
23 | + ToastUtils.showToast(json.optString("message")); | |
25 | 24 | } catch (Exception e1) { |
26 | 25 | e1.printStackTrace(); |
27 | 26 | } | ... | ... |