Commit 0648fe46aa4e4fe63eb3d3ee24a76227f9f655dc
1 parent
d37e980ebb
Exists in
master
绑定老师
Showing
14 changed files
with
688 additions
and
79 deletions
Show diff stats
app/src/main/AndroidManifest.xml
... | ... | @@ -83,6 +83,9 @@ |
83 | 83 | <activity |
84 | 84 | android:name=".ChooseActivity" |
85 | 85 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
86 | + <activity | |
87 | + android:name=".AddTeacherActivity" | |
88 | + android:theme="@style/Theme.AppCompat.NoActionBar" /> | |
86 | 89 | |
87 | 90 | <provider |
88 | 91 | android:name="androidx.core.content.FileProvider" | ... | ... |
app/src/main/java/com/hjx/parent/AddStudentActivity.java
1 | 1 | package com.hjx.parent; |
2 | 2 | |
3 | +import android.content.DialogInterface; | |
3 | 4 | import android.content.Intent; |
4 | 5 | import android.graphics.Bitmap; |
5 | 6 | import android.graphics.Color; |
... | ... | @@ -8,11 +9,14 @@ import android.os.Build; |
8 | 9 | import android.os.Bundle; |
9 | 10 | import android.os.Environment; |
10 | 11 | import android.provider.MediaStore; |
12 | +import android.text.TextUtils; | |
11 | 13 | import android.util.Log; |
12 | 14 | import android.view.LayoutInflater; |
13 | 15 | import android.view.View; |
14 | 16 | import android.widget.Button; |
15 | 17 | import android.widget.ImageView; |
18 | +import android.widget.LinearLayout; | |
19 | +import android.widget.RelativeLayout; | |
16 | 20 | import android.widget.TextView; |
17 | 21 | import android.widget.Toast; |
18 | 22 | |
... | ... | @@ -22,12 +26,14 @@ import com.bumptech.glide.Glide; |
22 | 26 | import com.bumptech.glide.load.resource.bitmap.RoundedCorners; |
23 | 27 | import com.bumptech.glide.request.RequestOptions; |
24 | 28 | import com.google.android.material.bottomsheet.BottomSheetDialog; |
29 | +import com.google.gson.Gson; | |
25 | 30 | import com.hjq.permissions.OnPermissionCallback; |
26 | 31 | import com.hjq.permissions.Permission; |
27 | 32 | import com.hjq.permissions.XXPermissions; |
28 | 33 | import com.prws.common.base.BaseActivity; |
29 | 34 | import com.prws.common.base.BasePresenter; |
30 | 35 | import com.prws.common.bean.ResponseResult; |
36 | +import com.prws.common.bean.Teacher; | |
31 | 37 | import com.prws.common.net.NetWorks; |
32 | 38 | import com.prws.common.utils.LogUtil; |
33 | 39 | import com.prws.common.utils.ScreenUtils; |
... | ... | @@ -68,6 +74,14 @@ public class AddStudentActivity extends BaseActivity { |
68 | 74 | View view_3; |
69 | 75 | View view_4; |
70 | 76 | View view_5; |
77 | + @BindView(R.id.tv_teacher) | |
78 | + TextView tv_teacher; | |
79 | + @BindView(R.id.rl_teacher) | |
80 | + RelativeLayout rl_teacher; | |
81 | + @BindView(R.id.iv_teacher) | |
82 | + ImageView iv_teacher; | |
83 | + @BindView(R.id.tv_bind) | |
84 | + TextView tv_bind; | |
71 | 85 | Button btn_next; |
72 | 86 | TextView tv_name, tv_sex, tv_nian, tv_shen; |
73 | 87 | @BindView(R.id.iv_avatar) |
... | ... | @@ -93,8 +107,10 @@ public class AddStudentActivity extends BaseActivity { |
93 | 107 | private static int CAMERA_REQUEST_CODE = 343; |
94 | 108 | private static int ALBUM_REQUEST_CODE = 456; |
95 | 109 | private static int CROP_REQUEST_CODE = 234; |
110 | + private static int BIND_TEACHER_CODE = 345; | |
96 | 111 | private File tempFile; |
97 | 112 | private String path; |
113 | + private Teacher teacher; | |
98 | 114 | |
99 | 115 | @Override |
100 | 116 | protected void onStart() { |
... | ... | @@ -145,7 +161,28 @@ public class AddStudentActivity extends BaseActivity { |
145 | 161 | findViewById(R.id.tv_cancel).setOnClickListener(view -> onBackPressed()); |
146 | 162 | btn_next.setOnClickListener(view -> { |
147 | 163 | if (isName && isSex && isNian && isShen) { |
148 | - addStudent(); | |
164 | + if (teacher != null) { | |
165 | + addStudent(); | |
166 | + } else { | |
167 | + showDialog("温馨提示", "您还未绑定老师,是否绑定?", "去绑定", "暂不绑定", new DialogInterface.OnClickListener() { | |
168 | + @Override | |
169 | + public void onClick(DialogInterface dialogInterface, int i) { | |
170 | + dialogInterface.dismiss(); | |
171 | + showDialog("温馨提示", "您暂未绑定老师,如需绑定老师\n" + "请联系400-800-3813", "确定", "", null, new DialogInterface.OnClickListener() { | |
172 | + @Override | |
173 | + public void onClick(DialogInterface dialogInterface, int i) { | |
174 | + addStudent(); | |
175 | + } | |
176 | + }); | |
177 | + } | |
178 | + }, new DialogInterface.OnClickListener() { | |
179 | + @Override | |
180 | + public void onClick(DialogInterface dialogInterface, int i) { | |
181 | + Intent intent = new Intent(AddStudentActivity.this, AddTeacherActivity.class); | |
182 | + startActivityForResult(intent, BIND_TEACHER_CODE); | |
183 | + } | |
184 | + }); | |
185 | + } | |
149 | 186 | } else { |
150 | 187 | Toast.makeText(this, "请完成设置后点击", Toast.LENGTH_SHORT).show(); |
151 | 188 | } |
... | ... | @@ -170,18 +207,17 @@ public class AddStudentActivity extends BaseActivity { |
170 | 207 | String nian = (String) SharedPreferencesUtil.getData("setNian", ""); |
171 | 208 | String shen = (String) SharedPreferencesUtil.getData("setShen", ""); |
172 | 209 | String xueq = (String) SharedPreferencesUtil.getData("setXueq", ""); |
173 | - | |
174 | - | |
175 | 210 | Map map = new HashMap(); |
176 | 211 | map.put("nickName", name); |
177 | 212 | map.put("gender", "男".equals(sex) ? 0 : 1); |
178 | 213 | map.put("gradeId", SharedPreferencesUtil.getData("grade", 1)); |
179 | 214 | map.put("parentIdentity", shen); |
180 | 215 | map.put("term", xueq); |
216 | + if (teacher != null) | |
217 | + map.put("userId", teacher.getId()); | |
181 | 218 | if (path != null) { |
182 | 219 | map.put("photo", path); |
183 | 220 | } |
184 | - | |
185 | 221 | NetWorks.registerStudent(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() { |
186 | 222 | @Override |
187 | 223 | public void onSubscribe(Disposable d) { |
... | ... | @@ -191,7 +227,6 @@ public class AddStudentActivity extends BaseActivity { |
191 | 227 | @Override |
192 | 228 | public void onNext(ResponseBody responseBody) { |
193 | 229 | try { |
194 | - | |
195 | 230 | String str = responseBody.string().toString(); |
196 | 231 | LogUtil.e(TAG, "----" + str); |
197 | 232 | JSONObject jo = new JSONObject(str); |
... | ... | @@ -205,7 +240,6 @@ public class AddStudentActivity extends BaseActivity { |
205 | 240 | e.printStackTrace(); |
206 | 241 | Toast.makeText(AddStudentActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show(); |
207 | 242 | } |
208 | - | |
209 | 243 | } |
210 | 244 | |
211 | 245 | @Override |
... | ... | @@ -221,6 +255,7 @@ public class AddStudentActivity extends BaseActivity { |
221 | 255 | }); |
222 | 256 | } |
223 | 257 | |
258 | + | |
224 | 259 | @Override |
225 | 260 | protected void initData() { |
226 | 261 | |
... | ... | @@ -335,7 +370,17 @@ public class AddStudentActivity extends BaseActivity { |
335 | 370 | //也可以进行一些保存、压缩等操作后上传 |
336 | 371 | File file = saveImage("head_output", image); |
337 | 372 | uploadAvatar(file); |
338 | - // Log.d("dsadsadsa",path); | |
373 | + } | |
374 | + } else if (requestCode == BIND_TEACHER_CODE && resultCode == 1000) { | |
375 | + String t = intent.getStringExtra("teacher"); | |
376 | + teacher = new Gson().fromJson(t, Teacher.class); | |
377 | + rl_teacher.setVisibility(View.VISIBLE); | |
378 | + tv_bind.setText("重新绑定"); | |
379 | + tv_teacher.setText(teacher.getUserName()); | |
380 | + if (!TextUtils.isEmpty(teacher.getPhoto())) { | |
381 | + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(AddStudentActivity.this, 20)); | |
382 | + RequestOptions options = RequestOptions.bitmapTransform(roundedCorners); | |
383 | + Glide.with(AddStudentActivity.this).load(teacher.getPhoto()).apply(options).into(iv_teacher); | |
339 | 384 | } |
340 | 385 | } |
341 | 386 | } |
... | ... | @@ -383,7 +428,6 @@ public class AddStudentActivity extends BaseActivity { |
383 | 428 | fos.close(); |
384 | 429 | return file; |
385 | 430 | } catch (IOException e) { |
386 | - Log.d("dsadsadsa", e.getLocalizedMessage()); | |
387 | 431 | e.printStackTrace(); |
388 | 432 | } |
389 | 433 | return null; |
... | ... | @@ -415,4 +459,10 @@ public class AddStudentActivity extends BaseActivity { |
415 | 459 | startActivityForResult(photoPickerIntent, ALBUM_REQUEST_CODE); |
416 | 460 | } |
417 | 461 | |
462 | + | |
463 | + @OnClick(R.id.view_6) | |
464 | + public void toAddTeacher(View view) { | |
465 | + Intent intent = new Intent(AddStudentActivity.this, AddTeacherActivity.class); | |
466 | + startActivityForResult(intent, BIND_TEACHER_CODE); | |
467 | + } | |
418 | 468 | } | ... | ... |
app/src/main/java/com/hjx/parent/AddTeacherActivity.java
... | ... | @@ -0,0 +1,157 @@ |
1 | +package com.hjx.parent; | |
2 | + | |
3 | +import android.content.Intent; | |
4 | +import android.graphics.Color; | |
5 | +import android.text.Editable; | |
6 | +import android.text.TextUtils; | |
7 | +import android.text.TextWatcher; | |
8 | +import android.view.View; | |
9 | +import android.widget.Button; | |
10 | +import android.widget.EditText; | |
11 | +import android.widget.ImageView; | |
12 | +import android.widget.RelativeLayout; | |
13 | +import android.widget.TextView; | |
14 | + | |
15 | +import com.bumptech.glide.Glide; | |
16 | +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; | |
17 | +import com.bumptech.glide.request.RequestOptions; | |
18 | +import com.google.gson.Gson; | |
19 | +import com.prws.common.base.BaseActivity; | |
20 | +import com.prws.common.base.BasePresenter; | |
21 | +import com.prws.common.bean.ResponseResult; | |
22 | +import com.prws.common.bean.Teacher; | |
23 | +import com.prws.common.net.NetWorks; | |
24 | +import com.prws.common.utils.Common; | |
25 | +import com.prws.common.utils.ScreenUtils; | |
26 | + | |
27 | +import butterknife.BindView; | |
28 | +import butterknife.OnClick; | |
29 | +import io.reactivex.Observer; | |
30 | +import io.reactivex.disposables.Disposable; | |
31 | + | |
32 | +public class AddTeacherActivity extends BaseActivity { | |
33 | + @BindView(R.id.et_1) | |
34 | + EditText et_1; | |
35 | + @BindView(R.id.btn_next) | |
36 | + Button btn_next; | |
37 | + @BindView(R.id.rl_teacher) | |
38 | + RelativeLayout rl_teacher; | |
39 | + @BindView(R.id.iv_teacher) | |
40 | + ImageView iv_teacher; | |
41 | + @BindView(R.id.tv_teacher) | |
42 | + TextView tv_teacher; | |
43 | + Teacher teacher; | |
44 | + | |
45 | + @Override | |
46 | + protected int layoutResId() { | |
47 | + return R.layout.activity_add_teacher; | |
48 | + } | |
49 | + | |
50 | + @Override | |
51 | + public Object getContract() { | |
52 | + return null; | |
53 | + } | |
54 | + | |
55 | + @Override | |
56 | + public BasePresenter getPresenter() { | |
57 | + return null; | |
58 | + } | |
59 | + | |
60 | + @Override | |
61 | + protected void initView() { | |
62 | + et_1.addTextChangedListener(new TextWatcher() { | |
63 | + @Override | |
64 | + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { | |
65 | + | |
66 | + } | |
67 | + | |
68 | + @Override | |
69 | + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { | |
70 | + | |
71 | + } | |
72 | + | |
73 | + @Override | |
74 | + public void afterTextChanged(Editable editable) { | |
75 | + if (editable.length() == 11) { | |
76 | + if (Common.isValidPhoneNumber(editable.toString())) { | |
77 | + searchTeacher(editable.toString()); | |
78 | + } else { | |
79 | + rl_teacher.setVisibility(View.GONE); | |
80 | + showToast("请输入正确的手机号码"); | |
81 | + btn_next.setTextColor(Color.parseColor("#999999")); | |
82 | + btn_next.setBackgroundResource(R.drawable.bg_solid_btn_grad); | |
83 | + btn_next.setEnabled(false); | |
84 | + } | |
85 | + } else { | |
86 | + rl_teacher.setVisibility(View.GONE); | |
87 | + btn_next.setBackgroundResource(R.drawable.bg_solid_btn_grad); | |
88 | + btn_next.setTextColor(Color.parseColor("#999999")); | |
89 | + btn_next.setEnabled(false); | |
90 | + } | |
91 | + } | |
92 | + }); | |
93 | + } | |
94 | + | |
95 | + | |
96 | + public void searchTeacher(String phone) { | |
97 | + NetWorks.searchTeacher(phone, new Observer<ResponseResult<Teacher>>() { | |
98 | + @Override | |
99 | + public void onSubscribe(Disposable d) { | |
100 | + | |
101 | + } | |
102 | + | |
103 | + @Override | |
104 | + public void onNext(ResponseResult<Teacher> result) { | |
105 | + if (result != null && result.getCode() == 200) { | |
106 | + teacher = result.getData(); | |
107 | + rl_teacher.setVisibility(View.VISIBLE); | |
108 | + if (!TextUtils.isEmpty(teacher.getPhoto())) { | |
109 | + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(AddTeacherActivity.this, 20)); | |
110 | + RequestOptions options = RequestOptions.bitmapTransform(roundedCorners); | |
111 | + Glide.with(AddTeacherActivity.this).load(teacher.getPhoto()).apply(options).into(iv_teacher); | |
112 | + } else { | |
113 | + iv_teacher.setImageResource(R.mipmap.ic_teacher_male); | |
114 | + } | |
115 | + tv_teacher.setText(teacher.getUserName()); | |
116 | + btn_next.setBackgroundResource(R.drawable.bg_solid_btn); | |
117 | + btn_next.setTextColor(Color.WHITE); | |
118 | + btn_next.setEnabled(true); | |
119 | + } | |
120 | + } | |
121 | + | |
122 | + @Override | |
123 | + public void onError(Throwable e) { | |
124 | + | |
125 | + } | |
126 | + | |
127 | + @Override | |
128 | + public void onComplete() { | |
129 | + | |
130 | + } | |
131 | + }); | |
132 | + } | |
133 | + | |
134 | + @OnClick(R.id.btn_next) | |
135 | + public void confirm(View view) { | |
136 | + Intent intent = new Intent(); | |
137 | + intent.putExtra("teacher", new Gson().toJson(teacher)); | |
138 | + setResult(1000,intent); | |
139 | + finish(); | |
140 | + } | |
141 | + | |
142 | + @Override | |
143 | + protected void initListener() { | |
144 | + | |
145 | + } | |
146 | + | |
147 | + @Override | |
148 | + protected void initData() { | |
149 | + | |
150 | + } | |
151 | + | |
152 | + @Override | |
153 | + public void onNetChanged(int netWorkState) { | |
154 | + | |
155 | + } | |
156 | + | |
157 | +} | ... | ... |
app/src/main/java/com/hjx/parent/ChangePwdActivity.java
app/src/main/java/com/hjx/parent/ChooseActivity.java
... | ... | @@ -92,10 +92,7 @@ public class ChooseActivity extends BaseActivity { |
92 | 92 | @Override |
93 | 93 | public void onNext(ResponseBody responseBody) { |
94 | 94 | try { |
95 | - | |
96 | 95 | String str = responseBody.string().toString(); |
97 | - | |
98 | - | |
99 | 96 | LogUtil.e("TAG", "----" + str); |
100 | 97 | JSONObject jo = new JSONObject(str); |
101 | 98 | boolean isSucceed = jo.getBoolean("success"); | ... | ... |
app/src/main/java/com/hjx/parent/EditStudentActivity.java
1 | 1 | package com.hjx.parent; |
2 | 2 | |
3 | +import android.content.DialogInterface; | |
3 | 4 | import android.content.Intent; |
4 | 5 | import android.graphics.Bitmap; |
5 | 6 | import android.graphics.Color; |
... | ... | @@ -14,6 +15,8 @@ import android.view.LayoutInflater; |
14 | 15 | import android.view.View; |
15 | 16 | import android.widget.Button; |
16 | 17 | import android.widget.ImageView; |
18 | +import android.widget.LinearLayout; | |
19 | +import android.widget.RelativeLayout; | |
17 | 20 | import android.widget.TextView; |
18 | 21 | import android.widget.Toast; |
19 | 22 | |
... | ... | @@ -31,6 +34,7 @@ import com.hjx.parent.bean.StudentBean; |
31 | 34 | import com.prws.common.base.BaseActivity; |
32 | 35 | import com.prws.common.base.BasePresenter; |
33 | 36 | import com.prws.common.bean.ResponseResult; |
37 | +import com.prws.common.bean.Teacher; | |
34 | 38 | import com.prws.common.net.NetWorks; |
35 | 39 | import com.prws.common.utils.LogUtil; |
36 | 40 | import com.prws.common.utils.ScreenUtils; |
... | ... | @@ -63,12 +67,21 @@ public class EditStudentActivity extends BaseActivity { |
63 | 67 | TextView tv_teacher; |
64 | 68 | @BindView(R.id.iv_teacher) |
65 | 69 | ImageView iv_teacher; |
70 | + @BindView(R.id.rl_teacher) | |
71 | + RelativeLayout rl_teacher; | |
72 | + @BindView(R.id.tv_bind) | |
73 | + TextView tv_bind; | |
74 | + @BindView(R.id.view_6) | |
75 | + LinearLayout view_6; | |
66 | 76 | private static int CAMERA_REQUEST_CODE = 343; |
67 | 77 | private static int ALBUM_REQUEST_CODE = 456; |
68 | 78 | private static int CROP_REQUEST_CODE = 234; |
79 | + | |
80 | + private static int BIND_TEACHER_CODE = 345; | |
69 | 81 | private File tempFile; |
70 | 82 | private String path; |
71 | 83 | StudentBean studentBean; |
84 | + private Teacher teacher; | |
72 | 85 | |
73 | 86 | @Override |
74 | 87 | protected int layoutResId() { |
... | ... | @@ -137,6 +150,8 @@ public class EditStudentActivity extends BaseActivity { |
137 | 150 | iv_avatar.setImageResource(studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female); |
138 | 151 | } |
139 | 152 | if (!"虚拟".equals(studentBean.getTeacherIdentity())) { |
153 | + rl_teacher.setVisibility(View.VISIBLE); | |
154 | + tv_bind.setText("重新绑定"); | |
140 | 155 | tv_teacher.setText(studentBean.getTeacherName()); |
141 | 156 | if (!TextUtils.isEmpty(studentBean.getTeacherAvatar())) { |
142 | 157 | RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(this, 25)); |
... | ... | @@ -146,7 +161,12 @@ public class EditStudentActivity extends BaseActivity { |
146 | 161 | iv_teacher.setImageResource(studentBean.getSex() == 0 ? R.mipmap.ic_teacher_male : R.mipmap.ic_teacher_female); |
147 | 162 | } |
148 | 163 | } else { |
149 | - iv_teacher.setVisibility(View.GONE); | |
164 | + rl_teacher.setVisibility(View.GONE); | |
165 | + if ((studentBean.getState() != null && studentBean.getState() == 0)) { | |
166 | + tv_bind.setText("待通过"); | |
167 | + tv_bind.setTextColor(Color.parseColor("#FF3737")); | |
168 | + view_6.setEnabled(false); | |
169 | + } | |
150 | 170 | } |
151 | 171 | |
152 | 172 | } |
... | ... | @@ -159,10 +179,37 @@ public class EditStudentActivity extends BaseActivity { |
159 | 179 | view_5.setOnClickListener(view -> startActivity(ShenActivity.class)); |
160 | 180 | findViewById(R.id.tv_cancel).setOnClickListener(view -> onBackPressed()); |
161 | 181 | btn_next.setOnClickListener(view -> { |
162 | - editStudent(); | |
182 | + if (teacher != null || !"虚拟".equals(studentBean.getTeacherIdentity()) || (studentBean.getState() != null && studentBean.getState() == 0)) { | |
183 | + editStudent(); | |
184 | + } else { | |
185 | + showDialog("温馨提示", "您还未绑定老师,是否绑定?", "去绑定", "暂不绑定", new DialogInterface.OnClickListener() { | |
186 | + @Override | |
187 | + public void onClick(DialogInterface dialogInterface, int i) { | |
188 | + dialogInterface.dismiss(); | |
189 | + showDialog("温馨提示", "您暂未绑定老师,如需绑定老师\n" + "请联系400-800-3813", "确定", "", null, new DialogInterface.OnClickListener() { | |
190 | + @Override | |
191 | + public void onClick(DialogInterface dialogInterface, int i) { | |
192 | + editStudent(); | |
193 | + } | |
194 | + }); | |
195 | + } | |
196 | + }, new DialogInterface.OnClickListener() { | |
197 | + @Override | |
198 | + public void onClick(DialogInterface dialogInterface, int i) { | |
199 | + Intent intent = new Intent(EditStudentActivity.this, AddTeacherActivity.class); | |
200 | + startActivityForResult(intent, BIND_TEACHER_CODE); | |
201 | + } | |
202 | + }); | |
203 | + } | |
163 | 204 | }); |
164 | 205 | } |
165 | 206 | |
207 | + @OnClick(R.id.view_6) | |
208 | + public void toAddTeacher(View view) { | |
209 | + Intent intent = new Intent(EditStudentActivity.this, AddTeacherActivity.class); | |
210 | + startActivityForResult(intent, BIND_TEACHER_CODE); | |
211 | + } | |
212 | + | |
166 | 213 | public void editStudent() { |
167 | 214 | Map map = new HashMap(); |
168 | 215 | map.put("nickName", studentBean.getNickName()); |
... | ... | @@ -170,6 +217,9 @@ public class EditStudentActivity extends BaseActivity { |
170 | 217 | map.put("gradeId", studentBean.getGradeId()); |
171 | 218 | map.put("parentIdentity", studentBean.getParentIdentity()); |
172 | 219 | map.put("term", studentBean.getTerm()); |
220 | + if (teacher != null) { | |
221 | + map.put("teacherId", teacher.getId()); | |
222 | + } | |
173 | 223 | map.put("stuId", studentBean.getStuId()); |
174 | 224 | NetWorks.editStudent(NetWorks.getMapRequestBody(map), new Observer<ResponseResult>() { |
175 | 225 | @Override |
... | ... | @@ -269,6 +319,17 @@ public class EditStudentActivity extends BaseActivity { |
269 | 319 | uploadAvatar(file); |
270 | 320 | // Log.d("dsadsadsa",path); |
271 | 321 | } |
322 | + } else if (requestCode == BIND_TEACHER_CODE && resultCode == 1000) { | |
323 | + String t = intent.getStringExtra("teacher"); | |
324 | + teacher = new Gson().fromJson(t, Teacher.class); | |
325 | + rl_teacher.setVisibility(View.VISIBLE); | |
326 | + tv_bind.setText("重新绑定"); | |
327 | + tv_teacher.setText(teacher.getUserName()); | |
328 | + if (!TextUtils.isEmpty(teacher.getPhoto())) { | |
329 | + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(EditStudentActivity.this, 20)); | |
330 | + RequestOptions options = RequestOptions.bitmapTransform(roundedCorners); | |
331 | + Glide.with(EditStudentActivity.this).load(teacher.getPhoto()).apply(options).into(iv_teacher); | |
332 | + } | |
272 | 333 | } |
273 | 334 | } |
274 | 335 | ... | ... |
app/src/main/java/com/hjx/parent/bean/StudentBean.java
... | ... | @@ -22,7 +22,15 @@ public class StudentBean { |
22 | 22 | String grade; |
23 | 23 | String teacherIdentity; |
24 | 24 | int sex; |
25 | + Integer state; | |
25 | 26 | |
27 | + public void setState(Integer state) { | |
28 | + this.state = state; | |
29 | + } | |
30 | + | |
31 | + public Integer getState() { | |
32 | + return state; | |
33 | + } | |
26 | 34 | |
27 | 35 | @Override |
28 | 36 | public String toString() { |
... | ... | @@ -47,6 +55,7 @@ public class StudentBean { |
47 | 55 | ", grade=" + grade + |
48 | 56 | ", teacherIdentity=" + teacherIdentity + |
49 | 57 | ", sex=" + sex + |
58 | + ", state=" + state + | |
50 | 59 | '}'; |
51 | 60 | } |
52 | 61 | ... | ... |
app/src/main/res/layout/activity_add_stu.xml
... | ... | @@ -158,9 +158,7 @@ |
158 | 158 | android:background="@drawable/bg_solid_white_10" |
159 | 159 | app:layout_constraintLeft_toLeftOf="parent" |
160 | 160 | app:layout_constraintRight_toRightOf="parent" |
161 | - app:layout_constraintTop_toTopOf="parent" | |
162 | - | |
163 | - /> | |
161 | + app:layout_constraintTop_toTopOf="parent" /> | |
164 | 162 | |
165 | 163 | <TextView |
166 | 164 | android:layout_width="wrap_content" |
... | ... | @@ -204,12 +202,81 @@ |
204 | 202 | android:background="@drawable/bg_solid_white_10" |
205 | 203 | app:layout_constraintLeft_toLeftOf="parent" |
206 | 204 | app:layout_constraintRight_toRightOf="parent" |
207 | - app:layout_constraintTop_toTopOf="parent" | |
205 | + app:layout_constraintTop_toTopOf="parent" /> | |
208 | 206 | |
209 | - /> | |
207 | + <LinearLayout | |
208 | + android:id="@+id/view_6" | |
209 | + android:layout_width="match_parent" | |
210 | + android:layout_height="wrap_content" | |
211 | + android:layout_marginLeft="15dp" | |
212 | + android:layout_marginTop="460dp" | |
213 | + android:layout_marginRight="15dp" | |
214 | + android:background="@drawable/bg_solid_white_10" | |
215 | + android:orientation="vertical" | |
216 | + app:layout_constraintLeft_toLeftOf="parent" | |
217 | + app:layout_constraintRight_toRightOf="parent" | |
218 | + app:layout_constraintTop_toTopOf="parent"> | |
210 | 219 | |
211 | - <TextView | |
220 | + <RelativeLayout | |
221 | + android:layout_width="match_parent" | |
222 | + android:layout_height="50dp"> | |
223 | + | |
224 | + <ImageView | |
225 | + android:layout_width="15dp" | |
226 | + android:layout_height="15dp" | |
227 | + android:layout_centerVertical="true" | |
228 | + android:layout_marginRight="5dp" | |
229 | + android:layout_toLeftOf="@+id/tv_bind" | |
230 | + android:src="@mipmap/ic_bind_teacher" /> | |
231 | + | |
232 | + <TextView | |
233 | + android:id="@+id/tv_bind" | |
234 | + android:layout_width="wrap_content" | |
235 | + android:layout_height="wrap_content" | |
236 | + android:layout_alignParentRight="true" | |
237 | + android:layout_centerVertical="true" | |
238 | + android:layout_marginRight="15dp" | |
239 | + android:text="去绑定" | |
240 | + android:textColor="#999999" | |
241 | + android:textSize="16dp" /> | |
242 | + | |
243 | + <TextView | |
244 | + android:layout_width="wrap_content" | |
245 | + android:layout_height="wrap_content" | |
246 | + android:layout_centerVertical="true" | |
247 | + android:layout_marginLeft="15dp" | |
248 | + android:text="我的老师" | |
249 | + android:textColor="#666666" | |
250 | + android:textSize="16dp" /> | |
251 | + </RelativeLayout> | |
252 | + | |
253 | + <RelativeLayout | |
254 | + android:id="@+id/rl_teacher" | |
255 | + android:layout_width="match_parent" | |
256 | + android:layout_height="35dp" | |
257 | + android:layout_marginBottom="15dp" | |
258 | + android:visibility="gone"> | |
212 | 259 | |
260 | + <ImageView | |
261 | + android:id="@+id/iv_teacher" | |
262 | + android:layout_width="35dp" | |
263 | + android:layout_height="35dp" | |
264 | + android:layout_marginLeft="15dp" | |
265 | + android:src="@mipmap/ic_teacher_male" /> | |
266 | + | |
267 | + <TextView | |
268 | + android:id="@+id/tv_teacher" | |
269 | + android:layout_width="wrap_content" | |
270 | + android:layout_height="wrap_content" | |
271 | + android:layout_alignParentRight="true" | |
272 | + android:layout_centerVertical="true" | |
273 | + android:layout_marginRight="15dp" | |
274 | + android:textColor="#999999" | |
275 | + android:textSize="16dp" /> | |
276 | + </RelativeLayout> | |
277 | + </LinearLayout> | |
278 | + | |
279 | + <TextView | |
213 | 280 | android:layout_width="wrap_content" |
214 | 281 | android:layout_height="wrap_content" |
215 | 282 | android:layout_marginLeft="15dp" |
... | ... | @@ -220,6 +287,7 @@ |
220 | 287 | app:layout_constraintLeft_toLeftOf="@id/view_5" |
221 | 288 | app:layout_constraintTop_toTopOf="@id/view_5" /> |
222 | 289 | |
290 | + | |
223 | 291 | <TextView |
224 | 292 | android:id="@+id/tv_shen" |
225 | 293 | android:layout_width="wrap_content" |
... | ... | @@ -241,12 +309,11 @@ |
241 | 309 | app:layout_constraintRight_toRightOf="@id/view_5" |
242 | 310 | app:layout_constraintTop_toTopOf="@id/view_5" /> |
243 | 311 | |
244 | - | |
245 | 312 | <Button |
246 | 313 | android:id="@+id/btn_next" |
247 | 314 | android:layout_width="180dp" |
248 | 315 | android:layout_height="40dp" |
249 | - android:layout_marginTop="500dp" | |
316 | + android:layout_marginTop="700dp" | |
250 | 317 | android:background="@drawable/bg_solid_btn_grad" |
251 | 318 | android:text="确认" |
252 | 319 | android:textColor="#999999" | ... | ... |
app/src/main/res/layout/activity_add_teacher.xml
... | ... | @@ -0,0 +1,118 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
4 | + android:layout_width="match_parent" | |
5 | + android:layout_height="match_parent" | |
6 | + android:background="#F4F6F8"> | |
7 | + | |
8 | + <View | |
9 | + android:id="@+id/view_1" | |
10 | + android:layout_width="match_parent" | |
11 | + android:layout_height="44dp" | |
12 | + android:background="@android:color/white" | |
13 | + app:layout_constraintTop_toTopOf="parent" /> | |
14 | + | |
15 | + <TextView | |
16 | + android:layout_width="wrap_content" | |
17 | + android:layout_height="wrap_content" | |
18 | + android:text="绑定老师" | |
19 | + android:textColor="#333333" | |
20 | + android:textSize="18dp" | |
21 | + app:layout_constraintBottom_toBottomOf="@id/view_1" | |
22 | + app:layout_constraintLeft_toLeftOf="@id/view_1" | |
23 | + app:layout_constraintRight_toRightOf="@id/view_1" | |
24 | + app:layout_constraintTop_toTopOf="@id/view_1" /> | |
25 | + | |
26 | + <TextView | |
27 | + android:id="@+id/tv_cancel" | |
28 | + android:layout_width="wrap_content" | |
29 | + android:layout_height="wrap_content" | |
30 | + android:layout_marginLeft="15dp" | |
31 | + android:text="取消" | |
32 | + android:textColor="#666666" | |
33 | + android:textSize="16dp" | |
34 | + app:layout_constraintBottom_toBottomOf="@id/view_1" | |
35 | + app:layout_constraintLeft_toLeftOf="@id/view_1" | |
36 | + app:layout_constraintTop_toTopOf="@id/view_1" /> | |
37 | + | |
38 | + <View | |
39 | + android:id="@+id/view_3" | |
40 | + android:layout_width="match_parent" | |
41 | + android:layout_height="50dp" | |
42 | + android:layout_marginLeft="15dp" | |
43 | + android:layout_marginTop="109dp" | |
44 | + android:layout_marginRight="15dp" | |
45 | + android:background="@drawable/bg_solid_white_10" | |
46 | + app:layout_constraintLeft_toLeftOf="parent" | |
47 | + app:layout_constraintRight_toRightOf="parent" | |
48 | + app:layout_constraintTop_toTopOf="parent" /> | |
49 | + | |
50 | + <EditText | |
51 | + android:id="@+id/et_1" | |
52 | + android:layout_width="0dp" | |
53 | + android:layout_height="0dp" | |
54 | + android:layout_marginLeft="5dp" | |
55 | + android:layout_marginRight="5dp" | |
56 | + android:inputType="phone" | |
57 | + android:maxLength="11" | |
58 | + android:textColor="#333333" | |
59 | + android:textColorHint="#999999" | |
60 | + android:textSize="16dp" | |
61 | + app:layout_constraintBottom_toBottomOf="@+id/view_3" | |
62 | + app:layout_constraintLeft_toLeftOf="@+id/view_3" | |
63 | + app:layout_constraintRight_toRightOf="@+id/view_3" | |
64 | + app:layout_constraintTop_toTopOf="@+id/view_3" /> | |
65 | + | |
66 | + <TextView | |
67 | + android:layout_width="wrap_content" | |
68 | + android:layout_height="wrap_content" | |
69 | + android:layout_marginLeft="15dp" | |
70 | + android:layout_marginBottom="15dp" | |
71 | + android:text="请输入手机号" | |
72 | + android:textColor="#666666" | |
73 | + app:layout_constraintBottom_toTopOf="@id/et_1" | |
74 | + app:layout_constraintLeft_toLeftOf="parent" /> | |
75 | + | |
76 | + <RelativeLayout | |
77 | + android:id="@+id/rl_teacher" | |
78 | + android:layout_width="match_parent" | |
79 | + android:layout_height="60dp" | |
80 | + android:layout_marginLeft="15dp" | |
81 | + android:layout_marginTop="25dp" | |
82 | + android:layout_marginRight="15dp" | |
83 | + android:background="@drawable/bg_solid_white_10" | |
84 | + android:visibility="gone" | |
85 | + app:layout_constraintTop_toBottomOf="@+id/et_1"> | |
86 | + | |
87 | + <ImageView | |
88 | + android:id="@+id/iv_teacher" | |
89 | + android:layout_width="35dp" | |
90 | + android:layout_height="35dp" | |
91 | + android:layout_marginLeft="15dp" | |
92 | + android:layout_centerVertical="true" | |
93 | + android:src="@mipmap/ic_teacher_male" /> | |
94 | + | |
95 | + <TextView | |
96 | + android:id="@+id/tv_teacher" | |
97 | + android:layout_width="wrap_content" | |
98 | + android:layout_height="wrap_content" | |
99 | + android:layout_alignParentRight="true" | |
100 | + android:layout_centerVertical="true" | |
101 | + android:layout_marginRight="15dp" | |
102 | + android:textColor="#333333" | |
103 | + android:textSize="16dp" /> | |
104 | + </RelativeLayout> | |
105 | + | |
106 | + <Button | |
107 | + android:id="@+id/btn_next" | |
108 | + android:layout_width="180dp" | |
109 | + android:layout_height="40dp" | |
110 | + android:layout_marginTop="560dp" | |
111 | + android:background="@drawable/bg_solid_btn_grad" | |
112 | + android:text="申请绑定" | |
113 | + android:textColor="#999999" | |
114 | + android:textSize="16dp" | |
115 | + app:layout_constraintLeft_toLeftOf="parent" | |
116 | + app:layout_constraintRight_toRightOf="parent" | |
117 | + app:layout_constraintTop_toTopOf="parent" /> | |
118 | +</androidx.constraintlayout.widget.ConstraintLayout> | |
0 | 119 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_edit_stu.xml
... | ... | @@ -241,51 +241,77 @@ |
241 | 241 | app:layout_constraintRight_toRightOf="@id/view_5" |
242 | 242 | app:layout_constraintTop_toTopOf="@id/view_5" /> |
243 | 243 | |
244 | - <View | |
244 | + <LinearLayout | |
245 | 245 | android:id="@+id/view_6" |
246 | 246 | android:layout_width="match_parent" |
247 | + android:layout_height="wrap_content" | |
247 | 248 | android:layout_marginLeft="15dp" |
249 | + android:layout_marginTop="460dp" | |
248 | 250 | android:layout_marginRight="15dp" |
249 | - android:layout_height="50dp" | |
250 | - android:layout_marginTop="455dp" | |
251 | 251 | android:background="@drawable/bg_solid_white_10" |
252 | + android:orientation="vertical" | |
252 | 253 | app:layout_constraintLeft_toLeftOf="parent" |
253 | 254 | app:layout_constraintRight_toRightOf="parent" |
254 | - app:layout_constraintTop_toTopOf="parent" | |
255 | - | |
256 | - /> | |
255 | + app:layout_constraintTop_toTopOf="parent"> | |
257 | 256 | |
258 | - <TextView | |
259 | - android:layout_width="wrap_content" | |
260 | - android:layout_height="wrap_content" | |
261 | - android:layout_marginLeft="15dp" | |
262 | - android:text="绑定老师" | |
263 | - android:textColor="#666666" | |
264 | - android:textSize="16dp" | |
265 | - app:layout_constraintBottom_toBottomOf="@id/view_6" | |
266 | - app:layout_constraintLeft_toLeftOf="@id/view_6" | |
267 | - app:layout_constraintTop_toTopOf="@id/view_6" /> | |
268 | - | |
269 | - <ImageView | |
270 | - android:id="@+id/iv_teacher" | |
271 | - android:layout_width="28dp" | |
272 | - android:layout_height="28dp" | |
273 | - android:layout_marginRight="10dp" | |
274 | - app:layout_constraintBottom_toBottomOf="@id/view_6" | |
275 | - app:layout_constraintRight_toLeftOf="@+id/tv_teacher" | |
276 | - app:layout_constraintTop_toTopOf="@id/view_6" /> | |
277 | - | |
278 | - <TextView | |
279 | - android:id="@+id/tv_teacher" | |
280 | - android:layout_width="wrap_content" | |
281 | - android:layout_height="wrap_content" | |
282 | - android:layout_marginRight="15dp" | |
283 | - android:text="未绑定" | |
284 | - android:textColor="#333333" | |
285 | - android:textSize="16dp" | |
286 | - app:layout_constraintBottom_toBottomOf="@id/view_6" | |
287 | - app:layout_constraintRight_toRightOf="@id/view_6" | |
288 | - app:layout_constraintTop_toTopOf="@id/view_6" /> | |
257 | + <RelativeLayout | |
258 | + android:layout_width="match_parent" | |
259 | + android:layout_height="50dp"> | |
260 | + | |
261 | + <ImageView | |
262 | + android:layout_width="15dp" | |
263 | + android:layout_height="15dp" | |
264 | + android:layout_centerVertical="true" | |
265 | + android:layout_marginRight="5dp" | |
266 | + android:layout_toLeftOf="@+id/tv_bind" | |
267 | + android:src="@mipmap/ic_bind_teacher" /> | |
268 | + | |
269 | + <TextView | |
270 | + android:id="@+id/tv_bind" | |
271 | + android:layout_width="wrap_content" | |
272 | + android:layout_height="wrap_content" | |
273 | + android:layout_alignParentRight="true" | |
274 | + android:layout_centerVertical="true" | |
275 | + android:layout_marginRight="15dp" | |
276 | + android:text="去绑定" | |
277 | + android:textColor="#333333" | |
278 | + android:textSize="16dp" /> | |
279 | + | |
280 | + <TextView | |
281 | + android:layout_width="wrap_content" | |
282 | + android:layout_height="wrap_content" | |
283 | + android:layout_centerVertical="true" | |
284 | + android:layout_marginLeft="15dp" | |
285 | + android:text="我的老师" | |
286 | + android:textColor="#666666" | |
287 | + android:textSize="16dp" /> | |
288 | + </RelativeLayout> | |
289 | + | |
290 | + <RelativeLayout | |
291 | + android:id="@+id/rl_teacher" | |
292 | + android:layout_width="match_parent" | |
293 | + android:layout_height="35dp" | |
294 | + android:layout_marginBottom="15dp" | |
295 | + android:visibility="gone"> | |
296 | + | |
297 | + <ImageView | |
298 | + android:id="@+id/iv_teacher" | |
299 | + android:layout_width="35dp" | |
300 | + android:layout_height="35dp" | |
301 | + android:layout_marginLeft="15dp" | |
302 | + android:src="@mipmap/ic_teacher_male" /> | |
303 | + | |
304 | + <TextView | |
305 | + android:id="@+id/tv_teacher" | |
306 | + android:layout_width="wrap_content" | |
307 | + android:layout_height="wrap_content" | |
308 | + android:layout_alignParentRight="true" | |
309 | + android:layout_centerVertical="true" | |
310 | + android:layout_marginRight="15dp" | |
311 | + android:textColor="#999999" | |
312 | + android:textSize="16dp" /> | |
313 | + </RelativeLayout> | |
314 | + </LinearLayout> | |
289 | 315 | |
290 | 316 | |
291 | 317 | <Button | ... | ... |
app/src/main/res/mipmap-hdpi/ic_bind_teacher.png
3.07 KB
libs/common/src/main/java/com/prws/common/base/BaseActivity.java
... | ... | @@ -2,10 +2,13 @@ package com.prws.common.base; |
2 | 2 | |
3 | 3 | |
4 | 4 | import android.app.Activity; |
5 | +import android.app.AlertDialog; | |
5 | 6 | import android.content.Context; |
7 | +import android.content.DialogInterface; | |
6 | 8 | import android.content.Intent; |
7 | 9 | import android.os.Bundle; |
8 | 10 | import android.os.IBinder; |
11 | +import android.text.TextUtils; | |
9 | 12 | import android.util.Log; |
10 | 13 | import android.view.MotionEvent; |
11 | 14 | import android.view.View; |
... | ... | @@ -13,6 +16,7 @@ import android.view.Window; |
13 | 16 | import android.view.WindowManager; |
14 | 17 | import android.view.inputmethod.InputMethodManager; |
15 | 18 | import android.widget.EditText; |
19 | +import android.widget.Toast; | |
16 | 20 | |
17 | 21 | import androidx.annotation.IdRes; |
18 | 22 | import androidx.annotation.Nullable; |
... | ... | @@ -26,6 +30,7 @@ import com.prws.common.R; |
26 | 30 | import com.prws.common.net.INetEvent; |
27 | 31 | import com.prws.common.utils.LogUtil; |
28 | 32 | import com.prws.common.utils.ScreenUtils; |
33 | +import com.prws.common.utils.SharedPreferencesUtil; | |
29 | 34 | import com.prws.common.view.LoadingView; |
30 | 35 | |
31 | 36 | import org.simple.eventbus.EventBus; |
... | ... | @@ -106,17 +111,27 @@ public abstract class BaseActivity<P extends BasePresenter, CONTRACT> extends Ap |
106 | 111 | p.bindView(this); |
107 | 112 | } |
108 | 113 | |
114 | + public void showDialog(String title, String message, String confirm, String cancel, DialogInterface.OnClickListener cancelListener, DialogInterface.OnClickListener listener) { | |
115 | + AlertDialog.Builder builder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert); | |
116 | + builder.setTitle(title); | |
117 | + builder.setMessage(message); | |
118 | + builder.setCancelable(false); | |
119 | + if (!TextUtils.isEmpty(cancel)) { | |
120 | + builder.setNegativeButton(cancel, cancelListener); | |
121 | + } | |
122 | + builder.setPositiveButton(confirm, listener); | |
123 | + builder.show(); | |
124 | + } | |
125 | + | |
109 | 126 | private void setWindow() { |
110 | 127 | Window window = getWindow(); |
111 | 128 | WindowManager.LayoutParams params = window.getAttributes(); |
112 | 129 | params.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN |
113 | - ; | |
130 | + ; | |
114 | 131 | window.setAttributes(params); |
115 | 132 | } |
116 | 133 | |
117 | 134 | |
118 | - | |
119 | - | |
120 | 135 | private void addNavigationBar() { |
121 | 136 | //判断是否有浮窗权限 |
122 | 137 | if (PermissionUtils.requestWindowManager(this)) { |
... | ... | @@ -147,7 +162,6 @@ public abstract class BaseActivity<P extends BasePresenter, CONTRACT> extends Ap |
147 | 162 | // } |
148 | 163 | |
149 | 164 | |
150 | - | |
151 | 165 | public void showAlertDialogOfFloatWindow() { |
152 | 166 | //弹窗提示用户开启权限 |
153 | 167 | // new AlertDialog(this).builder().setTitle(getString(R.string.need_permission)) |
... | ... | @@ -264,11 +278,11 @@ public abstract class BaseActivity<P extends BasePresenter, CONTRACT> extends Ap |
264 | 278 | |
265 | 279 | } |
266 | 280 | |
267 | - private void registerEventBus(){ | |
281 | + private void registerEventBus() { | |
268 | 282 | EventBus.getDefault().register(this); |
269 | 283 | } |
270 | 284 | |
271 | - private void unregisterEventBus(){ | |
285 | + private void unregisterEventBus() { | |
272 | 286 | EventBus.getDefault().unregister(this); |
273 | 287 | } |
274 | 288 | |
... | ... | @@ -276,6 +290,10 @@ public abstract class BaseActivity<P extends BasePresenter, CONTRACT> extends Ap |
276 | 290 | // LogUtil.toast(MainApplication.getAppContext(), getString(R.string.service_error)); |
277 | 291 | } |
278 | 292 | |
293 | + public void showToast(String s) { | |
294 | + Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT).show(); | |
295 | + } | |
296 | + | |
279 | 297 | private void unSubscribe() { |
280 | 298 | if (mCompositeDisposable != null) { |
281 | 299 | mCompositeDisposable.clear(); |
... | ... | @@ -324,7 +342,9 @@ public abstract class BaseActivity<P extends BasePresenter, CONTRACT> extends Ap |
324 | 342 | } |
325 | 343 | try { |
326 | 344 | fragmentTransaction.commitNowAllowingStateLoss(); |
327 | - }catch (Exception e){e.printStackTrace();} | |
345 | + } catch (Exception e) { | |
346 | + e.printStackTrace(); | |
347 | + } | |
328 | 348 | } |
329 | 349 | fragmentList.clear(); |
330 | 350 | } |
... | ... | @@ -332,26 +352,27 @@ public abstract class BaseActivity<P extends BasePresenter, CONTRACT> extends Ap |
332 | 352 | //************************* 用于隐藏键盘 ***************************************// |
333 | 353 | @Override |
334 | 354 | public boolean dispatchTouchEvent(MotionEvent ev) { |
335 | - if (ev.getAction() == MotionEvent.ACTION_DOWN){ | |
355 | + if (ev.getAction() == MotionEvent.ACTION_DOWN) { | |
336 | 356 | |
337 | 357 | View v = getCurrentFocus(); |
338 | - if (isShouldHideInput(v,ev)){ | |
358 | + if (isShouldHideInput(v, ev)) { | |
339 | 359 | hideSoftInput(v.getWindowToken()); |
340 | 360 | } |
341 | 361 | } |
342 | 362 | return super.dispatchTouchEvent(ev); |
343 | 363 | } |
344 | - private boolean isShouldHideInput(View v,MotionEvent event){ | |
345 | - if(v !=null&&(v instanceof EditText)){ | |
346 | - int[] l ={0,0}; | |
364 | + | |
365 | + private boolean isShouldHideInput(View v, MotionEvent event) { | |
366 | + if (v != null && (v instanceof EditText)) { | |
367 | + int[] l = {0, 0}; | |
347 | 368 | v.getLocationInWindow(l); |
348 | 369 | int left = l[0], top = l[1], bottom = top + v.getHeight(), right = left |
349 | 370 | + v.getWidth(); |
350 | - if(event.getX()> left &&event.getX()< right | |
351 | - &&event.getY()> top &&event.getY()< bottom){ | |
371 | + if (event.getX() > left && event.getX() < right | |
372 | + && event.getY() > top && event.getY() < bottom) { | |
352 | 373 | // 点击EditText的事件,忽略它。 |
353 | 374 | return false; |
354 | - }else{ | |
375 | + } else { | |
355 | 376 | return true; |
356 | 377 | } |
357 | 378 | } |
... | ... | @@ -364,10 +385,10 @@ public abstract class BaseActivity<P extends BasePresenter, CONTRACT> extends Ap |
364 | 385 | * |
365 | 386 | * @param token |
366 | 387 | */ |
367 | - private void hideSoftInput(IBinder token){ | |
368 | - LogUtil.i(TAG,"隐藏键盘"); | |
369 | - if(token !=null){ | |
370 | - InputMethodManager im =(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); | |
388 | + private void hideSoftInput(IBinder token) { | |
389 | + LogUtil.i(TAG, "隐藏键盘"); | |
390 | + if (token != null) { | |
391 | + InputMethodManager im = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); | |
371 | 392 | im.hideSoftInputFromWindow(token, |
372 | 393 | InputMethodManager.HIDE_NOT_ALWAYS); |
373 | 394 | } | ... | ... |
libs/common/src/main/java/com/prws/common/bean/Teacher.java
... | ... | @@ -0,0 +1,94 @@ |
1 | +package com.prws.common.bean; | |
2 | + | |
3 | +public class Teacher { | |
4 | + private Integer id; | |
5 | + private String userName; | |
6 | + private String account; | |
7 | + private String nickName; | |
8 | + private String phone; | |
9 | + private String mail; | |
10 | + private String identity; | |
11 | + private String photo; | |
12 | + private String qrCode; | |
13 | + private Integer sex; | |
14 | + | |
15 | + public Integer getId() { | |
16 | + return id; | |
17 | + } | |
18 | + | |
19 | + public void setId(Integer id) { | |
20 | + this.id = id; | |
21 | + } | |
22 | + | |
23 | + public String getUserName() { | |
24 | + return userName; | |
25 | + } | |
26 | + | |
27 | + public void setUserName(String userName) { | |
28 | + this.userName = userName; | |
29 | + } | |
30 | + | |
31 | + public String getAccount() { | |
32 | + return account; | |
33 | + } | |
34 | + | |
35 | + public void setAccount(String account) { | |
36 | + this.account = account; | |
37 | + } | |
38 | + | |
39 | + public String getNickName() { | |
40 | + return nickName; | |
41 | + } | |
42 | + | |
43 | + public void setNickName(String nickName) { | |
44 | + this.nickName = nickName; | |
45 | + } | |
46 | + | |
47 | + public String getPhone() { | |
48 | + return phone; | |
49 | + } | |
50 | + | |
51 | + public void setPhone(String phone) { | |
52 | + this.phone = phone; | |
53 | + } | |
54 | + | |
55 | + public String getMail() { | |
56 | + return mail; | |
57 | + } | |
58 | + | |
59 | + public void setMail(String mail) { | |
60 | + this.mail = mail; | |
61 | + } | |
62 | + | |
63 | + public String getIdentity() { | |
64 | + return identity; | |
65 | + } | |
66 | + | |
67 | + public void setIdentity(String identity) { | |
68 | + this.identity = identity; | |
69 | + } | |
70 | + | |
71 | + public String getPhoto() { | |
72 | + return photo; | |
73 | + } | |
74 | + | |
75 | + public void setPhoto(String photo) { | |
76 | + this.photo = photo; | |
77 | + } | |
78 | + | |
79 | + public String getQrCode() { | |
80 | + return qrCode; | |
81 | + } | |
82 | + | |
83 | + public void setQrCode(String qrCode) { | |
84 | + this.qrCode = qrCode; | |
85 | + } | |
86 | + | |
87 | + public Integer getSex() { | |
88 | + return sex; | |
89 | + } | |
90 | + | |
91 | + public void setSex(Integer sex) { | |
92 | + this.sex = sex; | |
93 | + } | |
94 | +} | ... | ... |
libs/common/src/main/java/com/prws/common/net/NetWorks.java
... | ... | @@ -7,6 +7,7 @@ import com.prws.common.bean.BaseEntity; |
7 | 7 | import com.prws.common.bean.GradeAndSubject; |
8 | 8 | import com.prws.common.bean.ResponseResult; |
9 | 9 | import com.prws.common.bean.ScheduleBean; |
10 | +import com.prws.common.bean.Teacher; | |
10 | 11 | import com.prws.common.utils.SharedPreferencesUtil; |
11 | 12 | |
12 | 13 | import java.io.File; |
... | ... | @@ -133,6 +134,9 @@ public class NetWorks extends RetrofitUtils { |
133 | 134 | |
134 | 135 | @GET("/api/v1/student/getStudyPlanForThisWeek") |
135 | 136 | Observable<ResponseResult<ScheduleBean>> getWeekPlan(@Header("Authorization") String token, @Query("stuId") String stuId); |
137 | + | |
138 | + @GET("api/v1/parent/searchTeacher") | |
139 | + Observable<ResponseResult<Teacher>> searchTeacher(@Header("Authorization") String token, @Query("phone") String phone); | |
136 | 140 | } |
137 | 141 | |
138 | 142 | |
... | ... | @@ -140,6 +144,10 @@ public class NetWorks extends RetrofitUtils { |
140 | 144 | return (String) SharedPreferencesUtil.getData("token", ""); |
141 | 145 | } |
142 | 146 | |
147 | + public static void searchTeacher(String phone, Observer<ResponseResult<Teacher>> observer) { | |
148 | + setSubscribe(service_url.searchTeacher(getHeader(), phone), observer); | |
149 | + } | |
150 | + | |
143 | 151 | public static void logout(Observer<ResponseBody> observer) { |
144 | 152 | setSubscribe(service_url.logout(), observer); |
145 | 153 | } | ... | ... |