Commit 9d5f373a0a66e038a8e242174e862d3df5b52016

Authored by zhanghaochen
1 parent b9c422a7c5
Exists in master

家长端APP功能完成

Showing 67 changed files with 3586 additions and 1447 deletions   Show diff stats
1 apply plugin: 'com.android.application' 1 apply plugin: 'com.android.application'
2 apply from: '../config.gradle' 2 apply from: '../config.gradle'
3 3
4 4
5 def androidId = rootProject.ext.androidId 5 def androidId = rootProject.ext.androidId
6 def support = rootProject.ext.dependencies 6 def support = rootProject.ext.dependencies
7 def url = rootProject.ext.url 7 def url = rootProject.ext.url
8 8
9 9
10 android { 10 android {
11 signingConfigs {
12
13 config {
14 keyAlias 'alias'
15 keyPassword '123456'
16 storeFile file('key.jks')
17 storePassword '123456'
18 }
19 debug {
20 }
21 }
11 compileSdk 32 22 compileSdk 32
12 23
13 defaultConfig { 24 defaultConfig {
14 applicationId "com.hjx.parent" 25 applicationId "com.hjx.parent"
15 minSdk 24 26 minSdk 24
16 targetSdk 32 27 targetSdk 32
17 versionCode 1 28 versionCode 1
18 versionName "1.0" 29 versionName "1.0"
19 30
20 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 31 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
21 } 32 }
22 33
34 android.applicationVariants.all {
35 variant ->
36 variant.outputs.all {
37 //在这里修改apk文件名
38 outputFileName = "parent-${variant.name}-v${variant.versionName}.apk"
39 }
40 }
23 buildTypes { 41 buildTypes {
42 debug {
43 minifyEnabled false
44 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
45 }
24 release { 46 release {
25 minifyEnabled false 47 minifyEnabled false
26 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 48 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
49 signingConfig signingConfigs.config
27 } 50 }
28 } 51 }
52 lintOptions {
53 checkReleaseBuilds false
54 abortOnError false
55 }
29 compileOptions { 56 compileOptions {
30 sourceCompatibility JavaVersion.VERSION_1_8 57 sourceCompatibility JavaVersion.VERSION_1_8
31 targetCompatibility JavaVersion.VERSION_1_8 58 targetCompatibility JavaVersion.VERSION_1_8
32 } 59 }
33 } 60 }
34 61
35 dependencies { 62 dependencies {
36 support.each { k, v -> implementation v } 63 support.each { k, v -> implementation v }
37 api project(path: ':libs:common') 64 api project(path: ':libs:common')
38 implementation 'androidx.appcompat:appcompat:1.5.1' 65 implementation 'androidx.appcompat:appcompat:1.5.1'
39 implementation 'com.google.android.material:material:1.6.1' 66 implementation 'com.google.android.material:material:1.6.1'
40 implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 67 implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
41 68 implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50'
42 } 69 }
No preview for this file type
app/src/main/AndroidManifest.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:tools="http://schemas.android.com/tools"
3 package="com.hjx.parent"> 4 package="com.hjx.parent">
4 5
5 6
6 <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> 7 <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
7 <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 --> 8 <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 -->
8 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 --> 9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 -->
9 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 --> 10 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 -->
10 <!-- 6.0系统需要添加权限才能获得wifi列表 --> 11 <!-- 6.0系统需要添加权限才能获得wifi列表 -->
11 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 12 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 13 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
13 <uses-permission android:name="android.permission.INTERNET" /> 14 <uses-permission android:name="android.permission.INTERNET" />
14 <uses-permission android:name="android.permission.RECORD_AUDIO" /> 15 <uses-permission android:name="android.permission.RECORD_AUDIO" />
15 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 16 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
16 17
17 <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> 18 <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
18 <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 19 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
19 <uses-permission android:name="android.permission.WAKE_LOCK" /> 20 <uses-permission android:name="android.permission.WAKE_LOCK" />
20 <uses-permission android:name="android.permission.CAMERA" /> 21 <uses-permission android:name="android.permission.CAMERA" />
21 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> 22 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
22 <uses-permission android:name="android.permission.VIBRATE" /> 23 <uses-permission android:name="android.permission.VIBRATE" />
23 24
24 <application 25 <application
26 android:name=".MyApplication"
25 android:allowBackup="true" 27 android:allowBackup="true"
26 android:icon="@mipmap/icon" 28 android:icon="@mipmap/icon"
27 android:label="@string/app_name" 29 android:label="@string/app_name"
28 android:supportsRtl="true" 30 android:supportsRtl="true"
29 android:theme="@style/Theme.Parent" 31 android:theme="@style/Theme.Parent">
30 android:name=".MyApplication"
31 >
32 <activity 32 <activity
33 android:name=".LoginActivity" 33 android:name=".LoginActivity"
34 android:theme="@style/ThemeSplash" 34 android:exported="true"
35 android:exported="true"> 35 android:theme="@style/ThemeSplash">
36 <intent-filter> 36 <intent-filter>
37 <action android:name="android.intent.action.MAIN" /> 37 <action android:name="android.intent.action.MAIN" />
38 <category android:name="android.intent.category.LAUNCHER" /> 38 <category android:name="android.intent.category.LAUNCHER" />
39 </intent-filter> 39 </intent-filter>
40 </activity> 40 </activity>
41 <activity android:name=".MainActivity" 41 <activity
42 android:theme="@style/Theme.AppCompat.NoActionBar" 42 android:name=".MainActivity"
43 /> 43 android:launchMode="singleTask"
44 <activity android:name=".RegisterActivity" 44 android:theme="@style/Theme.AppCompat.NoActionBar" />
45 android:theme="@style/Theme.AppCompat.NoActionBar"/> 45 <activity
46 <activity android:name=".UserActivity" 46 android:name=".RegisterActivity"
47 android:theme="@style/Theme.AppCompat.NoActionBar"/> 47 android:theme="@style/Theme.AppCompat.NoActionBar" />
48 <activity android:name=".YinsiActivity" 48 <activity
49 android:theme="@style/Theme.AppCompat.NoActionBar"/> 49 android:name=".UserActivity"
50 <activity android:name=".QRActivity" 50 android:theme="@style/Theme.AppCompat.NoActionBar" />
51 android:theme="@style/Theme.AppCompat.NoActionBar"/> 51 <activity
52 <activity android:name=".AddStudentActivity" 52 android:name=".YinsiActivity"
53 android:theme="@style/Theme.AppCompat.NoActionBar"/> 53 android:theme="@style/Theme.AppCompat.NoActionBar" />
54 <activity android:name=".NickActivity" 54 <activity
55 android:theme="@style/Theme.AppCompat.NoActionBar"/> 55 android:name=".QRActivity"
56 <activity android:name=".SexActivity" 56 android:theme="@style/Theme.AppCompat.NoActionBar" />
57 android:theme="@style/Theme.AppCompat.NoActionBar"/> 57 <activity
58 <activity android:name=".NianActivity" 58 android:name=".AddStudentActivity"
59 android:theme="@style/Theme.AppCompat.NoActionBar"/> 59 android:theme="@style/Theme.AppCompat.NoActionBar" />
60 <activity android:name=".ShenActivity" 60 <activity
61 android:theme="@style/Theme.AppCompat.NoActionBar"/> 61 android:name=".NickActivity"
62 <activity android:name=".AccountActivity" 62 android:theme="@style/Theme.AppCompat.NoActionBar" />
63 android:theme="@style/Theme.AppCompat.NoActionBar"/> 63 <activity
64 64 android:name=".SexActivity"
65 <activity android:name=".ChangePwdActivity" 65 android:theme="@style/Theme.AppCompat.NoActionBar" />
66 android:theme="@style/Theme.AppCompat.NoActionBar"/> 66 <activity
67 android:name=".NianActivity"
68 android:theme="@style/Theme.AppCompat.NoActionBar" />
69 <activity
70 android:name=".ShenActivity"
71 android:theme="@style/Theme.AppCompat.NoActionBar" />
72 <activity
73 android:name=".AccountActivity"
74 android:theme="@style/Theme.AppCompat.NoActionBar" />
67 75
76 <activity
77 android:name=".ChangePwdActivity"
78 android:theme="@style/Theme.AppCompat.NoActionBar" />
79 <activity
80 android:name=".EditStudentActivity"
81 android:theme="@style/Theme.AppCompat.NoActionBar" />
82 <activity
83 android:name=".ChooseActivity"
84 android:theme="@style/Theme.AppCompat.NoActionBar" />
68 85
86 <provider
87 android:name="androidx.core.content.FileProvider"
88 android:authorities="com.hjx.parent.fileprovider"
89 android:exported="false"
90 android:grantUriPermissions="true">
91 <meta-data
92 android:name="android.support.FILE_PROVIDER_PATHS"
93 android:resource="@xml/file_provider_paths"
94 tools:replace="android:resource" />
95 </provider>
69 </application> 96 </application>
app/src/main/java/com/hjx/parent/AccountActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.app.AlertDialog;
4 import android.content.DialogInterface;
5 import android.content.Intent;
6 import android.graphics.Bitmap;
7 import android.net.NetworkRequest;
8 import android.net.Uri;
9 import android.os.Build;
10 import android.os.Bundle;
11 import android.os.Environment;
12 import android.provider.MediaStore;
13 import android.text.TextUtils;
14 import android.util.Log;
15 import android.view.LayoutInflater;
16 import android.view.View;
17 import android.widget.ImageView;
3 import android.widget.TextView; 18 import android.widget.TextView;
19 import android.widget.Toast;
4 20
21 import androidx.core.content.FileProvider;
22
23 import com.bumptech.glide.Glide;
24 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
25 import com.bumptech.glide.request.RequestOptions;
26 import com.google.android.material.bottomsheet.BottomSheetDialog;
5 import com.prws.common.base.BaseActivity; 27 import com.prws.common.base.BaseActivity;
6 import com.prws.common.base.BasePresenter; 28 import com.prws.common.base.BasePresenter;
29 import com.prws.common.bean.ResponseResult;
30 import com.prws.common.net.NetWorks;
31 import com.prws.common.utils.LogUtil;
32 import com.prws.common.utils.ScreenUtils;
7 import com.prws.common.utils.SharedPreferencesUtil; 33 import com.prws.common.utils.SharedPreferencesUtil;
8 34
35 import org.json.JSONObject;
36
37 import java.io.File;
38 import java.io.FileOutputStream;
39 import java.io.IOException;
40 import java.util.HashMap;
41 import java.util.Map;
42
43 import butterknife.BindView;
44 import butterknife.OnClick;
45 import io.reactivex.Observer;
46 import io.reactivex.disposables.Disposable;
47 import okhttp3.ResponseBody;
48
9 public class AccountActivity extends BaseActivity { 49 public class AccountActivity extends BaseActivity {
10 50
51
11 @Override 52 @Override
12 protected int layoutResId() { 53 protected int layoutResId() {
13 return R.layout.activity_setac; 54 return R.layout.activity_setac;
14 } 55 }
15 56
16 @Override 57 @Override
17 public Object getContract() { 58 public Object getContract() {
18 return null; 59 return null;
19 } 60 }
20 61
21 @Override 62 @Override
22 public BasePresenter getPresenter() { 63 public BasePresenter getPresenter() {
23 return null; 64 return null;
24 } 65 }
25 66
26 67 private static int CAMERA_REQUEST_CODE = 343;
68 private static int ALBUM_REQUEST_CODE = 456;
69 private static int CROP_REQUEST_CODE = 234;
70 private File tempFile;
71 private String path;
27 TextView tv_6; 72 TextView tv_6;
73 @BindView(R.id.iv_3)
74 ImageView iv_3;
75
28 @Override 76 @Override
29 protected void initView() { 77 protected void initView() {
30 tv_6 = findViewById(R.id.tv_6); 78 tv_6 = findViewById(R.id.tv_6);
31 String phone = (String) SharedPreferencesUtil.getData("phone", ""); 79 String phone = (String) SharedPreferencesUtil.getData("phone", "");
80 String photo = (String) SharedPreferencesUtil.getData("photo", "");
81 if(!TextUtils.isEmpty(photo)){
82 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(AccountActivity.this, 45));
83 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
84 Glide.with(AccountActivity.this).load(photo).apply(options).into(iv_3);
85 }
32 if (phone != null && phone.length() > 0) 86 if (phone != null && phone.length() > 0)
33 tv_6.setText(phone); 87 tv_6.setText(phone);
34 } 88 }
35 89
36 @Override 90 @Override
37 protected void initListener() { 91 protected void initListener() {
38 findViewById(R.id.iv_back).setOnClickListener(view -> onBackPressed()); 92 findViewById(R.id.iv_back).setOnClickListener(view -> onBackPressed());
39
40 findViewById(R.id.tv_7).setOnClickListener(view -> startActivity(ChangePwdActivity.class)); 93 findViewById(R.id.tv_7).setOnClickListener(view -> startActivity(ChangePwdActivity.class));
41 } 94 }
42 95
43 @Override 96 @Override
44 protected void initData() { 97 protected void initData() {
45 98
46 } 99 }
47 100
48 @Override 101 @Override
49 public void onNetChanged(int netWorkState) { 102 public void onNetChanged(int netWorkState) {
50 103
51 } 104 }
105
106 private void uploadAvatar(File file) {
107
108 NetWorks.uploadAvatar(file, new Observer<ResponseResult<Map<String, String>>>() {
109 @Override
110 public void onSubscribe(Disposable d) {
111
112 }
113
114 @Override
115 public void onNext(ResponseResult<Map<String, String>> responseBody) {
116 if (responseBody.getData() != null && responseBody.getCode() == 200) {
117 path = responseBody.getData().get("imageUrl");
118 editUser(path);
119 }
120 }
121
122 @Override
123 public void onError(Throwable e) {
124 e.toString();
125 }
126
127 @Override
128 public void onComplete() {
129
130 }
131 });
132 }
133
134 public void editUser(String path) {
135 Map map = new HashMap();
136 map.put("userId", SharedPreferencesUtil.getData("userId", ""));
137 map.put("photo", path);
138
139 NetWorks.editUser(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() {
140 @Override
141 public void onSubscribe(Disposable d) {
142
143 }
144
145 @Override
146 public void onNext(ResponseBody responseBody) {
147 try {
148 String str = responseBody.string().toString();
149 LogUtil.e(TAG, "----" + str);
150 JSONObject jo = new JSONObject(str);
151 boolean isSucceed = jo.getBoolean("success");
152 if (isSucceed) {
153 SharedPreferencesUtil.putData("photo", path);
154 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(AccountActivity.this, 45));
155 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
156 Glide.with(AccountActivity.this).load(path).apply(options).into(iv_3);
157 Toast.makeText(AccountActivity.this, "修改成功", Toast.LENGTH_SHORT).show();
158 } else {
159 Toast.makeText(AccountActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show();
160 }
161 } catch (Exception e) {
162 e.printStackTrace();
163 Toast.makeText(AccountActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show();
164 }
165 }
166
167 @Override
168 public void onError(Throwable e) {
169
170 }
171
172 @Override
173 public void onComplete() {
174
175 }
176 });
177 }
178
179 public File saveImage(String name, Bitmap bmp) {
180 File appDir = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES).getPath());
181 if (!appDir.exists()) {
182 appDir.mkdir();
183 }
184 String fileName = name + ".jpg";
185 File file = new File(appDir, fileName);
186 try {
187 FileOutputStream fos = new FileOutputStream(file);
188 bmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
189 fos.flush();
190 fos.close();
191 return file;
192 } catch (IOException e) {
193 Log.d("dsadsadsa", e.getLocalizedMessage());
194 e.printStackTrace();
195 }
196 return null;
197 }
198
199 @Override
200 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
201 super.onActivityResult(requestCode, resultCode, intent);
202 if (requestCode == CAMERA_REQUEST_CODE) {
203 if (resultCode == RESULT_OK) {
204 //用相机返回的照片去调用剪裁也需要对Uri进行处理
205 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
206 Uri contentUri = FileProvider.getUriForFile(this,
207 this.getPackageName() + ".fileprovider", tempFile);
208 cropPhoto(contentUri);
209 } else {
210 cropPhoto(Uri.fromFile(tempFile));
211 }
212 }
213 } else if (requestCode == ALBUM_REQUEST_CODE) {
214 if (resultCode == RESULT_OK) {
215 Uri uri = intent.getData();
216 cropPhoto(uri);
217 }
218 } else if (requestCode == CROP_REQUEST_CODE) {
219 if (intent == null) {
220 return;
221 }
222 Bundle bundle = intent.getExtras();
223 if (bundle != null) {
224 //在这里获得了剪裁后的Bitmap对象,可以用于上传
225 Bitmap image = bundle.getParcelable("data");
226 //设置到ImageView上
227 //也可以进行一些保存、压缩等操作后上传
228 File file = saveImage("head_output", image);
229 uploadAvatar(file);
230 // Log.d("dsadsadsa",path);
231 }
232 }
233 }
234
235 private void getPicFromCamera() {
236 //用于保存调用相机拍照后所生成的文件
237 tempFile = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg");
238 //跳转到调用系统相机
239 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
240 //判断版本
241 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //如果在Android7.0以上,使用FileProvider获取Uri
242 intent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
243 Uri contentUri = FileProvider.getUriForFile(this,
244 this.getPackageName() + ".fileprovider", tempFile);
245 intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
246 } else { //否则使用Uri.fromFile(file)方法获取Uri
247 intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempFile));
248 }
249 startActivityForResult(intent, CAMERA_REQUEST_CODE);
250 }
251
252 private void cropPhoto(Uri uri) {
253 Uri contentUri = Uri.fromFile(new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg"));
254 Intent intent = new Intent("com.android.camera.action.CROP");
255 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
256 //Android 7.0需要临时添加读取Url的权限, 添加此属性是为了解决:调用裁剪框时候提示:图片无法加载或者加载图片失败或者无法加载此图片
257 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
258 }
259 intent.setDataAndType(uri, "image/*");
260 intent.putExtra("crop", "true");//发送裁剪信号,去掉也能进行裁剪
261 intent.putExtra("scale", true);// 设置缩放
262 intent.putExtra("scaleUpIfNeeded", true);// 去黑边
263 intent.putExtra("aspectX", 1);
264 intent.putExtra("aspectY", 1);
265 //上述两个属性控制裁剪框的缩放比例。
266 //当用户用手拉伸裁剪框时候,裁剪框会按照上述比例缩放。
267 intent.putExtra("outputX", 300);//属性控制裁剪完毕,保存的图片的大小格式。
268 intent.putExtra("outputY", 300);//你按照1:1的比例来裁剪的,如果最后成像是800*400,那么按照2:1的样式保存,
269 intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());//输出裁剪文件的格式
270 intent.putExtra("return-data", true);//是否返回裁剪后图片的Bitmap
271 intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);//设置输出路径
272 startActivityForResult(intent, CROP_REQUEST_CODE);
273 }
274
275 /**
276 * 从相册获取图片
277 */
278 private void getPicFromAlbm() {
279 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
280 photoPickerIntent.setType("image/*");
281 startActivityForResult(photoPickerIntent, ALBUM_REQUEST_CODE);
282 }
283
284 @OnClick(R.id.iv_3)
285 public void showButtonDialog(View view) {
286 BottomSheetDialog dialog = new BottomSheetDialog(this, R.style.BottomSheetDialog);
287 View bottomView = LayoutInflater.from(this).inflate(R.layout.bottom_sheet_layout, null);
288 dialog.setContentView(bottomView);
289 bottomView.findViewById(R.id.take_photo).setOnClickListener(new View.OnClickListener() {
290 @Override
291 public void onClick(View view) {
292 dialog.dismiss();
293 getPicFromCamera();
294 }
295 });
296 bottomView.findViewById(R.id.choose_photo).setOnClickListener(new View.OnClickListener() {
297 @Override
298 public void onClick(View view) {
299 dialog.dismiss();
300 getPicFromAlbm();
301 }
302 });
303 bottomView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
304 @Override
305 public void onClick(View view) {
306 dialog.dismiss();
307 }
308 });
309 dialog.show();
310 }
311
312 @OnClick(R.id.logout)
313 public void logout(View view) {
314 AlertDialog.Builder builder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
315 builder.setTitle("温馨提示");
316 builder.setMessage("是否退出登录?");
317 builder.setCancelable(false);
318 builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
319 @Override
320 public void onClick(DialogInterface dialogInterface, int i) {
321 dialogInterface.dismiss();
322 }
323 });
324 builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
325 @Override
326 public void onClick(DialogInterface dialogInterface, int i) {
327 SharedPreferencesUtil.clear(AccountActivity.this);
328 dialogInterface.dismiss();
329 setResult(1001);
330 finish();
331 }
332 });
333 builder.show();
334 }
335
app/src/main/java/com/hjx/parent/AddStudentActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.content.Intent;
4 import android.graphics.Bitmap;
3 import android.graphics.Color; 5 import android.graphics.Color;
6 import android.net.Uri;
7 import android.os.Build;
8 import android.os.Bundle;
9 import android.os.Environment;
10 import android.provider.MediaStore;
11 import android.util.Log;
12 import android.view.LayoutInflater;
4 import android.view.View; 13 import android.view.View;
5 import android.widget.Button; 14 import android.widget.Button;
15 import android.widget.ImageView;
6 import android.widget.TextView; 16 import android.widget.TextView;
7 import android.widget.Toast; 17 import android.widget.Toast;
8 18
19 import androidx.core.content.FileProvider;
20
21 import com.bumptech.glide.Glide;
22 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
23 import com.bumptech.glide.request.RequestOptions;
24 import com.google.android.material.bottomsheet.BottomSheetDialog;
9 import com.prws.common.base.BaseActivity; 25 import com.prws.common.base.BaseActivity;
10 import com.prws.common.base.BasePresenter; 26 import com.prws.common.base.BasePresenter;
27 import com.prws.common.bean.ResponseResult;
11 import com.prws.common.net.NetWorks; 28 import com.prws.common.net.NetWorks;
12 import com.prws.common.utils.LogUtil; 29 import com.prws.common.utils.LogUtil;
30 import com.prws.common.utils.ScreenUtils;
13 import com.prws.common.utils.SharedPreferencesUtil; 31 import com.prws.common.utils.SharedPreferencesUtil;
14 32
15 import org.json.JSONObject; 33 import org.json.JSONObject;
16 34
35 import java.io.File;
36 import java.io.FileOutputStream;
37 import java.io.IOException;
17 import java.util.HashMap; 38 import java.util.HashMap;
18 import java.util.Map; 39 import java.util.Map;
19 40
41 import butterknife.BindView;
42 import butterknife.OnClick;
20 import io.reactivex.Observer; 43 import io.reactivex.Observer;
21 import io.reactivex.disposables.Disposable; 44 import io.reactivex.disposables.Disposable;
22 import okhttp3.ResponseBody; 45 import okhttp3.ResponseBody;
23 46
24 public class AddStudentActivity extends BaseActivity { 47 public class AddStudentActivity extends BaseActivity {
25 @Override 48 @Override
26 protected int layoutResId() { 49 protected int layoutResId() {
27 return R.layout.activity_add_stu; 50 return R.layout.activity_add_stu;
28 } 51 }
29 52
30 @Override 53 @Override
31 public Object getContract() { 54 public Object getContract() {
32 return null; 55 return null;
33 } 56 }
34 57
35 @Override 58 @Override
36 public BasePresenter getPresenter() { 59 public BasePresenter getPresenter() {
37 return null; 60 return null;
38 } 61 }
39 62
40 View view_2; 63 View view_2;
41 View view_3; 64 View view_3;
42 View view_4; 65 View view_4;
43 View view_5; 66 View view_5;
44 Button btn_next; 67 Button btn_next;
45 TextView tv_name, tv_sex, tv_nian, tv_shen; 68 TextView tv_name, tv_sex, tv_nian, tv_shen;
69 @BindView(R.id.iv_avatar)
70 ImageView iv_avatar;
46 71
47 @Override 72 @Override
48 protected void initView() { 73 protected void initView() {
49 view_2 = findViewById(R.id.view_2); 74 view_2 = findViewById(R.id.view_2);
50 view_3 = findViewById(R.id.view_3); 75 view_3 = findViewById(R.id.view_3);
51 view_4 = findViewById(R.id.view_4); 76 view_4 = findViewById(R.id.view_4);
52 view_5 = findViewById(R.id.view_5); 77 view_5 = findViewById(R.id.view_5);
53 tv_name = findViewById(R.id.tv_name); 78 tv_name = findViewById(R.id.tv_name);
54 tv_sex = findViewById(R.id.tv_sex); 79 tv_sex = findViewById(R.id.tv_sex);
55 tv_nian = findViewById(R.id.tv_nian); 80 tv_nian = findViewById(R.id.tv_nian);
56 tv_shen = findViewById(R.id.tv_shen); 81 tv_shen = findViewById(R.id.tv_shen);
57
58
59 btn_next = findViewById(R.id.btn_next); 82 btn_next = findViewById(R.id.btn_next);
60 } 83 }
61 84
62 boolean isName = false; 85 boolean isName = false;
63 boolean isSex = false; 86 boolean isSex = false;
64 boolean isNian = false; 87 boolean isNian = false;
65 boolean isShen = false; 88 boolean isShen = false;
89 private static int CAMERA_REQUEST_CODE = 343;
90 private static int ALBUM_REQUEST_CODE = 456;
91 private static int CROP_REQUEST_CODE = 234;
92 private File tempFile;
93 private String path;
66 94
67 @Override 95 @Override
68 protected void onStart() { 96 protected void onStart() {
69 super.onStart(); 97 super.onStart();
70 String name = (String) SharedPreferencesUtil.getData("setName", ""); 98 String name = (String) SharedPreferencesUtil.getData("setName", "");
71 String sex = (String) SharedPreferencesUtil.getData("setSex", ""); 99 String sex = (String) SharedPreferencesUtil.getData("setSex", "");
72 String nian = (String) SharedPreferencesUtil.getData("setNian", ""); 100 String nian = (String) SharedPreferencesUtil.getData("setNian", "") + SharedPreferencesUtil.getData("setXueq", "");
73 String shen = (String) SharedPreferencesUtil.getData("setShen", ""); 101 String shen = (String) SharedPreferencesUtil.getData("setShen", "");
74 102
75 if (name != null && name.length() > 0) { 103 if (name != null && name.length() > 0) {
76 tv_name.setText(name); 104 tv_name.setText(name);
77 isName = true; 105 isName = true;
78 } else { 106 } else {
79 isName = false; 107 isName = false;
80 } 108 }
81 if (sex != null && sex.length() > 0) { 109 if (sex != null && sex.length() > 0) {
82 tv_sex.setText(sex); 110 tv_sex.setText(sex);
83 isSex = true; 111 isSex = true;
84 } else { 112 } else {
85 isSex = false; 113 isSex = false;
86 } 114 }
87 if (nian != null && nian.length() > 0) { 115 if (nian != null && nian.length() > 0) {
88 tv_nian.setText(nian); 116 tv_nian.setText(nian);
89 isNian = true; 117 isNian = true;
90 } else { 118 } else {
91 isNian = false; 119 isNian = false;
92 } 120 }
93 if (shen != null && shen.length() > 0) { 121 if (shen != null && shen.length() > 0) {
94 tv_shen.setText(shen); 122 tv_shen.setText(shen);
95 isShen = true; 123 isShen = true;
96 } else { 124 } else {
97 isShen = false; 125 isShen = false;
98 } 126 }
99 127
100 if (isName && isSex && isNian && isShen) { 128 if (isName && isSex && isNian && isShen) {
101 btn_next.setTextColor(Color.WHITE); 129 btn_next.setTextColor(Color.WHITE);
102 btn_next.setBackground(getResources().getDrawable(R.drawable.bg_solid_btn)); 130 btn_next.setBackground(getResources().getDrawable(R.drawable.bg_solid_btn));
103 } 131 }
104 132
105 } 133 }
106 134
107 @Override 135 @Override
108 protected void initListener() { 136 protected void initListener() {
109 view_2.setOnClickListener(view -> startActivity(NickActivity.class)); 137 view_2.setOnClickListener(view -> startActivity(NickActivity.class));
110 view_3.setOnClickListener(view -> startActivity(SexActivity.class)); 138 view_3.setOnClickListener(view -> startActivity(SexActivity.class));
111 view_4.setOnClickListener(view -> startActivity(NianActivity.class)); 139 view_4.setOnClickListener(view -> startActivity(NianActivity.class));
112 view_5.setOnClickListener(view -> startActivity(ShenActivity.class)); 140 view_5.setOnClickListener(view -> startActivity(ShenActivity.class));
113 findViewById(R.id.tv_cancel).setOnClickListener(view -> onBackPressed()); 141 findViewById(R.id.tv_cancel).setOnClickListener(view -> onBackPressed());
114 btn_next.setOnClickListener(view -> { 142 btn_next.setOnClickListener(view -> {
115 if (isName && isSex && isNian && isShen) { 143 if (isName && isSex && isNian && isShen) {
116 addStudent(); 144 addStudent();
117 } else { 145 } else {
118 Toast.makeText(this, "请完成设置后点击", Toast.LENGTH_SHORT).show(); 146 Toast.makeText(this, "请完成设置后点击", Toast.LENGTH_SHORT).show();
119 } 147 }
120 }); 148 });
121 } 149 }
122 150
123 @Override 151 @Override
124 protected void onDestroy() { 152 protected void onDestroy() {
125 super.onDestroy(); 153 super.onDestroy();
126 SharedPreferencesUtil.putData("setName", ""); 154 SharedPreferencesUtil.putData("setName", "");
127 SharedPreferencesUtil.putData("setSex", ""); 155 SharedPreferencesUtil.putData("setSex", "");
128 SharedPreferencesUtil.putData("setNian", ""); 156 SharedPreferencesUtil.putData("setNian", "");
129 SharedPreferencesUtil.putData("setShen", ""); 157 SharedPreferencesUtil.putData("setShen", "");
130 SharedPreferencesUtil.putData("setXueq", ""); 158 SharedPreferencesUtil.putData("setXueq", "");
131 159 SharedPreferencesUtil.putData("grade", 0);
132 } 160 }
161
162
133 public void addStudent() { 163 public void addStudent() {
134 String name = (String) SharedPreferencesUtil.getData("setName", ""); 164 String name = (String) SharedPreferencesUtil.getData("setName", "");
135 String sex = (String) SharedPreferencesUtil.getData("setSex", ""); 165 String sex = (String) SharedPreferencesUtil.getData("setSex", "");
136 String nian = (String) SharedPreferencesUtil.getData("setNian", ""); 166 String nian = (String) SharedPreferencesUtil.getData("setNian", "");
137 String shen = (String) SharedPreferencesUtil.getData("setShen", ""); 167 String shen = (String) SharedPreferencesUtil.getData("setShen", "");
138 String xueq = (String) SharedPreferencesUtil.getData("setXueq", ""); 168 String xueq = (String) SharedPreferencesUtil.getData("setXueq", "");
139 169
140 170
141 Map map = new HashMap(); 171 Map map = new HashMap();
142 map.put("nickName", name); 172 map.put("nickName", name);
143 map.put("gender", "1"); 173 map.put("gender", "男".equals(sex) ? 0 : 1);
144 map.put("gradeId", 1); 174 map.put("gradeId", SharedPreferencesUtil.getData("grade", 1));
145 map.put("parentIdentity", shen); 175 map.put("parentIdentity", shen);
146 map.put("term", xueq); 176 map.put("term", xueq);
147 177 if (path != null) {
178 map.put("photo", path);
179 }
148 180
149 NetWorks.registerStudent(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() { 181 NetWorks.registerStudent(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() {
150 @Override 182 @Override
151 public void onSubscribe(Disposable d) { 183 public void onSubscribe(Disposable d) {
152 184
153 } 185 }
154 186
155 @Override 187 @Override
156 public void onNext(ResponseBody responseBody) { 188 public void onNext(ResponseBody responseBody) {
157 try { 189 try {
158 190
159 String str = responseBody.string().toString(); 191 String str = responseBody.string().toString();
160 LogUtil.e(TAG, "----" + str); 192 LogUtil.e(TAG, "----" + str);
161 JSONObject jo = new JSONObject(str); 193 JSONObject jo = new JSONObject(str);
162 boolean isSucceed = jo.getBoolean("success"); 194 boolean isSucceed = jo.getBoolean("success");
163 if (isSucceed) { 195 if (isSucceed) {
164 finish(); 196 finish();
165 } else { 197 } else {
166 Toast.makeText(AddStudentActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show(); 198 Toast.makeText(AddStudentActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show();
167 } 199 }
168 } catch (Exception e) { 200 } catch (Exception e) {
169 e.printStackTrace(); 201 e.printStackTrace();
170 Toast.makeText(AddStudentActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show(); 202 Toast.makeText(AddStudentActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show();
171 } 203 }
172 204
173 } 205 }
174 206
175 @Override 207 @Override
176 public void onError(Throwable e) { 208 public void onError(Throwable e) {
177 209
178 } 210 }
179 211
180 @Override 212 @Override
181 public void onComplete() { 213 public void onComplete() {
182 214
183 } 215 }
184 216
185 }); 217 });
186 } 218 }
187 219
188 @Override 220 @Override
189 protected void initData() { 221 protected void initData() {
190 222
191 } 223 }
192 224
193 @Override 225 @Override
194 public void onNetChanged(int netWorkState) { 226 public void onNetChanged(int netWorkState) {
195 227
196 } 228 }
229
230 @OnClick(R.id.iv_avatar)
231 public void showButtonDialog(View view) {
232 BottomSheetDialog dialog = new BottomSheetDialog(this, R.style.BottomSheetDialog);
233 View bottomView = LayoutInflater.from(this).inflate(R.layout.bottom_sheet_layout, null);
234 dialog.setContentView(bottomView);
235 bottomView.findViewById(R.id.take_photo).setOnClickListener(new View.OnClickListener() {
236 @Override
237 public void onClick(View view) {
238 dialog.dismiss();
239 getPicFromCamera();
240 }
241 });
242 bottomView.findViewById(R.id.choose_photo).setOnClickListener(new View.OnClickListener() {
243 @Override
244 public void onClick(View view) {
245 dialog.dismiss();
246 getPicFromAlbm();
247 }
248 });
249 bottomView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
250 @Override
251 public void onClick(View view) {
252 dialog.dismiss();
253 }
254 });
255 dialog.show();
256 }
257
258 private void cropPhoto(Uri uri) {
259 Uri contentUri = Uri.fromFile(new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg"));
260 Intent intent = new Intent("com.android.camera.action.CROP");
261 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
262 //Android 7.0需要临时添加读取Url的权限, 添加此属性是为了解决:调用裁剪框时候提示:图片无法加载或者加载图片失败或者无法加载此图片
263 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
264 }
265 intent.setDataAndType(uri, "image/*");
266 intent.putExtra("crop", "true");//发送裁剪信号,去掉也能进行裁剪
267 intent.putExtra("scale", true);// 设置缩放
268 intent.putExtra("scaleUpIfNeeded", true);// 去黑边
269 intent.putExtra("aspectX", 1);
270 intent.putExtra("aspectY", 1);
271 //上述两个属性控制裁剪框的缩放比例。
272 //当用户用手拉伸裁剪框时候,裁剪框会按照上述比例缩放。
273 intent.putExtra("outputX", 300);//属性控制裁剪完毕,保存的图片的大小格式。
274 intent.putExtra("outputY", 300);//你按照1:1的比例来裁剪的,如果最后成像是800*400,那么按照2:1的样式保存,
275 intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());//输出裁剪文件的格式
276 intent.putExtra("return-data", true);//是否返回裁剪后图片的Bitmap
277 intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);//设置输出路径
278 startActivityForResult(intent, CROP_REQUEST_CODE);
279 }
280
281 @Override
282 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
283 super.onActivityResult(requestCode, resultCode, intent);
284 if (requestCode == CAMERA_REQUEST_CODE) {
285 if (resultCode == RESULT_OK) {
286 //用相机返回的照片去调用剪裁也需要对Uri进行处理
287 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
288 Uri contentUri = FileProvider.getUriForFile(AddStudentActivity.this,
289 this.getPackageName() + ".fileprovider", tempFile);
290 cropPhoto(contentUri);
291 } else {
292 cropPhoto(Uri.fromFile(tempFile));
293 }
294 }
295 } else if (requestCode == ALBUM_REQUEST_CODE) {
296 if (resultCode == RESULT_OK) {
297 Uri uri = intent.getData();
298 cropPhoto(uri);
299 }
300 } else if (requestCode == CROP_REQUEST_CODE) {
301 if (intent == null) {
302 return;
303 }
304 Bundle bundle = intent.getExtras();
305 if (bundle != null) {
306 //在这里获得了剪裁后的Bitmap对象,可以用于上传
307 Bitmap image = bundle.getParcelable("data");
308 //设置到ImageView上
309 //也可以进行一些保存、压缩等操作后上传
310 File file = saveImage("head_output", image);
311 uploadAvatar(file);
312 // Log.d("dsadsadsa",path);
313 }
314 }
315 }
316
317 private void uploadAvatar(File file) {
318 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(this, 45));
319 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
320 Glide.with(this).load(file).apply(options).into(iv_avatar);
321 NetWorks.uploadAvatar(file, new Observer<ResponseResult<Map<String, String>>>() {
322 @Override
323 public void onSubscribe(Disposable d) {
324
325 }
326
327 @Override
328 public void onNext(ResponseResult<Map<String, String>> responseBody) {
329 if (responseBody.getData() != null && responseBody.getCode() == 200) {
330 path = responseBody.getData().get("imageUrl");
331 }
332 }
333
334 @Override
335 public void onError(Throwable e) {
336 e.toString();
337 }
338
339 @Override
340 public void onComplete() {
341
342 }
343 });
344 }
345
346 public File saveImage(String name, Bitmap bmp) {
347 File appDir = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES).getPath());
348 if (!appDir.exists()) {
349 appDir.mkdir();
350 }
351 String fileName = name + ".jpg";
352 File file = new File(appDir, fileName);
353 try {
354 FileOutputStream fos = new FileOutputStream(file);
355 bmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
356 fos.flush();
357 fos.close();
358 return file;
359 } catch (IOException e) {
360 Log.d("dsadsadsa", e.getLocalizedMessage());
361 e.printStackTrace();
362 }
363 return null;
364 }
365
366 private void getPicFromCamera() {
367 //用于保存调用相机拍照后所生成的文件
368 tempFile = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg");
369 //跳转到调用系统相机
370 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
371 //判断版本
372 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //如果在Android7.0以上,使用FileProvider获取Uri
373 intent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
374 Uri contentUri = FileProvider.getUriForFile(AddStudentActivity.this,
375 this.getPackageName() + ".fileprovider", tempFile);
376 intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
377 } else { //否则使用Uri.fromFile(file)方法获取Uri
378 intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempFile));
379 }
380 startActivityForResult(intent, CAMERA_REQUEST_CODE);
381 }
382
383 /**
384 * 从相册获取图片
385 */
386 private void getPicFromAlbm() {
387 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
388 photoPickerIntent.setType("image/*");
389 startActivityForResult(photoPickerIntent, ALBUM_REQUEST_CODE);
390 }
391
app/src/main/java/com/hjx/parent/ChangePwdActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.widget.EditText; 3 import android.widget.EditText;
4 import android.widget.TextView; 4 import android.widget.TextView;
5 import android.widget.Toast; 5 import android.widget.Toast;
6 6
7 import com.prws.common.base.BaseActivity; 7 import com.prws.common.base.BaseActivity;
8 import com.prws.common.base.BasePresenter; 8 import com.prws.common.base.BasePresenter;
9 import com.prws.common.net.NetWorks; 9 import com.prws.common.net.NetWorks;
10 import com.prws.common.utils.LogUtil; 10 import com.prws.common.utils.LogUtil;
11 import com.prws.common.utils.SharedPreferencesUtil; 11 import com.prws.common.utils.SharedPreferencesUtil;
12 12
13 import org.json.JSONObject; 13 import org.json.JSONObject;
14 14
15 import java.util.HashMap; 15 import java.util.HashMap;
16 import java.util.Map; 16 import java.util.Map;
17 17
18 import butterknife.BindView;
18 import io.reactivex.Observer; 19 import io.reactivex.Observer;
19 import io.reactivex.disposables.Disposable; 20 import io.reactivex.disposables.Disposable;
20 import okhttp3.ResponseBody; 21 import okhttp3.ResponseBody;
21 22
22 public class ChangePwdActivity extends BaseActivity { 23 public class ChangePwdActivity extends BaseActivity {
24 @BindView(R.id.et_old_password)
25 EditText et_old_password;
26 @BindView(R.id.et_pwd_2)
27 EditText et_pwd_2;
23 28
24 @Override 29 @Override
25 protected int layoutResId() { 30 protected int layoutResId() {
26 return R.layout.activity_changem; 31 return R.layout.activity_changem;
27 } 32 }
28 33
29 @Override 34 @Override
30 public Object getContract() { 35 public Object getContract() {
31 return null; 36 return null;
32 } 37 }
33 38
34 @Override 39 @Override
35 public BasePresenter getPresenter() { 40 public BasePresenter getPresenter() {
36 return null; 41 return null;
37 } 42 }
38 43
39 44
40
41 EditText et_pwd; 45 EditText et_pwd;
46
42 @Override 47 @Override
43 protected void initView() { 48 protected void initView() {
44
45
46 et_pwd = findViewById(R.id.et_pwd); 49 et_pwd = findViewById(R.id.et_pwd);
47 } 50 }
48 51
49 @Override 52 @Override
50 protected void initListener() { 53 protected void initListener() {
51 findViewById(R.id.iv_back).setOnClickListener(view -> onBackPressed()); 54 findViewById(R.id.iv_back).setOnClickListener(view -> onBackPressed());
52
53 findViewById(R.id.btn_next).setOnClickListener(view -> { 55 findViewById(R.id.btn_next).setOnClickListener(view -> {
54 String pwd = et_pwd.getText().toString().trim(); 56 String pwd = et_pwd.getText().toString().trim();
55 if (pwd == null || pwd.length() == 0){ 57 if (pwd == null || pwd.length() == 0) {
56 Toast.makeText(this,"密码不能为空",Toast.LENGTH_SHORT).show(); 58 Toast.makeText(this, "密码不能为空", Toast.LENGTH_SHORT).show();
59 return;
60 }
61 if (pwd.length() < 6 || pwd.length() > 16) {
62 Toast.makeText(this, "密码必须为6-16位,数字或字母", Toast.LENGTH_SHORT).show();
63 return;
64 }
65 if (!pwd.equals(et_pwd_2.getText().toString())) {
66 Toast.makeText(this, "两次密码输入不一致", Toast.LENGTH_SHORT).show();
57 return; 67 return;
58 } 68 }
59
60 changePwd(pwd); 69 changePwd(pwd);
61
62 }); 70 });
63
64 } 71 }
65 72
66 public void changePwd(String pwd){ 73 public void changePwd(String pwd) {
67 String userId = (String) SharedPreferencesUtil.getData("userId", ""); 74 String userId = (String) SharedPreferencesUtil.getData("userId", "");
68 Map map = new HashMap(); 75 Map map = new HashMap();
69 map.put("userId",userId); 76 map.put("userId", userId);
70 map.put("password",pwd); 77 map.put("password", pwd);
71 78 map.put("oldPassword", et_old_password.getText().toString());
72
73 NetWorks.changePassword(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() { 79 NetWorks.changePassword(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() {
74 @Override 80 @Override
75 public void onSubscribe(Disposable d) { 81 public void onSubscribe(Disposable d) {
76 82
77 } 83 }
78 84
79 @Override 85 @Override
80 public void onNext(ResponseBody responseBody) { 86 public void onNext(ResponseBody responseBody) {
81 try { 87 try {
82 88
83 String str = responseBody.string().toString(); 89 String str = responseBody.string().toString();
84 90
85 91
86 LogUtil.e(TAG,"----"+str); 92 LogUtil.e(TAG, "----" + str);
87 JSONObject jo = new JSONObject(str); 93 JSONObject jo = new JSONObject(str);
88 boolean isSucceed = jo.getBoolean("success"); 94 boolean isSucceed = jo.getBoolean("success");
89 if (isSucceed){ 95 if (isSucceed) {
90 Toast.makeText(ChangePwdActivity.this, "修改成功", Toast.LENGTH_SHORT).show(); 96 Toast.makeText(ChangePwdActivity.this, "修改成功", Toast.LENGTH_SHORT).show();
91 finish(); 97 finish();
92 98
93 }else { 99 } else {
94 Toast.makeText(ChangePwdActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show(); 100 Toast.makeText(ChangePwdActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show();
95 } 101 }
96 }catch (Exception e){ 102 } catch (Exception e) {
97 e.printStackTrace(); 103 e.printStackTrace();
98 Toast.makeText(ChangePwdActivity.this,"服务繁忙,请重试",Toast.LENGTH_SHORT).show(); 104 Toast.makeText(ChangePwdActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show();
99 } 105 }
100 106
101 } 107 }
102 108
103 @Override 109 @Override
104 public void onError(Throwable e) { 110 public void onError(Throwable e) {
105 111
106 } 112 }
107 113
108 @Override 114 @Override
109 public void onComplete() { 115 public void onComplete() {
110 116
111 } 117 }
112 }); 118 });
113 119
114 } 120 }
115 121
116 @Override 122 @Override
117 protected void initData() { 123 protected void initData() {
app/src/main/java/com/hjx/parent/ChooseActivity.java
File was created 1 package com.hjx.parent;
2
3 import android.content.Intent;
4 import android.text.TextUtils;
5 import android.view.View;
6 import android.widget.ImageView;
7
8 import androidx.annotation.NonNull;
9 import androidx.recyclerview.widget.LinearLayoutManager;
10 import androidx.recyclerview.widget.RecyclerView;
11
12 import com.bumptech.glide.Glide;
13 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
14 import com.bumptech.glide.request.RequestOptions;
15 import com.chad.library.adapter.base.BaseQuickAdapter;
16 import com.chad.library.adapter.base.BaseViewHolder;
17 import com.google.gson.Gson;
18 import com.hjx.parent.bean.StudentBean;
19 import com.prws.common.base.BaseActivity;
20 import com.prws.common.base.BasePresenter;
21 import com.prws.common.net.NetWorks;
22 import com.prws.common.utils.LogUtil;
23 import com.prws.common.utils.ScreenUtils;
24 import com.prws.common.utils.SharedPreferencesUtil;
25
26 import org.json.JSONArray;
27 import org.json.JSONObject;
28
29 import java.util.ArrayList;
30
31 import butterknife.BindView;
32 import butterknife.OnClick;
33 import io.reactivex.Observer;
34 import io.reactivex.disposables.Disposable;
35 import okhttp3.ResponseBody;
36
37 public class ChooseActivity extends BaseActivity {
38 @BindView(R.id.recycle)
39 RecyclerView recycle;
40 private int select = 0;
41
42 @Override
43 protected int layoutResId() {
44 return R.layout.choose_activity;
45 }
46
47 @Override
48 public Object getContract() {
49 return null;
50 }
51
52 @Override
53 public BasePresenter getPresenter() {
54 return null;
55 }
56
57 @Override
58 protected void initView() {
59
60 }
61
62 @Override
63 protected void initListener() {
64
65 }
66
67 @Override
68 protected void initData() {
69
70 }
71
72 @Override
73 public void onNetChanged(int netWorkState) {
74
75 }
76
77 @Override
78 protected void onResume() {
79 super.onResume();
80 loadChildList();
81 }
82
83 ArrayList<StudentBean> alist = new ArrayList<>();
84
85 public void loadChildList() {
86 NetWorks.listChildren(new Observer<ResponseBody>() {
87 @Override
88 public void onSubscribe(Disposable d) {
89
90 }
91
92 @Override
93 public void onNext(ResponseBody responseBody) {
94 try {
95
96 String str = responseBody.string().toString();
97
98
99 LogUtil.e("TAG", "----" + str);
100 JSONObject jo = new JSONObject(str);
101 boolean isSucceed = jo.getBoolean("success");
102 if (isSucceed) {
103 JSONArray jarr = jo.getJSONArray("data");
104 alist.clear();
105 for (int i = 0; i < jarr.length(); i++) {
106 JSONObject jo2 = jarr.getJSONObject(i);
107 Gson gson = new Gson();
108 StudentBean sb = gson.fromJson(jo2.toString(), StudentBean.class);
109 alist.add(sb);
110 }
111 if (alist.size() > 0) {
112 loadList();
113 }
114
115 } else {
116
117 }
118 } catch (Exception e) {
119 e.printStackTrace();
120 }
121 }
122
123 @Override
124 public void onError(Throwable e) {
125
126 }
127
128 @Override
129 public void onComplete() {
130
131 }
132 });
133 }
134
135 public void loadList() {
136 StudentBean sb = new StudentBean();
137 sb.setNickName("添加学生");
138 alist.add(sb);
139 String student = (String) SharedPreferencesUtil.getData("student", "");
140 try {
141 StudentBean studentBean = new Gson().fromJson(student, StudentBean.class);
142 for (int i = 0; i < alist.size(); i++) {
143 if (studentBean.getStuId().equals(alist.get(i).getStuId())) {
144 select = i;
145 break;
146 }
147 }
148 } catch (Exception e) {
149
150 }
151 BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_child_choose, alist) {
152 @Override
153 protected void convert(@NonNull BaseViewHolder item, Object o) {
154 StudentBean studentBean = alist.get(item.getAdapterPosition());
155 item.setText(R.id.tv_name, studentBean.getNickName());
156 if (TextUtils.isEmpty(studentBean.getStuId())) {
157 item.setVisible(R.id.rl_add, true);
158 item.getConvertView().setOnClickListener(new View.OnClickListener() {
159 @Override
160 public void onClick(View view) {
161 startActivity(new Intent(ChooseActivity.this, AddStudentActivity.class));
162 }
163 });
164 } else {
165 item.setBackgroundRes(R.id.rl_child, select == item.getAdapterPosition() ? R.drawable.bg_solid_white_10_or : R.drawable.bg_solid_white_10);
166 item.setImageResource(R.id.iv_select, select == item.getAdapterPosition() ? R.mipmap.gx : R.mipmap.wsyq);
167 item.setVisible(R.id.rl_add, false);
168 if (TextUtils.isEmpty(studentBean.getPhoto())) {
169 item.setImageResource(R.id.iv_avatar, studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
170 } else {
171 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(ChooseActivity.this, 45));
172 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
173 Glide.with(ChooseActivity.this).load(studentBean.getPhoto()).apply(options).into((ImageView) item.getView(R.id.iv_avatar));
174 }
175 item.setVisible(R.id.iv_vip, !"虚拟".equals(studentBean.getTeacherIdentity()));
176 item.getConvertView().setOnClickListener(new View.OnClickListener() {
177 @Override
178 public void onClick(View view) {
179 select = item.getAdapterPosition();
180 notifyDataSetChanged();
181 }
182 });
183 }
184 }
185 };
186 recycle.setLayoutManager(new LinearLayoutManager(ChooseActivity.this, LinearLayoutManager.VERTICAL, false));
187 recycle.setAdapter(adapter);
188 }
189
190 @OnClick(R.id.tv_confirm)
191 public void confirm(View view) {
192 if (alist.size() > 0 && alist.size() - 1 >= select && alist.get(select) != null) {
193 StudentBean studentBean = alist.get(select);
194 Intent intent = new Intent(ChooseActivity.this, MainActivity.class);
195 SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean));
196 startActivity(intent);
197 finish();
198 }
199 }
200 }
201
app/src/main/java/com/hjx/parent/EditStudentActivity.java
File was created 1 package com.hjx.parent;
2
3 import android.content.Intent;
4 import android.graphics.Bitmap;
5 import android.graphics.Color;
6 import android.net.Uri;
7 import android.os.Build;
8 import android.os.Bundle;
9 import android.os.Environment;
10 import android.provider.MediaStore;
11 import android.text.TextUtils;
12 import android.util.Log;
13 import android.view.LayoutInflater;
14 import android.view.View;
15 import android.widget.Button;
16 import android.widget.ImageView;
17 import android.widget.TextView;
18 import android.widget.Toast;
19
20 import androidx.core.content.FileProvider;
21
22 import com.bumptech.glide.Glide;
23 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
24 import com.bumptech.glide.request.RequestOptions;
25 import com.google.android.material.bottomsheet.BottomSheetDialog;
26 import com.google.gson.Gson;
27 import com.hjx.parent.bean.StudentBean;
28 import com.prws.common.base.BaseActivity;
29 import com.prws.common.base.BasePresenter;
30 import com.prws.common.bean.ResponseResult;
31 import com.prws.common.net.NetWorks;
32 import com.prws.common.utils.LogUtil;
33 import com.prws.common.utils.ScreenUtils;
34 import com.prws.common.utils.SharedPreferencesUtil;
35
36 import org.json.JSONObject;
37
38 import java.io.File;
39 import java.io.FileOutputStream;
40 import java.io.IOException;
41 import java.util.HashMap;
42 import java.util.Map;
43
44 import butterknife.BindView;
45 import butterknife.OnClick;
46 import io.reactivex.Observer;
47 import io.reactivex.disposables.Disposable;
48
49 public class EditStudentActivity extends BaseActivity {
50 View view_2;
51 View view_3;
52 View view_4;
53 View view_5;
54 Button btn_next;
55 TextView tv_name, tv_sex, tv_nian, tv_shen;
56 @BindView(R.id.iv_avatar)
57 ImageView iv_avatar;
58 @BindView(R.id.tv_teacher)
59 TextView tv_teacher;
60 @BindView(R.id.iv_teacher)
61 ImageView iv_teacher;
62 private static int CAMERA_REQUEST_CODE = 343;
63 private static int ALBUM_REQUEST_CODE = 456;
64 private static int CROP_REQUEST_CODE = 234;
65 private File tempFile;
66 private String path;
67 StudentBean studentBean;
68
69 @Override
70 protected int layoutResId() {
71 return R.layout.activity_edit_stu;
72 }
73
74 @Override
75 public Object getContract() {
76 return null;
77 }
78
79 @Override
80 public BasePresenter getPresenter() {
81 return null;
82 }
83
84 @Override
85 protected void initView() {
86 view_2 = findViewById(R.id.view_2);
87 view_3 = findViewById(R.id.view_3);
88 view_4 = findViewById(R.id.view_4);
89 view_5 = findViewById(R.id.view_5);
90 tv_name = findViewById(R.id.tv_name);
91 tv_sex = findViewById(R.id.tv_sex);
92 tv_nian = findViewById(R.id.tv_nian);
93 tv_shen = findViewById(R.id.tv_shen);
94 btn_next = findViewById(R.id.btn_next);
95 }
96
97 @Override
98 protected void onStart() {
99 super.onStart();
100 String name = (String) SharedPreferencesUtil.getData("setName", "");
101 String sex = (String) SharedPreferencesUtil.getData("setSex", "");
102 String nian = (String) SharedPreferencesUtil.getData("setNian", "");
103 String shen = (String) SharedPreferencesUtil.getData("setShen", "");
104 String xueq = (String) SharedPreferencesUtil.getData("setXueq", "");
105 btn_next.setTextColor(Color.WHITE);
106 btn_next.setBackground(getResources().getDrawable(R.drawable.bg_solid_btn));
107 studentBean = new Gson().fromJson(getIntent().getStringExtra("student"), StudentBean.class);
108 if (name != null && name.length() > 0) {
109 studentBean.setNickName(name);
110 }
111 if (sex != null && sex.length() > 0) {
112 studentBean.setGender("男".equals(sex) ? 0 : 1);
113 }
114 if (nian != null && nian.length() > 0) {
115 studentBean.setGrade(nian);
116 studentBean.setGradeId((Integer) SharedPreferencesUtil.getData("grade", 1));
117 }
118 if (xueq != null && xueq.length() > 0) {
119 studentBean.setTerm(xueq);
120 }
121 if (shen != null && shen.length() > 0) {
122 studentBean.setParentIdentity(shen);
123 }
124 tv_name.setText(studentBean.getNickName());
125 tv_nian.setText(studentBean.getGrade() + studentBean.getTerm());
126 tv_sex.setText(studentBean.getGender() == 0 ? "男" : "女");
127 tv_shen.setText(studentBean.getParentIdentity());
128 if (!TextUtils.isEmpty(studentBean.getPhoto())) {
129 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(this, 45));
130 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
131 Glide.with(this).load(studentBean.getPhoto()).apply(options).into(iv_avatar);
132 } else {
133 iv_avatar.setImageResource(studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
134 }
135 if (!"虚拟".equals(studentBean.getTeacherIdentity())) {
136 tv_teacher.setText(studentBean.getTeacherName());
137 if (!TextUtils.isEmpty(studentBean.getTeacherAvatar())) {
138 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(this, 25));
139 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
140 Glide.with(this).load(studentBean.getTeacherAvatar()).apply(options).into(iv_teacher);
141 } else {
142 iv_teacher.setImageResource(studentBean.getSex() == 0 ? R.mipmap.ic_teacher_male : R.mipmap.ic_teacher_female);
143 }
144 } else {
145 iv_teacher.setVisibility(View.GONE);
146 }
147
148 }
149
150 @Override
151 protected void initListener() {
152 view_2.setOnClickListener(view -> startActivity(NickActivity.class));
153 view_3.setOnClickListener(view -> startActivity(SexActivity.class));
154 view_4.setOnClickListener(view -> startActivity(NianActivity.class));
155 view_5.setOnClickListener(view -> startActivity(ShenActivity.class));
156 findViewById(R.id.tv_cancel).setOnClickListener(view -> onBackPressed());
157 btn_next.setOnClickListener(view -> {
158 editStudent();
159 });
160 }
161
162 public void editStudent() {
163 Map map = new HashMap();
164 map.put("nickName", studentBean.getNickName());
165 map.put("gender", studentBean.getGender());
166 map.put("gradeId", studentBean.getGradeId());
167 map.put("parentIdentity", studentBean.getParentIdentity());
168 map.put("term", studentBean.getTerm());
169 map.put("stuId", studentBean.getStuId());
170 NetWorks.editStudent(NetWorks.getMapRequestBody(map), new Observer<ResponseResult>() {
171 @Override
172 public void onSubscribe(Disposable d) {
173
174 }
175
176 @Override
177 public void onNext(ResponseResult responseResult) {
178 try {
179 boolean isSucceed = responseResult.getSuccess();
180 if (isSucceed) {
181 finish();
182 } else {
183 Toast.makeText(EditStudentActivity.this, responseResult.getMsg(), Toast.LENGTH_SHORT).show();
184 }
185 } catch (Exception e) {
186
187 }
188 }
189
190 @Override
191 public void onError(Throwable e) {
192
193 }
194
195 @Override
196 public void onComplete() {
197
198 }
199 });
200 }
201
202 @Override
203 protected void initData() {
204
205 }
206
207 @Override
208 public void onNetChanged(int netWorkState) {
209
210 }
211
212 private void cropPhoto(Uri uri) {
213 Uri contentUri = Uri.fromFile(new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg"));
214 Intent intent = new Intent("com.android.camera.action.CROP");
215 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
216 //Android 7.0需要临时添加读取Url的权限, 添加此属性是为了解决:调用裁剪框时候提示:图片无法加载或者加载图片失败或者无法加载此图片
217 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
218 }
219 intent.setDataAndType(uri, "image/*");
220 intent.putExtra("crop", "true");//发送裁剪信号,去掉也能进行裁剪
221 intent.putExtra("scale", true);// 设置缩放
222 intent.putExtra("scaleUpIfNeeded", true);// 去黑边
223 intent.putExtra("aspectX", 1);
224 intent.putExtra("aspectY", 1);
225 //上述两个属性控制裁剪框的缩放比例。
226 //当用户用手拉伸裁剪框时候,裁剪框会按照上述比例缩放。
227 intent.putExtra("outputX", 300);//属性控制裁剪完毕,保存的图片的大小格式。
228 intent.putExtra("outputY", 300);//你按照1:1的比例来裁剪的,如果最后成像是800*400,那么按照2:1的样式保存,
229 intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());//输出裁剪文件的格式
230 intent.putExtra("return-data", true);//是否返回裁剪后图片的Bitmap
231 intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);//设置输出路径
232 startActivityForResult(intent, CROP_REQUEST_CODE);
233 }
234
235 @Override
236 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
237 super.onActivityResult(requestCode, resultCode, intent);
238 if (requestCode == CAMERA_REQUEST_CODE) {
239 if (resultCode == RESULT_OK) {
240 //用相机返回的照片去调用剪裁也需要对Uri进行处理
241 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
242 Uri contentUri = FileProvider.getUriForFile(this,
243 this.getPackageName() + ".fileprovider", tempFile);
244 cropPhoto(contentUri);
245 } else {
246 cropPhoto(Uri.fromFile(tempFile));
247 }
248 }
249 } else if (requestCode == ALBUM_REQUEST_CODE) {
250 if (resultCode == RESULT_OK) {
251 Uri uri = intent.getData();
252 cropPhoto(uri);
253 }
254 } else if (requestCode == CROP_REQUEST_CODE) {
255 if (intent == null) {
256 return;
257 }
258 Bundle bundle = intent.getExtras();
259 if (bundle != null) {
260 //在这里获得了剪裁后的Bitmap对象,可以用于上传
261 Bitmap image = bundle.getParcelable("data");
262 //设置到ImageView上
263 //也可以进行一些保存、压缩等操作后上传
264 File file = saveImage("head_output", image);
265 uploadAvatar(file);
266 // Log.d("dsadsadsa",path);
267 }
268 }
269 }
270
271 private void uploadAvatar(File file) {
272 NetWorks.uploadStudentAvatar(file, studentBean.getStuId(), new Observer<ResponseResult<Map<String, String>>>() {
273 @Override
274 public void onSubscribe(Disposable d) {
275
276 }
277
278 @Override
279 public void onNext(ResponseResult<Map<String, String>> responseBody) {
280 if (responseBody.getData() != null && responseBody.getCode() == 200) {
281 String filePath = responseBody.getData().get("imageUrl");
282 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(EditStudentActivity.this, 45));
283 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
284 Glide.with(EditStudentActivity.this).load(filePath).apply(options).into(iv_avatar);
285 }
286 }
287
288 @Override
289 public void onError(Throwable e) {
290 e.toString();
291 }
292
293 @Override
294 public void onComplete() {
295
296 }
297 });
298 }
299
300 public File saveImage(String name, Bitmap bmp) {
301 File appDir = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES).getPath());
302 if (!appDir.exists()) {
303 appDir.mkdir();
304 }
305 String fileName = name + ".jpg";
306 File file = new File(appDir, fileName);
307 try {
308 FileOutputStream fos = new FileOutputStream(file);
309 bmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
310 fos.flush();
311 fos.close();
312 return file;
313 } catch (IOException e) {
314 Log.d("dsadsadsa", e.getLocalizedMessage());
315 e.printStackTrace();
316 }
317 return null;
318 }
319
320 private void getPicFromCamera() {
321 //用于保存调用相机拍照后所生成的文件
322 tempFile = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), System.currentTimeMillis() + ".jpg");
323 //跳转到调用系统相机
324 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
325 //判断版本
326 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //如果在Android7.0以上,使用FileProvider获取Uri
327 intent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
328 Uri contentUri = FileProvider.getUriForFile(this,
329 this.getPackageName() + ".fileprovider", tempFile);
330 intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
331 } else { //否则使用Uri.fromFile(file)方法获取Uri
332 intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempFile));
333 }
334 startActivityForResult(intent, CAMERA_REQUEST_CODE);
335 }
336
337 /**
338 * 从相册获取图片
339 */
340 private void getPicFromAlbm() {
341 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
342 photoPickerIntent.setType("image/*");
343 startActivityForResult(photoPickerIntent, ALBUM_REQUEST_CODE);
344 }
345
346 @Override
347 protected void onDestroy() {
348 super.onDestroy();
349 SharedPreferencesUtil.putData("setName", "");
350 SharedPreferencesUtil.putData("setSex", "");
351 SharedPreferencesUtil.putData("setNian", "");
352 SharedPreferencesUtil.putData("setShen", "");
353 SharedPreferencesUtil.putData("setXueq", "");
354 SharedPreferencesUtil.putData("grade", 0);
355 }
356
357 @OnClick(R.id.iv_avatar)
358 public void showButtonDialog(View view) {
359 BottomSheetDialog dialog = new BottomSheetDialog(this, R.style.BottomSheetDialog);
360 View bottomView = LayoutInflater.from(this).inflate(R.layout.bottom_sheet_layout, null);
361 dialog.setContentView(bottomView);
362 bottomView.findViewById(R.id.take_photo).setOnClickListener(new View.OnClickListener() {
363 @Override
364 public void onClick(View view) {
365 dialog.dismiss();
366 getPicFromCamera();
367 }
368 });
369 bottomView.findViewById(R.id.choose_photo).setOnClickListener(new View.OnClickListener() {
370 @Override
371 public void onClick(View view) {
372 dialog.dismiss();
373 getPicFromAlbm();
374 }
375 });
376 bottomView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
377 @Override
378 public void onClick(View view) {
379 dialog.dismiss();
380 }
381 });
382 dialog.show();
383 }
384 }
385
app/src/main/java/com/hjx/parent/LoginActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.content.Intent;
3 import android.os.Bundle; 4 import android.os.Bundle;
4 import android.telephony.PhoneNumberUtils; 5 import android.telephony.PhoneNumberUtils;
5 import android.text.InputType; 6 import android.text.InputType;
7 import android.text.TextUtils;
6 import android.widget.Button; 8 import android.widget.Button;
7 import android.widget.CheckBox; 9 import android.widget.CheckBox;
8 import android.widget.EditText; 10 import android.widget.EditText;
9 import android.widget.ImageView; 11 import android.widget.ImageView;
10 import android.widget.TextView; 12 import android.widget.TextView;
11 import android.widget.Toast; 13 import android.widget.Toast;
12 14
13 import androidx.appcompat.app.AppCompatActivity; 15 import androidx.appcompat.app.AppCompatActivity;
14 16
15 import com.prws.common.base.BaseActivity; 17 import com.prws.common.base.BaseActivity;
16 import com.prws.common.base.BasePresenter; 18 import com.prws.common.base.BasePresenter;
17 import com.prws.common.bean.BaseEntity; 19 import com.prws.common.bean.BaseEntity;
18 import com.prws.common.net.NetWorks; 20 import com.prws.common.net.NetWorks;
19 import com.prws.common.utils.LogUtil; 21 import com.prws.common.utils.LogUtil;
20 import com.prws.common.utils.SharedPreferencesUtil; 22 import com.prws.common.utils.SharedPreferencesUtil;
21 import com.prws.common.utils.acmanager.ActivityManager; 23 import com.prws.common.utils.acmanager.ActivityManager;
22 24
23 import org.json.JSONObject; 25 import org.json.JSONObject;
24 26
25 import java.io.IOException; 27 import java.io.IOException;
26 import java.util.HashMap; 28 import java.util.HashMap;
27 import java.util.Map; 29 import java.util.Map;
28 30
29 import io.reactivex.Observer; 31 import io.reactivex.Observer;
30 import io.reactivex.disposables.Disposable; 32 import io.reactivex.disposables.Disposable;
31 import okhttp3.ResponseBody; 33 import okhttp3.ResponseBody;
32 34
33 35
34 public class LoginActivity extends BaseActivity { 36 public class LoginActivity extends BaseActivity {
35 37
36 38
37 EditText et_phone; 39 EditText et_phone;
38 EditText et_pwd; 40 EditText et_pwd;
39 ImageView iv_show; 41 ImageView iv_show;
40 ImageView iv_delete; 42 ImageView iv_delete;
41 Button btn_login; 43 Button btn_login;
42 TextView tv_reg; 44 TextView tv_reg;
43 CheckBox cb_1; 45 CheckBox cb_1;
44 TextView tv_user; 46 TextView tv_user;
45 TextView tv_ys; 47 TextView tv_ys;
46 48
47 49
48
49 @Override 50 @Override
50 protected int layoutResId() { 51 protected int layoutResId() {
51 return R.layout.activity_login; 52 return R.layout.activity_login;
52 } 53 }
53 54
54 @Override 55 @Override
55 public Object getContract() { 56 public Object getContract() {
56 return null; 57 return null;
57 } 58 }
58 59
59 @Override 60 @Override
60 public BasePresenter getPresenter() { 61 public BasePresenter getPresenter() {
61 return null; 62 return null;
62 } 63 }
63 64
64 65
65 @Override 66 @Override
66 protected void initView() { 67 protected void initView() {
67 et_phone = findViewById(R.id.et_phone); 68 et_phone = findViewById(R.id.et_phone);
68 et_pwd = findViewById(R.id.et_pwd); 69 et_pwd = findViewById(R.id.et_pwd);
69 iv_show = findViewById(R.id.iv_4); 70 iv_show = findViewById(R.id.iv_4);
70 iv_delete = findViewById(R.id.iv_2); 71 iv_delete = findViewById(R.id.iv_2);
71 btn_login = findViewById(R.id.btn_1); 72 btn_login = findViewById(R.id.btn_1);
72 tv_reg = findViewById(R.id.tv_2); 73 tv_reg = findViewById(R.id.tv_2);
73 cb_1 = findViewById(R.id.cb_1); 74 cb_1 = findViewById(R.id.cb_1);
74 tv_user = findViewById(R.id.tv_4); 75 tv_user = findViewById(R.id.tv_4);
75 tv_ys = findViewById(R.id.tv_6); 76 tv_ys = findViewById(R.id.tv_6);
76 77
77 78
78 String role = (String) SharedPreferencesUtil.getData("role",""); 79 String student = (String) SharedPreferencesUtil.getData("student", "");
79 80
80 if (role != null && role.length()> 0){ 81 if (!TextUtils.isEmpty(student)) {
81 LogUtil.e(TAG,"role 不是空----"); 82 LogUtil.e(TAG, "role 不是空----");
82 startActivity(MainActivity.class); 83 Intent intent = new Intent(this, MainActivity.class);
84 startActivity(intent);
83 finish(); 85 finish();
84 return; 86 return;
85 }else { 87 } else {
86 LogUtil.e(TAG,"role 是空----"); 88 LogUtil.e(TAG, "role 是空----");
87 } 89 }
88 90
89 91
90
91
92 } 92 }
93 93
94 @Override 94 @Override
95 protected void initListener() { 95 protected void initListener() {
96 iv_delete.setOnClickListener(view -> { 96 iv_delete.setOnClickListener(view -> {
97 et_phone.setText(""); 97 et_phone.setText("");
98 }); 98 });
99 iv_show.setOnClickListener(view -> { 99 iv_show.setOnClickListener(view -> {
100 100 if (iv_show.getBackground().getConstantState().equals(getDrawable(R.mipmap.xs).getConstantState())) {
101 if (iv_show.getBackground().getConstantState().equals(getDrawable(R.mipmap.xs).getConstantState())){
102 iv_show.setBackgroundResource(R.mipmap.yc); 101 iv_show.setBackgroundResource(R.mipmap.yc);
103 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); 102 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
104 }else { 103 } else {
105 iv_show.setBackgroundResource(R.mipmap.xs); 104 iv_show.setBackgroundResource(R.mipmap.xs);
106 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); 105 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
107 } 106 }
108
109
110 }); 107 });
111 108
112 109
113 btn_login.setOnClickListener(view -> { 110 btn_login.setOnClickListener(view -> {
114 111
115 String phone = et_phone.getText().toString().trim(); 112 String phone = et_phone.getText().toString().trim();
116 String pwd = et_pwd.getText().toString().trim(); 113 String pwd = et_pwd.getText().toString().trim();
117 if (phone.isEmpty() || pwd.isEmpty() || phone.length() == 0 || pwd.length() == 0){ 114 if (phone.isEmpty() || pwd.isEmpty() || phone.length() == 0 || pwd.length() == 0) {
118 Toast.makeText(this,"手机号以及密码不能为空",Toast.LENGTH_SHORT).show(); 115 Toast.makeText(this, "手机号以及密码不能为空", Toast.LENGTH_SHORT).show();
119 return; 116 return;
120 } 117 }
121 118
122 if (!PhoneNumberUtils.isGlobalPhoneNumber(et_phone.getText().toString())){ 119 if (!PhoneNumberUtils.isGlobalPhoneNumber(et_phone.getText().toString())) {
123 Toast.makeText(this,"请输入正确的手机号码",Toast.LENGTH_SHORT).show(); 120 Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_SHORT).show();
124 return; 121 return;
125 } 122 }
126 123
127 if (!cb_1.isChecked()){ 124 if (!cb_1.isChecked()) {
128 Toast.makeText(this,"请勾选协议",Toast.LENGTH_SHORT).show(); 125 Toast.makeText(this, "请勾选协议", Toast.LENGTH_SHORT).show();
129 return; 126 return;
130 } 127 }
131 128
132 login(phone,pwd); 129 login(phone, pwd);
133 130
134 }); 131 });
135 132
136 tv_reg.setOnClickListener(view -> { 133 tv_reg.setOnClickListener(view -> {
137 startActivity(RegisterActivity.class); 134 startActivity(RegisterActivity.class);
138 finish(); 135 finish();
139 }); 136 });
140 137
141 tv_ys.setOnClickListener(view -> { 138 tv_ys.setOnClickListener(view -> {
142 startActivity(YinsiActivity.class); 139 startActivity(YinsiActivity.class);
143 }); 140 });
144 tv_user.setOnClickListener(view -> { 141 tv_user.setOnClickListener(view -> {
145 startActivity(UserActivity.class); 142 startActivity(UserActivity.class);
146 }); 143 });
147 } 144 }
148 145
149 public void login(final String phone ,String pwd){ 146 public void login(final String phone, String pwd) {
150 147
151 Map map = new HashMap(); 148 Map map = new HashMap();
152 map.put("username",phone); 149 map.put("username", phone);
153 map.put("password",pwd); 150 map.put("password", pwd);
154 151
155 152
156 NetWorks.login(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() { 153 NetWorks.login(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() {
157 @Override 154 @Override
158 public void onSubscribe(Disposable d) { 155 public void onSubscribe(Disposable d) {
159 156
160 } 157 }
161 158
162 @Override 159 @Override
163 public void onNext(ResponseBody responseBody) { 160 public void onNext(ResponseBody responseBody) {
164 try { 161 try {
165
166 String str = responseBody.string().toString(); 162 String str = responseBody.string().toString();
167 163 LogUtil.e(TAG, "----" + str);
168
169 LogUtil.e(TAG,"----"+str);
170 JSONObject jo = new JSONObject(str); 164 JSONObject jo = new JSONObject(str);
171 boolean isSucceed = jo.getBoolean("success"); 165 boolean isSucceed = jo.getBoolean("success");
172 if (isSucceed){ 166 if (isSucceed) {
173 JSONObject jo2 = jo.getJSONObject("data"); 167 JSONObject jo2 = jo.getJSONObject("data");
174 SharedPreferencesUtil.putData("phone",phone); 168 SharedPreferencesUtil.putData("phone", phone);
175 SharedPreferencesUtil.putData("role",jo2.getString("role")); 169 SharedPreferencesUtil.putData("role", jo2.getString("role"));
176 SharedPreferencesUtil.putData("userId",jo2.getString("userId")); 170 SharedPreferencesUtil.putData("userId", jo2.getString("userId"));
177 SharedPreferencesUtil.putData("token",jo2.getString("token")); 171 SharedPreferencesUtil.putData("token", jo2.getString("token"));
178 172 JSONObject user = new JSONObject(jo2.getString("user"));
179 startActivity(MainActivity.class); 173 SharedPreferencesUtil.putData("photo", user.getString("photo"));
180 174 startActivity(ChooseActivity.class);
181 }else { 175 finish();
182 Toast.makeText(LoginActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show(); 176 } else {
183 } 177 Toast.makeText(LoginActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show();
184 }catch (Exception e){ 178 }
179 } catch (Exception e) {
185 e.printStackTrace(); 180 e.printStackTrace();
186 Toast.makeText(LoginActivity.this,"服务繁忙,请重试",Toast.LENGTH_SHORT).show(); 181 Toast.makeText(LoginActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show();
187 } 182 }
188
189 } 183 }
190 184
191 @Override 185 @Override
192 public void onError(Throwable e) { 186 public void onError(Throwable e) {
193 187
194 } 188 }
195 189
196 @Override 190 @Override
197 public void onComplete() { 191 public void onComplete() {
198 192
199 } 193 }
200 }); 194 });
201 } 195 }
202 196
203 197
204 @Override 198 @Override
205 protected void initData() { 199 protected void initData() {
206 200
207 } 201 }
208 202
209 @Override 203 @Override
app/src/main/java/com/hjx/parent/MainActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import androidx.appcompat.app.AppCompatActivity; 3 import androidx.appcompat.app.AppCompatActivity;
4 import androidx.constraintlayout.widget.ConstraintLayout; 4 import androidx.constraintlayout.widget.ConstraintLayout;
5 5
6 import android.graphics.Color; 6 import android.graphics.Color;
7 import android.os.Bundle; 7 import android.os.Bundle;
8 import android.widget.ImageView; 8 import android.widget.ImageView;
9 import android.widget.TextView; 9 import android.widget.TextView;
10 10
11 import com.hjx.parent.fragment.HomeFragment; 11 import com.hjx.parent.fragment.HomeFragment;
12 import com.hjx.parent.fragment.MeFragment; 12 import com.hjx.parent.fragment.MeFragment;
13 import com.prws.common.base.BaseActivity; 13 import com.prws.common.base.BaseActivity;
14 import com.prws.common.base.BasePresenter; 14 import com.prws.common.base.BasePresenter;
15 15
16 public class MainActivity extends BaseActivity { 16 public class MainActivity extends BaseActivity {
17 17
18 @Override 18 @Override
19 protected int layoutResId() { 19 protected int layoutResId() {
20 return R.layout.activity_main; 20 return R.layout.activity_main;
21 } 21 }
22 22
23 @Override 23 @Override
24 public Object getContract() { 24 public Object getContract() {
25 return null; 25 return null;
26 } 26 }
27 27
28 @Override 28 @Override
29 public BasePresenter getPresenter() { 29 public BasePresenter getPresenter() {
30 return null; 30 return null;
31 } 31 }
32 32
33 33
34
35
36 HomeFragment homeFragment; 34 HomeFragment homeFragment;
37 MeFragment meFragment; 35 MeFragment meFragment;
38 ConstraintLayout cl_home; 36 ConstraintLayout cl_home;
39 ConstraintLayout cl_me; 37 ConstraintLayout cl_me;
40 ImageView iv_3,iv_4; 38 ImageView iv_3, iv_4;
41 TextView tv_1,tv_4; 39 TextView tv_1, tv_4;
42 40
43 @Override 41 @Override
44 protected void initView() { 42 protected void initView() {
45 showFragment(getHomeFragment(),R.id.rl_content); 43 showFragment(getHomeFragment(), R.id.rl_content);
46 cl_home = findViewById(R.id.cl_home); 44 cl_home = findViewById(R.id.cl_home);
47 cl_me = findViewById(R.id.cl_me); 45 cl_me = findViewById(R.id.cl_me);
48 iv_3 = findViewById(R.id.iv_3); 46 iv_3 = findViewById(R.id.iv_3);
49 iv_4 = findViewById(R.id.iv_4); 47 iv_4 = findViewById(R.id.iv_4);
50 tv_1 = findViewById(R.id.tv_1); 48 tv_1 = findViewById(R.id.tv_1);
51 tv_4 = findViewById(R.id.tv_4); 49 tv_4 = findViewById(R.id.tv_4);
52
53
54 iv_3.setBackgroundResource(R.mipmap.hoss); 50 iv_3.setBackgroundResource(R.mipmap.hoss);
55 tv_1.setTextColor(Color.parseColor("#FE5E09")); 51 tv_1.setTextColor(Color.parseColor("#FE5E09"));
56
57
58
59 } 52 }
60 53
61 public HomeFragment getHomeFragment(){ 54 public HomeFragment getHomeFragment() {
62 if (homeFragment == null) 55 if (homeFragment == null)
63 homeFragment = new HomeFragment(); 56 homeFragment = new HomeFragment();
64 return homeFragment; 57 return homeFragment;
65 } 58 }
66 59
67 public MeFragment getMeFragment(){ 60 public MeFragment getMeFragment() {
68 if (meFragment == null) 61 if (meFragment == null)
69 meFragment = new MeFragment(); 62 meFragment = new MeFragment();
70 return meFragment; 63 return meFragment;
71 } 64 }
72 65
73 66
74
75 @Override 67 @Override
76 protected void initListener() { 68 protected void initListener() {
77 cl_home.setOnClickListener(view -> { 69 cl_home.setOnClickListener(view -> {
78 showFragment(getHomeFragment(),R.id.rl_content); 70 showFragment(getHomeFragment(), R.id.rl_content);
79 iv_3.setBackgroundResource(R.mipmap.hoss); 71 iv_3.setBackgroundResource(R.mipmap.hoss);
80 tv_1.setTextColor(Color.parseColor("#FE5E09")); 72 tv_1.setTextColor(Color.parseColor("#FE5E09"));
81
82
83 iv_4.setBackgroundResource(R.mipmap.wmus); 73 iv_4.setBackgroundResource(R.mipmap.wmus);
84 tv_4.setTextColor(Color.parseColor("#333333")); 74 tv_4.setTextColor(Color.parseColor("#333333"));
85
86
87 }); 75 });
88 76
89 cl_me.setOnClickListener(view -> { 77 cl_me.setOnClickListener(view -> {
90 showFragment(getMeFragment(),R.id.rl_content); 78 showFragment(getMeFragment(), R.id.rl_content);
91
92 iv_3.setBackgroundResource(R.mipmap.hous); 79 iv_3.setBackgroundResource(R.mipmap.hous);
93 tv_1.setTextColor(Color.parseColor("#333333")); 80 tv_1.setTextColor(Color.parseColor("#333333"));
94
95
96 iv_4.setBackgroundResource(R.mipmap.wmss); 81 iv_4.setBackgroundResource(R.mipmap.wmss);
97 tv_4.setTextColor(Color.parseColor("#FE5E09")); 82 tv_4.setTextColor(Color.parseColor("#FE5E09"));
98
99
100 }); 83 });
101 } 84 }
102 85
103 @Override 86 @Override
104 protected void initData() { 87 protected void initData() {
105 88
106 } 89 }
107 90
108 @Override 91 @Override
109 public void onNetChanged(int netWorkState) { 92 public void onNetChanged(int netWorkState) {
110 93
111 } 94 }
112 } 95 }
app/src/main/java/com/hjx/parent/NianActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.app.AlertDialog;
4 import android.content.DialogInterface;
5 import android.view.View;
3 import android.widget.TextView; 6 import android.widget.TextView;
7 import android.widget.Toast;
4 8
9 import com.google.gson.Gson;
10 import com.prws.common.bean.GradeAndSubject;
5 import com.prws.common.base.BaseActivity; 11 import com.prws.common.base.BaseActivity;
6 import com.prws.common.base.BasePresenter; 12 import com.prws.common.base.BasePresenter;
13 import com.prws.common.bean.ResponseResult;
14 import com.prws.common.net.NetWorks;
7 import com.prws.common.utils.SharedPreferencesUtil; 15 import com.prws.common.utils.SharedPreferencesUtil;
8 16
17 import java.io.IOException;
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import butterknife.BindView;
22 import butterknife.OnClick;
23 import io.reactivex.Observer;
24 import io.reactivex.disposables.Disposable;
25 import okhttp3.ResponseBody;
26
9 public class NianActivity extends BaseActivity { 27 public class NianActivity extends BaseActivity {
10 @Override 28 @Override
11 protected int layoutResId() { 29 protected int layoutResId() {
12 return R.layout.activity_set_nian; 30 return R.layout.activity_set_nian;
13 } 31 }
14 32
15 @Override 33 @Override
16 public Object getContract() { 34 public Object getContract() {
17 return null; 35 return null;
18 } 36 }
19 37
20 @Override 38 @Override
21 public BasePresenter getPresenter() { 39 public BasePresenter getPresenter() {
22 return null; 40 return null;
23 } 41 }
24 42
43 @BindView(R.id.tv_nian)
25 TextView tv_nian; 44 TextView tv_nian;
45 @BindView(R.id.tv_xq)
26 TextView tv_xq; 46 TextView tv_xq;
47 private int gradeId;
27 48
28 @Override 49 @Override
29 protected void initView() { 50 protected void initView() {
30 tv_nian = findViewById(R.id.tv_nian);
31 tv_xq = findViewById(R.id.tv_xq);
32 findViewById(R.id.tv_cancel).setOnClickListener(view -> onBackPressed()); 51 findViewById(R.id.tv_cancel).setOnClickListener(view -> onBackPressed());
33 findViewById(R.id.tv_ok).setOnClickListener(view -> { 52 findViewById(R.id.tv_ok).setOnClickListener(view -> {
34 SharedPreferencesUtil.putData("setNian", tv_nian.getText()); 53 SharedPreferencesUtil.putData("setNian", tv_nian.getText());
35 SharedPreferencesUtil.putData("setXueq", tv_xq.getText()); 54 SharedPreferencesUtil.putData("setXueq", tv_xq.getText());
55 SharedPreferencesUtil.putData("grade", gradeId);
36 finish(); 56 finish();
37 }); 57 });
58 }
59
60 @OnClick(R.id.view_3)
61 public void changeTerm(View view) {
62 String[] strings = {"上学期", "下学期"};
63 AlertDialog.Builder builder = new AlertDialog.Builder(NianActivity.this, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
64 builder.setTitle("请选择学期");
65 builder.setSingleChoiceItems(strings, 0, new DialogInterface.OnClickListener() {
66 @Override
67 public void onClick(DialogInterface dialogInterface, int i) {
68 tv_xq.setText(strings[i]);
69 dialogInterface.dismiss();
70 }
71 });
72 builder.setCancelable(false);
73 builder.show();
74 }
38 75
76 @OnClick(R.id.view_2)
77 public void getGradeAndSubject(View view) {
78 NetWorks.listGradeAndSubject(new Observer<ResponseResult<List<GradeAndSubject>>>() {
79 @Override
80 public void onSubscribe(Disposable d) {
39 81
82 }
83
84 @Override
85 public void onNext(ResponseResult<List<GradeAndSubject>> listResponseResult) {
86 if (listResponseResult != null && listResponseResult.getCode() == 200) {
87 List<GradeAndSubject> list = listResponseResult.getData();
88 List<String> stringList = new ArrayList<>();
89 for (GradeAndSubject gradeAndSubject : list) {
90 stringList.add(gradeAndSubject.getGrade().getGrade());
91 }
92 String[] strings = stringList.toArray(new String[stringList.size()]);
93 AlertDialog.Builder builder = new AlertDialog.Builder(NianActivity.this, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
94 builder.setTitle("请选择年级");
95 builder.setSingleChoiceItems(strings, 0, new DialogInterface.OnClickListener() {
96 @Override
97 public void onClick(DialogInterface dialogInterface, int i) {
98 tv_nian.setText(list.get(i).getGrade().getGrade());
99 gradeId = list.get(i).getGrade().getId();
100 dialogInterface.dismiss();
101 }
102 });
103 builder.setCancelable(false);
104 builder.show();
105 }
106 }
107
108 @Override
109 public void onError(Throwable e) {
110 e.toString();
111 }
112
113 @Override
114 public void onComplete() {
115
116 }
117 });
40 } 118 }
41 119
42 @Override 120 @Override
43 protected void initListener() { 121 protected void initListener() {
44 122
45 } 123 }
46 124
47 @Override 125 @Override
48 protected void initData() { 126 protected void initData() {
49 127
50 } 128 }
51 129
52 @Override 130 @Override
53 public void onNetChanged(int netWorkState) { 131 public void onNetChanged(int netWorkState) {
54 132
55 } 133 }
app/src/main/java/com/hjx/parent/QRActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.graphics.Bitmap; 3 import android.graphics.Bitmap;
4 import android.widget.Toast; 4 import android.widget.Toast;
5 5
6 import com.google.gson.Gson; 6 import com.google.gson.Gson;
7 import com.hjx.parent.bean.RegisterBean; 7 import com.hjx.parent.bean.RegisterBean;
8 import com.prws.common.base.BaseActivity; 8 import com.prws.common.base.BaseActivity;
9 import com.prws.common.base.BasePresenter; 9 import com.prws.common.base.BasePresenter;
10 import com.prws.common.net.NetWorks; 10 import com.prws.common.net.NetWorks;
11 import com.prws.common.utils.LogUtil; 11 import com.prws.common.utils.LogUtil;
12 import com.prws.common.utils.SharedPreferencesUtil; 12 import com.prws.common.utils.SharedPreferencesUtil;
13 import com.uuzuche.lib_zxing.activity.CaptureFragment; 13 import com.uuzuche.lib_zxing.activity.CaptureFragment;
14 import com.uuzuche.lib_zxing.activity.CodeUtils; 14 import com.uuzuche.lib_zxing.activity.CodeUtils;
15 15
16 import org.json.JSONObject; 16 import org.json.JSONObject;
17 17
18 import java.io.IOException; 18 import java.io.IOException;
19 19
20 import io.reactivex.Observer; 20 import io.reactivex.Observer;
21 import io.reactivex.disposables.Disposable; 21 import io.reactivex.disposables.Disposable;
22 import okhttp3.ResponseBody; 22 import okhttp3.ResponseBody;
23 23
24 public class QRActivity extends BaseActivity { 24 public class QRActivity extends BaseActivity {
25 @Override 25 @Override
26 protected int layoutResId() { 26 protected int layoutResId() {
27 return R.layout.activity_qr; 27 return R.layout.activity_qr;
28 } 28 }
29 29
30 @Override 30 @Override
31 public Object getContract() { 31 public Object getContract() {
32 return null; 32 return null;
33 } 33 }
34 34
35 @Override 35 @Override
36 public BasePresenter getPresenter() { 36 public BasePresenter getPresenter() {
37 return null; 37 return null;
38 } 38 }
39 39
40 @Override 40 @Override
41 protected void initView() { 41 protected void initView() {
42 42
43 findViewById(R.id.iv_back).setOnClickListener(view -> startActivity(MainActivity.class)); 43 findViewById(R.id.iv_back).setOnClickListener(view -> startActivity(MainActivity.class));
44 44
45 CaptureFragment captureFragment = new CaptureFragment(); 45 CaptureFragment captureFragment = new CaptureFragment();
46 46
47 captureFragment.setAnalyzeCallback(new CodeUtils.AnalyzeCallback() { 47 captureFragment.setAnalyzeCallback(new CodeUtils.AnalyzeCallback() {
48 @Override 48 @Override
49 public void onAnalyzeSuccess(Bitmap mBitmap, String result) { 49 public void onAnalyzeSuccess(Bitmap mBitmap, String result) {
50 LogUtil.e(TAG,"result----:"+result); 50 LogUtil.e(TAG, "result----:" + result);
51 51
52 loginAnd(result); 52 loginAnd(result);
53 53
54 } 54 }
55 55
56 @Override 56 @Override
57 public void onAnalyzeFailed() { 57 public void onAnalyzeFailed() {
58 58
59 } 59 }
60 }); 60 });
61 61
62 62
63 getSupportFragmentManager().beginTransaction().replace(R.id.rl_content, captureFragment).commit(); 63 getSupportFragmentManager().beginTransaction().replace(R.id.rl_content, captureFragment).commit();
64 64
65 65
66 } 66 }
67 67
68 public void loginAnd(String str){ 68 public void loginAnd(String str) {
69 NetWorks.scanAndLogin(str, new Observer<ResponseBody>() { 69 NetWorks.scanAndLogin(str, new Observer<ResponseBody>() {
70 @Override 70 @Override
71 public void onSubscribe(Disposable d) { 71 public void onSubscribe(Disposable d) {
72 72
73 } 73 }
74 74
75 @Override 75 @Override
76 public void onNext(ResponseBody responseBody) { 76 public void onNext(ResponseBody responseBody) {
77 try { 77 try {
78 78
79 String str = responseBody.string().toString(); 79 String str = responseBody.string().toString();
80 LogUtil.e(TAG,"----"+str); 80 LogUtil.e(TAG, "----" + str);
81 JSONObject jo = new JSONObject(str); 81 JSONObject jo = new JSONObject(str);
82 boolean isSucceed = jo.getBoolean("success"); 82 boolean isSucceed = jo.getBoolean("success");
83 if (isSucceed){ 83 if (isSucceed) {
84 startActivity(MainActivity.class); 84 startActivity(MainActivity.class);
85 finish(); 85 finish();
86 }else { 86 } else {
87 Toast.makeText(QRActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show(); 87 Toast.makeText(QRActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show();
88 } 88 }
89 }catch (Exception e){ 89 } catch (Exception e) {
90 e.printStackTrace(); 90 e.printStackTrace();
91 Toast.makeText(QRActivity.this,"服务繁忙,请重试",Toast.LENGTH_SHORT).show(); 91 Toast.makeText(QRActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show();
92 startActivity(MainActivity.class); 92 startActivity(MainActivity.class);
93 } 93 }
94
95
96
97
98
99 } 94 }
100 95
101 @Override 96 @Override
102 public void onError(Throwable e) { 97 public void onError(Throwable e) {
103 98
104 } 99 }
105 100
106 @Override 101 @Override
107 public void onComplete() { 102 public void onComplete() {
108 103
109 } 104 }
110 }); 105 });
111 } 106 }
112 107
113 @Override 108 @Override
114 protected void initListener() { 109 protected void initListener() {
115 110
116 } 111 }
117 112
118 @Override 113 @Override
119 protected void initData() { 114 protected void initData() {
120 115
121 } 116 }
122 117
123 @Override 118 @Override
124 public void onNetChanged(int netWorkState) { 119 public void onNetChanged(int netWorkState) {
125 120
126 } 121 }
127 } 122 }
128 123
app/src/main/java/com/hjx/parent/RegisterActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.telephony.PhoneNumberUtils; 5 import android.telephony.PhoneNumberUtils;
6 import android.text.InputType; 6 import android.text.InputType;
7 import android.widget.Button; 7 import android.widget.Button;
8 import android.widget.CheckBox; 8 import android.widget.CheckBox;
9 import android.widget.EditText; 9 import android.widget.EditText;
10 import android.widget.ImageView; 10 import android.widget.ImageView;
11 import android.widget.TextView; 11 import android.widget.TextView;
12 import android.widget.Toast; 12 import android.widget.Toast;
13 13
14 import androidx.annotation.Nullable; 14 import androidx.annotation.Nullable;
15 15
16 import com.google.gson.Gson; 16 import com.google.gson.Gson;
17 import com.hjq.permissions.OnPermissionCallback; 17 import com.hjq.permissions.OnPermissionCallback;
18 import com.hjq.permissions.Permission; 18 import com.hjq.permissions.Permission;
19 import com.hjq.permissions.XXPermissions; 19 import com.hjq.permissions.XXPermissions;
20 import com.hjx.parent.bean.RegisterBean; 20 import com.hjx.parent.bean.RegisterBean;
21 import com.prws.common.base.BaseActivity; 21 import com.prws.common.base.BaseActivity;
22 import com.prws.common.base.BasePresenter; 22 import com.prws.common.base.BasePresenter;
23 import com.prws.common.bean.BaseEntity; 23 import com.prws.common.bean.BaseEntity;
24 import com.prws.common.net.NetWorks; 24 import com.prws.common.net.NetWorks;
25 import com.prws.common.utils.GsonUtil; 25 import com.prws.common.utils.GsonUtil;
26 import com.prws.common.utils.LogUtil; 26 import com.prws.common.utils.LogUtil;
27 import com.prws.common.utils.SharedPreferencesUtil; 27 import com.prws.common.utils.SharedPreferencesUtil;
28 import com.uuzuche.lib_zxing.activity.CaptureActivity; 28 import com.uuzuche.lib_zxing.activity.CaptureActivity;
29 import com.uuzuche.lib_zxing.activity.CodeUtils; 29 import com.uuzuche.lib_zxing.activity.CodeUtils;
30 30
31 import org.json.JSONObject;
32
31 import java.io.IOException; 33 import java.io.IOException;
32 import java.util.HashMap; 34 import java.util.HashMap;
33 import java.util.List; 35 import java.util.List;
34 import java.util.Map; 36 import java.util.Map;
35 37
36 import io.reactivex.Observer; 38 import io.reactivex.Observer;
37 import io.reactivex.disposables.Disposable; 39 import io.reactivex.disposables.Disposable;
38 import okhttp3.ResponseBody; 40 import okhttp3.ResponseBody;
39 41
40 public class RegisterActivity extends BaseActivity { 42 public class RegisterActivity extends BaseActivity {
41 43
42 EditText et_phone; 44 EditText et_phone;
43 EditText et_pwd; 45 EditText et_pwd;
44 EditText et_pwd_2; 46 EditText et_pwd_2;
45 ImageView iv_show; 47 ImageView iv_show;
46 ImageView iv_show_2; 48 ImageView iv_show_2;
47 ImageView iv_delete; 49 ImageView iv_delete;
48 Button btn_reg; 50 Button btn_reg;
49 TextView tv_log; 51 TextView tv_log;
50 CheckBox cb_1; 52 CheckBox cb_1;
51 TextView tv_user; 53 TextView tv_user;
52 TextView tv_ys; 54 TextView tv_ys;
53 55
54 56
55 @Override 57 @Override
56 protected int layoutResId() { 58 protected int layoutResId() {
57 return R.layout.activity_register; 59 return R.layout.activity_register;
58 } 60 }
59 61
60 @Override 62 @Override
61 public Object getContract() { 63 public Object getContract() {
62 return null; 64 return null;
63 } 65 }
64 66
65 @Override 67 @Override
66 public BasePresenter getPresenter() { 68 public BasePresenter getPresenter() {
67 return null; 69 return null;
68 } 70 }
69 71
70 @Override 72 @Override
71 protected void initView() { 73 protected void initView() {
72 et_phone = findViewById(R.id.et_phone); 74 et_phone = findViewById(R.id.et_phone);
73 et_pwd = findViewById(R.id.et_pwd); 75 et_pwd = findViewById(R.id.et_pwd);
74 iv_show = findViewById(R.id.iv_4); 76 iv_show = findViewById(R.id.iv_4);
75 iv_show_2 = findViewById(R.id.iv_6); 77 iv_show_2 = findViewById(R.id.iv_6);
76 et_pwd_2 = findViewById(R.id.et_pwd_2); 78 et_pwd_2 = findViewById(R.id.et_pwd_2);
77 iv_delete = findViewById(R.id.iv_2); 79 iv_delete = findViewById(R.id.iv_2);
78 btn_reg = findViewById(R.id.btn_1); 80 btn_reg = findViewById(R.id.btn_1);
79 tv_log = findViewById(R.id.tv_2); 81 tv_log = findViewById(R.id.tv_2);
80 cb_1 = findViewById(R.id.cb_1); 82 cb_1 = findViewById(R.id.cb_1);
81 tv_user = findViewById(R.id.tv_4); 83 tv_user = findViewById(R.id.tv_4);
82 tv_ys = findViewById(R.id.tv_6); 84 tv_ys = findViewById(R.id.tv_6);
83 85
84 86
85 } 87 }
86 88
87 @Override 89 @Override
88 protected void initListener() { 90 protected void initListener() {
89 iv_delete.setOnClickListener(view -> { 91 iv_delete.setOnClickListener(view -> {
90 et_phone.setText(""); 92 et_phone.setText("");
91 }); 93 });
92 iv_show.setOnClickListener(view -> { 94 iv_show.setOnClickListener(view -> {
93 95
94 if (iv_show.getBackground().getConstantState().equals(getDrawable(R.mipmap.xs).getConstantState())) { 96 if (iv_show.getBackground().getConstantState().equals(getDrawable(R.mipmap.xs).getConstantState())) {
95 iv_show.setBackgroundResource(R.mipmap.yc); 97 iv_show.setBackgroundResource(R.mipmap.yc);
96 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); 98 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
97 } else { 99 } else {
98 iv_show.setBackgroundResource(R.mipmap.xs); 100 iv_show.setBackgroundResource(R.mipmap.xs);
99 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); 101 et_pwd.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
100 } 102 }
101 103
102 104
103 }); 105 });
104 106
105 iv_show_2.setOnClickListener(view -> { 107 iv_show_2.setOnClickListener(view -> {
106 108
107 if (iv_show_2.getBackground().getConstantState().equals(getDrawable(R.mipmap.xs).getConstantState())) { 109 if (iv_show_2.getBackground().getConstantState().equals(getDrawable(R.mipmap.xs).getConstantState())) {
108 iv_show_2.setBackgroundResource(R.mipmap.yc); 110 iv_show_2.setBackgroundResource(R.mipmap.yc);
109 et_pwd_2.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); 111 et_pwd_2.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
110 } else { 112 } else {
111 iv_show_2.setBackgroundResource(R.mipmap.xs); 113 iv_show_2.setBackgroundResource(R.mipmap.xs);
112 et_pwd_2.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); 114 et_pwd_2.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
113 } 115 }
114 116
115 117
116 }); 118 });
117 119
118 120
119 btn_reg.setOnClickListener(view -> { 121 btn_reg.setOnClickListener(view -> {
120 122
121 String phone = et_phone.getText().toString().trim(); 123 String phone = et_phone.getText().toString().trim();
122 String pwd = et_pwd.getText().toString().trim(); 124 String pwd = et_pwd.getText().toString().trim();
123 String pwd2 = et_pwd_2.getText().toString().trim(); 125 String pwd2 = et_pwd_2.getText().toString().trim();
124 if (phone.isEmpty() || pwd.isEmpty() || phone.length() == 0 || pwd.length() == 0) { 126 if (phone.isEmpty() || pwd.isEmpty() || phone.length() == 0 || pwd.length() == 0) {
125 Toast.makeText(this, "手机号以及密码不能为空", Toast.LENGTH_SHORT).show(); 127 Toast.makeText(this, "手机号以及密码不能为空", Toast.LENGTH_SHORT).show();
126 return; 128 return;
127 } 129 }
128 130
129 if (!PhoneNumberUtils.isGlobalPhoneNumber(et_phone.getText().toString())) { 131 if (!PhoneNumberUtils.isGlobalPhoneNumber(et_phone.getText().toString())) {
130 Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_SHORT).show(); 132 Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_SHORT).show();
131 return; 133 return;
132 } 134 }
133 135
134 if (!cb_1.isChecked()) { 136 if (!cb_1.isChecked()) {
135 Toast.makeText(this, "请勾选协议", Toast.LENGTH_SHORT).show(); 137 Toast.makeText(this, "请勾选协议", Toast.LENGTH_SHORT).show();
136 return; 138 return;
137 } 139 }
138 if (!pwd.equals(pwd2)) { 140 if (!pwd.equals(pwd2)) {
139 Toast.makeText(this, "两次密码需要一致", Toast.LENGTH_SHORT).show(); 141 Toast.makeText(this, "两次密码需要一致", Toast.LENGTH_SHORT).show();
140 return; 142 return;
141 } 143 }
142 144
143 reg(phone, pwd); 145 reg(phone, pwd);
144 146
145 }); 147 });
146 148
147 tv_log.setOnClickListener(view -> { 149 tv_log.setOnClickListener(view -> {
148 startActivity(LoginActivity.class); 150 startActivity(LoginActivity.class);
149 finish(); 151 finish();
150 }); 152 });
151 153
152 tv_ys.setOnClickListener(view -> { 154 tv_ys.setOnClickListener(view -> {
153 startActivity(YinsiActivity.class); 155 startActivity(YinsiActivity.class);
154 }); 156 });
155 tv_user.setOnClickListener(view -> { 157 tv_user.setOnClickListener(view -> {
156 startActivity(UserActivity.class); 158 startActivity(UserActivity.class);
157 }); 159 });
158 } 160 }
159 161
160 public void reg(final String phone, String pwd) { 162 public void reg(final String phone, String pwd) {
161 163
162 Map map = new HashMap(); 164 Map map = new HashMap();
163 map.put("username", phone); 165 map.put("username", phone);
164 map.put("password", pwd); 166 map.put("password", pwd);
165 167
166 168
167 NetWorks.registerParent(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() { 169 NetWorks.registerParent(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() {
168 @Override 170 @Override
169 public void onSubscribe(Disposable d) { 171 public void onSubscribe(Disposable d) {
170 172
171 } 173 }
172 174
173 @Override 175 @Override
174 public void onNext(ResponseBody responseBody) { 176 public void onNext(ResponseBody responseBody) {
175 String str = null; 177 String str = null;
176 try { 178 try {
177 str = responseBody.string(); 179 str = responseBody.string();
178 } catch (IOException e) { 180 } catch (IOException e) {
179 e.printStackTrace(); 181 e.printStackTrace();
180 } 182 }
181 183
182 if (str == null || str.length() == 0) { 184 if (str == null || str.length() == 0) {
183 Toast.makeText(RegisterActivity.this, "服务器繁忙", Toast.LENGTH_SHORT).show(); 185 Toast.makeText(RegisterActivity.this, "服务器繁忙", Toast.LENGTH_SHORT).show();
184 return; 186 return;
185 } 187 }
186 188
187 RegisterBean registerBean = new Gson().fromJson(str, RegisterBean.class); 189 RegisterBean registerBean = new Gson().fromJson(str, RegisterBean.class);
188 190
189 if (!registerBean.isSuccess()) { 191 if (!registerBean.isSuccess()) {
190 Toast.makeText(RegisterActivity.this, registerBean.getMsg(), Toast.LENGTH_SHORT).show(); 192 Toast.makeText(RegisterActivity.this, registerBean.getMsg(), Toast.LENGTH_SHORT).show();
191 return; 193 return;
192 } 194 }
193 195
194 if (registerBean.getData().getUserName() != null && registerBean.getData().getUserName().length() > 0) { 196 if (registerBean.getData().getUserName() != null && registerBean.getData().getUserName().length() > 0) {
195 SharedPreferencesUtil.putData("phone",phone); 197 SharedPreferencesUtil.putData("phone", phone);
196 SharedPreferencesUtil.putData("role",registerBean.getData().getUserName()); 198 SharedPreferencesUtil.putData("role", registerBean.getData().getUserName());
197 SharedPreferencesUtil.putData("userId",registerBean.getData().getUserName()); 199 SharedPreferencesUtil.putData("userId", registerBean.getData().getUserName());
198 200 login(phone, pwd);
199 //进入扫码界面
200 goQRView();
201 201
202 } 202 }
203 203
204 204
205 } 205 }
206 206
207 @Override 207 @Override
208 public void onError(Throwable e) { 208 public void onError(Throwable e) {
209 209
210 } 210 }
211 211
212 @Override 212 @Override
213 public void onComplete() { 213 public void onComplete() {
214 214
215 } 215 }
216 }); 216 });
217 } 217 }
218 218
219 public void login(final String phone, String pwd) {
220 Map map = new HashMap();
221 map.put("username", phone);
222 map.put("password", pwd);
223
224 NetWorks.login(NetWorks.getMapRequestBody(map), new Observer<ResponseBody>() {
225 @Override
226 public void onSubscribe(Disposable d) {
227
228 }
229
230 @Override
231 public void onNext(ResponseBody responseBody) {
232 try {
233 String str = responseBody.string().toString();
234 LogUtil.e(TAG, "----" + str);
235 JSONObject jo = new JSONObject(str);
236 boolean isSucceed = jo.getBoolean("success");
237 if (isSucceed) {
238 JSONObject jo2 = jo.getJSONObject("data");
239 SharedPreferencesUtil.putData("phone", phone);
240 SharedPreferencesUtil.putData("role", jo2.getString("role"));
241 SharedPreferencesUtil.putData("userId", jo2.getString("userId"));
242 SharedPreferencesUtil.putData("token", jo2.getString("token"));
243 startActivity(ChooseActivity.class);
244 } else {
245 Toast.makeText(RegisterActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show();
246 }
247 } catch (Exception e) {
248 e.printStackTrace();
249 Toast.makeText(RegisterActivity.this, "服务繁忙,请重试", Toast.LENGTH_SHORT).show();
250 }
251
252 }
253
254 @Override
255 public void onError(Throwable e) {
256
257 }
258
259 @Override
260 public void onComplete() {
261
262 }
263 });
264 }
265
219 public void goQRView() { 266 public void goQRView() {
220 267
221 if (!XXPermissions.isGranted(this, Permission.CAMERA)) { 268 if (!XXPermissions.isGranted(this, Permission.CAMERA)) {
222 XXPermissions.with(this) 269 XXPermissions.with(this)
223 // 申请多个权限 270 // 申请多个权限
224 .permission(Permission.CAMERA) 271 .permission(Permission.CAMERA)
225 .request(new OnPermissionCallback() { 272 .request(new OnPermissionCallback() {
226 @Override 273 @Override
227 public void onGranted(List<String> permissions, boolean all) { 274 public void onGranted(List<String> permissions, boolean all) {
228 if (all) { 275 if (all) {
229 //开启扫码界面 276 //开启扫码界面
230 startQRView(); 277 startQRView();
231 278
232 } else { 279 } else {
233 Toast.makeText(RegisterActivity.this, "需要相机权限", Toast.LENGTH_SHORT).show(); 280 Toast.makeText(RegisterActivity.this, "需要相机权限", Toast.LENGTH_SHORT).show();
234 } 281 }
235 } 282 }
236 283
237 @Override 284 @Override
238 public void onDenied(List<String> permissions, boolean never) { 285 public void onDenied(List<String> permissions, boolean never) {
239 XXPermissions.startPermissionActivity(RegisterActivity.this, permissions); 286 XXPermissions.startPermissionActivity(RegisterActivity.this, permissions);
240 } 287 }
241 }); 288 });
242 289
243 290
244 } else { 291 } else {
245 startQRView(); 292 startQRView();
246 } 293 }
247 294
248 295
249 } 296 }
250 297
251 public void startQRView() { 298 public void startQRView() {
252 299
253 startActivity(QRActivity.class); 300 startActivity(QRActivity.class);
254 finish(); 301 finish();
255 302
256 } 303 }
257 304
258 305
259
260 @Override 306 @Override
261 protected void initData() { 307 protected void initData() {
262 308
263 } 309 }
264 310
265 @Override 311 @Override
266 public void onNetChanged(int netWorkState) { 312 public void onNetChanged(int netWorkState) {
app/src/main/java/com/hjx/parent/bean/StudentBean.java
1 package com.hjx.parent.bean; 1 package com.hjx.parent.bean;
2 2
3 public class StudentBean { 3 public class StudentBean {
4 4
5 String stuId; 5 String stuId;
6 String stuName; 6 String stuName;
7 int gender; 7 int gender;
8 String term; 8 String term;
9 String account; 9 String account;
10 String nickName; 10 String nickName;
11 String address; 11 String address;
12 String phone; 12 String phone;
13 String photo; 13 String photo;
14 int fromType; 14 int fromType;
15 int gradeId; 15 int gradeId;
16 String oriSchool; 16 String oriSchool;
17 String parentPhone; 17 String parentPhone;
18 String parentIdentity; 18 String parentIdentity;
19 String teacherName; 19 String teacherName;
20 int teacherId; 20 int teacherId;
21 String teacherAvatar;
22 String grade;
23 String teacherIdentity;
24 int sex;
25
21 26
22 @Override 27 @Override
23 public String toString() { 28 public String toString() {
24 return "StudentBean{" + 29 return "StudentBean{" +
25 "stuId='" + stuId + '\'' + 30 "stuId='" + stuId + '\'' +
26 ", stuName='" + stuName + '\'' + 31 ", stuName='" + stuName + '\'' +
27 ", gender=" + gender + 32 ", gender=" + gender +
28 ", term='" + term + '\'' + 33 ", term='" + term + '\'' +
29 ", account='" + account + '\'' + 34 ", account='" + account + '\'' +
30 ", nickName='" + nickName + '\'' + 35 ", nickName='" + nickName + '\'' +
31 ", address='" + address + '\'' + 36 ", address='" + address + '\'' +
32 ", phone='" + phone + '\'' + 37 ", phone='" + phone + '\'' +
33 ", photo='" + photo + '\'' + 38 ", photo='" + photo + '\'' +
34 ", fromType=" + fromType + 39 ", fromType=" + fromType +
35 ", gradeId=" + gradeId + 40 ", gradeId=" + gradeId +
36 ", oriSchool='" + oriSchool + '\'' + 41 ", oriSchool='" + oriSchool + '\'' +
37 ", parentPhone='" + parentPhone + '\'' + 42 ", parentPhone='" + parentPhone + '\'' +
38 ", parentIdentity='" + parentIdentity + '\'' + 43 ", parentIdentity='" + parentIdentity + '\'' +
39 ", teacherName='" + teacherName + '\'' + 44 ", teacherName='" + teacherName + '\'' +
40 ", teacherId=" + teacherId + 45 ", teacherId=" + teacherId +
46 ", teacherAvatar=" + teacherAvatar +
47 ", grade=" + grade +
48 ", teacherIdentity=" + teacherIdentity +
49 ", sex=" + sex +
41 '}'; 50 '}';
42 } 51 }
43 52
53 public void setSex(int sex) {
54 this.sex = sex;
55 }
56
57 public int getSex() {
58 return sex;
59 }
60
61 public void setTeacherIdentity(String teacherIdentity) {
62 this.teacherIdentity = teacherIdentity;
63 }
64
65 public String getTeacherIdentity() {
66 return teacherIdentity;
67 }
68
69 public void setTeacherAvatar(String teacherAvatar) {
70 this.teacherAvatar = teacherAvatar;
71 }
72
73 public void setGrade(String grade) {
74 this.grade = grade;
75 }
76
77 public String getTeacherAvatar() {
78 return teacherAvatar;
79 }
80
81 public String getGrade() {
82 return grade;
83 }
84
44 public String getStuId() { 85 public String getStuId() {
45 return stuId; 86 return stuId;
46 } 87 }
47 88
48 public void setStuId(String stuId) { 89 public void setStuId(String stuId) {
49 this.stuId = stuId; 90 this.stuId = stuId;
50 } 91 }
51 92
52 public String getStuName() { 93 public String getStuName() {
53 return stuName; 94 return stuName;
54 } 95 }
55 96
56 public void setStuName(String stuName) { 97 public void setStuName(String stuName) {
57 this.stuName = stuName; 98 this.stuName = stuName;
58 } 99 }
59 100
60 public int getGender() { 101 public int getGender() {
61 return gender; 102 return gender;
62 } 103 }
63 104
64 public void setGender(int gender) { 105 public void setGender(int gender) {
65 this.gender = gender; 106 this.gender = gender;
66 } 107 }
67 108
68 public String getTerm() { 109 public String getTerm() {
69 return term; 110 return term;
70 } 111 }
71 112
72 public void setTerm(String term) { 113 public void setTerm(String term) {
73 this.term = term; 114 this.term = term;
74 } 115 }
75 116
76 public String getAccount() { 117 public String getAccount() {
77 return account; 118 return account;
78 } 119 }
79 120
80 public void setAccount(String account) { 121 public void setAccount(String account) {
81 this.account = account; 122 this.account = account;
82 } 123 }
83 124
84 public String getNickName() { 125 public String getNickName() {
85 return nickName; 126 return nickName;
86 } 127 }
87 128
88 public void setNickName(String nickName) { 129 public void setNickName(String nickName) {
89 this.nickName = nickName; 130 this.nickName = nickName;
90 } 131 }
91 132
92 public String getAddress() { 133 public String getAddress() {
93 return address; 134 return address;
94 } 135 }
95 136
96 public void setAddress(String address) { 137 public void setAddress(String address) {
97 this.address = address; 138 this.address = address;
98 } 139 }
99 140
100 public String getPhone() { 141 public String getPhone() {
101 return phone; 142 return phone;
102 } 143 }
103 144
104 public void setPhone(String phone) { 145 public void setPhone(String phone) {
105 this.phone = phone; 146 this.phone = phone;
106 } 147 }
107 148
108 public String getPhoto() { 149 public String getPhoto() {
109 return photo; 150 return photo;
110 } 151 }
111 152
112 public void setPhoto(String photo) { 153 public void setPhoto(String photo) {
113 this.photo = photo; 154 this.photo = photo;
114 } 155 }
115 156
116 public int getFromType() { 157 public int getFromType() {
117 return fromType; 158 return fromType;
118 } 159 }
119 160
120 public void setFromType(int fromType) { 161 public void setFromType(int fromType) {
121 this.fromType = fromType; 162 this.fromType = fromType;
122 } 163 }
123 164
124 public int getGradeId() { 165 public int getGradeId() {
125 return gradeId; 166 return gradeId;
126 } 167 }
127 168
128 public void setGradeId(int gradeId) { 169 public void setGradeId(int gradeId) {
129 this.gradeId = gradeId; 170 this.gradeId = gradeId;
130 } 171 }
131 172
132 public String getOriSchool() { 173 public String getOriSchool() {
133 return oriSchool; 174 return oriSchool;
134 } 175 }
135 176
136 public void setOriSchool(String oriSchool) { 177 public void setOriSchool(String oriSchool) {
137 this.oriSchool = oriSchool; 178 this.oriSchool = oriSchool;
138 } 179 }
139 180
140 public String getParentPhone() { 181 public String getParentPhone() {
141 return parentPhone; 182 return parentPhone;
142 } 183 }
143 184
144 public void setParentPhone(String parentPhone) { 185 public void setParentPhone(String parentPhone) {
145 this.parentPhone = parentPhone; 186 this.parentPhone = parentPhone;
146 } 187 }
147 188
148 public String getParentIdentity() { 189 public String getParentIdentity() {
149 return parentIdentity; 190 return parentIdentity;
150 } 191 }
151 192
152 public void setParentIdentity(String parentIdentity) { 193 public void setParentIdentity(String parentIdentity) {
153 this.parentIdentity = parentIdentity; 194 this.parentIdentity = parentIdentity;
154 } 195 }
155 196
156 public String getTeacherName() { 197 public String getTeacherName() {
157 return teacherName; 198 return teacherName;
158 } 199 }
159 200
160 public void setTeacherName(String teacherName) { 201 public void setTeacherName(String teacherName) {
161 this.teacherName = teacherName; 202 this.teacherName = teacherName;
162 } 203 }
163 204
164 public int getTeacherId() { 205 public int getTeacherId() {
165 return teacherId; 206 return teacherId;
166 } 207 }
167 208
168 public void setTeacherId(int teacherId) { 209 public void setTeacherId(int teacherId) {
169 this.teacherId = teacherId; 210 this.teacherId = teacherId;
170 } 211 }
171 } 212 }
172 213
app/src/main/java/com/hjx/parent/fragment/HomeFragment.java
1 package com.hjx.parent.fragment; 1 package com.hjx.parent.fragment;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.text.TextUtils;
6 import android.view.LayoutInflater;
7 import android.view.View;
5 import android.widget.ImageView; 8 import android.widget.ImageView;
9 import android.widget.LinearLayout;
6 import android.widget.TextView; 10 import android.widget.TextView;
7 import android.widget.Toast; 11 import android.widget.Toast;
8 12
13 import androidx.annotation.NonNull;
9 import androidx.annotation.Nullable; 14 import androidx.annotation.Nullable;
10 15 import androidx.recyclerview.widget.LinearLayoutManager;
16 import androidx.recyclerview.widget.RecyclerView;
17
18 import com.bumptech.glide.Glide;
19 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
20 import com.bumptech.glide.request.RequestOptions;
21 import com.chad.library.adapter.base.BaseQuickAdapter;
22 import com.chad.library.adapter.base.BaseViewHolder;
23 import com.google.gson.Gson;
11 import com.hjq.permissions.OnPermissionCallback; 24 import com.hjq.permissions.OnPermissionCallback;
12 import com.hjq.permissions.Permission; 25 import com.hjq.permissions.Permission;
13 import com.hjq.permissions.XXPermissions; 26 import com.hjq.permissions.XXPermissions;
27 import com.hjx.parent.ChooseActivity;
28 import com.hjx.parent.QRActivity;
14 import com.hjx.parent.R; 29 import com.hjx.parent.R;
30 import com.hjx.parent.bean.StudentBean;
15 import com.prws.common.base.BaseFragment; 31 import com.prws.common.base.BaseFragment;
32 import com.prws.common.bean.ResponseResult;
33 import com.prws.common.bean.ScheduleBean;
34 import com.prws.common.bean.Video;
35 import com.prws.common.net.NetWorks;
36 import com.prws.common.utils.ScreenUtils;
16 import com.prws.common.utils.SharedPreferencesUtil; 37 import com.prws.common.utils.SharedPreferencesUtil;
17 import com.uuzuche.lib_zxing.activity.CaptureActivity; 38 import com.uuzuche.lib_zxing.activity.CaptureActivity;
18 import com.uuzuche.lib_zxing.activity.CodeUtils; 39 import com.uuzuche.lib_zxing.activity.CodeUtils;
19 40
41 import java.text.SimpleDateFormat;
42 import java.util.ArrayList;
20 import java.util.List; 43 import java.util.List;
21 44
45 import butterknife.BindView;
46 import butterknife.OnClick;
47 import io.reactivex.Observer;
48 import io.reactivex.disposables.Disposable;
49
22 public class HomeFragment extends BaseFragment { 50 public class HomeFragment extends BaseFragment {
23 @Override 51 @Override
24 protected int getLayoutRes() { 52 protected int getLayoutRes() {
25 return R.layout.fragment_home; 53 return R.layout.fragment_home;
26 } 54 }
27 55
28 ImageView iv_sapmiao; 56 ImageView iv_sapmiao;
29 TextView tv_name; 57 TextView tv_name;
58 StudentBean studentBean;
59 ImageView iv_2;
60 @BindView(R.id.recycle)
61 RecyclerView recyclerView;
62 @BindView(R.id.tv_empty)
63 TextView tv_empty;
64 @BindView(R.id.iv_empty)
65 ImageView iv_empty;
66
30 @Override 67 @Override
31 protected void initDatas() { 68 protected void initDatas() {
32 super.initDatas(); 69 super.initDatas();
70 iv_2 = mRootView.findViewById(R.id.iv_2);
33 iv_sapmiao = mRootView.findViewById(R.id.iv_sapmiao); 71 iv_sapmiao = mRootView.findViewById(R.id.iv_sapmiao);
34 tv_name = mRootView.findViewById(R.id.tv_name); 72 tv_name = mRootView.findViewById(R.id.tv_name);
35 iv_sapmiao.setOnClickListener(view -> { 73 iv_sapmiao.setOnClickListener(view -> {
36 74 if (!XXPermissions.isGranted(getActivity(), Permission.CAMERA)) {
37 if (!XXPermissions.isGranted(getActivity(), Permission.CAMERA)){
38 XXPermissions.with(getActivity()) 75 XXPermissions.with(getActivity())
39 // 申请多个权限 76 // 申请多个权限
40 .permission(Permission.CAMERA) 77 .permission(Permission.CAMERA)
41 .request(new OnPermissionCallback() { 78 .request(new OnPermissionCallback() {
42 @Override 79 @Override
43 public void onGranted(List<String> permissions, boolean all) { 80 public void onGranted(List<String> permissions, boolean all) {
44 if (all){ 81 if (all) {
45 //开启扫码界面 82 //开启扫码界面
46 startQRView(); 83 startQRView();
47 84
48 85
49 }else { 86 } else {
50 Toast.makeText(getActivity(),"需要相机权限",Toast.LENGTH_SHORT).show(); 87 Toast.makeText(getActivity(), "需要相机权限", Toast.LENGTH_SHORT).show();
51 } 88 }
52 } 89 }
53 90
54 @Override 91 @Override
55 public void onDenied(List<String> permissions, boolean never) { 92 public void onDenied(List<String> permissions, boolean never) {
56 XXPermissions.startPermissionActivity(getActivity(), permissions); 93 XXPermissions.startPermissionActivity(getActivity(), permissions);
57 } 94 }
58 }); 95 });
96 } else {
97 startQRView();
98 }
59 99
100 });
101 }
60 102
61 103
62 104 @Override
63 }else { 105 public void onResume() {
64 startQRView(); 106 super.onResume();
107 String student = (String) SharedPreferencesUtil.getData("student", "");
108 try {
109 studentBean = new Gson().fromJson(student, StudentBean.class);
110 tv_name.setText(studentBean.getNickName());
111 if (TextUtils.isEmpty(studentBean.getPhoto())) {
112 iv_2.setImageResource(studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
113 } else {
114 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 20));
115 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
116 Glide.with(getActivity()).load(studentBean.getPhoto()).apply(options).into(iv_2);
65 } 117 }
118 getWeekPlan(studentBean.getStuId());
119 } catch (Exception e) {
66 120
121 }
122 }
67 123
68 }); 124 public void getWeekPlan(String id) {
125 NetWorks.getWeekPlan(id, new Observer<ResponseResult<ScheduleBean>>() {
126 @Override
127 public void onSubscribe(Disposable d) {
69 128
70 String role = (String) SharedPreferencesUtil.getData("role",""); 129 }
71 String userId = (String) SharedPreferencesUtil.getData("userId","");
72 String token = (String) SharedPreferencesUtil.getData("token","");
73 String phone = (String) SharedPreferencesUtil.getData("phone","");
74 if (role != null && role.length() > 0)
75 tv_name.setText(role);
76 130
77 } 131 @Override
132 public void onNext(ResponseResult<ScheduleBean> result) {
133 if (result != null && result.getCode() == 200) {
134 showWeekPlan(result.getData().getList());
135 }
136 }
78 137
79 public void startQRView(){ 138 @Override
139 public void onError(Throwable e) {
80 140
141 }
81 142
82 startActivityForResult(new Intent(getActivity(), CaptureActivity.class),101); 143 @Override
144 public void onComplete() {
83 145
146 }
147 });
148 }
84 149
150 public void startQRView() {
151 startActivityForResult(new Intent(getActivity(), QRActivity.class), 101);
85 } 152 }
86 153
87 @Override 154 @Override
88 public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 155 public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
89 super.onActivityResult(requestCode, resultCode, data); 156 super.onActivityResult(requestCode, resultCode, data);
90 if (requestCode == 101){ 157 if (requestCode == 101) {
91 if (null != data) { 158 if (null != data) {
92 Bundle bundle = data.getExtras(); 159 Bundle bundle = data.getExtras();
93 if (bundle == null) { 160 if (bundle == null) {
94 return; 161 return;
95 } 162 }
96 if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_SUCCESS) { 163 if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_SUCCESS) {
97 String result = bundle.getString(CodeUtils.RESULT_STRING); 164 String result = bundle.getString(CodeUtils.RESULT_STRING);
98 Toast.makeText(getActivity(), "解析结果:" + result, Toast.LENGTH_LONG).show(); 165 Toast.makeText(getActivity(), "解析结果:" + result, Toast.LENGTH_LONG).show();
99 } else if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_FAILED) { 166 } else if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_FAILED) {
100 Toast.makeText(getActivity(), "解析二维码失败", Toast.LENGTH_LONG).show(); 167 Toast.makeText(getActivity(), "解析二维码失败", Toast.LENGTH_LONG).show();
101 } 168 }
102 } 169 }
103 } 170 }
171 }
172
173 @OnClick({R.id.iv_2, R.id.tv_name})
174 public void choose(View view) {
175 Intent intent = new Intent(getActivity(), ChooseActivity.class);
176 startActivity(intent);
177 }
178
179 @OnClick(R.id.iv_1)
180 public void exit(View view) {
181 getActivity().finish();
182 }
183
184 private void showWeekPlan(List<Video> list) {
185 iv_empty.setVisibility(list.size() > 0 ? View.GONE : View.VISIBLE);
186 tv_empty.setVisibility(list.size() > 0 ? View.GONE : View.VISIBLE);
187 List<Schedule> schedules = new ArrayList<>();
188 for (int i = 0; i < list.size(); i++) {
189 String date = new SimpleDateFormat("yyyy.MM.dd").format(list.get(i).getStudyTime());
190 if (schedules.size() > 0 && schedules.get(schedules.size() - 1).getDate().equals(date)) {
191 schedules.get(schedules.size() - 1).getStrings().add(list.get(i).getSectionChildName());
192 } else {
193 List<String> stringList = new ArrayList<>();
194 Schedule schedule = new Schedule();
195 schedule.setDate(date);
196 stringList.add(list.get(i).getSectionChildName());
197 schedule.setStrings(stringList);
198 schedules.add(schedule);
199 }
200 }
201 BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_schedule, schedules) {
202 @Override
203 protected void convert(@NonNull BaseViewHolder item, Object o) {
204 Schedule schedule = schedules.get(item.getAdapterPosition());
205 item.setText(R.id.tv_date, schedule.getDate());
206 LinearLayout layout = item.getView(R.id.ll_schedule);
207 for (int i = 0; i < schedule.getStrings().size(); i++) {
208 View view = LayoutInflater.from(getContext()).inflate(R.layout.item_video, null);
209 TextView textView = view.findViewById(R.id.tv_name);
210 textView.setText(schedule.getStrings().get(i));
211 layout.addView(view);
212 }
213 }
214 };
215 recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
216 recyclerView.setAdapter(adapter);
217 }
218
219 class Schedule {
220 String date;
221 List<String> strings;
222
223 public void setDate(String date) {
224 this.date = date;
225 }
104 226
227 public void setStrings(List<String> strings) {
228 this.strings = strings;
229 }
105 230
231 public String getDate() {
232 return date;
233 }
234
app/src/main/java/com/hjx/parent/fragment/MeFragment.java
1 package com.hjx.parent.fragment; 1 package com.hjx.parent.fragment;
2 2
3 import android.app.AlertDialog;
4 import android.content.DialogInterface;
3 import android.content.Intent; 5 import android.content.Intent;
6 import android.text.TextUtils;
4 import android.view.View; 7 import android.view.View;
5 import android.widget.ImageView; 8 import android.widget.ImageView;
6 import android.widget.TextView; 9 import android.widget.TextView;
7 import android.widget.Toast; 10 import android.widget.Toast;
8 11
12 import androidx.annotation.NonNull;
13 import androidx.annotation.Nullable;
9 import androidx.constraintlayout.widget.Group; 14 import androidx.constraintlayout.widget.Group;
15 import androidx.recyclerview.widget.LinearLayoutManager;
16 import androidx.recyclerview.widget.RecyclerView;
10 17
11 import com.bumptech.glide.Glide; 18 import com.bumptech.glide.Glide;
19 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
20 import com.bumptech.glide.request.RequestOptions;
21 import com.chad.library.adapter.base.BaseQuickAdapter;
22 import com.chad.library.adapter.base.BaseViewHolder;
12 import com.developer.wang.utils.PermissionUtils; 23 import com.developer.wang.utils.PermissionUtils;
13 import com.google.gson.Gson; 24 import com.google.gson.Gson;
14 import com.google.gson.JsonArray; 25 import com.google.gson.JsonArray;
15 import com.hjq.permissions.OnPermissionCallback; 26 import com.hjq.permissions.OnPermissionCallback;
16 import com.hjq.permissions.Permission; 27 import com.hjq.permissions.Permission;
17 import com.hjq.permissions.XXPermissions; 28 import com.hjq.permissions.XXPermissions;
18 import com.hjx.parent.AccountActivity; 29 import com.hjx.parent.AccountActivity;
19 import com.hjx.parent.AddStudentActivity; 30 import com.hjx.parent.AddStudentActivity;
31 import com.hjx.parent.EditStudentActivity;
20 import com.hjx.parent.LoginActivity; 32 import com.hjx.parent.LoginActivity;
21 import com.hjx.parent.MainActivity; 33 import com.hjx.parent.MainActivity;
22 import com.hjx.parent.QRActivity; 34 import com.hjx.parent.QRActivity;
23 import com.hjx.parent.R; 35 import com.hjx.parent.R;
24 import com.hjx.parent.UserActivity; 36 import com.hjx.parent.UserActivity;
25 import com.hjx.parent.YinsiActivity; 37 import com.hjx.parent.YinsiActivity;
26 import com.hjx.parent.bean.StudentBean; 38 import com.hjx.parent.bean.StudentBean;
27 import com.prws.common.base.BaseFragment; 39 import com.prws.common.base.BaseFragment;
28 import com.prws.common.net.NetWorks; 40 import com.prws.common.net.NetWorks;
29 import com.prws.common.utils.LogUtil; 41 import com.prws.common.utils.LogUtil;
42 import com.prws.common.utils.ScreenUtils;
30 import com.prws.common.utils.SharedPreferencesUtil; 43 import com.prws.common.utils.SharedPreferencesUtil;
31 44
32 import org.json.JSONArray; 45 import org.json.JSONArray;
33 import org.json.JSONObject; 46 import org.json.JSONObject;
34 47
35 import java.util.ArrayList; 48 import java.util.ArrayList;
36 import java.util.HashMap; 49 import java.util.HashMap;
37 import java.util.List; 50 import java.util.List;
38 import java.util.Map; 51 import java.util.Map;
39 52
53 import butterknife.BindView;
54 import butterknife.OnClick;
40 import io.reactivex.Observer; 55 import io.reactivex.Observer;
41 import io.reactivex.disposables.Disposable; 56 import io.reactivex.disposables.Disposable;
42 import okhttp3.ResponseBody; 57 import okhttp3.ResponseBody;
43 58
44 public class MeFragment extends BaseFragment { 59 public class MeFragment extends BaseFragment {
45 @Override 60 @Override
46 protected int getLayoutRes() { 61 protected int getLayoutRes() {
47 return R.layout.fragment_me; 62 return R.layout.fragment_me;
48 } 63 }
49 64
50 ImageView iv_bann;
51 Group group_1; 65 Group group_1;
52 TextView tv_name; 66 TextView tv_name;
53 TextView tv_phone; 67 TextView tv_phone;
54 ImageView iv_21, iv_22, iv_23; 68 ImageView iv_toux;
55 TextView tv_21, tv_22, tv_23; 69 RecyclerView recycle;
56
57 70
58 @Override 71 @Override
59 protected void initDatas() { 72 protected void initDatas() {
60 super.initDatas(); 73 super.initDatas();
61 74 recycle = mRootView.findViewById(R.id.recycle);
62
63 iv_bann = mRootView.findViewById(R.id.iv_bann);
64 group_1 = mRootView.findViewById(R.id.group_1); 75 group_1 = mRootView.findViewById(R.id.group_1);
65
66 String role = (String) SharedPreferencesUtil.getData("role", ""); 76 String role = (String) SharedPreferencesUtil.getData("role", "");
67 String userId = (String) SharedPreferencesUtil.getData("userId", ""); 77 String userId = (String) SharedPreferencesUtil.getData("userId", "");
68 String token = (String) SharedPreferencesUtil.getData("token", ""); 78 String token = (String) SharedPreferencesUtil.getData("token", "");
69 String phone = (String) SharedPreferencesUtil.getData("phone", ""); 79 String phone = (String) SharedPreferencesUtil.getData("phone", "");
70 if (role == null || role.length() == 0) { 80 group_1.setVisibility(View.VISIBLE);
71 iv_bann.setVisibility(View.VISIBLE); 81 iv_toux = mRootView.findViewById(R.id.iv_toux);
72 group_1.setVisibility(View.GONE);
73
74 iv_bann.setOnClickListener(view -> {
75
76 if (!XXPermissions.isGranted(getActivity(), Permission.CAMERA)) {
77 XXPermissions.with(getActivity())
78 // 申请多个权限
79 .permission(Permission.CAMERA)
80 .request(new OnPermissionCallback() {
81 @Override
82 public void onGranted(List<String> permissions, boolean all) {
83 if (all) {
84 //开启扫码界面
85 startActivity(new Intent(getActivity(), QRActivity.class));
86 getActivity().finish();
87 } else {
88 Toast.makeText(getActivity(), "需要相机权限", Toast.LENGTH_SHORT).show();
89 }
90 }
91
92 @Override
93 public void onDenied(List<String> permissions, boolean never) {
94 XXPermissions.startPermissionActivity(getActivity(), permissions);
95 }
96 });
97
98
99 }
100
101
102 });
103 return;
104 } else {
105 iv_bann.setVisibility(View.GONE);
106 group_1.setVisibility(View.VISIBLE);
107 }
108 tv_name = mRootView.findViewById(R.id.tv_name); 82 tv_name = mRootView.findViewById(R.id.tv_name);
109 tv_phone = mRootView.findViewById(R.id.tv_phone); 83 tv_phone = mRootView.findViewById(R.id.tv_phone);
110 iv_21 = mRootView.findViewById(R.id.iv_21); 84 tv_phone.setVisibility(View.GONE);
111 iv_22 = mRootView.findViewById(R.id.iv_22); 85 // tv_phone.setText(phone);
112 iv_23 = mRootView.findViewById(R.id.iv_23); 86 tv_name.setText(phone);
113 tv_21 = mRootView.findViewById(R.id.tv_21);
114 tv_22 = mRootView.findViewById(R.id.tv_22);
115 tv_23 = mRootView.findViewById(R.id.tv_23);
116
117 tv_phone.setText(phone);
118 tv_name.setText(role);
119
120 iv_21.setOnClickListener(view -> {
121 if (iv_21.getBackground().getConstantState().equals(getActivity().getDrawable(R.mipmap.tjxss).getConstantState())) {
122 startActivity(new Intent(getActivity(), AddStudentActivity.class));
123 }
124
125 });
126
127 iv_22.setOnClickListener(view -> {
128 if (iv_22.getBackground().getConstantState().equals(getActivity().getDrawable(R.mipmap.tjxss).getConstantState())) {
129 startActivity(new Intent(getActivity(), AddStudentActivity.class));
130
131 }
132 });
133 iv_23.setOnClickListener(view -> {
134 if (iv_23.getBackground().getConstantState().equals(getActivity().getDrawable(R.mipmap.tjxss).getConstantState())) {
135 startActivity(new Intent(getActivity(), AddStudentActivity.class));
136 }
137 });
138
139
140 } 87 }
141 88
142 @Override 89 @Override
143 public void onResume() { 90 public void onResume() {
144 super.onResume(); 91 super.onResume();
92 String photo = (String) SharedPreferencesUtil.getData("photo", "");
93 if (!TextUtils.isEmpty(photo)) {
94 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 45));
95 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
96 Glide.with(getContext()).load(photo).apply(options).into(iv_toux);
97 }
145 loadChildList(); 98 loadChildList();
146 } 99 }
147 100
148 ArrayList<StudentBean> alist = new ArrayList<>(); 101 ArrayList<StudentBean> alist = new ArrayList<>();
149 102
150 public void loadChildList() { 103 public void loadChildList() {
151
152
153 NetWorks.listChildren(new Observer<ResponseBody>() { 104 NetWorks.listChildren(new Observer<ResponseBody>() {
154 @Override 105 @Override
155 public void onSubscribe(Disposable d) { 106 public void onSubscribe(Disposable d) {
156 107
157 } 108 }
158 109
159 @Override 110 @Override
160 public void onNext(ResponseBody responseBody) { 111 public void onNext(ResponseBody responseBody) {
161 try { 112 try {
162 113
163 String str = responseBody.string().toString(); 114 String str = responseBody.string().toString();
164 115
165 116
166 LogUtil.e("TAG", "----" + str); 117 LogUtil.e("TAG", "----" + str);
167 JSONObject jo = new JSONObject(str); 118 JSONObject jo = new JSONObject(str);
168 boolean isSucceed = jo.getBoolean("success"); 119 boolean isSucceed = jo.getBoolean("success");
169 if (isSucceed) { 120 if (isSucceed) {
170 JSONArray jarr = jo.getJSONArray("data"); 121 JSONArray jarr = jo.getJSONArray("data");
171 alist.clear(); 122 alist.clear();
172 for (int i = 0; i < jarr.length(); i++) { 123 for (int i = 0; i < jarr.length(); i++) {
173 JSONObject jo2 = jarr.getJSONObject(i); 124 JSONObject jo2 = jarr.getJSONObject(i);
174 StudentBean sb = new StudentBean(); 125 Gson gson = new Gson();
175 try { 126 StudentBean sb = gson.fromJson(jo2.toString(), StudentBean.class);
176 sb.setStuId(jo2.getString("stuId"));
177 } catch (Exception e) {
178 }
179 try {
180 sb.setStuName(jo2.getString("stuName"));
181 } catch (Exception e) {
182 }
183 try {
184 sb.setGender(jo2.getInt("gender"));
185 } catch (Exception e) {
186 }
187 try {
188 sb.setTerm(jo2.getString("term"));
189 } catch (Exception e) {
190 }
191 try {
192 sb.setAccount(jo2.getString("account"));
193 } catch (Exception e) {
194 }
195 try {
196 sb.setNickName(jo2.getString("nickName"));
197 } catch (Exception e) {
198 }
199 try {
200 sb.setAddress(jo2.getString("address"));
201 } catch (Exception e) {
202 }
203 try {
204 sb.setPhone(jo2.getString("phone"));
205 } catch (Exception e) {
206 }
207 try {
208 sb.setPhoto(jo2.getString("photo"));
209 } catch (Exception e) {
210 }
211 try {
212 sb.setFromType(jo2.getInt("fromType"));
213 } catch (Exception e) {
214 }
215 try {
216 sb.setGradeId(jo2.getInt("gradeId"));
217 } catch (Exception e) {
218 }
219 try {
220 sb.setTeacherId(jo2.getInt("teacherId"));
221 } catch (Exception e) {
222 }
223 try {
224 sb.setOriSchool(jo2.getString("oriSchool"));
225 } catch (Exception e) {
226 }
227 try {
228 sb.setParentPhone(jo2.getString("parentPhone"));
229 } catch (Exception e) {
230 }
231 try {
232 sb.setParentIdentity(jo2.getString("parentIdentity"));
233 } catch (Exception e) {
234 }
235 try {
236 sb.setTeacherName(jo2.getString("teacherName"));
237 } catch (Exception e) {
238 }
239 alist.add(sb); 127 alist.add(sb);
240 } 128 }
241 129 if (alist.size() > 0) {
242 if (alist.size() > 0)
243 loadList(); 130 loadList();
131 }
244 132
245 } else { 133 } else {
246 134
247 } 135 }
248 } catch (Exception e) { 136 } catch (Exception e) {
249 e.printStackTrace(); 137 e.printStackTrace();
250
251 } 138 }
252
253 } 139 }
254 140
255 @Override 141 @Override
256 public void onError(Throwable e) { 142 public void onError(Throwable e) {
257 143
258 } 144 }
259 145
260 @Override 146 @Override
261 public void onComplete() { 147 public void onComplete() {
262 148
263 } 149 }
264 }); 150 });
265
266
267 mRootView.findViewById(R.id.view_4).setOnClickListener(view -> startActivity(new Intent(getActivity(), YinsiActivity.class))); 151 mRootView.findViewById(R.id.view_4).setOnClickListener(view -> startActivity(new Intent(getActivity(), YinsiActivity.class)));
268 mRootView.findViewById(R.id.view_5).setOnClickListener(view -> startActivity(new Intent(getActivity(), UserActivity.class))); 152 mRootView.findViewById(R.id.view_5).setOnClickListener(view -> startActivity(new Intent(getActivity(), UserActivity.class)));
269 mRootView.findViewById(R.id.view_3).setOnClickListener(view -> startActivity(new Intent(getActivity(), AccountActivity.class))); 153 mRootView.findViewById(R.id.view_3).setOnClickListener(view -> startActivityForResult(new Intent(getActivity(), AccountActivity.class), 1003));
154 }
270 155
156 @Override
157 public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
158 super.onActivityResult(requestCode, resultCode, data);
159 Intent intent = new Intent(getActivity(), LoginActivity.class);
160 startActivity(intent);
161 getActivity().finish();
271 } 162 }
272 163
273 public void loadList() { 164 public void loadList() {
274 iv_21.setBackgroundResource(R.mipmap.tjxss); 165 StudentBean sb = new StudentBean();
275 tv_21.setText("添加学生"); 166 sb.setNickName("添加学生");
276 167 alist.add(0, sb);
277 168 BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_child, alist) {
278 iv_22.setBackgroundResource(R.mipmap.tjxss); 169 @Override
app/src/main/res/drawable/bg_item_video_10.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <shape xmlns:android="http://schemas.android.com/apk/res/android"
3 android:shape="rectangle">
4
5 <solid android:color="#FFF9F6" />
6
7 <corners
8 android:radius="10dp"
9 />
10
11 </shape>
app/src/main/res/drawable/bg_solid_btn_grad.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <shape xmlns:android="http://schemas.android.com/apk/res/android" 2 <shape xmlns:android="http://schemas.android.com/apk/res/android"
3 android:shape="rectangle"> 3 android:shape="rectangle">
4 4
5 <solid android:color="#E5E5E5" /> 5 <solid android:color="#E5E5E5" />
6 6
7 <corners 7 <corners android:radius="20dp" />
8 android:radius="20dp"
9 />
10 8
11 </shape> 9 </shape>
app/src/main/res/drawable/bg_solid_white_10_or.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <shape xmlns:android="http://schemas.android.com/apk/res/android" 2 <shape xmlns:android="http://schemas.android.com/apk/res/android"
3 android:shape="rectangle"> 3 android:shape="rectangle">
4 4
5 <solid android:color="#FFFFFF" 5 <solid android:color="#FFFFFF" />
6 /> 6 <stroke
7 <stroke android:width="2dp" 7 android:width="1dp"
8 android:color="#FE5E09" 8 android:color="#FE5E09" />
9 />
10 9
11 <corners 10 <corners android:radius="10dp" />
12 android:radius="10dp"
13 />
14 11
15 </shape> 12 </shape>
app/src/main/res/layout/activity_add_stu.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <View 8 <View
10 android:id="@+id/view_1" 9 android:id="@+id/view_1"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="44dp" 11 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 12 android:background="@android:color/white"
15 /> 13 app:layout_constraintTop_toTopOf="parent" />
14
16 <TextView 15 <TextView
17 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
19 android:text="添加学生" 18 android:text="添加学生"
20 android:textColor="#333333" 19 android:textColor="#333333"
21 android:textSize="18dp" 20 android:textSize="18dp"
21 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1" />
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25
26 />
27 <TextView 26 <TextView
28 android:id="@+id/tv_cancel" 27 android:id="@+id/tv_cancel"
29 android:layout_width="wrap_content" 28 android:layout_width="wrap_content"
30 android:layout_height="wrap_content" 29 android:layout_height="wrap_content"
30 android:layout_marginLeft="15dp"
31 android:text="取消" 31 android:text="取消"
32 android:textColor="#666666" 32 android:textColor="#666666"
33 android:textSize="16dp" 33 android:textSize="16dp"
34 app:layout_constraintLeft_toLeftOf="@id/view_1"
35 app:layout_constraintTop_toTopOf="@id/view_1"
36 app:layout_constraintBottom_toBottomOf="@id/view_1" 34 app:layout_constraintBottom_toBottomOf="@id/view_1"
37 android:layout_marginLeft="15dp" 35 app:layout_constraintLeft_toLeftOf="@id/view_1"
38 /> 36 app:layout_constraintTop_toTopOf="@id/view_1" />
39 <ImageView 37
38 <RelativeLayout
39 android:id="@+id/rl_avatar"
40 android:layout_width="75dp" 40 android:layout_width="75dp"
41 android:layout_height="75dp" 41 android:layout_height="75dp"
42 android:background="@mipmap/txz" 42 android:layout_marginTop="32dp"
43 app:layout_constraintLeft_toLeftOf="parent" 43 app:layout_constraintLeft_toLeftOf="parent"
44 app:layout_constraintRight_toRightOf="parent" 44 app:layout_constraintRight_toRightOf="parent"
45 app:layout_constraintTop_toBottomOf="@id/view_1" 45 app:layout_constraintTop_toBottomOf="@id/view_1">
46 android:layout_marginTop="32dp" 46
47 /> 47 <ImageView
48 android:id="@+id/iv_avatar"
49 android:layout_width="match_parent"
50 android:layout_height="match_parent"
51 android:background="@mipmap/txz" />
52
53 <ImageView
54 android:layout_width="20dp"
55 android:layout_height="20dp"
56 android:layout_alignParentRight="true"
57 android:layout_alignParentBottom="true"
58 android:layout_marginBottom="5dp"
59 android:src="@mipmap/ic_edit" />
60 </RelativeLayout>
61
48 62
49 <View 63 <View
50 android:id="@+id/view_2" 64 android:id="@+id/view_2"
51 android:layout_width="345dp" 65 android:layout_width="match_parent"
52 android:layout_height="50dp" 66 android:layout_height="50dp"
67 android:layout_marginLeft="15dp"
68 android:layout_marginTop="195dp"
69 android:layout_marginRight="15dp"
53 android:background="@drawable/bg_solid_white_10" 70 android:background="@drawable/bg_solid_white_10"
54 app:layout_constraintLeft_toLeftOf="parent" 71 app:layout_constraintLeft_toLeftOf="parent"
55 app:layout_constraintRight_toRightOf="parent" 72 app:layout_constraintRight_toRightOf="parent"
56 app:layout_constraintTop_toTopOf="parent" 73 app:layout_constraintTop_toTopOf="parent" />
57 android:layout_marginTop="195dp"
58 />
59 74
60 <TextView 75 <TextView
61 android:layout_width="wrap_content" 76 android:layout_width="wrap_content"
62 android:layout_height="wrap_content" 77 android:layout_height="wrap_content"
78 android:layout_marginLeft="15dp"
79 android:text="昵称"
63 android:textColor="#666666" 80 android:textColor="#666666"
64 android:textSize="16dp" 81 android:textSize="16dp"
65 android:text="昵称"
66 app:layout_constraintTop_toTopOf="@id/view_2"
67 app:layout_constraintBottom_toBottomOf="@id/view_2" 82 app:layout_constraintBottom_toBottomOf="@id/view_2"
68 app:layout_constraintLeft_toLeftOf="@id/view_2" 83 app:layout_constraintLeft_toLeftOf="@id/view_2"
69 android:layout_marginLeft="15dp" 84 app:layout_constraintTop_toTopOf="@id/view_2" />
70 /> 85
71 <ImageView 86 <ImageView
72 android:layout_width="5.5dp" 87 android:layout_width="5.5dp"
73 android:layout_height="9.5dp" 88 android:layout_height="9.5dp"
89 android:layout_marginRight="15dp"
74 android:background="@mipmap/ycaj" 90 android:background="@mipmap/ycaj"
75 app:layout_constraintTop_toTopOf="@id/view_2"
76 app:layout_constraintBottom_toBottomOf="@id/view_2" 91 app:layout_constraintBottom_toBottomOf="@id/view_2"
77 app:layout_constraintRight_toRightOf="@id/view_2" 92 app:layout_constraintRight_toRightOf="@id/view_2"
78 android:layout_marginRight="15dp" 93 app:layout_constraintTop_toTopOf="@id/view_2" />
79 />
80 94
81 <TextView 95 <TextView
82 android:id="@+id/tv_name" 96 android:id="@+id/tv_name"
83 android:layout_width="wrap_content" 97 android:layout_width="wrap_content"
84 android:layout_height="wrap_content" 98 android:layout_height="wrap_content"
99 android:layout_marginRight="26dp"
100 android:text="请输入"
85 android:textColor="#999999" 101 android:textColor="#999999"
86 android:textSize="16dp" 102 android:textSize="16dp"
87 android:text="请输入"
88 app:layout_constraintTop_toTopOf="@id/view_2"
89 app:layout_constraintBottom_toBottomOf="@id/view_2" 103 app:layout_constraintBottom_toBottomOf="@id/view_2"
90 app:layout_constraintRight_toRightOf="@id/view_2" 104 app:layout_constraintRight_toRightOf="@id/view_2"
91 android:layout_marginRight="26dp" 105 app:layout_constraintTop_toTopOf="@id/view_2" />
92 />
93 106
94 <View 107 <View
95 android:id="@+id/view_3" 108 android:id="@+id/view_3"
96 android:layout_width="345dp" 109 android:layout_width="match_parent"
97 android:layout_height="50dp" 110 android:layout_height="50dp"
111 android:layout_marginLeft="15dp"
112 android:layout_marginTop="260dp"
113 android:layout_marginRight="15dp"
98 android:background="@drawable/bg_solid_white_10" 114 android:background="@drawable/bg_solid_white_10"
99 app:layout_constraintLeft_toLeftOf="parent" 115 app:layout_constraintLeft_toLeftOf="parent"
100 app:layout_constraintRight_toRightOf="parent" 116 app:layout_constraintRight_toRightOf="parent"
101 app:layout_constraintTop_toTopOf="parent" 117 app:layout_constraintTop_toTopOf="parent" />
102 android:layout_marginTop="260dp"
103 />
104 118
105 <TextView 119 <TextView
106 android:layout_width="wrap_content" 120 android:layout_width="wrap_content"
107 android:layout_height="wrap_content" 121 android:layout_height="wrap_content"
122 android:layout_marginLeft="15dp"
123 android:text="性别"
108 android:textColor="#666666" 124 android:textColor="#666666"
109 android:textSize="16dp" 125 android:textSize="16dp"
110 android:text="性别"
111 app:layout_constraintTop_toTopOf="@id/view_3"
112 app:layout_constraintBottom_toBottomOf="@id/view_3" 126 app:layout_constraintBottom_toBottomOf="@id/view_3"
113 app:layout_constraintLeft_toLeftOf="@id/view_3" 127 app:layout_constraintLeft_toLeftOf="@id/view_3"
114 android:layout_marginLeft="15dp" 128 app:layout_constraintTop_toTopOf="@id/view_3" />
115 /> 129
116 <ImageView 130 <ImageView
117 android:layout_width="5.5dp" 131 android:layout_width="5.5dp"
118 android:layout_height="9.5dp" 132 android:layout_height="9.5dp"
133 android:layout_marginRight="15dp"
119 android:background="@mipmap/ycaj" 134 android:background="@mipmap/ycaj"
120 app:layout_constraintTop_toTopOf="@id/view_3"
121 app:layout_constraintBottom_toBottomOf="@id/view_3" 135 app:layout_constraintBottom_toBottomOf="@id/view_3"
122 app:layout_constraintRight_toRightOf="@id/view_3" 136 app:layout_constraintRight_toRightOf="@id/view_3"
123 android:layout_marginRight="15dp" 137 app:layout_constraintTop_toTopOf="@id/view_3" />
124 /> 138
125 <TextView 139 <TextView
126 android:id="@+id/tv_sex" 140 android:id="@+id/tv_sex"
127 android:layout_width="wrap_content" 141 android:layout_width="wrap_content"
128 android:layout_height="wrap_content" 142 android:layout_height="wrap_content"
143 android:layout_marginRight="26dp"
144 android:text="请选择"
129 android:textColor="#999999" 145 android:textColor="#999999"
130 android:textSize="16dp" 146 android:textSize="16dp"
131 android:text="请选择"
132 app:layout_constraintTop_toTopOf="@id/view_3"
133 app:layout_constraintBottom_toBottomOf="@id/view_3" 147 app:layout_constraintBottom_toBottomOf="@id/view_3"
134 app:layout_constraintRight_toRightOf="@id/view_3" 148 app:layout_constraintRight_toRightOf="@id/view_3"
135 android:layout_marginRight="26dp" 149 app:layout_constraintTop_toTopOf="@id/view_3" />
136 />
137 150
138 <View 151 <View
139 android:id="@+id/view_4" 152 android:id="@+id/view_4"
140 android:layout_width="345dp" 153 android:layout_width="match_parent"
141 android:layout_height="50dp" 154 android:layout_height="50dp"
155 android:layout_marginLeft="15dp"
156 android:layout_marginTop="325dp"
157 android:layout_marginRight="15dp"
142 android:background="@drawable/bg_solid_white_10" 158 android:background="@drawable/bg_solid_white_10"
143 app:layout_constraintLeft_toLeftOf="parent" 159 app:layout_constraintLeft_toLeftOf="parent"
144 app:layout_constraintRight_toRightOf="parent" 160 app:layout_constraintRight_toRightOf="parent"
145 app:layout_constraintTop_toTopOf="parent" 161 app:layout_constraintTop_toTopOf="parent"
146 android:layout_marginTop="325dp"
147 162
148 /> 163 />
149 164
150 <TextView 165 <TextView
151 android:layout_width="wrap_content" 166 android:layout_width="wrap_content"
152 android:layout_height="wrap_content" 167 android:layout_height="wrap_content"
168 android:layout_marginLeft="15dp"
169 android:text="年级"
153 android:textColor="#666666" 170 android:textColor="#666666"
154 android:textSize="16dp" 171 android:textSize="16dp"
155 android:text="年级"
156 app:layout_constraintTop_toTopOf="@id/view_4"
157 app:layout_constraintBottom_toBottomOf="@id/view_4" 172 app:layout_constraintBottom_toBottomOf="@id/view_4"
158 app:layout_constraintLeft_toLeftOf="@id/view_4" 173 app:layout_constraintLeft_toLeftOf="@id/view_4"
159 android:layout_marginLeft="15dp" 174 app:layout_constraintTop_toTopOf="@id/view_4" />
160 /> 175
161 <ImageView 176 <ImageView
162 android:layout_width="5.5dp" 177 android:layout_width="5.5dp"
163 android:layout_height="9.5dp" 178 android:layout_height="9.5dp"
179 android:layout_marginRight="15dp"
164 android:background="@mipmap/ycaj" 180 android:background="@mipmap/ycaj"
165 app:layout_constraintTop_toTopOf="@id/view_4"
166 app:layout_constraintBottom_toBottomOf="@id/view_4" 181 app:layout_constraintBottom_toBottomOf="@id/view_4"
167 app:layout_constraintRight_toRightOf="@id/view_4" 182 app:layout_constraintRight_toRightOf="@id/view_4"
168 android:layout_marginRight="15dp" 183 app:layout_constraintTop_toTopOf="@id/view_4" />
169 /> 184
170 <TextView 185 <TextView
171 android:id="@+id/tv_nian" 186 android:id="@+id/tv_nian"
172 android:layout_width="wrap_content" 187 android:layout_width="wrap_content"
173 android:layout_height="wrap_content" 188 android:layout_height="wrap_content"
189 android:layout_marginRight="26dp"
190 android:text="请选择"
174 android:textColor="#999999" 191 android:textColor="#999999"
175 android:textSize="16dp" 192 android:textSize="16dp"
176 android:text="请选择"
177 app:layout_constraintTop_toTopOf="@id/view_4"
178 app:layout_constraintBottom_toBottomOf="@id/view_4" 193 app:layout_constraintBottom_toBottomOf="@id/view_4"
179 app:layout_constraintRight_toRightOf="@id/view_4" 194 app:layout_constraintRight_toRightOf="@id/view_4"
180 android:layout_marginRight="26dp" 195 app:layout_constraintTop_toTopOf="@id/view_4" />
181 /> 196
182 <View 197 <View
183 android:id="@+id/view_5" 198 android:id="@+id/view_5"
184 android:layout_width="345dp" 199 android:layout_width="match_parent"
185 android:layout_height="50dp" 200 android:layout_height="50dp"
201 android:layout_marginLeft="15dp"
202 android:layout_marginTop="390dp"
203 android:layout_marginRight="15dp"
186 android:background="@drawable/bg_solid_white_10" 204 android:background="@drawable/bg_solid_white_10"
187 app:layout_constraintLeft_toLeftOf="parent" 205 app:layout_constraintLeft_toLeftOf="parent"
188 app:layout_constraintRight_toRightOf="parent" 206 app:layout_constraintRight_toRightOf="parent"
189 app:layout_constraintTop_toTopOf="parent" 207 app:layout_constraintTop_toTopOf="parent"
190 android:layout_marginTop="390dp"
191 208
192 /> 209 />
193 210
194 <TextView 211 <TextView
195 212
196 android:layout_width="wrap_content" 213 android:layout_width="wrap_content"
197 android:layout_height="wrap_content" 214 android:layout_height="wrap_content"
215 android:layout_marginLeft="15dp"
216 android:text="家长身份"
198 android:textColor="#666666" 217 android:textColor="#666666"
199 android:textSize="16dp" 218 android:textSize="16dp"
200 android:text="家长身份"
201 app:layout_constraintTop_toTopOf="@id/view_5"
202 app:layout_constraintBottom_toBottomOf="@id/view_5" 219 app:layout_constraintBottom_toBottomOf="@id/view_5"
203 app:layout_constraintLeft_toLeftOf="@id/view_5" 220 app:layout_constraintLeft_toLeftOf="@id/view_5"
204 android:layout_marginLeft="15dp" 221 app:layout_constraintTop_toTopOf="@id/view_5" />
205 /> 222
206 <TextView 223 <TextView
207 android:id="@+id/tv_shen" 224 android:id="@+id/tv_shen"
208 android:layout_width="wrap_content" 225 android:layout_width="wrap_content"
209 android:layout_height="wrap_content" 226 android:layout_height="wrap_content"
227 android:layout_marginRight="26dp"
app/src/main/res/layout/activity_changem.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <View 8 <View
10 android:id="@+id/view_1" 9 android:id="@+id/view_1"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="44dp" 11 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 12 android:background="@android:color/white"
15 /> 13 app:layout_constraintTop_toTopOf="parent" />
14
16 <TextView 15 <TextView
17 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
19 android:text="修改密码" 18 android:text="修改密码"
20 android:textColor="#333333" 19 android:textColor="#333333"
21 android:textSize="18dp" 20 android:textSize="18dp"
21 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1" />
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25
26 />
27 <ImageView 26 <ImageView
28 android:id="@+id/iv_back" 27 android:id="@+id/iv_back"
29 android:layout_width="10dp" 28 android:layout_width="10dp"
30 android:layout_height="16dp" 29 android:layout_height="16dp"
31 app:layout_constraintLeft_toLeftOf="parent"
32 app:layout_constraintTop_toTopOf="@id/view_1"
33 app:layout_constraintBottom_toBottomOf="@id/view_1"
34 android:layout_marginLeft="15dp" 30 android:layout_marginLeft="15dp"
35 android:background="@mipmap/icon_back" 31 android:background="@mipmap/icon_back"
36 /> 32 app:layout_constraintBottom_toBottomOf="@id/view_1"
33 app:layout_constraintLeft_toLeftOf="parent"
34 app:layout_constraintTop_toTopOf="@id/view_1" />
35
37 <View 36 <View
38 android:layout_width="match_parent" 37 android:layout_width="match_parent"
39 android:layout_height="1dp" 38 android:layout_height="1dp"
40 android:background="#EEEEEE" 39 android:background="#EEEEEE"
41 app:layout_constraintTop_toBottomOf="@id/view_1" 40 app:layout_constraintTop_toBottomOf="@id/view_1" />
42 />
43 41
44 <View 42 <View
45 android:id="@+id/view_3" 43 android:id="@+id/view_3"
46 android:layout_width="match_parent" 44 android:layout_width="match_parent"
47 android:layout_height="45dp" 45 android:layout_height="45dp"
46 android:layout_marginTop="80dp"
48 android:background="@android:color/white" 47 android:background="@android:color/white"
49 app:layout_constraintLeft_toLeftOf="parent" 48 app:layout_constraintLeft_toLeftOf="parent"
50 app:layout_constraintRight_toRightOf="parent" 49 app:layout_constraintRight_toRightOf="parent"
51 app:layout_constraintTop_toTopOf="parent" 50 app:layout_constraintTop_toTopOf="parent" />
52 android:layout_marginTop="80dp" 51
53 /> 52
54 <ImageView
55 android:id="@+id/iv_3"
56 android:layout_width="20dp"
57 android:layout_height="16dp"
58 android:background="@mipmap/xs"
59 app:layout_constraintTop_toTopOf="@id/view_3"
60 app:layout_constraintBottom_toBottomOf="@id/view_3"
61 app:layout_constraintRight_toRightOf="@id/view_3"
62 android:layout_marginRight="20dp"
63 />
64 <TextView 53 <TextView
65 android:id="@+id/tv_3" 54 android:id="@+id/tv_3"
66 android:layout_width="wrap_content" 55 android:layout_width="wrap_content"
67 android:layout_height="wrap_content" 56 android:layout_height="wrap_content"
57 android:layout_marginLeft="15dp"
68 android:text="请输入原密码" 58 android:text="请输入原密码"
69 android:textColor="#333333" 59 android:textColor="#333333"
70 android:textSize="15dp" 60 android:textSize="15dp"
71 app:layout_constraintTop_toTopOf="@id/view_3"
72 app:layout_constraintBottom_toBottomOf="@id/view_3" 61 app:layout_constraintBottom_toBottomOf="@id/view_3"
73 app:layout_constraintLeft_toLeftOf="@id/view_3" 62 app:layout_constraintLeft_toLeftOf="@id/view_3"
74 android:layout_marginLeft="15dp" 63 app:layout_constraintTop_toTopOf="@id/view_3" />
75 />
76 64
77 65
78 <EditText 66 <EditText
67 android:id="@+id/et_old_password"
79 android:layout_width="0dp" 68 android:layout_width="0dp"
80 android:layout_height="45dp" 69 android:layout_height="45dp"
81 android:background="@android:color/transparent"
82 app:layout_constraintTop_toTopOf="@id/view_3"
83 app:layout_constraintBottom_toBottomOf="@id/view_3"
84 app:layout_constraintLeft_toRightOf="@id/tv_3"
85 app:layout_constraintRight_toRightOf="parent"
86 android:layout_marginLeft="30dp" 70 android:layout_marginLeft="30dp"
87 android:layout_marginRight="50dp" 71 android:layout_marginRight="50dp"
88 android:textSize="15dp" 72 android:background="@android:color/transparent"
89 android:gravity="left|center_vertical" 73 android:gravity="left|center_vertical"
90 android:inputType="textPassword"
91 android:hint="请输入密码" 74 android:hint="请输入密码"
75 android:inputType="textPassword"
92 android:textColor="#333333" 76 android:textColor="#333333"
93 android:textColorHint="#666666" 77 android:textColorHint="#666666"
78 android:textSize="15dp"
79 app:layout_constraintBottom_toBottomOf="@id/view_3"
80 app:layout_constraintLeft_toRightOf="@id/tv_3"
81 app:layout_constraintRight_toRightOf="parent"
82 app:layout_constraintTop_toTopOf="@id/view_3"
94 83
95 /> 84 />
96 85
97 <View 86 <View
98 android:id="@+id/view_4" 87 android:id="@+id/view_4"
99 android:layout_width="match_parent" 88 android:layout_width="match_parent"
100 android:layout_height="45dp" 89 android:layout_height="45dp"
90 android:layout_marginTop="125dp"
101 android:background="@android:color/white" 91 android:background="@android:color/white"
102 app:layout_constraintLeft_toLeftOf="parent" 92 app:layout_constraintLeft_toLeftOf="parent"
103 app:layout_constraintRight_toRightOf="parent" 93 app:layout_constraintRight_toRightOf="parent"
104 app:layout_constraintTop_toTopOf="parent" 94 app:layout_constraintTop_toTopOf="parent" />
105 android:layout_marginTop="125dp" 95
106 /> 96
107 <ImageView
108 android:id="@+id/iv_4"
109 android:layout_width="20dp"
110 android:layout_height="16dp"
111 android:background="@mipmap/xs"
112 app:layout_constraintTop_toTopOf="@id/view_4"
113 app:layout_constraintBottom_toBottomOf="@id/view_4"
114 app:layout_constraintRight_toRightOf="@id/view_4"
115 android:layout_marginRight="20dp"
116 />
117 <TextView 97 <TextView
118 android:id="@+id/tv_4" 98 android:id="@+id/tv_4"
119 android:layout_width="wrap_content" 99 android:layout_width="wrap_content"
120 android:layout_height="wrap_content" 100 android:layout_height="wrap_content"
101 android:layout_marginLeft="15dp"
121 android:text="请输入新密码" 102 android:text="请输入新密码"
122 android:textColor="#333333" 103 android:textColor="#333333"
123 android:textSize="15dp" 104 android:textSize="15dp"
124 app:layout_constraintTop_toTopOf="@id/view_4"
125 app:layout_constraintBottom_toBottomOf="@id/view_4" 105 app:layout_constraintBottom_toBottomOf="@id/view_4"
126 app:layout_constraintLeft_toLeftOf="@id/view_4" 106 app:layout_constraintLeft_toLeftOf="@id/view_4"
127 android:layout_marginLeft="15dp" 107 app:layout_constraintTop_toTopOf="@id/view_4" />
128 />
129 108
130 109
131 <EditText 110 <EditText
132 android:id="@+id/et_pwd" 111 android:id="@+id/et_pwd"
133 android:layout_width="0dp" 112 android:layout_width="0dp"
134 android:layout_height="45dp" 113 android:layout_height="45dp"
135 android:background="@android:color/transparent"
136 app:layout_constraintTop_toTopOf="@id/view_4"
137 app:layout_constraintBottom_toBottomOf="@id/view_4"
138 app:layout_constraintLeft_toRightOf="@id/tv_4"
139 app:layout_constraintRight_toRightOf="parent"
140 android:layout_marginLeft="30dp" 114 android:layout_marginLeft="30dp"
141 android:layout_marginRight="50dp" 115 android:layout_marginRight="50dp"
142 android:textSize="15dp" 116 android:background="@android:color/transparent"
143 android:gravity="left|center_vertical" 117 android:gravity="left|center_vertical"
144 android:inputType="textPassword"
145 android:hint="请输入密码" 118 android:hint="请输入密码"
119 android:inputType="textPassword"
146 android:textColor="#333333" 120 android:textColor="#333333"
147 android:textColorHint="#666666" 121 android:textColorHint="#666666"
148 /> 122 android:textSize="15dp"
123 app:layout_constraintBottom_toBottomOf="@id/view_4"
124 app:layout_constraintLeft_toRightOf="@id/tv_4"
125 app:layout_constraintRight_toRightOf="parent"
126 app:layout_constraintTop_toTopOf="@id/view_4" />
149 127
150 128
151 <View 129 <View
152 android:id="@+id/view_5" 130 android:id="@+id/view_5"
153 android:layout_width="match_parent" 131 android:layout_width="match_parent"
154 android:layout_height="45dp" 132 android:layout_height="45dp"
133 android:layout_marginTop="171dp"
155 android:background="@android:color/white" 134 android:background="@android:color/white"
156 app:layout_constraintLeft_toLeftOf="parent" 135 app:layout_constraintLeft_toLeftOf="parent"
157 app:layout_constraintRight_toRightOf="parent" 136 app:layout_constraintRight_toRightOf="parent"
158 app:layout_constraintTop_toTopOf="parent" 137 app:layout_constraintTop_toTopOf="parent" />
159 android:layout_marginTop="171dp" 138
160 /> 139
161 <ImageView
162 android:id="@+id/iv_5"
163 android:layout_width="20dp"
164 android:layout_height="16dp"
165 android:background="@mipmap/xs"
166 app:layout_constraintTop_toTopOf="@id/view_5"
167 app:layout_constraintBottom_toBottomOf="@id/view_5"
168 app:layout_constraintRight_toRightOf="@id/view_5"
169 android:layout_marginRight="20dp"
170 />
171 <TextView 140 <TextView
172 android:id="@+id/tv_5" 141 android:id="@+id/tv_5"
173 android:layout_width="wrap_content" 142 android:layout_width="wrap_content"
174 android:layout_height="wrap_content" 143 android:layout_height="wrap_content"
144 android:layout_marginLeft="15dp"
175 android:text="再次输入新密码" 145 android:text="再次输入新密码"
176 android:textColor="#333333" 146 android:textColor="#333333"
177 android:textSize="15dp" 147 android:textSize="15dp"
178 app:layout_constraintTop_toTopOf="@id/view_5"
179 app:layout_constraintBottom_toBottomOf="@id/view_5" 148 app:layout_constraintBottom_toBottomOf="@id/view_5"
180 app:layout_constraintLeft_toLeftOf="@id/view_5" 149 app:layout_constraintLeft_toLeftOf="@id/view_5"
181 android:layout_marginLeft="15dp" 150 app:layout_constraintTop_toTopOf="@id/view_5" />
182 />
183 151
184 152
185 <EditText 153 <EditText
154 android:id="@+id/et_pwd_2"
186 android:layout_width="0dp" 155 android:layout_width="0dp"
187 android:layout_height="45dp" 156 android:layout_height="45dp"
188 android:background="@android:color/transparent"
189 app:layout_constraintTop_toTopOf="@id/view_5"
190 app:layout_constraintBottom_toBottomOf="@id/view_5"
191 app:layout_constraintLeft_toRightOf="@id/tv_5"
192 app:layout_constraintRight_toRightOf="parent"
193 android:layout_marginLeft="15dp" 157 android:layout_marginLeft="15dp"
194 android:layout_marginRight="50dp" 158 android:layout_marginRight="50dp"
195 android:textSize="15dp" 159 android:background="@android:color/transparent"
196 android:gravity="left|center_vertical" 160 android:gravity="left|center_vertical"
197 android:inputType="textPassword"
198 android:hint="请再次输入密码" 161 android:hint="请再次输入密码"
162 android:inputType="textPassword"
199 android:textColor="#333333" 163 android:textColor="#333333"
200 android:textColorHint="#666666" 164 android:textColorHint="#666666"
201 /> 165 android:textSize="15dp"
166 app:layout_constraintBottom_toBottomOf="@id/view_5"
167 app:layout_constraintLeft_toRightOf="@id/tv_5"
168 app:layout_constraintRight_toRightOf="parent"
app/src/main/res/layout/activity_edit_stu.xml
File was created 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 <RelativeLayout
39 android:id="@+id/rl_avatar"
40 android:layout_width="75dp"
41 android:layout_height="75dp"
42 android:layout_marginTop="32dp"
43 app:layout_constraintLeft_toLeftOf="parent"
44 app:layout_constraintRight_toRightOf="parent"
45 app:layout_constraintTop_toBottomOf="@id/view_1">
46
47 <ImageView
48 android:id="@+id/iv_avatar"
49 android:layout_width="match_parent"
50 android:layout_height="match_parent"
51 android:background="@mipmap/txz" />
52
53 <ImageView
54 android:layout_width="20dp"
55 android:layout_height="20dp"
56 android:layout_alignParentRight="true"
57 android:layout_alignParentBottom="true"
58 android:layout_marginBottom="5dp"
59 android:src="@mipmap/ic_edit" />
60 </RelativeLayout>
61
62
63 <View
64 android:id="@+id/view_2"
65 android:layout_width="match_parent"
66 android:layout_marginLeft="15dp"
67 android:layout_marginRight="15dp"
68 android:layout_height="50dp"
69 android:layout_marginTop="195dp"
70 android:background="@drawable/bg_solid_white_10"
71 app:layout_constraintLeft_toLeftOf="parent"
72 app:layout_constraintRight_toRightOf="parent"
73 app:layout_constraintTop_toTopOf="parent" />
74
75 <TextView
76 android:layout_width="wrap_content"
77 android:layout_height="wrap_content"
78 android:layout_marginLeft="15dp"
79 android:text="昵称"
80 android:textColor="#666666"
81 android:textSize="16dp"
82 app:layout_constraintBottom_toBottomOf="@id/view_2"
83 app:layout_constraintLeft_toLeftOf="@id/view_2"
84 app:layout_constraintTop_toTopOf="@id/view_2" />
85
86 <ImageView
87 android:layout_width="5.5dp"
88 android:layout_height="9.5dp"
89 android:layout_marginRight="15dp"
90 android:background="@mipmap/ycaj"
91 app:layout_constraintBottom_toBottomOf="@id/view_2"
92 app:layout_constraintRight_toRightOf="@id/view_2"
93 app:layout_constraintTop_toTopOf="@id/view_2" />
94
95 <TextView
96 android:id="@+id/tv_name"
97 android:layout_width="wrap_content"
98 android:layout_height="wrap_content"
99 android:layout_marginRight="26dp"
100 android:text="请输入"
101 android:textColor="#333333"
102 android:textSize="16dp"
103 app:layout_constraintBottom_toBottomOf="@id/view_2"
104 app:layout_constraintRight_toRightOf="@id/view_2"
105 app:layout_constraintTop_toTopOf="@id/view_2" />
106
107 <View
108 android:id="@+id/view_3"
109 android:layout_width="match_parent"
110 android:layout_marginLeft="15dp"
111 android:layout_marginRight="15dp"
112 android:layout_height="50dp"
113 android:layout_marginTop="260dp"
114 android:background="@drawable/bg_solid_white_10"
115 app:layout_constraintLeft_toLeftOf="parent"
116 app:layout_constraintRight_toRightOf="parent"
117 app:layout_constraintTop_toTopOf="parent" />
118
119 <TextView
120 android:layout_width="wrap_content"
121 android:layout_height="wrap_content"
122 android:layout_marginLeft="15dp"
123 android:text="性别"
124 android:textColor="#666666"
125 android:textSize="16dp"
126 app:layout_constraintBottom_toBottomOf="@id/view_3"
127 app:layout_constraintLeft_toLeftOf="@id/view_3"
128 app:layout_constraintTop_toTopOf="@id/view_3" />
129
130 <ImageView
131 android:layout_width="5.5dp"
132 android:layout_height="9.5dp"
133 android:layout_marginRight="15dp"
134 android:background="@mipmap/ycaj"
135 app:layout_constraintBottom_toBottomOf="@id/view_3"
136 app:layout_constraintRight_toRightOf="@id/view_3"
137 app:layout_constraintTop_toTopOf="@id/view_3" />
138
139 <TextView
140 android:id="@+id/tv_sex"
141 android:layout_width="wrap_content"
142 android:layout_height="wrap_content"
143 android:layout_marginRight="26dp"
144 android:text="请选择"
145 android:textColor="#333333"
146 android:textSize="16dp"
147 app:layout_constraintBottom_toBottomOf="@id/view_3"
148 app:layout_constraintRight_toRightOf="@id/view_3"
149 app:layout_constraintTop_toTopOf="@id/view_3" />
150
151 <View
152 android:id="@+id/view_4"
153 android:layout_width="match_parent"
154 android:layout_marginLeft="15dp"
155 android:layout_marginRight="15dp"
156 android:layout_height="50dp"
157 android:layout_marginTop="325dp"
158 android:background="@drawable/bg_solid_white_10"
159 app:layout_constraintLeft_toLeftOf="parent"
160 app:layout_constraintRight_toRightOf="parent"
161 app:layout_constraintTop_toTopOf="parent"
162
163 />
164
165 <TextView
166 android:layout_width="wrap_content"
167 android:layout_height="wrap_content"
168 android:layout_marginLeft="15dp"
169 android:text="年级"
170 android:textColor="#666666"
171 android:textSize="16dp"
172 app:layout_constraintBottom_toBottomOf="@id/view_4"
173 app:layout_constraintLeft_toLeftOf="@id/view_4"
174 app:layout_constraintTop_toTopOf="@id/view_4" />
175
176 <ImageView
177 android:layout_width="5.5dp"
178 android:layout_height="9.5dp"
179 android:layout_marginRight="15dp"
180 android:background="@mipmap/ycaj"
181 app:layout_constraintBottom_toBottomOf="@id/view_4"
182 app:layout_constraintRight_toRightOf="@id/view_4"
183 app:layout_constraintTop_toTopOf="@id/view_4" />
184
185 <TextView
186 android:id="@+id/tv_nian"
187 android:layout_width="wrap_content"
188 android:layout_height="wrap_content"
189 android:layout_marginRight="26dp"
190 android:text="请选择"
191 android:textColor="#333333"
192 android:textSize="16dp"
193 app:layout_constraintBottom_toBottomOf="@id/view_4"
194 app:layout_constraintRight_toRightOf="@id/view_4"
195 app:layout_constraintTop_toTopOf="@id/view_4" />
196
197 <View
198 android:id="@+id/view_5"
199 android:layout_width="match_parent"
200 android:layout_marginLeft="15dp"
201 android:layout_marginRight="15dp"
202 android:layout_height="50dp"
203 android:layout_marginTop="390dp"
204 android:background="@drawable/bg_solid_white_10"
205 app:layout_constraintLeft_toLeftOf="parent"
206 app:layout_constraintRight_toRightOf="parent"
207 app:layout_constraintTop_toTopOf="parent"
208
209 />
210
211 <TextView
212
213 android:layout_width="wrap_content"
214 android:layout_height="wrap_content"
215 android:layout_marginLeft="15dp"
216 android:text="家长身份"
217 android:textColor="#666666"
218 android:textSize="16dp"
219 app:layout_constraintBottom_toBottomOf="@id/view_5"
220 app:layout_constraintLeft_toLeftOf="@id/view_5"
221 app:layout_constraintTop_toTopOf="@id/view_5" />
222
223 <TextView
224 android:id="@+id/tv_shen"
225 android:layout_width="wrap_content"
226 android:layout_height="wrap_content"
227 android:layout_marginRight="26dp"
228 android:text="请选择"
229 android:textColor="#333333"
230 android:textSize="16dp"
231 app:layout_constraintBottom_toBottomOf="@id/view_5"
232 app:layout_constraintRight_toRightOf="@id/view_5"
233 app:layout_constraintTop_toTopOf="@id/view_5" />
234
235 <ImageView
236 android:layout_width="5.5dp"
237 android:layout_height="9.5dp"
238 android:layout_marginRight="15dp"
239 android:background="@mipmap/ycaj"
240 app:layout_constraintBottom_toBottomOf="@id/view_5"
241 app:layout_constraintRight_toRightOf="@id/view_5"
242 app:layout_constraintTop_toTopOf="@id/view_5" />
243
244 <View
245 android:id="@+id/view_6"
246 android:layout_width="match_parent"
247 android:layout_marginLeft="15dp"
248 android:layout_marginRight="15dp"
249 android:layout_height="50dp"
250 android:layout_marginTop="455dp"
251 android:background="@drawable/bg_solid_white_10"
252 app:layout_constraintLeft_toLeftOf="parent"
253 app:layout_constraintRight_toRightOf="parent"
254 app:layout_constraintTop_toTopOf="parent"
255
256 />
257
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" />
289
290
291 <Button
292 android:id="@+id/btn_next"
293 android:layout_width="180dp"
294 android:layout_height="40dp"
295 android:layout_marginTop="570dp"
296 android:background="@drawable/bg_solid_btn_grad"
297 android:text="确认"
298 android:textColor="#999999"
299 android:textSize="16dp"
300 app:layout_constraintLeft_toLeftOf="parent"
301 app:layout_constraintRight_toRightOf="parent"
302 app:layout_constraintTop_toTopOf="parent" />
303
304
305 </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/activity_login.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="@mipmap/bg">
6 android:background="@mipmap/bg"
7 >
8
9 7
10 8
11 <TextView 9 <TextView
12 android:layout_width="wrap_content" 10 android:layout_width="wrap_content"
13 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
12 android:layout_marginLeft="30dp"
13 android:layout_marginTop="64dp"
14 android:text="登陆" 14 android:text="登陆"
15 android:textColor="#333333" 15 android:textColor="#333333"
16 android:textStyle="bold"
17 android:textSize="25dp" 16 android:textSize="25dp"
18 android:layout_marginLeft="30dp" 17 android:textStyle="bold"
19 android:layout_marginTop="64dp"
20 app:layout_constraintLeft_toLeftOf="parent" 18 app:layout_constraintLeft_toLeftOf="parent"
21 app:layout_constraintTop_toTopOf="parent" 19 app:layout_constraintTop_toTopOf="parent" />
22 />
23 20
24 <View 21 <View
25 android:id="@+id/view_1" 22 android:id="@+id/view_1"
26 android:layout_width="315dp" 23 android:layout_width="315dp"
27 android:layout_height="50dp" 24 android:layout_height="50dp"
28 app:layout_constraintLeft_toLeftOf="parent"
29 app:layout_constraintRight_toRightOf="parent"
30 app:layout_constraintTop_toTopOf="parent"
31 android:layout_marginTop="166dp" 25 android:layout_marginTop="166dp"
32 android:background="@drawable/bg_solid_white" 26 android:background="@drawable/bg_solid_white"
33 /> 27 app:layout_constraintLeft_toLeftOf="parent"
28 app:layout_constraintRight_toRightOf="parent"
29 app:layout_constraintTop_toTopOf="parent" />
34 30
35 <ImageView 31 <ImageView
36 android:id="@+id/iv_1" 32 android:id="@+id/iv_1"
37 android:layout_width="16dp" 33 android:layout_width="16dp"
38 android:layout_height="18dp" 34 android:layout_height="18dp"
39 app:layout_constraintTop_toTopOf="@id/view_1" 35 android:layout_marginLeft="20dp"
36 android:background="@mipmap/sjh"
40 app:layout_constraintBottom_toBottomOf="@id/view_1" 37 app:layout_constraintBottom_toBottomOf="@id/view_1"
41 app:layout_constraintLeft_toLeftOf="@id/view_1" 38 app:layout_constraintLeft_toLeftOf="@id/view_1"
42 android:background="@mipmap/sjh" 39 app:layout_constraintTop_toTopOf="@id/view_1" />
43 android:layout_marginLeft="20dp"
44 />
45 40
46 <ImageView 41 <ImageView
47 android:id="@+id/iv_2" 42 android:id="@+id/iv_2"
48 android:layout_width="13dp" 43 android:layout_width="13dp"
49 android:layout_height="13dp" 44 android:layout_height="13dp"
45 android:layout_marginRight="20dp"
50 android:background="@mipmap/sc" 46 android:background="@mipmap/sc"
51 app:layout_constraintTop_toTopOf="@id/view_1"
52 app:layout_constraintBottom_toBottomOf="@id/view_1" 47 app:layout_constraintBottom_toBottomOf="@id/view_1"
53 app:layout_constraintRight_toRightOf="@id/view_1" 48 app:layout_constraintRight_toRightOf="@id/view_1"
54 android:layout_marginRight="20dp" 49 app:layout_constraintTop_toTopOf="@id/view_1" />
55 />
56 50
57 <EditText 51 <EditText
58 android:id="@+id/et_phone" 52 android:id="@+id/et_phone"
59 android:layout_width="0dp" 53 android:layout_width="0dp"
60 android:layout_height="0dp" 54 android:layout_height="0dp"
55 android:layout_marginLeft="46dp"
61 android:background="@android:color/transparent" 56 android:background="@android:color/transparent"
62 app:layout_constraintTop_toTopOf="@id/view_1"
63 app:layout_constraintBottom_toBottomOf="@id/view_1"
64 app:layout_constraintRight_toLeftOf="@id/iv_2"
65 app:layout_constraintLeft_toLeftOf="@id/view_1"
66 android:textColorHint="#999999"
67 android:hint="请输入手机号"
68 android:textSize="16dp"
69 android:gravity="left|center_vertical" 57 android:gravity="left|center_vertical"
58 android:hint="请输入手机号"
70 android:inputType="number" 59 android:inputType="number"
71 android:layout_marginLeft="46dp"
72 android:maxLength="11" 60 android:maxLength="11"
73 /> 61 android:textColorHint="#999999"
62 android:textSize="16dp"
63 app:layout_constraintBottom_toBottomOf="@id/view_1"
64 app:layout_constraintLeft_toLeftOf="@id/view_1"
65 app:layout_constraintRight_toLeftOf="@id/iv_2"
66 app:layout_constraintTop_toTopOf="@id/view_1" />
74 67
75 68
76 <View 69 <View
77 android:id="@+id/view_2" 70 android:id="@+id/view_2"
78 android:layout_width="315dp" 71 android:layout_width="315dp"
79 android:layout_height="50dp" 72 android:layout_height="50dp"
80 app:layout_constraintLeft_toLeftOf="parent"
81 app:layout_constraintRight_toRightOf="parent"
82 app:layout_constraintTop_toTopOf="parent"
83 android:layout_marginTop="241dp" 73 android:layout_marginTop="241dp"
84 android:background="@drawable/bg_solid_white" 74 android:background="@drawable/bg_solid_white"
85 /> 75 app:layout_constraintLeft_toLeftOf="parent"
76 app:layout_constraintRight_toRightOf="parent"
77 app:layout_constraintTop_toTopOf="parent" />
86 78
87 <ImageView 79 <ImageView
88 android:id="@+id/iv_3" 80 android:id="@+id/iv_3"
89 android:layout_width="16dp" 81 android:layout_width="16dp"
90 android:layout_height="18dp" 82 android:layout_height="18dp"
91 app:layout_constraintTop_toTopOf="@id/view_2" 83 android:layout_marginLeft="20dp"
84 android:background="@mipmap/mm"
92 app:layout_constraintBottom_toBottomOf="@id/view_2" 85 app:layout_constraintBottom_toBottomOf="@id/view_2"
93 app:layout_constraintLeft_toLeftOf="@id/view_2" 86 app:layout_constraintLeft_toLeftOf="@id/view_2"
94 android:background="@mipmap/mm" 87 app:layout_constraintTop_toTopOf="@id/view_2" />
95 android:layout_marginLeft="20dp"
96 />
97 88
98 <ImageView 89 <ImageView
99 android:id="@+id/iv_4" 90 android:id="@+id/iv_4"
100 android:layout_width="20dp" 91 android:layout_width="20dp"
101 android:layout_height="16dp" 92 android:layout_height="16dp"
93 android:layout_marginRight="20dp"
102 android:background="@mipmap/xs" 94 android:background="@mipmap/xs"
103 app:layout_constraintTop_toTopOf="@id/view_2"
104 app:layout_constraintBottom_toBottomOf="@id/view_2" 95 app:layout_constraintBottom_toBottomOf="@id/view_2"
105 app:layout_constraintRight_toRightOf="@id/view_2" 96 app:layout_constraintRight_toRightOf="@id/view_2"
106 android:layout_marginRight="20dp" 97 app:layout_constraintTop_toTopOf="@id/view_2" />
107 />
108 98
109 <EditText 99 <EditText
110 android:id="@+id/et_pwd" 100 android:id="@+id/et_pwd"
111 android:layout_width="0dp" 101 android:layout_width="0dp"
112 android:layout_height="0dp" 102 android:layout_height="0dp"
103 android:layout_marginLeft="46dp"
104 android:layout_marginRight="20dp"
113 android:background="@android:color/transparent" 105 android:background="@android:color/transparent"
114 app:layout_constraintTop_toTopOf="@id/view_2" 106 android:gravity="left|center_vertical"
107 android:hint="请输入密码"
108 android:inputType="textPassword"
109 android:textColorHint="#999999"
110 android:textSize="16dp"
115 app:layout_constraintBottom_toBottomOf="@id/view_2" 111 app:layout_constraintBottom_toBottomOf="@id/view_2"
116 app:layout_constraintLeft_toLeftOf="@id/view_2" 112 app:layout_constraintLeft_toLeftOf="@id/view_2"
117 app:layout_constraintRight_toLeftOf="@id/iv_4" 113 app:layout_constraintRight_toLeftOf="@id/iv_4"
118 android:layout_marginLeft="46dp" 114 app:layout_constraintTop_toTopOf="@id/view_2" />
119 android:textColorHint="#999999"
120 android:hint="请输入密码"
121 android:textSize="16dp"
122 android:gravity="left|center_vertical"
123 android:inputType="textPassword"
124 android:layout_marginRight="20dp"
125 />
126 115
127 116
128 <Button 117 <Button
129 android:id="@+id/btn_1" 118 android:id="@+id/btn_1"
130 android:layout_width="315dp" 119 android:layout_width="315dp"
131 android:layout_height="50dp" 120 android:layout_height="50dp"
132 app:layout_constraintLeft_toLeftOf="parent"
133 app:layout_constraintRight_toRightOf="parent"
134 app:layout_constraintTop_toTopOf="parent"
135 android:layout_marginTop="331dp" 121 android:layout_marginTop="331dp"
136 android:background="@drawable/bg_solid_btn" 122 android:background="@drawable/bg_solid_btn"
123 android:text="登陆"
137 android:textColor="@color/white" 124 android:textColor="@color/white"
138 android:textSize="18dp" 125 android:textSize="18dp"
139 android:text="登陆" 126 app:layout_constraintLeft_toLeftOf="parent"
140 /> 127 app:layout_constraintRight_toRightOf="parent"
128 app:layout_constraintTop_toTopOf="parent" />
129
141 <TextView 130 <TextView
142 android:id="@+id/tv_1" 131 android:id="@+id/tv_1"
143 android:layout_width="wrap_content" 132 android:layout_width="wrap_content"
144 android:layout_height="wrap_content" 133 android:layout_height="wrap_content"
134 android:layout_marginLeft="85dp"
135 android:layout_marginTop="15dp"
145 android:text="没有账号,立即" 136 android:text="没有账号,立即"
146 android:textColor="#666666" 137 android:textColor="#666666"
147 android:textSize="17dp" 138 android:textSize="17dp"
148 app:layout_constraintLeft_toLeftOf="@id/btn_1" 139 app:layout_constraintLeft_toLeftOf="@id/btn_1"
149 app:layout_constraintTop_toBottomOf="@id/btn_1" 140 app:layout_constraintTop_toBottomOf="@id/btn_1" />
150 android:layout_marginLeft="85dp" 141
151 android:layout_marginTop="15dp"
152 />
153 <TextView 142 <TextView
154 android:id="@+id/tv_2" 143 android:id="@+id/tv_2"
155 android:layout_width="wrap_content" 144 android:layout_width="wrap_content"
156 android:layout_height="wrap_content" 145 android:layout_height="wrap_content"
146 android:layout_marginTop="15dp"
157 android:text="注册" 147 android:text="注册"
158 android:textColor="#FE5E09" 148 android:textColor="#FE5E09"
159 android:textSize="17dp" 149 android:textSize="17dp"
160 app:layout_constraintLeft_toRightOf="@id/tv_1" 150 app:layout_constraintLeft_toRightOf="@id/tv_1"
161 app:layout_constraintTop_toBottomOf="@id/btn_1" 151 app:layout_constraintTop_toBottomOf="@id/btn_1" />
162 android:layout_marginTop="15dp"
163 />
164 152
165 153
166 <CheckBox 154 <CheckBox
167 android:id="@+id/cb_1" 155 android:id="@+id/cb_1"
168 android:layout_width="13dp" 156 android:layout_width="wrap_content"
169 android:layout_height="13dp" 157 android:layout_height="wrap_content"
170 app:layout_constraintBottom_toBottomOf="parent"
171 app:layout_constraintLeft_toLeftOf="parent"
172 android:layout_marginLeft="67dp" 158 android:layout_marginLeft="67dp"
173 android:layout_marginBottom="50dp" 159 android:layout_marginBottom="50dp"
174 android:background="@android:color/transparent" 160 android:background="@android:color/transparent"
175 android:button="@drawable/checked_xc" 161 app:layout_constraintBottom_toBottomOf="parent"
176 /> 162 app:layout_constraintLeft_toLeftOf="parent" />
163
177 <TextView 164 <TextView
178 android:id="@+id/tv_3" 165 android:id="@+id/tv_3"
179 android:layout_width="wrap_content" 166 android:layout_width="wrap_content"
180 android:layout_height="wrap_content" 167 android:layout_height="wrap_content"
168 android:layout_marginLeft="5dp"
181 android:text="已阅读并同意《" 169 android:text="已阅读并同意《"
182 android:textColor="#999999" 170 android:textColor="#999999"
183 android:textSize="12dp" 171 android:textSize="12dp"
184 app:layout_constraintLeft_toRightOf="@id/cb_1"
185 app:layout_constraintTop_toTopOf="@id/cb_1"
186 app:layout_constraintBottom_toBottomOf="@id/cb_1" 172 app:layout_constraintBottom_toBottomOf="@id/cb_1"
187 android:layout_marginLeft="5dp" 173 app:layout_constraintLeft_toRightOf="@id/cb_1"
188 /> 174 app:layout_constraintTop_toTopOf="@id/cb_1" />
175
189 <TextView 176 <TextView
190 android:id="@+id/tv_4" 177 android:id="@+id/tv_4"
191 android:layout_width="wrap_content" 178 android:layout_width="wrap_content"
192 android:layout_height="wrap_content" 179 android:layout_height="wrap_content"
193 android:text="用户协议" 180 android:text="用户协议"
194 android:textColor="#FE5E09" 181 android:textColor="#FE5E09"
195 android:textSize="12dp" 182 android:textSize="12dp"
196 app:layout_constraintLeft_toRightOf="@id/tv_3"
197 app:layout_constraintTop_toTopOf="@id/cb_1"
198 app:layout_constraintBottom_toBottomOf="@id/cb_1" 183 app:layout_constraintBottom_toBottomOf="@id/cb_1"
199 /> 184 app:layout_constraintLeft_toRightOf="@id/tv_3"
185 app:layout_constraintTop_toTopOf="@id/cb_1" />
186
200 <TextView 187 <TextView
201 android:id="@+id/tv_5" 188 android:id="@+id/tv_5"
202 android:layout_width="wrap_content" 189 android:layout_width="wrap_content"
203 android:layout_height="wrap_content" 190 android:layout_height="wrap_content"
app/src/main/res/layout/activity_me.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 5 xmlns:app="http://schemas.android.com/apk/res-auto"
6 android:background="#F4F6F8" 6 android:background="#F4F6F8"
7 > 7 >
8 8
9 <View 9 <View
10 android:id="@+id/view_1" 10 android:id="@+id/view_1"
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="44dp" 12 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent" 13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 14 android:background="@android:color/white"
15 /> 15 />
16 <TextView 16 <TextView
17 android:layout_width="wrap_content" 17 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 18 android:layout_height="wrap_content"
19 android:text="关于我们" 19 android:text="关于我们"
20 android:textColor="#333333" 20 android:textColor="#333333"
21 android:textSize="18dp" 21 android:textSize="18dp"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1"
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25 app:layout_constraintBottom_toBottomOf="@id/view_1"
26 /> 26 />
27 <ImageView 27 <ImageView
28 android:id="@+id/iv_back" 28 android:id="@+id/iv_back"
29 android:layout_width="10dp" 29 android:layout_width="10dp"
30 android:layout_height="16dp" 30 android:layout_height="16dp"
31 app:layout_constraintLeft_toLeftOf="parent" 31 app:layout_constraintLeft_toLeftOf="parent"
32 app:layout_constraintTop_toTopOf="@id/view_1" 32 app:layout_constraintTop_toTopOf="@id/view_1"
33 app:layout_constraintBottom_toBottomOf="@id/view_1" 33 app:layout_constraintBottom_toBottomOf="@id/view_1"
34 android:layout_marginLeft="15dp" 34 android:layout_marginLeft="15dp"
35 android:background="@mipmap/icon_back" 35 android:background="@mipmap/icon_back"
36 /> 36 />
37 <View 37 <View
38 android:layout_width="match_parent" 38 android:layout_width="match_parent"
39 android:layout_height="1dp" 39 android:layout_height="1dp"
40 android:background="#EEEEEE" 40 android:background="#EEEEEE"
41 app:layout_constraintTop_toBottomOf="@id/view_1" 41 app:layout_constraintTop_toBottomOf="@id/view_1"
42 /> 42 />
43 43
44 <View 44 <View
45 android:id="@+id/view_3" 45 android:id="@+id/view_3"
46 android:layout_width="345dp" 46 android:layout_width="match_parent"
47 android:layout_marginLeft="15dp"
48 android:layout_marginRight="15dp"
47 android:layout_height="68dp" 49 android:layout_height="68dp"
48 android:background="@drawable/bg_solid_white_10" 50 android:background="@drawable/bg_solid_white_10"
49 app:layout_constraintLeft_toLeftOf="parent" 51 app:layout_constraintLeft_toLeftOf="parent"
50 app:layout_constraintRight_toRightOf="parent" 52 app:layout_constraintRight_toRightOf="parent"
51 app:layout_constraintTop_toTopOf="parent" 53 app:layout_constraintTop_toTopOf="parent"
52 android:layout_marginTop="90dp" 54 android:layout_marginTop="90dp"
53 /> 55 />
54 <TextView 56 <TextView
55 android:layout_width="wrap_content" 57 android:layout_width="wrap_content"
56 android:layout_height="wrap_content" 58 android:layout_height="wrap_content"
57 android:text="我们的官网" 59 android:text="我们的官网"
58 android:textColor="#333333" 60 android:textColor="#333333"
59 android:textSize="15dp" 61 android:textSize="15dp"
60 app:layout_constraintLeft_toLeftOf="@id/view_3" 62 app:layout_constraintLeft_toLeftOf="@id/view_3"
61 app:layout_constraintTop_toTopOf="@id/view_3" 63 app:layout_constraintTop_toTopOf="@id/view_3"
62 android:layout_marginLeft="15dp" 64 android:layout_marginLeft="15dp"
63 android:layout_marginTop="15dp" 65 android:layout_marginTop="15dp"
64 /> 66 />
65 <TextView 67 <TextView
66 android:layout_width="wrap_content" 68 android:layout_width="wrap_content"
67 android:layout_height="wrap_content" 69 android:layout_height="wrap_content"
68 android:text="www.hjx.com" 70 android:text="www.hjx.com"
69 android:textColor="#666666" 71 android:textColor="#666666"
70 android:textSize="13dp" 72 android:textSize="13dp"
71 app:layout_constraintLeft_toLeftOf="@id/view_3" 73 app:layout_constraintLeft_toLeftOf="@id/view_3"
72 app:layout_constraintBottom_toBottomOf="@id/view_3" 74 app:layout_constraintBottom_toBottomOf="@id/view_3"
73 android:layout_marginLeft="15dp" 75 android:layout_marginLeft="15dp"
74 android:layout_marginBottom="15dp" 76 android:layout_marginBottom="15dp"
75 /> 77 />
76 78
77 <View 79 <View
78 android:id="@+id/view_4" 80 android:id="@+id/view_4"
79 android:layout_width="345dp" 81 android:layout_width="match_parent"
82 android:layout_marginLeft="15dp"
83 android:layout_marginRight="15dp"
80 android:layout_height="111dp" 84 android:layout_height="111dp"
81 android:background="@drawable/bg_solid_white_10" 85 android:background="@drawable/bg_solid_white_10"
82 app:layout_constraintLeft_toLeftOf="parent" 86 app:layout_constraintLeft_toLeftOf="parent"
83 app:layout_constraintRight_toRightOf="parent" 87 app:layout_constraintRight_toRightOf="parent"
84 app:layout_constraintTop_toTopOf="parent" 88 app:layout_constraintTop_toTopOf="parent"
85 android:layout_marginTop="173dp" 89 android:layout_marginTop="173dp"
86 /> 90 />
87 <TextView 91 <TextView
88 android:layout_width="wrap_content" 92 android:layout_width="wrap_content"
89 android:layout_height="wrap_content" 93 android:layout_height="wrap_content"
90 android:text="联系我们" 94 android:text="联系我们"
91 android:textColor="#333333" 95 android:textColor="#333333"
92 android:textSize="15dp" 96 android:textSize="15dp"
93 app:layout_constraintLeft_toLeftOf="@id/view_4" 97 app:layout_constraintLeft_toLeftOf="@id/view_4"
94 app:layout_constraintTop_toTopOf="@id/view_4" 98 app:layout_constraintTop_toTopOf="@id/view_4"
95 android:layout_marginLeft="15dp" 99 android:layout_marginLeft="15dp"
96 android:layout_marginTop="15dp" 100 android:layout_marginTop="15dp"
97 /> 101 />
98 <TextView 102 <TextView
99 android:id="@+id/tv_3" 103 android:id="@+id/tv_3"
100 android:layout_width="wrap_content" 104 android:layout_width="wrap_content"
101 android:layout_height="wrap_content" 105 android:layout_height="wrap_content"
102 android:text="邮箱: www.info@hjx.com" 106 android:text="邮箱: www.info@hjx.com"
103 android:textColor="#666666" 107 android:textColor="#666666"
104 android:textSize="15dp" 108 android:textSize="15dp"
105 app:layout_constraintLeft_toLeftOf="@id/view_4" 109 app:layout_constraintLeft_toLeftOf="@id/view_4"
106 app:layout_constraintTop_toTopOf="@id/view_4" 110 app:layout_constraintTop_toTopOf="@id/view_4"
107 android:layout_marginLeft="15dp" 111 android:layout_marginLeft="15dp"
108 android:layout_marginTop="44dp" 112 android:layout_marginTop="44dp"
109 /> 113 />
110 <TextView 114 <TextView
111 android:id="@+id/tv_4" 115 android:id="@+id/tv_4"
112 android:layout_width="wrap_content" 116 android:layout_width="wrap_content"
113 android:layout_height="wrap_content" 117 android:layout_height="wrap_content"
114 android:text="客服电话: 400-800-3813" 118 android:text="客服电话: 400-800-3813"
115 android:textColor="#666666" 119 android:textColor="#666666"
116 android:textSize="15dp" 120 android:textSize="15dp"
117 app:layout_constraintLeft_toLeftOf="@id/view_4" 121 app:layout_constraintLeft_toLeftOf="@id/view_4"
118 app:layout_constraintTop_toBottomOf="@id/tv_3" 122 app:layout_constraintTop_toBottomOf="@id/tv_3"
119 android:layout_marginLeft="15dp" 123 android:layout_marginLeft="15dp"
120 /> 124 />
121 <TextView 125 <TextView
122 android:layout_width="wrap_content" 126 android:layout_width="wrap_content"
123 android:layout_height="wrap_content" 127 android:layout_height="wrap_content"
124 android:text="地址: 上海市徐汇区桂箐路65号新研大厦B座701室" 128 android:text="地址: 上海市徐汇区桂箐路65号新研大厦B座701室"
125 android:textColor="#666666" 129 android:textColor="#666666"
126 android:textSize="15dp" 130 android:textSize="15dp"
127 app:layout_constraintLeft_toLeftOf="@id/view_4" 131 app:layout_constraintLeft_toLeftOf="@id/view_4"
128 app:layout_constraintTop_toBottomOf="@id/tv_4" 132 app:layout_constraintTop_toBottomOf="@id/tv_4"
129 android:layout_marginLeft="15dp" 133 android:layout_marginLeft="15dp"
130 /> 134 />
131 135
132 <View 136 <View
133 android:id="@+id/view_5" 137 android:id="@+id/view_5"
134 android:layout_width="345dp" 138 android:layout_width="match_parent"
139 android:layout_marginLeft="15dp"
140 android:layout_marginRight="15dp"
135 android:layout_height="132dp" 141 android:layout_height="132dp"
136 android:background="@drawable/bg_solid_white_10" 142 android:background="@drawable/bg_solid_white_10"
137 app:layout_constraintLeft_toLeftOf="parent" 143 app:layout_constraintLeft_toLeftOf="parent"
138 app:layout_constraintRight_toRightOf="parent" 144 app:layout_constraintRight_toRightOf="parent"
139 app:layout_constraintTop_toTopOf="parent" 145 app:layout_constraintTop_toTopOf="parent"
140 android:layout_marginTop="299dp" 146 android:layout_marginTop="299dp"
141 /> 147 />
142 <TextView 148 <TextView
143 android:layout_width="wrap_content" 149 android:layout_width="wrap_content"
144 android:layout_height="wrap_content" 150 android:layout_height="wrap_content"
145 android:text="官方微信公众号" 151 android:text="官方微信公众号"
146 android:textColor="#333333" 152 android:textColor="#333333"
147 android:textSize="15dp" 153 android:textSize="15dp"
148 app:layout_constraintLeft_toLeftOf="@id/view_5" 154 app:layout_constraintLeft_toLeftOf="@id/view_5"
149 app:layout_constraintTop_toTopOf="@id/view_5" 155 app:layout_constraintTop_toTopOf="@id/view_5"
150 android:layout_marginLeft="15dp" 156 android:layout_marginLeft="15dp"
151 android:layout_marginTop="15dp" 157 android:layout_marginTop="15dp"
152 /> 158 />
153 159
154 <ImageView 160 <ImageView
155 android:layout_width="73dp" 161 android:layout_width="73dp"
156 android:layout_height="73dp" 162 android:layout_height="73dp"
157 app:layout_constraintLeft_toLeftOf="@id/view_5" 163 app:layout_constraintLeft_toLeftOf="@id/view_5"
158 app:layout_constraintRight_toRightOf="@id/view_5" 164 app:layout_constraintRight_toRightOf="@id/view_5"
159 app:layout_constraintBottom_toBottomOf="@id/view_5" 165 app:layout_constraintBottom_toBottomOf="@id/view_5"
160 android:layout_marginBottom="15dp" 166 android:layout_marginBottom="15dp"
161 android:background="@mipmap/eco" 167 android:background="@mipmap/eco"
162 /> 168 />
163 169
164 170
165 </androidx.constraintlayout.widget.ConstraintLayout> 171 </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/activity_register.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="@mipmap/bg">
6 android:background="@mipmap/bg"
7 >
8
9 7
10 8
11 <TextView 9 <TextView
12 android:layout_width="wrap_content" 10 android:layout_width="wrap_content"
13 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
12 android:layout_marginLeft="30dp"
13 android:layout_marginTop="64dp"
14 android:text="注册" 14 android:text="注册"
15 android:textColor="#333333" 15 android:textColor="#333333"
16 android:textStyle="bold"
17 android:textSize="25dp" 16 android:textSize="25dp"
18 android:layout_marginLeft="30dp" 17 android:textStyle="bold"
19 android:layout_marginTop="64dp"
20 app:layout_constraintLeft_toLeftOf="parent" 18 app:layout_constraintLeft_toLeftOf="parent"
21 app:layout_constraintTop_toTopOf="parent" 19 app:layout_constraintTop_toTopOf="parent" />
22 />
23 20
24 <View 21 <View
25 android:id="@+id/view_1" 22 android:id="@+id/view_1"
26 android:layout_width="315dp" 23 android:layout_width="315dp"
27 android:layout_height="50dp" 24 android:layout_height="50dp"
28 app:layout_constraintLeft_toLeftOf="parent"
29 app:layout_constraintRight_toRightOf="parent"
30 app:layout_constraintTop_toTopOf="parent"
31 android:layout_marginTop="166dp" 25 android:layout_marginTop="166dp"
32 android:background="@drawable/bg_solid_white" 26 android:background="@drawable/bg_solid_white"
33 /> 27 app:layout_constraintLeft_toLeftOf="parent"
28 app:layout_constraintRight_toRightOf="parent"
29 app:layout_constraintTop_toTopOf="parent" />
34 30
35 <ImageView 31 <ImageView
36 android:id="@+id/iv_1" 32 android:id="@+id/iv_1"
37 android:layout_width="16dp" 33 android:layout_width="16dp"
38 android:layout_height="18dp" 34 android:layout_height="18dp"
39 app:layout_constraintTop_toTopOf="@id/view_1" 35 android:layout_marginLeft="20dp"
36 android:background="@mipmap/sjh"
40 app:layout_constraintBottom_toBottomOf="@id/view_1" 37 app:layout_constraintBottom_toBottomOf="@id/view_1"
41 app:layout_constraintLeft_toLeftOf="@id/view_1" 38 app:layout_constraintLeft_toLeftOf="@id/view_1"
42 android:background="@mipmap/sjh" 39 app:layout_constraintTop_toTopOf="@id/view_1" />
43 android:layout_marginLeft="20dp"
44 />
45 40
46 <ImageView 41 <ImageView
47 android:id="@+id/iv_2" 42 android:id="@+id/iv_2"
48 android:layout_width="13dp" 43 android:layout_width="13dp"
49 android:layout_height="13dp" 44 android:layout_height="13dp"
45 android:layout_marginRight="20dp"
50 android:background="@mipmap/sc" 46 android:background="@mipmap/sc"
51 app:layout_constraintTop_toTopOf="@id/view_1"
52 app:layout_constraintBottom_toBottomOf="@id/view_1" 47 app:layout_constraintBottom_toBottomOf="@id/view_1"
53 app:layout_constraintRight_toRightOf="@id/view_1" 48 app:layout_constraintRight_toRightOf="@id/view_1"
54 android:layout_marginRight="20dp" 49 app:layout_constraintTop_toTopOf="@id/view_1" />
55 />
56 50
57 <EditText 51 <EditText
58 android:id="@+id/et_phone" 52 android:id="@+id/et_phone"
59 android:layout_width="0dp" 53 android:layout_width="0dp"
60 android:layout_height="0dp" 54 android:layout_height="0dp"
55 android:layout_marginLeft="46dp"
61 android:background="@android:color/transparent" 56 android:background="@android:color/transparent"
62 app:layout_constraintTop_toTopOf="@id/view_1"
63 app:layout_constraintBottom_toBottomOf="@id/view_1"
64 app:layout_constraintRight_toLeftOf="@id/iv_2"
65 app:layout_constraintLeft_toLeftOf="@id/view_1"
66 android:textColorHint="#999999"
67 android:hint="请输入手机号"
68 android:textSize="16dp"
69 android:gravity="left|center_vertical" 57 android:gravity="left|center_vertical"
58 android:hint="请输入手机号"
70 android:inputType="number" 59 android:inputType="number"
71 android:layout_marginLeft="46dp"
72 android:maxLength="11" 60 android:maxLength="11"
73 android:textColor="#333333" 61 android:textColor="#333333"
74 /> 62 android:textColorHint="#999999"
63 android:textSize="16dp"
64 app:layout_constraintBottom_toBottomOf="@id/view_1"
65 app:layout_constraintLeft_toLeftOf="@id/view_1"
66 app:layout_constraintRight_toLeftOf="@id/iv_2"
67 app:layout_constraintTop_toTopOf="@id/view_1" />
75 68
76 69
77 <View 70 <View
78 android:id="@+id/view_2" 71 android:id="@+id/view_2"
79 android:layout_width="315dp" 72 android:layout_width="315dp"
80 android:layout_height="50dp" 73 android:layout_height="50dp"
81 app:layout_constraintLeft_toLeftOf="parent"
82 app:layout_constraintRight_toRightOf="parent"
83 app:layout_constraintTop_toTopOf="parent"
84 android:layout_marginTop="241dp" 74 android:layout_marginTop="241dp"
85 android:background="@drawable/bg_solid_white" 75 android:background="@drawable/bg_solid_white"
86 /> 76 app:layout_constraintLeft_toLeftOf="parent"
77 app:layout_constraintRight_toRightOf="parent"
78 app:layout_constraintTop_toTopOf="parent" />
87 79
88 <ImageView 80 <ImageView
89 android:id="@+id/iv_3" 81 android:id="@+id/iv_3"
90 android:layout_width="16dp" 82 android:layout_width="16dp"
91 android:layout_height="18dp" 83 android:layout_height="18dp"
92 app:layout_constraintTop_toTopOf="@id/view_2" 84 android:layout_marginLeft="20dp"
85 android:background="@mipmap/mm"
93 app:layout_constraintBottom_toBottomOf="@id/view_2" 86 app:layout_constraintBottom_toBottomOf="@id/view_2"
94 app:layout_constraintLeft_toLeftOf="@id/view_2" 87 app:layout_constraintLeft_toLeftOf="@id/view_2"
95 android:background="@mipmap/mm" 88 app:layout_constraintTop_toTopOf="@id/view_2" />
96 android:layout_marginLeft="20dp"
97 />
98 89
99 <ImageView 90 <ImageView
100 android:id="@+id/iv_4" 91 android:id="@+id/iv_4"
101 android:layout_width="20dp" 92 android:layout_width="20dp"
102 android:layout_height="16dp" 93 android:layout_height="16dp"
94 android:layout_marginRight="20dp"
103 android:background="@mipmap/xs" 95 android:background="@mipmap/xs"
104 app:layout_constraintTop_toTopOf="@id/view_2"
105 app:layout_constraintBottom_toBottomOf="@id/view_2" 96 app:layout_constraintBottom_toBottomOf="@id/view_2"
106 app:layout_constraintRight_toRightOf="@id/view_2" 97 app:layout_constraintRight_toRightOf="@id/view_2"
107 android:layout_marginRight="20dp" 98 app:layout_constraintTop_toTopOf="@id/view_2" />
108 />
109 99
110 <EditText 100 <EditText
111 android:id="@+id/et_pwd" 101 android:id="@+id/et_pwd"
112 android:layout_width="0dp" 102 android:layout_width="0dp"
113 android:layout_height="0dp" 103 android:layout_height="0dp"
114 android:background="@android:color/transparent"
115 app:layout_constraintTop_toTopOf="@id/view_2"
116 app:layout_constraintBottom_toBottomOf="@id/view_2"
117 app:layout_constraintLeft_toLeftOf="@id/view_2"
118 app:layout_constraintRight_toLeftOf="@id/iv_4"
119 android:layout_marginLeft="46dp" 104 android:layout_marginLeft="46dp"
120 android:textColorHint="#999999" 105 android:layout_marginRight="20dp"
121 android:hint="请输入密码" 106 android:background="@android:color/transparent"
122 android:textSize="16dp"
123 android:gravity="left|center_vertical" 107 android:gravity="left|center_vertical"
108 android:hint="请输入密码"
124 android:inputType="textPassword" 109 android:inputType="textPassword"
125 android:layout_marginRight="20dp"
126 android:textColor="#333333" 110 android:textColor="#333333"
127 /> 111 android:textColorHint="#999999"
112 android:textSize="16dp"
113 app:layout_constraintBottom_toBottomOf="@id/view_2"
114 app:layout_constraintLeft_toLeftOf="@id/view_2"
115 app:layout_constraintRight_toLeftOf="@id/iv_4"
116 app:layout_constraintTop_toTopOf="@id/view_2" />
128 117
129 118
130 <View 119 <View
131 android:id="@+id/view_3" 120 android:id="@+id/view_3"
132 android:layout_width="315dp" 121 android:layout_width="315dp"
133 android:layout_height="50dp" 122 android:layout_height="50dp"
134 app:layout_constraintLeft_toLeftOf="parent"
135 app:layout_constraintRight_toRightOf="parent"
136 app:layout_constraintTop_toTopOf="parent"
137 android:layout_marginTop="316dp" 123 android:layout_marginTop="316dp"
138 android:background="@drawable/bg_solid_white" 124 android:background="@drawable/bg_solid_white"
139 /> 125 app:layout_constraintLeft_toLeftOf="parent"
126 app:layout_constraintRight_toRightOf="parent"
127 app:layout_constraintTop_toTopOf="parent" />
140 128
141 <ImageView 129 <ImageView
142 android:id="@+id/iv_5" 130 android:id="@+id/iv_5"
143 android:layout_width="16dp" 131 android:layout_width="16dp"
144 android:layout_height="18dp" 132 android:layout_height="18dp"
145 app:layout_constraintTop_toTopOf="@id/view_3" 133 android:layout_marginLeft="20dp"
134 android:background="@mipmap/mm"
146 app:layout_constraintBottom_toBottomOf="@id/view_3" 135 app:layout_constraintBottom_toBottomOf="@id/view_3"
147 app:layout_constraintLeft_toLeftOf="@id/view_3" 136 app:layout_constraintLeft_toLeftOf="@id/view_3"
148 android:background="@mipmap/mm" 137 app:layout_constraintTop_toTopOf="@id/view_3" />
149 android:layout_marginLeft="20dp"
150 />
151 138
152 <ImageView 139 <ImageView
153 android:id="@+id/iv_6" 140 android:id="@+id/iv_6"
154 android:layout_width="20dp" 141 android:layout_width="20dp"
155 android:layout_height="16dp" 142 android:layout_height="16dp"
143 android:layout_marginRight="20dp"
156 android:background="@mipmap/xs" 144 android:background="@mipmap/xs"
157 app:layout_constraintTop_toTopOf="@id/view_3"
158 app:layout_constraintBottom_toBottomOf="@id/view_3" 145 app:layout_constraintBottom_toBottomOf="@id/view_3"
159 app:layout_constraintRight_toRightOf="@id/view_3" 146 app:layout_constraintRight_toRightOf="@id/view_3"
160 android:layout_marginRight="20dp" 147 app:layout_constraintTop_toTopOf="@id/view_3" />
161 />
162 148
163 <EditText 149 <EditText
164 android:id="@+id/et_pwd_2" 150 android:id="@+id/et_pwd_2"
165 android:layout_width="0dp" 151 android:layout_width="0dp"
166 android:layout_height="0dp" 152 android:layout_height="0dp"
167 android:background="@android:color/transparent"
168 app:layout_constraintTop_toTopOf="@id/view_3"
169 app:layout_constraintBottom_toBottomOf="@id/view_3"
170 app:layout_constraintLeft_toLeftOf="@id/view_3"
171 app:layout_constraintRight_toLeftOf="@id/iv_6"
172 android:layout_marginLeft="46dp" 153 android:layout_marginLeft="46dp"
173 android:textColorHint="#999999" 154 android:layout_marginRight="20dp"
174 android:hint="再次输入密码" 155 android:background="@android:color/transparent"
175 android:textSize="16dp"
176 android:gravity="left|center_vertical" 156 android:gravity="left|center_vertical"
157 android:hint="再次输入密码"
177 android:inputType="textPassword" 158 android:inputType="textPassword"
178 android:layout_marginRight="20dp"
179 android:textColor="#333333" 159 android:textColor="#333333"
180 /> 160 android:textColorHint="#999999"
161 android:textSize="16dp"
162 app:layout_constraintBottom_toBottomOf="@id/view_3"
163 app:layout_constraintLeft_toLeftOf="@id/view_3"
164 app:layout_constraintRight_toLeftOf="@id/iv_6"
165 app:layout_constraintTop_toTopOf="@id/view_3" />
166
181 <TextView 167 <TextView
182 android:layout_width="wrap_content" 168 android:layout_width="wrap_content"
183 android:layout_height="wrap_content" 169 android:layout_height="wrap_content"
184 app:layout_constraintTop_toBottomOf="@id/view_3"
185 app:layout_constraintLeft_toLeftOf="@id/view_3"
186 android:layout_marginLeft="45dp" 170 android:layout_marginLeft="45dp"
187 android:layout_marginTop="10dp" 171 android:layout_marginTop="10dp"
188 android:textSize="13dp"
189 android:text="6-16位密码,数字或字母" 172 android:text="6-16位密码,数字或字母"
190 android:textColor="#999999" 173 android:textColor="#999999"
191 /> 174 android:textSize="13dp"
175 app:layout_constraintLeft_toLeftOf="@id/view_3"
176 app:layout_constraintTop_toBottomOf="@id/view_3" />
192 177
193 <Button 178 <Button
194 android:id="@+id/btn_1" 179 android:id="@+id/btn_1"
195 android:layout_width="315dp" 180 android:layout_width="315dp"
196 android:layout_height="50dp" 181 android:layout_height="50dp"
197 app:layout_constraintLeft_toLeftOf="parent"
198 app:layout_constraintRight_toRightOf="parent"
199 app:layout_constraintTop_toTopOf="parent"
200 android:layout_marginTop="428dp" 182 android:layout_marginTop="428dp"
201 android:background="@drawable/bg_solid_btn" 183 android:background="@drawable/bg_solid_btn"
184 android:text="注册"
202 android:textColor="@color/white" 185 android:textColor="@color/white"
203 android:textSize="18dp" 186 android:textSize="18dp"
204 android:text="注册" 187 app:layout_constraintLeft_toLeftOf="parent"
205 /> 188 app:layout_constraintRight_toRightOf="parent"
189 app:layout_constraintTop_toTopOf="parent" />
190
206 <TextView 191 <TextView
207 android:id="@+id/tv_1" 192 android:id="@+id/tv_1"
208 android:layout_width="wrap_content" 193 android:layout_width="wrap_content"
209 android:layout_height="wrap_content" 194 android:layout_height="wrap_content"
195 android:layout_marginLeft="85dp"
196 android:layout_marginTop="15dp"
210 android:text="已有账号,立即" 197 android:text="已有账号,立即"
211 android:textColor="#666666" 198 android:textColor="#666666"
212 android:textSize="17dp" 199 android:textSize="17dp"
213 app:layout_constraintLeft_toLeftOf="@id/btn_1" 200 app:layout_constraintLeft_toLeftOf="@id/btn_1"
214 app:layout_constraintTop_toBottomOf="@id/btn_1" 201 app:layout_constraintTop_toBottomOf="@id/btn_1" />
215 android:layout_marginLeft="85dp" 202
216 android:layout_marginTop="15dp"
217 />
218 <TextView 203 <TextView
219 android:id="@+id/tv_2" 204 android:id="@+id/tv_2"
220 android:layout_width="wrap_content" 205 android:layout_width="wrap_content"
221 android:layout_height="wrap_content" 206 android:layout_height="wrap_content"
207 android:layout_marginTop="15dp"
222 android:text="登陆" 208 android:text="登陆"
223 android:textColor="#FE5E09" 209 android:textColor="#FE5E09"
224 android:textSize="17dp" 210 android:textSize="17dp"
225 app:layout_constraintLeft_toRightOf="@id/tv_1" 211 app:layout_constraintLeft_toRightOf="@id/tv_1"
226 app:layout_constraintTop_toBottomOf="@id/btn_1" 212 app:layout_constraintTop_toBottomOf="@id/btn_1" />
227 android:layout_marginTop="15dp"
228 />
229 213
230 214
231 <CheckBox 215 <CheckBox
232 android:id="@+id/cb_1" 216 android:id="@+id/cb_1"
233 android:layout_width="13dp" 217 android:layout_width="wrap_content"
234 android:layout_height="13dp" 218 android:layout_height="wrap_content"
235 app:layout_constraintBottom_toBottomOf="parent"
236 app:layout_constraintLeft_toLeftOf="parent"
237 android:layout_marginLeft="67dp" 219 android:layout_marginLeft="67dp"
238 android:layout_marginBottom="50dp" 220 android:layout_marginBottom="50dp"
239 android:background="@android:color/transparent" 221 android:background="@android:color/transparent"
240 android:button="@drawable/checked_xc" 222 app:layout_constraintBottom_toBottomOf="parent"
241 /> 223 app:layout_constraintLeft_toLeftOf="parent" />
224
242 <TextView 225 <TextView
243 android:id="@+id/tv_3" 226 android:id="@+id/tv_3"
244 android:layout_width="wrap_content" 227 android:layout_width="wrap_content"
245 android:layout_height="wrap_content" 228 android:layout_height="wrap_content"
229 android:layout_marginLeft="5dp"
246 android:text="已阅读并同意《" 230 android:text="已阅读并同意《"
247 android:textColor="#999999" 231 android:textColor="#999999"
248 android:textSize="12dp" 232 android:textSize="12dp"
249 app:layout_constraintLeft_toRightOf="@id/cb_1"
250 app:layout_constraintTop_toTopOf="@id/cb_1"
251 app:layout_constraintBottom_toBottomOf="@id/cb_1" 233 app:layout_constraintBottom_toBottomOf="@id/cb_1"
252 android:layout_marginLeft="5dp" 234 app:layout_constraintLeft_toRightOf="@id/cb_1"
253 /> 235 app:layout_constraintTop_toTopOf="@id/cb_1" />
236
254 <TextView 237 <TextView
255 android:id="@+id/tv_4" 238 android:id="@+id/tv_4"
256 android:layout_width="wrap_content" 239 android:layout_width="wrap_content"
257 android:layout_height="wrap_content" 240 android:layout_height="wrap_content"
app/src/main/res/layout/activity_select_stu.xml
1 <?xml version="1.0" encoding="utf-8"?> File was deleted
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto"
6 android:background="#F4F6F8"
7 >
8
9 <View
10 android:id="@+id/view_1"
11 android:layout_width="match_parent"
12 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white"
15 />
16 <TextView
17 android:layout_width="wrap_content"
18 android:layout_height="wrap_content"
19 android:text="选择学生"
20 android:textColor="#333333"
21 android:textSize="18dp"
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 app:layout_constraintBottom_toBottomOf="@id/view_1"
26 />
27
28
29 <Button
30 android:layout_width="180dp"
31 android:layout_height="40dp"
32 app:layout_constraintLeft_toLeftOf="parent"
33 app:layout_constraintRight_toRightOf="parent"
34 app:layout_constraintTop_toTopOf="parent"
35 android:layout_marginTop="500dp"
36 android:background="@drawable/bg_solid_btn"
37 android:text="确认"
38 android:textColor="#FFFFFF"
39 android:textSize="16dp"
40 />
41
42
43
44
45 </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/activity_set_jia.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <View 8 <View
10 android:id="@+id/view_1" 9 android:id="@+id/view_1"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="44dp" 11 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 12 android:background="@android:color/white"
15 /> 13 app:layout_constraintTop_toTopOf="parent" />
14
16 <TextView 15 <TextView
17 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
19 android:text="家长身份" 18 android:text="家长身份"
20 android:textColor="#333333" 19 android:textColor="#333333"
21 android:textSize="18dp" 20 android:textSize="18dp"
21 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1" />
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25
26 />
27 <TextView 26 <TextView
28 android:id="@+id/tv_cancel" 27 android:id="@+id/tv_cancel"
29 android:layout_width="wrap_content" 28 android:layout_width="wrap_content"
30 android:layout_height="wrap_content" 29 android:layout_height="wrap_content"
30 android:layout_marginLeft="15dp"
31 android:text="取消" 31 android:text="取消"
32 android:textColor="#666666" 32 android:textColor="#666666"
33 android:textSize="16dp" 33 android:textSize="16dp"
34 app:layout_constraintLeft_toLeftOf="@id/view_1"
35 app:layout_constraintTop_toTopOf="@id/view_1"
36 app:layout_constraintBottom_toBottomOf="@id/view_1" 34 app:layout_constraintBottom_toBottomOf="@id/view_1"
37 android:layout_marginLeft="15dp" 35 app:layout_constraintLeft_toLeftOf="@id/view_1"
38 /> 36 app:layout_constraintTop_toTopOf="@id/view_1" />
37
39 <TextView 38 <TextView
40 android:id="@+id/tv_ok" 39 android:id="@+id/tv_ok"
41 android:layout_width="wrap_content" 40 android:layout_width="wrap_content"
42 android:layout_height="wrap_content" 41 android:layout_height="wrap_content"
42 android:layout_marginRight="15dp"
43 android:text="确认" 43 android:text="确认"
44 android:textColor="#FE5E09" 44 android:textColor="#FE5E09"
45 android:textSize="16dp" 45 android:textSize="16dp"
46 app:layout_constraintRight_toRightOf="@id/view_1"
47 app:layout_constraintTop_toTopOf="@id/view_1"
48 app:layout_constraintBottom_toBottomOf="@id/view_1" 46 app:layout_constraintBottom_toBottomOf="@id/view_1"
49 android:layout_marginRight="15dp" 47 app:layout_constraintRight_toRightOf="@id/view_1"
50 /> 48 app:layout_constraintTop_toTopOf="@id/view_1" />
49
51 <TextView 50 <TextView
52 android:layout_width="wrap_content" 51 android:layout_width="wrap_content"
53 android:layout_height="wrap_content" 52 android:layout_height="wrap_content"
54 android:text="请选择身份"
55 app:layout_constraintBottom_toTopOf="@id/view_2"
56 android:layout_marginBottom="15dp"
57 app:layout_constraintLeft_toLeftOf="parent"
58 android:layout_marginLeft="15dp" 53 android:layout_marginLeft="15dp"
54 android:layout_marginBottom="15dp"
55 android:text="请选择身份"
59 android:textColor="#666666" 56 android:textColor="#666666"
60 android:textSize="16dp" 57 android:textSize="16dp"
61 /> 58 app:layout_constraintBottom_toTopOf="@id/view_2"
59 app:layout_constraintLeft_toLeftOf="parent" />
62 60
63 <View 61 <View
64 android:id="@+id/view_2" 62 android:id="@+id/view_2"
65 android:layout_width="345dp" 63 android:layout_width="match_parent"
66 android:layout_height="50dp" 64 android:layout_height="50dp"
65 android:layout_marginLeft="15dp"
66 android:layout_marginTop="109dp"
67 android:layout_marginRight="15dp"
67 android:background="@drawable/bg_solid_white_10" 68 android:background="@drawable/bg_solid_white_10"
68 app:layout_constraintLeft_toLeftOf="parent" 69 app:layout_constraintLeft_toLeftOf="parent"
69 app:layout_constraintRight_toRightOf="parent" 70 app:layout_constraintRight_toRightOf="parent"
70 app:layout_constraintTop_toTopOf="parent" 71 app:layout_constraintTop_toTopOf="parent" />
71 android:layout_marginTop="109dp"
72 />
73 72
74 73
75 <TextView 74 <TextView
76 android:layout_width="wrap_content" 75 android:layout_width="wrap_content"
77 android:layout_height="wrap_content" 76 android:layout_height="wrap_content"
78 app:layout_constraintLeft_toLeftOf="@id/view_2" 77 android:text="爸爸"
79 app:layout_constraintRight_toRightOf="@id/view_2"
80 app:layout_constraintTop_toTopOf="@+id/view_2"
81 app:layout_constraintBottom_toBottomOf="@+id/view_2"
82 android:textColor="#333333" 78 android:textColor="#333333"
83 android:textSize="16dp" 79 android:textSize="16dp"
84 android:text="爸爸" 80 app:layout_constraintBottom_toBottomOf="@+id/view_2"
85 /> 81 app:layout_constraintLeft_toLeftOf="@id/view_2"
82 app:layout_constraintRight_toRightOf="@id/view_2"
83 app:layout_constraintTop_toTopOf="@+id/view_2" />
86 84
87 <ImageView 85 <ImageView
88 android:id="@+id/iv_1" 86 android:id="@+id/iv_1"
89 android:layout_width="13dp" 87 android:layout_width="13dp"
90 android:layout_height="13dp" 88 android:layout_height="13dp"
89 android:layout_marginRight="20dp"
91 android:background="@mipmap/wsyq" 90 android:background="@mipmap/wsyq"
92 app:layout_constraintTop_toTopOf="@id/view_2"
93 app:layout_constraintBottom_toBottomOf="@id/view_2" 91 app:layout_constraintBottom_toBottomOf="@id/view_2"
94 app:layout_constraintRight_toRightOf="@id/view_2" 92 app:layout_constraintRight_toRightOf="@id/view_2"
95 android:layout_marginRight="20dp" 93 app:layout_constraintTop_toTopOf="@id/view_2" />
96 />
97 94
98 <View 95 <View
99 android:id="@+id/view_3" 96 android:id="@+id/view_3"
100 android:layout_width="345dp" 97 android:layout_width="match_parent"
101 android:layout_height="50dp" 98 android:layout_height="50dp"
99 android:layout_marginLeft="15dp"
100 android:layout_marginTop="175dp"
101 android:layout_marginRight="15dp"
102 android:background="@drawable/bg_solid_white_10" 102 android:background="@drawable/bg_solid_white_10"
103 app:layout_constraintLeft_toLeftOf="parent" 103 app:layout_constraintLeft_toLeftOf="parent"
104 app:layout_constraintRight_toRightOf="parent" 104 app:layout_constraintRight_toRightOf="parent"
105 app:layout_constraintTop_toTopOf="parent" 105 app:layout_constraintTop_toTopOf="parent" />
106 android:layout_marginTop="175dp"
107 />
108 106
109 107
110 <TextView 108 <TextView
111 android:layout_width="wrap_content" 109 android:layout_width="wrap_content"
112 android:layout_height="wrap_content" 110 android:layout_height="wrap_content"
113 app:layout_constraintLeft_toLeftOf="@id/view_3" 111 android:text="妈妈"
114 app:layout_constraintRight_toRightOf="@id/view_3"
115 app:layout_constraintTop_toTopOf="@+id/view_3"
116 app:layout_constraintBottom_toBottomOf="@+id/view_3"
117 android:textColor="#333333" 112 android:textColor="#333333"
118 android:textSize="16dp" 113 android:textSize="16dp"
119 android:text="妈妈" 114 app:layout_constraintBottom_toBottomOf="@+id/view_3"
120 /> 115 app:layout_constraintLeft_toLeftOf="@id/view_3"
116 app:layout_constraintRight_toRightOf="@id/view_3"
117 app:layout_constraintTop_toTopOf="@+id/view_3" />
121 118
122 <ImageView 119 <ImageView
123 android:id="@+id/iv_2" 120 android:id="@+id/iv_2"
124 android:layout_width="13dp" 121 android:layout_width="13dp"
125 android:layout_height="13dp" 122 android:layout_height="13dp"
123 android:layout_marginRight="20dp"
126 android:background="@mipmap/wsyq" 124 android:background="@mipmap/wsyq"
127 app:layout_constraintTop_toTopOf="@id/view_3"
128 app:layout_constraintBottom_toBottomOf="@id/view_3" 125 app:layout_constraintBottom_toBottomOf="@id/view_3"
129 app:layout_constraintRight_toRightOf="@id/view_3" 126 app:layout_constraintRight_toRightOf="@id/view_3"
130 android:layout_marginRight="20dp" 127 app:layout_constraintTop_toTopOf="@id/view_3" />
131 /> 128
132 <View 129 <View
133 android:id="@+id/view_4" 130 android:id="@+id/view_4"
134 android:layout_width="345dp" 131 android:layout_width="match_parent"
135 android:layout_height="50dp" 132 android:layout_height="50dp"
133 android:layout_marginLeft="15dp"
134 android:layout_marginTop="240dp"
135 android:layout_marginRight="15dp"
136 android:background="@drawable/bg_solid_white_10" 136 android:background="@drawable/bg_solid_white_10"
137 app:layout_constraintLeft_toLeftOf="parent" 137 app:layout_constraintLeft_toLeftOf="parent"
138 app:layout_constraintRight_toRightOf="parent" 138 app:layout_constraintRight_toRightOf="parent"
139 app:layout_constraintTop_toTopOf="parent" 139 app:layout_constraintTop_toTopOf="parent" />
140 android:layout_marginTop="240dp"
141 />
142 140
143 141
144 <TextView 142 <TextView
145 android:layout_width="wrap_content" 143 android:layout_width="wrap_content"
146 android:layout_height="wrap_content" 144 android:layout_height="wrap_content"
147 app:layout_constraintLeft_toLeftOf="@id/view_4" 145 android:text="爷爷"
148 app:layout_constraintRight_toRightOf="@id/view_4"
149 app:layout_constraintTop_toTopOf="@+id/view_4"
150 app:layout_constraintBottom_toBottomOf="@+id/view_4"
151 android:textColor="#333333" 146 android:textColor="#333333"
152 android:textSize="16dp" 147 android:textSize="16dp"
153 android:text="爷爷" 148 app:layout_constraintBottom_toBottomOf="@+id/view_4"
154 /> 149 app:layout_constraintLeft_toLeftOf="@id/view_4"
150 app:layout_constraintRight_toRightOf="@id/view_4"
151 app:layout_constraintTop_toTopOf="@+id/view_4" />
155 152
156 <ImageView 153 <ImageView
157 android:id="@+id/iv_3" 154 android:id="@+id/iv_3"
158 android:layout_width="13dp" 155 android:layout_width="13dp"
159 android:layout_height="13dp" 156 android:layout_height="13dp"
157 android:layout_marginRight="20dp"
160 android:background="@mipmap/wsyq" 158 android:background="@mipmap/wsyq"
161 app:layout_constraintTop_toTopOf="@id/view_4"
162 app:layout_constraintBottom_toBottomOf="@id/view_4" 159 app:layout_constraintBottom_toBottomOf="@id/view_4"
163 app:layout_constraintRight_toRightOf="@id/view_4" 160 app:layout_constraintRight_toRightOf="@id/view_4"
164 android:layout_marginRight="20dp" 161 app:layout_constraintTop_toTopOf="@id/view_4" />
165 /> 162
166 <View 163 <View
167 android:id="@+id/view_5" 164 android:id="@+id/view_5"
168 android:layout_width="345dp" 165 android:layout_width="match_parent"
169 android:layout_height="50dp" 166 android:layout_height="50dp"
167 android:layout_marginLeft="15dp"
168 android:layout_marginTop="304dp"
169 android:layout_marginRight="15dp"
170 android:background="@drawable/bg_solid_white_10" 170 android:background="@drawable/bg_solid_white_10"
171 app:layout_constraintLeft_toLeftOf="parent" 171 app:layout_constraintLeft_toLeftOf="parent"
172 app:layout_constraintRight_toRightOf="parent" 172 app:layout_constraintRight_toRightOf="parent"
173 app:layout_constraintTop_toTopOf="parent" 173 app:layout_constraintTop_toTopOf="parent" />
174 android:layout_marginTop="304dp"
175 />
176 174
177 175
178 <TextView 176 <TextView
179 android:layout_width="wrap_content" 177 android:layout_width="wrap_content"
180 android:layout_height="wrap_content" 178 android:layout_height="wrap_content"
181 app:layout_constraintLeft_toLeftOf="@id/view_5" 179 android:text="奶奶"
182 app:layout_constraintRight_toRightOf="@id/view_5"
183 app:layout_constraintTop_toTopOf="@+id/view_5"
184 app:layout_constraintBottom_toBottomOf="@+id/view_5"
185 android:textColor="#333333" 180 android:textColor="#333333"
186 android:textSize="16dp" 181 android:textSize="16dp"
187 android:text="奶奶" 182 app:layout_constraintBottom_toBottomOf="@+id/view_5"
188 /> 183 app:layout_constraintLeft_toLeftOf="@id/view_5"
184 app:layout_constraintRight_toRightOf="@id/view_5"
185 app:layout_constraintTop_toTopOf="@+id/view_5" />
189 186
190 <ImageView 187 <ImageView
191 android:id="@+id/iv_4" 188 android:id="@+id/iv_4"
192 android:layout_width="13dp" 189 android:layout_width="13dp"
193 android:layout_height="13dp" 190 android:layout_height="13dp"
191 android:layout_marginRight="20dp"
194 android:background="@mipmap/wsyq" 192 android:background="@mipmap/wsyq"
195 app:layout_constraintTop_toTopOf="@id/view_5"
196 app:layout_constraintBottom_toBottomOf="@id/view_5" 193 app:layout_constraintBottom_toBottomOf="@id/view_5"
197 app:layout_constraintRight_toRightOf="@id/view_5" 194 app:layout_constraintRight_toRightOf="@id/view_5"
198 android:layout_marginRight="20dp" 195 app:layout_constraintTop_toTopOf="@id/view_5" />
199 /> 196
200 <View 197 <View
201 android:id="@+id/view_6" 198 android:id="@+id/view_6"
202 android:layout_width="345dp" 199 android:layout_width="match_parent"
203 android:layout_height="50dp" 200 android:layout_height="50dp"
201 android:layout_marginLeft="15dp"
202 android:layout_marginTop="370dp"
203 android:layout_marginRight="15dp"
204 android:background="@drawable/bg_solid_white_10" 204 android:background="@drawable/bg_solid_white_10"
205 app:layout_constraintLeft_toLeftOf="parent" 205 app:layout_constraintLeft_toLeftOf="parent"
206 app:layout_constraintRight_toRightOf="parent" 206 app:layout_constraintRight_toRightOf="parent"
207 app:layout_constraintTop_toTopOf="parent" 207 app:layout_constraintTop_toTopOf="parent" />
208 android:layout_marginTop="370dp"
209 />
210 208
211 209
212 <TextView 210 <TextView
213 android:layout_width="wrap_content" 211 android:layout_width="wrap_content"
214 android:layout_height="wrap_content" 212 android:layout_height="wrap_content"
215 app:layout_constraintLeft_toLeftOf="@id/view_6" 213 android:text="外公"
216 app:layout_constraintRight_toRightOf="@id/view_6"
217 app:layout_constraintTop_toTopOf="@+id/view_6"
218 app:layout_constraintBottom_toBottomOf="@+id/view_6"
219 android:textColor="#333333" 214 android:textColor="#333333"
220 android:textSize="16dp" 215 android:textSize="16dp"
221 android:text="外公" 216 app:layout_constraintBottom_toBottomOf="@+id/view_6"
222 /> 217 app:layout_constraintLeft_toLeftOf="@id/view_6"
218 app:layout_constraintRight_toRightOf="@id/view_6"
219 app:layout_constraintTop_toTopOf="@+id/view_6" />
223 220
224 <ImageView 221 <ImageView
225 android:id="@+id/iv_5" 222 android:id="@+id/iv_5"
226 android:layout_width="13dp" 223 android:layout_width="13dp"
227 android:layout_height="13dp" 224 android:layout_height="13dp"
225 android:layout_marginRight="20dp"
228 android:background="@mipmap/wsyq" 226 android:background="@mipmap/wsyq"
229 app:layout_constraintTop_toTopOf="@id/view_6"
230 app:layout_constraintBottom_toBottomOf="@id/view_6" 227 app:layout_constraintBottom_toBottomOf="@id/view_6"
231 app:layout_constraintRight_toRightOf="@id/view_6" 228 app:layout_constraintRight_toRightOf="@id/view_6"
app/src/main/res/layout/activity_set_nian.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <View 8 <View
10 android:id="@+id/view_1" 9 android:id="@+id/view_1"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="44dp" 11 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 12 android:background="@android:color/white"
15 /> 13 app:layout_constraintTop_toTopOf="parent" />
14
16 <TextView 15 <TextView
17 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
19 android:text="年级" 18 android:text="年级"
20 android:textColor="#333333" 19 android:textColor="#333333"
21 android:textSize="18dp" 20 android:textSize="18dp"
21 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1" />
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25
26 />
27 <TextView 26 <TextView
28 android:id="@+id/tv_cancel" 27 android:id="@+id/tv_cancel"
29 android:layout_width="wrap_content" 28 android:layout_width="wrap_content"
30 android:layout_height="wrap_content" 29 android:layout_height="wrap_content"
30 android:layout_marginLeft="15dp"
31 android:text="取消" 31 android:text="取消"
32 android:textColor="#666666" 32 android:textColor="#666666"
33 android:textSize="16dp" 33 android:textSize="16dp"
34 app:layout_constraintLeft_toLeftOf="@id/view_1"
35 app:layout_constraintTop_toTopOf="@id/view_1"
36 app:layout_constraintBottom_toBottomOf="@id/view_1" 34 app:layout_constraintBottom_toBottomOf="@id/view_1"
37 android:layout_marginLeft="15dp" 35 app:layout_constraintLeft_toLeftOf="@id/view_1"
38 /> 36 app:layout_constraintTop_toTopOf="@id/view_1" />
37
39 <TextView 38 <TextView
40 android:id="@+id/tv_ok" 39 android:id="@+id/tv_ok"
41 android:layout_width="wrap_content" 40 android:layout_width="wrap_content"
42 android:layout_height="wrap_content" 41 android:layout_height="wrap_content"
42 android:layout_marginRight="15dp"
43 android:text="确认" 43 android:text="确认"
44 android:textColor="#FE5E09" 44 android:textColor="#FE5E09"
45 android:textSize="16dp" 45 android:textSize="16dp"
46 app:layout_constraintRight_toRightOf="@id/view_1"
47 app:layout_constraintTop_toTopOf="@id/view_1"
48 app:layout_constraintBottom_toBottomOf="@id/view_1" 46 app:layout_constraintBottom_toBottomOf="@id/view_1"
49 android:layout_marginRight="15dp" 47 app:layout_constraintRight_toRightOf="@id/view_1"
50 /> 48 app:layout_constraintTop_toTopOf="@id/view_1" />
49
51 <TextView 50 <TextView
52 android:layout_width="wrap_content" 51 android:layout_width="wrap_content"
53 android:layout_height="wrap_content" 52 android:layout_height="wrap_content"
54 android:text="请选择年级"
55 app:layout_constraintBottom_toTopOf="@id/view_2"
56 android:layout_marginBottom="15dp"
57 app:layout_constraintLeft_toLeftOf="parent"
58 android:layout_marginLeft="15dp" 53 android:layout_marginLeft="15dp"
54 android:layout_marginBottom="15dp"
55 android:text="请选择年级"
59 android:textColor="#666666" 56 android:textColor="#666666"
60 android:textSize="16dp" 57 android:textSize="16dp"
61 /> 58 app:layout_constraintBottom_toTopOf="@id/view_2"
59 app:layout_constraintLeft_toLeftOf="parent" />
62 60
63 <View 61 <View
64 android:id="@+id/view_2" 62 android:id="@+id/view_2"
65 android:layout_width="345dp" 63 android:layout_width="match_parent"
66 android:layout_height="50dp" 64 android:layout_height="50dp"
65 android:layout_marginLeft="15dp"
66 android:layout_marginTop="109dp"
67 android:layout_marginRight="15dp"
67 android:background="@drawable/bg_solid_white_10" 68 android:background="@drawable/bg_solid_white_10"
68 app:layout_constraintLeft_toLeftOf="parent" 69 app:layout_constraintLeft_toLeftOf="parent"
69 app:layout_constraintRight_toRightOf="parent" 70 app:layout_constraintRight_toRightOf="parent"
70 app:layout_constraintTop_toTopOf="parent" 71 app:layout_constraintTop_toTopOf="parent" />
71 android:layout_marginTop="109dp"
72 />
73 72
74 73
75 <TextView 74 <TextView
76 android:id="@+id/tv_nian" 75 android:id="@+id/tv_nian"
77 android:layout_width="wrap_content" 76 android:layout_width="wrap_content"
78 android:layout_height="wrap_content" 77 android:layout_height="wrap_content"
79 app:layout_constraintLeft_toLeftOf="@id/view_2" 78 android:layout_marginLeft="15dp"
80 app:layout_constraintTop_toTopOf="@+id/view_2" 79 android:text="七年级"
81 app:layout_constraintBottom_toBottomOf="@+id/view_2"
82 android:textColor="#333333" 80 android:textColor="#333333"
83 android:textSize="16dp" 81 android:textSize="16dp"
84 android:text="一年纪" 82 app:layout_constraintBottom_toBottomOf="@+id/view_2"
85 android:layout_marginLeft="15dp" 83 app:layout_constraintLeft_toLeftOf="@id/view_2"
86 /> 84 app:layout_constraintTop_toTopOf="@+id/view_2" />
87 85
88 <ImageView 86 <ImageView
89 android:layout_width="5.5dp" 87 android:layout_width="5.5dp"
90 android:layout_height="9.5dp" 88 android:layout_height="9.5dp"
89 android:layout_marginRight="15dp"
91 android:background="@mipmap/ycaj" 90 android:background="@mipmap/ycaj"
92 app:layout_constraintTop_toTopOf="@id/view_2"
93 app:layout_constraintBottom_toBottomOf="@id/view_2" 91 app:layout_constraintBottom_toBottomOf="@id/view_2"
94 app:layout_constraintRight_toRightOf="@id/view_2" 92 app:layout_constraintRight_toRightOf="@id/view_2"
95 android:layout_marginRight="15dp" 93 app:layout_constraintTop_toTopOf="@id/view_2" />
96 />
97 94
98 <TextView 95 <TextView
99 android:layout_width="wrap_content" 96 android:layout_width="wrap_content"
100 android:layout_height="wrap_content" 97 android:layout_height="wrap_content"
101 android:text="请选择学期"
102 app:layout_constraintBottom_toTopOf="@id/view_3"
103 android:layout_marginBottom="15dp"
104 app:layout_constraintLeft_toLeftOf="parent"
105 android:layout_marginLeft="15dp" 98 android:layout_marginLeft="15dp"
99 android:layout_marginBottom="15dp"
100 android:text="请选择学期"
106 android:textColor="#666666" 101 android:textColor="#666666"
107 android:textSize="16dp" 102 android:textSize="16dp"
108 /> 103 app:layout_constraintBottom_toTopOf="@id/view_3"
104 app:layout_constraintLeft_toLeftOf="parent" />
109 105
110 <View 106 <View
111 android:id="@+id/view_3" 107 android:id="@+id/view_3"
112 android:layout_width="345dp" 108 android:layout_width="match_parent"
113 android:layout_height="50dp" 109 android:layout_height="50dp"
110 android:layout_marginLeft="15dp"
111 android:layout_marginTop="209dp"
112 android:layout_marginRight="15dp"
114 android:background="@drawable/bg_solid_white_10" 113 android:background="@drawable/bg_solid_white_10"
115 app:layout_constraintLeft_toLeftOf="parent" 114 app:layout_constraintLeft_toLeftOf="parent"
116 app:layout_constraintRight_toRightOf="parent" 115 app:layout_constraintRight_toRightOf="parent"
117 app:layout_constraintTop_toTopOf="parent" 116 app:layout_constraintTop_toTopOf="parent" />
118 android:layout_marginTop="209dp"
119 />
120 117
121 <ImageView 118 <ImageView
122 android:layout_width="5.5dp" 119 android:layout_width="5.5dp"
123 android:layout_height="9.5dp" 120 android:layout_height="9.5dp"
121 android:layout_marginRight="15dp"
124 android:background="@mipmap/ycaj" 122 android:background="@mipmap/ycaj"
125 app:layout_constraintTop_toTopOf="@id/view_3"
app/src/main/res/layout/activity_set_nick.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <View 8 <View
10 android:id="@+id/view_1" 9 android:id="@+id/view_1"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="44dp" 11 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 12 android:background="@android:color/white"
15 /> 13 app:layout_constraintTop_toTopOf="parent" />
14
16 <TextView 15 <TextView
17 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
19 android:text="昵称" 18 android:text="昵称"
20 android:textColor="#333333" 19 android:textColor="#333333"
21 android:textSize="18dp" 20 android:textSize="18dp"
21 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1" />
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25
26 />
27 <TextView 26 <TextView
28 android:id="@+id/tv_cancel" 27 android:id="@+id/tv_cancel"
29 android:layout_width="wrap_content" 28 android:layout_width="wrap_content"
30 android:layout_height="wrap_content" 29 android:layout_height="wrap_content"
30 android:layout_marginLeft="15dp"
31 android:text="取消" 31 android:text="取消"
32 android:textColor="#666666" 32 android:textColor="#666666"
33 android:textSize="16dp" 33 android:textSize="16dp"
34 app:layout_constraintLeft_toLeftOf="@id/view_1"
35 app:layout_constraintTop_toTopOf="@id/view_1"
36 app:layout_constraintBottom_toBottomOf="@id/view_1" 34 app:layout_constraintBottom_toBottomOf="@id/view_1"
37 android:layout_marginLeft="15dp" 35 app:layout_constraintLeft_toLeftOf="@id/view_1"
38 /> 36 app:layout_constraintTop_toTopOf="@id/view_1" />
37
39 <TextView 38 <TextView
40 android:id="@+id/tv_ok" 39 android:id="@+id/tv_ok"
41 android:layout_width="wrap_content" 40 android:layout_width="wrap_content"
42 android:layout_height="wrap_content" 41 android:layout_height="wrap_content"
42 android:layout_marginRight="15dp"
43 android:text="确认" 43 android:text="确认"
44 android:textColor="#FE5E09" 44 android:textColor="#FE5E09"
45 android:textSize="16dp" 45 android:textSize="16dp"
46 app:layout_constraintRight_toRightOf="@id/view_1"
47 app:layout_constraintTop_toTopOf="@id/view_1"
48 app:layout_constraintBottom_toBottomOf="@id/view_1" 46 app:layout_constraintBottom_toBottomOf="@id/view_1"
49 android:layout_marginRight="15dp" 47 app:layout_constraintRight_toRightOf="@id/view_1"
50 /> 48 app:layout_constraintTop_toTopOf="@id/view_1" />
51 49
52 50
53 <View 51 <View
54 android:id="@+id/view_3" 52 android:id="@+id/view_3"
55 android:layout_width="345dp" 53 android:layout_width="match_parent"
56 android:layout_height="50dp" 54 android:layout_height="50dp"
55 android:layout_marginLeft="15dp"
56 android:layout_marginTop="109dp"
57 android:layout_marginRight="15dp"
57 android:background="@drawable/bg_solid_white_10" 58 android:background="@drawable/bg_solid_white_10"
58 app:layout_constraintLeft_toLeftOf="parent" 59 app:layout_constraintLeft_toLeftOf="parent"
59 app:layout_constraintRight_toRightOf="parent" 60 app:layout_constraintRight_toRightOf="parent"
60 app:layout_constraintTop_toTopOf="parent" 61 app:layout_constraintTop_toTopOf="parent" />
61 android:layout_marginTop="109dp" 62
62 />
63 <EditText 63 <EditText
64 android:id="@+id/et_1" 64 android:id="@+id/et_1"
65 android:layout_width="0dp" 65 android:layout_width="0dp"
66 android:layout_height="0dp" 66 android:layout_height="0dp"
67 app:layout_constraintLeft_toLeftOf="@+id/view_3"
68 app:layout_constraintRight_toRightOf="@+id/view_3"
69 app:layout_constraintTop_toTopOf="@+id/view_3"
70 app:layout_constraintBottom_toBottomOf="@+id/view_3"
71 android:layout_marginLeft="5dp" 67 android:layout_marginLeft="5dp"
72 android:layout_marginRight="5dp" 68 android:layout_marginRight="5dp"
73 android:textSize="16dp"
74 android:textColorHint="#999999"
75 android:hint="请设置2-10个字符,不包括无效字符" 69 android:hint="请设置2-10个字符,不包括无效字符"
76 android:textColor="#333333" 70 android:textColor="#333333"
77 /> 71 android:textColorHint="#999999"
72 android:textSize="16dp"
73 app:layout_constraintBottom_toBottomOf="@+id/view_3"
74 app:layout_constraintLeft_toLeftOf="@+id/view_3"
75 app:layout_constraintRight_toRightOf="@+id/view_3"
app/src/main/res/layout/activity_set_sex.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 5 xmlns:app="http://schemas.android.com/apk/res-auto"
6 android:background="#F4F6F8" 6 android:background="#F4F6F8"
7 > 7 >
8 8
9 <View 9 <View
10 android:id="@+id/view_1" 10 android:id="@+id/view_1"
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="44dp" 12 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent" 13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 14 android:background="@android:color/white"
15 /> 15 />
16 <TextView 16 <TextView
17 android:layout_width="wrap_content" 17 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 18 android:layout_height="wrap_content"
19 android:text="性别" 19 android:text="性别"
20 android:textColor="#333333" 20 android:textColor="#333333"
21 android:textSize="18dp" 21 android:textSize="18dp"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1"
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25 app:layout_constraintBottom_toBottomOf="@id/view_1"
26 /> 26 />
27 <TextView 27 <TextView
28 android:id="@+id/tv_cancel" 28 android:id="@+id/tv_cancel"
29 android:layout_width="wrap_content" 29 android:layout_width="wrap_content"
30 android:layout_height="wrap_content" 30 android:layout_height="wrap_content"
31 android:text="取消" 31 android:text="取消"
32 android:textColor="#666666" 32 android:textColor="#666666"
33 android:textSize="16dp" 33 android:textSize="16dp"
34 app:layout_constraintLeft_toLeftOf="@id/view_1" 34 app:layout_constraintLeft_toLeftOf="@id/view_1"
35 app:layout_constraintTop_toTopOf="@id/view_1" 35 app:layout_constraintTop_toTopOf="@id/view_1"
36 app:layout_constraintBottom_toBottomOf="@id/view_1" 36 app:layout_constraintBottom_toBottomOf="@id/view_1"
37 android:layout_marginLeft="15dp" 37 android:layout_marginLeft="15dp"
38 /> 38 />
39 <TextView 39 <TextView
40 android:id="@+id/tv_ok" 40 android:id="@+id/tv_ok"
41 android:layout_width="wrap_content" 41 android:layout_width="wrap_content"
42 android:layout_height="wrap_content" 42 android:layout_height="wrap_content"
43 android:text="确认" 43 android:text="确认"
44 android:textColor="#FE5E09" 44 android:textColor="#FE5E09"
45 android:textSize="16dp" 45 android:textSize="16dp"
46 app:layout_constraintRight_toRightOf="@id/view_1" 46 app:layout_constraintRight_toRightOf="@id/view_1"
47 app:layout_constraintTop_toTopOf="@id/view_1" 47 app:layout_constraintTop_toTopOf="@id/view_1"
48 app:layout_constraintBottom_toBottomOf="@id/view_1" 48 app:layout_constraintBottom_toBottomOf="@id/view_1"
49 android:layout_marginRight="15dp" 49 android:layout_marginRight="15dp"
50 /> 50 />
51 51
52 52
53 <View 53 <View
54 android:id="@+id/view_2" 54 android:id="@+id/view_2"
55 android:layout_width="345dp" 55 android:layout_width="match_parent"
56 android:layout_marginLeft="15dp"
57 android:layout_marginRight="15dp"
56 android:layout_height="50dp" 58 android:layout_height="50dp"
57 android:background="@drawable/bg_solid_white_10" 59 android:background="@drawable/bg_solid_white_10"
58 app:layout_constraintLeft_toLeftOf="parent" 60 app:layout_constraintLeft_toLeftOf="parent"
59 app:layout_constraintRight_toRightOf="parent" 61 app:layout_constraintRight_toRightOf="parent"
60 app:layout_constraintTop_toTopOf="parent" 62 app:layout_constraintTop_toTopOf="parent"
61 android:layout_marginTop="109dp" 63 android:layout_marginTop="109dp"
62 /> 64 />
63 65
64 <ImageView 66 <ImageView
65 android:id="@+id/cb_1" 67 android:id="@+id/cb_1"
66 android:layout_width="13dp" 68 android:layout_width="13dp"
67 android:layout_height="13dp" 69 android:layout_height="13dp"
68 android:background="@mipmap/wsyq" 70 android:background="@mipmap/wsyq"
69 app:layout_constraintTop_toTopOf="@id/view_2" 71 app:layout_constraintTop_toTopOf="@id/view_2"
70 app:layout_constraintBottom_toBottomOf="@id/view_2" 72 app:layout_constraintBottom_toBottomOf="@id/view_2"
71 app:layout_constraintRight_toRightOf="@id/view_2" 73 app:layout_constraintRight_toRightOf="@id/view_2"
72 android:layout_marginRight="20dp" 74 android:layout_marginRight="20dp"
73 /> 75 />
74 76
75 <ImageView 77 <ImageView
76 android:id="@+id/iv_1" 78 android:id="@+id/iv_1"
77 android:layout_width="10dp" 79 android:layout_width="10dp"
78 android:layout_height="14dp" 80 android:layout_height="14dp"
79 android:background="@mipmap/xb_nv" 81 android:background="@mipmap/xb_nv"
80 app:layout_constraintTop_toTopOf="@+id/view_2" 82 app:layout_constraintTop_toTopOf="@+id/view_2"
81 app:layout_constraintBottom_toBottomOf="@+id/view_2" 83 app:layout_constraintBottom_toBottomOf="@+id/view_2"
82 app:layout_constraintLeft_toLeftOf="@+id/view_2" 84 app:layout_constraintLeft_toLeftOf="@+id/view_2"
83 android:layout_marginLeft="161dp" 85 android:layout_marginLeft="161dp"
84 /> 86 />
85 <TextView 87 <TextView
86 android:layout_width="wrap_content" 88 android:layout_width="wrap_content"
87 android:layout_height="wrap_content" 89 android:layout_height="wrap_content"
88 app:layout_constraintLeft_toRightOf="@id/iv_1" 90 app:layout_constraintLeft_toRightOf="@id/iv_1"
89 app:layout_constraintTop_toTopOf="@+id/iv_1" 91 app:layout_constraintTop_toTopOf="@+id/iv_1"
90 app:layout_constraintBottom_toBottomOf="@+id/iv_1" 92 app:layout_constraintBottom_toBottomOf="@+id/iv_1"
91 android:textColor="#333333" 93 android:textColor="#333333"
92 android:textSize="16dp" 94 android:textSize="16dp"
93 android:text="女" 95 android:text="女"
94 android:layout_marginLeft="5dp" 96 android:layout_marginLeft="5dp"
95 /> 97 />
96 98
97 <TextView 99 <TextView
98 android:layout_width="wrap_content" 100 android:layout_width="wrap_content"
99 android:layout_height="wrap_content" 101 android:layout_height="wrap_content"
100 android:text="请选择性别" 102 android:text="请选择性别"
101 app:layout_constraintBottom_toTopOf="@id/view_2" 103 app:layout_constraintBottom_toTopOf="@id/view_2"
102 android:layout_marginBottom="15dp" 104 android:layout_marginBottom="15dp"
103 app:layout_constraintLeft_toLeftOf="parent" 105 app:layout_constraintLeft_toLeftOf="parent"
104 android:layout_marginLeft="15dp" 106 android:layout_marginLeft="15dp"
105 android:textColor="#666666" 107 android:textColor="#666666"
106 android:textSize="16dp" 108 android:textSize="16dp"
107 /> 109 />
108 110
109 <View 111 <View
110 android:id="@+id/view_3" 112 android:id="@+id/view_3"
111 android:layout_width="345dp" 113 android:layout_width="match_parent"
114 android:layout_marginLeft="15dp"
115 android:layout_marginRight="15dp"
112 android:layout_height="50dp" 116 android:layout_height="50dp"
113 android:background="@drawable/bg_solid_white_10" 117 android:background="@drawable/bg_solid_white_10"
114 app:layout_constraintLeft_toLeftOf="parent" 118 app:layout_constraintLeft_toLeftOf="parent"
115 app:layout_constraintRight_toRightOf="parent" 119 app:layout_constraintRight_toRightOf="parent"
116 app:layout_constraintTop_toTopOf="parent" 120 app:layout_constraintTop_toTopOf="parent"
117 android:layout_marginTop="174dp" 121 android:layout_marginTop="174dp"
118 /> 122 />
119 123
120 <ImageView 124 <ImageView
121 android:id="@+id/cb_2" 125 android:id="@+id/cb_2"
122 android:layout_width="13dp" 126 android:layout_width="13dp"
123 android:layout_height="13dp" 127 android:layout_height="13dp"
124 android:background="@mipmap/wsyq" 128 android:background="@mipmap/wsyq"
125 app:layout_constraintTop_toTopOf="@id/view_3" 129 app:layout_constraintTop_toTopOf="@id/view_3"
126 app:layout_constraintBottom_toBottomOf="@id/view_3" 130 app:layout_constraintBottom_toBottomOf="@id/view_3"
127 app:layout_constraintRight_toRightOf="@id/view_3" 131 app:layout_constraintRight_toRightOf="@id/view_3"
128 android:layout_marginRight="20dp" 132 android:layout_marginRight="20dp"
129 /> 133 />
130 <ImageView 134 <ImageView
131 android:id="@+id/iv_2" 135 android:id="@+id/iv_2"
132 android:layout_width="10dp" 136 android:layout_width="10dp"
133 android:layout_height="14dp" 137 android:layout_height="14dp"
134 android:background="@mipmap/xb_n" 138 android:background="@mipmap/xb_n"
135 app:layout_constraintTop_toTopOf="@+id/view_3" 139 app:layout_constraintTop_toTopOf="@+id/view_3"
136 app:layout_constraintBottom_toBottomOf="@+id/view_3" 140 app:layout_constraintBottom_toBottomOf="@+id/view_3"
137 app:layout_constraintLeft_toLeftOf="@+id/view_3" 141 app:layout_constraintLeft_toLeftOf="@+id/view_3"
138 android:layout_marginLeft="161dp" 142 android:layout_marginLeft="161dp"
139 /> 143 />
140 <TextView 144 <TextView
141 android:layout_width="wrap_content" 145 android:layout_width="wrap_content"
142 android:layout_height="wrap_content" 146 android:layout_height="wrap_content"
143 app:layout_constraintLeft_toRightOf="@id/iv_2" 147 app:layout_constraintLeft_toRightOf="@id/iv_2"
144 app:layout_constraintTop_toTopOf="@+id/iv_2" 148 app:layout_constraintTop_toTopOf="@+id/iv_2"
145 app:layout_constraintBottom_toBottomOf="@+id/iv_2" 149 app:layout_constraintBottom_toBottomOf="@+id/iv_2"
146 android:textColor="#333333" 150 android:textColor="#333333"
147 android:textSize="16dp" 151 android:textSize="16dp"
148 android:text="男" 152 android:text="男"
149 android:layout_marginLeft="5dp" 153 android:layout_marginLeft="5dp"
150 /> 154 />
151 155
152 156
153 157
154 158
155 </androidx.constraintlayout.widget.ConstraintLayout> 159 </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/activity_setac.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <View 8 <View
10 android:id="@+id/view_1" 9 android:id="@+id/view_1"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="44dp" 11 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 12 android:background="@android:color/white"
15 /> 13 app:layout_constraintTop_toTopOf="parent" />
14
16 <TextView 15 <TextView
17 android:layout_width="wrap_content" 16 android:layout_width="wrap_content"
18 android:layout_height="wrap_content" 17 android:layout_height="wrap_content"
19 android:text="账号设置" 18 android:text="账号设置"
20 android:textColor="#333333" 19 android:textColor="#333333"
21 android:textSize="18dp" 20 android:textSize="18dp"
21 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 app:layout_constraintLeft_toLeftOf="@id/view_1" 22 app:layout_constraintLeft_toLeftOf="@id/view_1"
23 app:layout_constraintRight_toRightOf="@id/view_1" 23 app:layout_constraintRight_toRightOf="@id/view_1"
24 app:layout_constraintTop_toTopOf="@id/view_1" 24 app:layout_constraintTop_toTopOf="@id/view_1" />
25 app:layout_constraintBottom_toBottomOf="@id/view_1" 25
26 />
27 <ImageView 26 <ImageView
28 android:id="@+id/iv_back" 27 android:id="@+id/iv_back"
29 android:layout_width="10dp" 28 android:layout_width="10dp"
30 android:layout_height="16dp" 29 android:layout_height="16dp"
31 app:layout_constraintLeft_toLeftOf="parent"
32 app:layout_constraintTop_toTopOf="@id/view_1"
33 app:layout_constraintBottom_toBottomOf="@id/view_1"
34 android:layout_marginLeft="15dp" 30 android:layout_marginLeft="15dp"
35 android:background="@mipmap/icon_back" 31 android:background="@mipmap/icon_back"
36 /> 32 app:layout_constraintBottom_toBottomOf="@id/view_1"
33 app:layout_constraintLeft_toLeftOf="parent"
34 app:layout_constraintTop_toTopOf="@id/view_1" />
35
37 <View 36 <View
38 android:layout_width="match_parent" 37 android:layout_width="match_parent"
39 android:layout_height="1dp" 38 android:layout_height="1dp"
40 android:background="#EEEEEE" 39 android:background="#EEEEEE"
41 app:layout_constraintTop_toBottomOf="@id/view_1" 40 app:layout_constraintTop_toBottomOf="@id/view_1" />
42 />
43 41
44 <View 42 <View
45 android:id="@+id/view_3" 43 android:id="@+id/view_3"
46 android:layout_width="345dp" 44 android:layout_width="match_parent"
47 android:layout_height="80dp" 45 android:layout_height="80dp"
46 android:layout_marginLeft="15dp"
47 android:layout_marginTop="90dp"
48 android:layout_marginRight="15dp"
48 android:background="@drawable/bg_solid_white_10" 49 android:background="@drawable/bg_solid_white_10"
49 app:layout_constraintLeft_toLeftOf="parent" 50 app:layout_constraintLeft_toLeftOf="parent"
50 app:layout_constraintRight_toRightOf="parent" 51 app:layout_constraintRight_toRightOf="parent"
51 app:layout_constraintTop_toTopOf="parent" 52 app:layout_constraintTop_toTopOf="parent" />
52 android:layout_marginTop="90dp" 53
53 />
54 <ImageView 54 <ImageView
55 android:id="@+id/iv_3" 55 android:id="@+id/iv_3"
56 android:layout_width="57dp" 56 android:layout_width="57dp"
57 android:layout_height="57dp" 57 android:layout_height="57dp"
58 android:background="@mipmap/txz" 58 android:layout_marginRight="31dp"
59 app:layout_constraintTop_toTopOf="@id/view_3" 59 android:background="@mipmap/ic_parent_avatar"
60 app:layout_constraintBottom_toBottomOf="@id/view_3" 60 app:layout_constraintBottom_toBottomOf="@id/view_3"
61 app:layout_constraintRight_toRightOf="@id/view_3" 61 app:layout_constraintRight_toRightOf="@id/view_3"
62 android:layout_marginRight="31dp" 62 app:layout_constraintTop_toTopOf="@id/view_3" />
63 /> 63
64 <TextView 64 <TextView
65 android:id="@+id/tv_3" 65 android:id="@+id/tv_3"
66 android:layout_width="wrap_content" 66 android:layout_width="wrap_content"
67 android:layout_height="wrap_content" 67 android:layout_height="wrap_content"
68 android:layout_marginLeft="15dp"
68 android:text="头像" 69 android:text="头像"
69 android:textColor="#333333" 70 android:textColor="#333333"
70 android:textSize="15dp" 71 android:textSize="15dp"
71 app:layout_constraintTop_toTopOf="@id/view_3"
72 app:layout_constraintBottom_toBottomOf="@id/view_3" 72 app:layout_constraintBottom_toBottomOf="@id/view_3"
73 app:layout_constraintLeft_toLeftOf="@id/view_3" 73 app:layout_constraintLeft_toLeftOf="@id/view_3"
74 android:layout_marginLeft="15dp" 74 app:layout_constraintTop_toTopOf="@id/view_3" />
75 /> 75
76 <ImageView 76 <ImageView
77 android:layout_width="5.5dp" 77 android:layout_width="5.5dp"
78 android:layout_height="9.5dp" 78 android:layout_height="9.5dp"
79 android:layout_marginRight="15dp"
79 android:background="@mipmap/ycaj" 80 android:background="@mipmap/ycaj"
80 app:layout_constraintTop_toTopOf="@id/view_3"
81 app:layout_constraintBottom_toBottomOf="@id/view_3" 81 app:layout_constraintBottom_toBottomOf="@id/view_3"
82 app:layout_constraintRight_toRightOf="@id/view_3" 82 app:layout_constraintRight_toRightOf="@id/view_3"
83 android:layout_marginRight="15dp" 83 app:layout_constraintTop_toTopOf="@id/view_3" />
84 />
85 84
86 <View 85 <View
87 android:id="@+id/view_4" 86 android:id="@+id/view_4"
88 android:layout_width="345dp" 87 android:layout_width="match_parent"
89 android:layout_height="90dp" 88 android:layout_height="90dp"
89 android:layout_marginLeft="15dp"
90 android:layout_marginTop="185dp"
91 android:layout_marginRight="15dp"
90 android:background="@drawable/bg_solid_white_10" 92 android:background="@drawable/bg_solid_white_10"
91 app:layout_constraintLeft_toLeftOf="parent" 93 app:layout_constraintLeft_toLeftOf="parent"
92 app:layout_constraintRight_toRightOf="parent" 94 app:layout_constraintRight_toRightOf="parent"
93 app:layout_constraintTop_toTopOf="parent" 95 app:layout_constraintTop_toTopOf="parent" />
94 android:layout_marginTop="185dp"
95 />
96 96
97 <TextView 97 <TextView
98 android:id="@+id/tv_4" 98 android:id="@+id/tv_4"
99 android:layout_width="wrap_content" 99 android:layout_width="wrap_content"
100 android:layout_height="wrap_content" 100 android:layout_height="wrap_content"
101 android:layout_marginLeft="15dp"
102 android:layout_marginTop="15dp"
101 android:text="账户" 103 android:text="账户"
102 android:textColor="#333333" 104 android:textColor="#333333"
103 android:textSize="15dp" 105 android:textSize="15dp"
104 app:layout_constraintTop_toTopOf="@id/view_4"
105 app:layout_constraintLeft_toLeftOf="@id/view_4" 106 app:layout_constraintLeft_toLeftOf="@id/view_4"
106 android:layout_marginLeft="15dp" 107 app:layout_constraintTop_toTopOf="@id/view_4" />
107 android:layout_marginTop="15dp" 108
108 />
109 <TextView 109 <TextView
110 android:id="@+id/tv_5" 110 android:id="@+id/tv_5"
111 android:layout_width="wrap_content" 111 android:layout_width="wrap_content"
112 android:layout_height="wrap_content" 112 android:layout_height="wrap_content"
113 android:layout_marginLeft="15dp"
114 android:layout_marginTop="60dp"
113 android:text="密码" 115 android:text="密码"
114 android:textColor="#333333" 116 android:textColor="#333333"
115 android:textSize="15dp" 117 android:textSize="15dp"
116 app:layout_constraintTop_toTopOf="@id/view_4"
117 app:layout_constraintLeft_toLeftOf="@id/view_4" 118 app:layout_constraintLeft_toLeftOf="@id/view_4"
118 android:layout_marginLeft="15dp" 119 app:layout_constraintTop_toTopOf="@id/view_4" />
119 android:layout_marginTop="60dp" 120
120 />
121 <TextView 121 <TextView
122 android:id="@+id/tv_6" 122 android:id="@+id/tv_6"
123 android:layout_width="wrap_content" 123 android:layout_width="wrap_content"
124 android:layout_height="wrap_content" 124 android:layout_height="wrap_content"
125 android:layout_marginTop="15dp"
126 android:layout_marginRight="15dp"
125 android:text="123" 127 android:text="123"
126 android:textColor="#666666" 128 android:textColor="#666666"
127 android:textSize="15dp" 129 android:textSize="15dp"
128 app:layout_constraintTop_toTopOf="@id/view_4"
129 app:layout_constraintRight_toRightOf="@id/view_4" 130 app:layout_constraintRight_toRightOf="@id/view_4"
130 android:layout_marginRight="15dp" 131 app:layout_constraintTop_toTopOf="@id/view_4" />
131 android:layout_marginTop="15dp" 132
132 />
133 <ImageView 133 <ImageView
134 android:layout_width="5.5dp" 134 android:layout_width="5.5dp"
135 android:layout_height="9.5dp" 135 android:layout_height="9.5dp"
136 android:layout_marginRight="15dp"
136 android:background="@mipmap/ycaj" 137 android:background="@mipmap/ycaj"
137 app:layout_constraintTop_toTopOf="@id/tv_7"
138 app:layout_constraintBottom_toBottomOf="@id/tv_7" 138 app:layout_constraintBottom_toBottomOf="@id/tv_7"
139 app:layout_constraintRight_toRightOf="@id/view_4" 139 app:layout_constraintRight_toRightOf="@id/view_4"
140 android:layout_marginRight="15dp" 140 app:layout_constraintTop_toTopOf="@id/tv_7" />
141 /> 141
142 <TextView 142 <TextView
143 android:id="@+id/tv_7" 143 android:id="@+id/tv_7"
144 android:layout_width="wrap_content" 144 android:layout_width="wrap_content"
145 android:layout_height="wrap_content" 145 android:layout_height="wrap_content"
app/src/main/res/layout/bottom_sheet_layout.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="wrap_content"
5 android:orientation="vertical"
6 android:background="@drawable/shape_bottom_sheet_dialog">
7
8 <TextView
9 android:id="@+id/take_photo"
10 android:layout_width="match_parent"
11 android:layout_height="50dp"
12 android:text="拍照"
13 android:textSize="15sp"
14 android:textColor="#191919"
15 android:gravity="center"/>
16
17
18 <View
19 android:layout_width="match_parent"
20 android:layout_height="1dp"
21 android:background="#F5F5F5"/>
22 <TextView
23 android:id="@+id/choose_photo"
24 android:layout_width="match_parent"
25 android:layout_height="50dp"
26 android:text="从相册选择"
27 android:textSize="15sp"
28 android:textColor="#191919"
29 android:gravity="center"/>
30
31 <View
32 android:layout_width="match_parent"
33 android:layout_height="10dp"
34 android:background="#F5F5F5"/>
35 <TextView
36 android:id="@+id/cancel"
37 android:layout_width="match_parent"
38 android:layout_height="50dp"
39 android:text="取消"
40 android:textSize="15sp"
41 android:textColor="#191919"
42 android:gravity="center"/>
43
44 </LinearLayout>
app/src/main/res/layout/choose_activity.xml
File was created 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:layout_width="match_parent"
3 android:layout_height="match_parent"
4 android:background="#F4F6F8">
5
6 <TextView
7 android:id="@+id/tv_title"
8 android:layout_width="match_parent"
9 android:layout_height="44dp"
10 android:background="@color/white"
11 android:gravity="center"
12 android:text="选择学生"
13 android:textColor="#333333"
14 android:textSize="18sp" />
15
16 <androidx.recyclerview.widget.RecyclerView
17 android:id="@+id/recycle"
18 android:layout_width="match_parent"
19 android:layout_height="wrap_content"
20 android:layout_above="@+id/tv_confirm"
21 android:layout_below="@+id/tv_title"
22 android:layout_marginBottom="20dp" />
23
24 <TextView
25 android:id="@+id/tv_confirm"
26 android:layout_width="180dp"
27 android:layout_height="40dp"
28 android:layout_alignParentBottom="true"
29 android:layout_centerHorizontal="true"
30 android:layout_marginBottom="120dp"
31 android:background="@drawable/bg_solid_btn"
32 android:gravity="center"
33 android:text="确认"
34
35 android:textColor="@color/white"
36 android:textSize="16sp" />
37
38 </RelativeLayout>
39
app/src/main/res/layout/fragment_home.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <View 8 <View
10 android:id="@+id/view_1" 9 android:id="@+id/view_1"
11 android:layout_width="match_parent" 10 android:layout_width="match_parent"
12 android:layout_height="44dp" 11 android:layout_height="44dp"
13 app:layout_constraintTop_toTopOf="parent"
14 android:background="@android:color/white" 12 android:background="@android:color/white"
15 /> 13 app:layout_constraintTop_toTopOf="parent" />
14
16 <ImageView 15 <ImageView
17 android:id="@+id/iv_1" 16 android:id="@+id/iv_1"
18 android:layout_width="10dp" 17 android:layout_width="10dp"
19 android:layout_height="16dp" 18 android:layout_height="16dp"
20 app:layout_constraintLeft_toLeftOf="parent"
21 app:layout_constraintTop_toTopOf="@id/view_1"
22 app:layout_constraintBottom_toBottomOf="@id/view_1"
23 android:layout_marginLeft="15dp" 19 android:layout_marginLeft="15dp"
24 android:background="@mipmap/icon_back" 20 android:background="@mipmap/icon_back"
25 /> 21 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 app:layout_constraintLeft_toLeftOf="parent"
23 app:layout_constraintTop_toTopOf="@id/view_1" />
26 24
27 <ImageView 25 <ImageView
28 android:id="@+id/iv_2" 26 android:id="@+id/iv_2"
29 android:layout_width="31dp" 27 android:layout_width="31dp"
30 android:layout_height="31dp" 28 android:layout_height="31dp"
31 app:layout_constraintTop_toTopOf="@id/view_1"
32 app:layout_constraintBottom_toBottomOf="@id/view_1"
33 app:layout_constraintLeft_toLeftOf="parent"
34 android:layout_marginLeft="35dp" 29 android:layout_marginLeft="35dp"
35 android:background="@mipmap/txz" 30 android:background="@mipmap/txz"
36 /> 31 app:layout_constraintBottom_toBottomOf="@id/view_1"
32 app:layout_constraintLeft_toLeftOf="parent"
33 app:layout_constraintTop_toTopOf="@id/view_1" />
34
37 <TextView 35 <TextView
38 android:id="@+id/tv_name" 36 android:id="@+id/tv_name"
39 android:layout_width="wrap_content" 37 android:layout_width="wrap_content"
40 android:layout_height="wrap_content" 38 android:layout_height="wrap_content"
39 android:layout_marginLeft="6.5dp"
41 android:textColor="#333333" 40 android:textColor="#333333"
42 android:textSize="15dp" 41 android:textSize="15dp"
43 app:layout_constraintTop_toTopOf="@id/view_1"
44 app:layout_constraintBottom_toBottomOf="@id/view_1" 42 app:layout_constraintBottom_toBottomOf="@id/view_1"
45 app:layout_constraintLeft_toRightOf="@id/iv_2" 43 app:layout_constraintLeft_toRightOf="@id/iv_2"
46 android:layout_marginLeft="6.5dp" 44 app:layout_constraintTop_toTopOf="@id/view_1" />
47 /> 45
48 <ImageView 46 <ImageView
49 android:id="@+id/iv_3" 47 android:id="@+id/iv_3"
50 android:layout_width="8dp" 48 android:layout_width="8dp"
51 android:layout_height="5dp" 49 android:layout_height="5dp"
52 app:layout_constraintTop_toTopOf="@id/view_1"
53 app:layout_constraintBottom_toBottomOf="@id/view_1"
54 app:layout_constraintLeft_toRightOf="@id/tv_name"
55 android:layout_marginLeft="5dp" 50 android:layout_marginLeft="5dp"
56 android:background="@mipmap/xxan" 51 android:background="@mipmap/xxan"
57 /> 52 app:layout_constraintBottom_toBottomOf="@id/view_1"
53 app:layout_constraintLeft_toRightOf="@id/tv_name"
54 app:layout_constraintTop_toTopOf="@id/view_1" />
58 55
59 <ImageView 56 <ImageView
60 android:id="@+id/iv_sapmiao" 57 android:id="@+id/iv_sapmiao"
61 android:layout_width="345dp" 58 android:layout_width="match_parent"
62 android:layout_height="167dp" 59 android:layout_height="167dp"
63 app:layout_constraintLeft_toLeftOf="parent" 60 android:layout_marginLeft="15dp"
64 app:layout_constraintRight_toRightOf="parent"
65 app:layout_constraintTop_toTopOf="parent"
66 android:layout_marginTop="60dp" 61 android:layout_marginTop="60dp"
62 android:layout_marginRight="15dp"
67 android:background="@mipmap/ssss" 63 android:background="@mipmap/ssss"
68 /> 64 app:layout_constraintLeft_toLeftOf="parent"
65 app:layout_constraintRight_toRightOf="parent"
66 app:layout_constraintTop_toTopOf="parent" />
69 67
70 68
71 <View 69 <LinearLayout
72 android:id="@+id/view_2" 70 android:id="@+id/view_2"
73 android:layout_width="345dp" 71 android:layout_width="match_parent"
74 android:layout_height="100dp" 72 android:layout_height="100dp"
73 android:layout_marginLeft="15dp"
74 android:layout_marginTop="240dp"
75 android:layout_marginRight="15dp"
76 android:background="@drawable/bg_solid_white_10"
77 android:orientation="horizontal"
75 app:layout_constraintLeft_toLeftOf="parent" 78 app:layout_constraintLeft_toLeftOf="parent"
76 app:layout_constraintRight_toRightOf="parent" 79 app:layout_constraintRight_toRightOf="parent"
77 app:layout_constraintTop_toTopOf="parent" 80 app:layout_constraintTop_toTopOf="parent">
78 android:background="@drawable/bg_solid_white_10"
79 android:layout_marginTop="240dp"
80 />
81 81
82 <ImageView 82 <LinearLayout
83 android:id="@+id/iv_21" 83 android:layout_width="0dp"
84 android:layout_width="50dp" 84 android:layout_height="wrap_content"
85 android:layout_height="50dp" 85 android:layout_weight="1"
86 app:layout_constraintLeft_toLeftOf="@id/view_2" 86 android:orientation="vertical">
87 app:layout_constraintTop_toTopOf="@id/view_2"
88 android:layout_marginLeft="10dp"
89 android:layout_marginTop="15dp"
90 android:background="@mipmap/yyxz"
91 />
92 <TextView
93 android:layout_width="wrap_content"
94 android:layout_height="wrap_content"
95 android:textColor="#333333"
96 android:textSize="13dp"
97 android:text="应用管理"
98 android:layout_marginTop="8dp"
99 app:layout_constraintLeft_toLeftOf="@id/iv_21"
100 app:layout_constraintRight_toRightOf="@id/iv_21"
101 app:layout_constraintTop_toBottomOf="@id/iv_21"
102 />
103 <ImageView
104 android:id="@+id/iv_22"
105 android:layout_width="50dp"
106 android:layout_height="50dp"
107 app:layout_constraintLeft_toLeftOf="@id/view_2"
108 app:layout_constraintTop_toTopOf="@id/view_2"
109 android:layout_marginLeft="101dp"
110 android:layout_marginTop="15dp"
111 android:background="@mipmap/xxxt"
112 />
113 <TextView
114 android:layout_width="wrap_content"
115 android:layout_height="wrap_content"
116 android:textColor="#333333"
117 android:textSize="13dp"
118 android:text="小星错题"
119 android:layout_marginTop="8dp"
120 app:layout_constraintLeft_toLeftOf="@id/iv_22"
121 app:layout_constraintRight_toRightOf="@id/iv_22"
122 app:layout_constraintTop_toBottomOf="@id/iv_22"
123 />
124 <ImageView
125 android:id="@+id/iv_23"
126 android:layout_width="50dp"
127 android:layout_height="50dp"
128 app:layout_constraintLeft_toLeftOf="@id/view_2"
129 app:layout_constraintTop_toTopOf="@id/view_2"
130 android:layout_marginLeft="194dp"
131 android:layout_marginTop="15dp"
132 android:background="@mipmap/ffsj"
133 />
134 <TextView
135 android:layout_width="wrap_content"
136 android:layout_height="wrap_content"
137 android:textColor="#333333"
138 android:textSize="13dp"
139 android:text="分发试卷"
140 android:layout_marginTop="8dp"
141 app:layout_constraintLeft_toLeftOf="@id/iv_23"
142 app:layout_constraintRight_toRightOf="@id/iv_23"
143 app:layout_constraintTop_toBottomOf="@id/iv_23"
144 />
145 <ImageView
146 android:id="@+id/iv_24"
147 android:layout_width="50dp"
148 android:layout_height="50dp"
149 app:layout_constraintLeft_toLeftOf="@id/view_2"
150 app:layout_constraintTop_toTopOf="@id/view_2"
151 android:layout_marginLeft="285dp"
152 android:layout_marginTop="15dp"
153 android:background="@mipmap/sbgl"
154 />
155 <TextView
156 android:layout_width="wrap_content"
157 android:layout_height="wrap_content"
158 android:textColor="#333333"
159 android:textSize="13dp"
160 android:text="设备管理"
161 android:layout_marginTop="8dp"
162 app:layout_constraintLeft_toLeftOf="@id/iv_24"
163 app:layout_constraintRight_toRightOf="@id/iv_24"
164 app:layout_constraintTop_toBottomOf="@id/iv_24"
165 />
166 87
167 <View 88 <ImageView
89 android:id="@+id/iv_21"
90 android:layout_width="50dp"
91 android:layout_height="50dp"
92 android:layout_gravity="center_horizontal"
93 android:layout_marginTop="15dp"
94 android:background="@mipmap/yyxz" />
95
96 <TextView
97 android:layout_width="wrap_content"
98 android:layout_height="wrap_content"
99 android:layout_gravity="center_horizontal"
100 android:layout_marginTop="8dp"
101 android:text="应用管理"
102 android:textColor="#333333"
103 android:textSize="13dp"
104 app:layout_constraintLeft_toLeftOf="@id/iv_21"
105 app:layout_constraintRight_toRightOf="@id/iv_21"
106 app:layout_constraintTop_toBottomOf="@id/iv_21" />
107 </LinearLayout>
108
109 <LinearLayout
110 android:layout_width="0dp"
111 android:layout_height="wrap_content"
112 android:layout_weight="1"
113 android:orientation="vertical">
114
115 <ImageView
116 android:id="@+id/iv_22"
117 android:layout_width="50dp"
118 android:layout_height="50dp"
119 android:layout_gravity="center_horizontal"
120 android:layout_marginTop="15dp"
121 android:background="@mipmap/xxxt"
122 app:layout_constraintLeft_toLeftOf="@id/view_2"
123 app:layout_constraintTop_toTopOf="@id/view_2" />
124
125 <TextView
126 android:layout_width="wrap_content"
127 android:layout_height="wrap_content"
128 android:layout_gravity="center_horizontal"
129 android:layout_marginTop="8dp"
130 android:text="小星错题"
131 android:textColor="#333333"
132 android:textSize="13dp"
133 app:layout_constraintLeft_toLeftOf="@id/iv_22"
134 app:layout_constraintRight_toRightOf="@id/iv_22"
135 app:layout_constraintTop_toBottomOf="@id/iv_22" />
136 </LinearLayout>
137
138 <LinearLayout
139 android:layout_width="0dp"
140 android:layout_height="wrap_content"
141 android:layout_weight="1"
142 android:orientation="vertical">
143
144 <ImageView
145 android:id="@+id/iv_23"
146 android:layout_width="50dp"
147 android:layout_height="50dp"
148 android:layout_gravity="center_horizontal"
149 android:layout_marginTop="15dp"
150 android:background="@mipmap/ffsj"
151 app:layout_constraintLeft_toLeftOf="@id/view_2"
152 app:layout_constraintTop_toTopOf="@id/view_2" />
153
154 <TextView
155 android:layout_width="wrap_content"
156 android:layout_height="wrap_content"
157 android:layout_gravity="center_horizontal"
158 android:layout_marginTop="8dp"
159 android:text="分发试卷"
160 android:textColor="#333333"
161 android:textSize="13dp"
162 app:layout_constraintLeft_toLeftOf="@id/iv_23"
163 app:layout_constraintRight_toRightOf="@id/iv_23"
164 app:layout_constraintTop_toBottomOf="@id/iv_23" />
165 </LinearLayout>
166
167 <LinearLayout
168 android:layout_width="0dp"
169 android:layout_height="wrap_content"
170 android:layout_weight="1"
171 android:orientation="vertical">
172
173 <ImageView
174 android:id="@+id/iv_24"
175 android:layout_width="50dp"
176 android:layout_height="50dp"
177 android:layout_gravity="center_horizontal"
178 android:layout_marginTop="15dp"
179 android:background="@mipmap/sbgl"
app/src/main/res/layout/fragment_me.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:background="#F4F6F8">
6 android:background="#F4F6F8"
7 >
8 7
9 <androidx.constraintlayout.widget.Group 8 <androidx.constraintlayout.widget.Group
10 android:id="@+id/group_1" 9 android:id="@+id/group_1"
11 android:layout_width="wrap_content" 10 android:layout_width="wrap_content"
12 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
13 app:constraint_referenced_ids="iv_toux,tv_name,tv_phone,view_2,tv_title,iv_21,iv_22,iv_23,tv_21,tv_22,tv_23" 12 android:visibility="visible" />
14 android:visibility="gone"
15 />
16 13
17 <View 14 <View
18 android:id="@+id/view_1" 15 android:id="@+id/view_1"
19 android:layout_width="match_parent" 16 android:layout_width="match_parent"
20 android:layout_height="44dp" 17 android:layout_height="44dp"
21 app:layout_constraintTop_toTopOf="parent"
22 android:background="@android:color/white" 18 android:background="@android:color/white"
23 /> 19 app:layout_constraintTop_toTopOf="parent" />
20
24 <TextView 21 <TextView
25 android:layout_width="wrap_content" 22 android:layout_width="wrap_content"
26 android:layout_height="wrap_content" 23 android:layout_height="wrap_content"
27 android:text="个人中心" 24 android:text="个人中心"
28 android:textColor="#333333" 25 android:textColor="#333333"
29 android:textSize="18dp" 26 android:textSize="18dp"
27 app:layout_constraintBottom_toBottomOf="@id/view_1"
30 app:layout_constraintLeft_toLeftOf="@id/view_1" 28 app:layout_constraintLeft_toLeftOf="@id/view_1"
31 app:layout_constraintRight_toRightOf="@id/view_1" 29 app:layout_constraintRight_toRightOf="@id/view_1"
32 app:layout_constraintTop_toTopOf="@id/view_1" 30 app:layout_constraintTop_toTopOf="@id/view_1" />
33 app:layout_constraintBottom_toBottomOf="@id/view_1"
34 />
35 31
36 <ImageView
37 android:id="@+id/iv_bann"
38 android:layout_width="345dp"
39 android:layout_height="167dp"
40 android:background="@mipmap/smdlaa"
41 app:layout_constraintLeft_toLeftOf="parent"
42 app:layout_constraintRight_toRightOf="parent"
43 app:layout_constraintTop_toTopOf="parent"
44 android:layout_marginTop="63dp"
45 android:visibility="visible"
46 />
47 32
48 <ImageView 33 <ImageView
49 android:id="@+id/iv_toux" 34 android:id="@+id/iv_toux"
50 android:layout_width="57dp" 35 android:layout_width="57dp"
51 android:layout_height="57dp" 36 android:layout_height="57dp"
52 app:layout_constraintLeft_toLeftOf="parent"
53 app:layout_constraintTop_toTopOf="parent"
54 android:layout_marginLeft="15dp" 37 android:layout_marginLeft="15dp"
55 android:layout_marginTop="63dp" 38 android:layout_marginTop="63dp"
56 android:background="@mipmap/txz" 39 android:background="@mipmap/ic_parent_avatar"
57 /> 40 app:layout_constraintLeft_toLeftOf="parent"
41 app:layout_constraintTop_toTopOf="parent" />
58 42
59 <TextView 43 <TextView
60 android:id="@+id/tv_name" 44 android:id="@+id/tv_name"
61 android:layout_width="wrap_content" 45 android:layout_width="wrap_content"
62 android:layout_height="wrap_content" 46 android:layout_height="wrap_content"
63 app:layout_constraintLeft_toLeftOf="parent"
64 app:layout_constraintTop_toTopOf="parent"
65 android:layout_marginLeft="88dp" 47 android:layout_marginLeft="88dp"
66 android:layout_marginTop="72dp" 48 android:layout_marginTop="72dp"
67 android:textSize="20dp"
68 android:textColor="#333333"
69 android:text="名字" 49 android:text="名字"
70 /> 50 android:textColor="#333333"
51 android:textSize="20dp"
52 app:layout_constraintLeft_toLeftOf="parent"
53 app:layout_constraintTop_toTopOf="parent" />
54
71 <TextView 55 <TextView
72 android:id="@+id/tv_phone" 56 android:id="@+id/tv_phone"
73 android:layout_width="wrap_content" 57 android:layout_width="wrap_content"
74 android:layout_height="wrap_content" 58 android:layout_height="wrap_content"
75 app:layout_constraintLeft_toLeftOf="parent"
76 app:layout_constraintTop_toTopOf="parent"
77 android:layout_marginLeft="88dp" 59 android:layout_marginLeft="88dp"
78 android:layout_marginTop="98dp" 60 android:layout_marginTop="98dp"
61 android:text="1231223123"
79 android:textColor="#999999" 62 android:textColor="#999999"
80 android:textSize="17dp" 63 android:textSize="17dp"
81 android:text="1231223123" 64 android:visibility="gone"
82 /> 65 app:layout_constraintLeft_toLeftOf="parent"
83 66 app:layout_constraintTop_toTopOf="parent" />
84 67
85 68
86 <View 69 <LinearLayout
87 android:id="@+id/view_2" 70 android:id="@+id/view_2"
88 android:layout_width="345dp" 71 android:layout_width="match_parent"
89 android:layout_height="140dp" 72 android:layout_height="140dp"
90 app:layout_constraintLeft_toLeftOf="parent" 73 android:layout_marginLeft="15dp"
91 app:layout_constraintRight_toRightOf="parent"
92 app:layout_constraintTop_toTopOf="parent"
93 android:layout_marginTop="140dp" 74 android:layout_marginTop="140dp"
75 android:layout_marginRight="15dp"
94 android:background="@drawable/bg_solid_white_10" 76 android:background="@drawable/bg_solid_white_10"
95 /> 77 android:orientation="vertical"
96 78 app:layout_constraintLeft_toLeftOf="parent"
97 <TextView 79 app:layout_constraintRight_toRightOf="parent"
98 android:id="@+id/tv_title" 80 app:layout_constraintTop_toTopOf="parent">
99 android:layout_width="wrap_content"
100 android:layout_height="wrap_content"
101 android:text="学生"
102 android:textColor="#333333"
103 android:textSize="16dp"
104 app:layout_constraintLeft_toLeftOf="@id/view_2"
105 app:layout_constraintTop_toTopOf="@id/view_2"
106 android:layout_marginLeft="15dp"
107 android:layout_marginTop="15dp"
108 />
109
110 <ImageView
111 android:id="@+id/iv_21"
112 android:layout_width="56dp"
113 android:layout_height="56dp"
114 android:background="@mipmap/tjxss"
115 app:layout_constraintLeft_toLeftOf="@id/view_2"
116 app:layout_constraintTop_toTopOf="@id/view_2"
117 android:layout_marginLeft="15dp"
118 android:layout_marginTop="44dp"
119 />
120 <TextView
121 android:id="@+id/tv_21"
122 android:layout_width="wrap_content"
123 android:layout_height="wrap_content"
124 app:layout_constraintLeft_toLeftOf="@id/iv_21"
125 app:layout_constraintRight_toRightOf="@id/iv_21"
126 app:layout_constraintTop_toBottomOf="@id/iv_21"
127 android:layout_marginTop="10dp"
128 android:textColor="#000000"
129 android:textSize="13dp"
130 android:text="添加学生"
131 />
132 <ImageView
133 android:id="@+id/iv_22"
134 android:layout_width="56dp"
135 android:layout_height="56dp"
136 android:background="@mipmap/tjxss"
137 app:layout_constraintLeft_toLeftOf="@id/view_2"
138 app:layout_constraintTop_toTopOf="@id/view_2"
139 android:layout_marginLeft="144dp"
140 android:layout_marginTop="44dp"
141 />
142 <TextView
143 android:id="@+id/tv_22"
144 android:layout_width="wrap_content"
145 android:layout_height="wrap_content"
146 app:layout_constraintLeft_toLeftOf="@id/iv_22"
147 app:layout_constraintRight_toRightOf="@id/iv_22"
148 app:layout_constraintTop_toBottomOf="@id/iv_22"
149 android:layout_marginTop="10dp"
150 android:textColor="#000000"
151 android:textSize="13dp"
152 android:text="添加学生"
153 />
154 <ImageView
155 android:id="@+id/iv_23"
156 android:layout_width="56dp"
157 android:layout_height="56dp"
158 android:background="@mipmap/tjxss"
159 app:layout_constraintLeft_toLeftOf="@id/view_2"
160 app:layout_constraintTop_toTopOf="@id/view_2"
161 android:layout_marginLeft="274dp"
162 android:layout_marginTop="44dp"
163 />
164 <TextView
165 android:id="@+id/tv_23"
166 android:layout_width="wrap_content"
167 android:layout_height="wrap_content"
168 app:layout_constraintLeft_toLeftOf="@id/iv_23"
169 app:layout_constraintRight_toRightOf="@id/iv_23"
170 app:layout_constraintTop_toBottomOf="@id/iv_23"
171 android:layout_marginTop="10dp"
172 android:textColor="#000000"
173 android:textSize="13dp"
174 android:text="添加学生"
175 />
176
177
178
179
180
181
182 81
82 <TextView
83 android:id="@+id/tv_title"
84 android:layout_width="wrap_content"
85 android:layout_height="wrap_content"
86 android:layout_marginLeft="15dp"
87 android:layout_marginTop="15dp"
88 android:text="学生"
89 android:textColor="#333333"
90 android:textSize="16dp" />
183 91
92 <androidx.recyclerview.widget.RecyclerView
93 android:id="@+id/recycle"
94 android:layout_width="match_parent"
95 android:layout_height="match_parent"
96 android:layout_marginLeft="15dp"
97 android:layout_marginRight="15dp" />
98 </LinearLayout>
184 99
185 <View 100 <View
186 android:id="@+id/view_3" 101 android:id="@+id/view_3"
187 android:layout_width="345dp" 102 android:layout_width="match_parent"
188 android:layout_height="45dp" 103 android:layout_height="45dp"
104 android:layout_marginLeft="15dp"
105 android:layout_marginTop="15dp"
106 android:layout_marginRight="15dp"
107 android:background="@drawable/bg_solid_white_10_top"
189 app:layout_constraintLeft_toLeftOf="parent" 108 app:layout_constraintLeft_toLeftOf="parent"
190 app:layout_constraintRight_toRightOf="parent" 109 app:layout_constraintRight_toRightOf="parent"
191 app:layout_goneMarginTop="241dp"
192 app:layout_constraintTop_toBottomOf="@id/view_2" 110 app:layout_constraintTop_toBottomOf="@id/view_2"
193 android:layout_marginTop="15dp" 111 app:layout_goneMarginTop="241dp" />
194 android:background="@drawable/bg_solid_white_10_top" 112
195 />
196 <ImageView 113 <ImageView
197 android:layout_width="6.8dp" 114 android:layout_width="6.8dp"
198 android:layout_height="12dp" 115 android:layout_height="12dp"
116 android:layout_marginRight="15dp"
199 android:background="@mipmap/ycaj" 117 android:background="@mipmap/ycaj"
200 app:layout_constraintTop_toTopOf="@id/view_3"
201 app:layout_constraintBottom_toBottomOf="@id/view_3" 118 app:layout_constraintBottom_toBottomOf="@id/view_3"
202 app:layout_constraintRight_toRightOf="@id/view_3" 119 app:layout_constraintRight_toRightOf="@id/view_3"
203 android:layout_marginRight="15dp" 120 app:layout_constraintTop_toTopOf="@id/view_3" />
204 /> 121
205 <ImageView 122 <ImageView
206 android:layout_width="14dp" 123 android:layout_width="14dp"
207 android:layout_height="14dp" 124 android:layout_height="14dp"
208 app:layout_constraintTop_toTopOf="@id/view_3"
209 app:layout_constraintBottom_toBottomOf="@id/view_3"
210 app:layout_constraintLeft_toLeftOf="@id/view_3"
211 android:layout_marginLeft="15dp" 125 android:layout_marginLeft="15dp"
212 android:background="@mipmap/szz" 126 android:background="@mipmap/szz"
213 /> 127 app:layout_constraintBottom_toBottomOf="@id/view_3"
128 app:layout_constraintLeft_toLeftOf="@id/view_3"
129 app:layout_constraintTop_toTopOf="@id/view_3" />
214 130
215 <TextView 131 <TextView
216 android:layout_width="wrap_content" 132 android:layout_width="wrap_content"
217 android:layout_height="wrap_content" 133 android:layout_height="wrap_content"
134 android:layout_marginLeft="40dp"
135 android:text="账户设置"
218 android:textColor="#333333" 136 android:textColor="#333333"
219 android:textSize="15dp" 137 android:textSize="15dp"
220 android:text="账户设置"
221 app:layout_constraintTop_toTopOf="@id/view_3"
222 app:layout_constraintBottom_toBottomOf="@id/view_3" 138 app:layout_constraintBottom_toBottomOf="@id/view_3"
223 app:layout_constraintLeft_toLeftOf="@id/view_3" 139 app:layout_constraintLeft_toLeftOf="@id/view_3"
224 android:layout_marginLeft="40dp" 140 app:layout_constraintTop_toTopOf="@id/view_3" />
225 /> 141
226 <View 142 <View
227 android:id="@+id/view_4" 143 android:id="@+id/view_4"
228 android:layout_width="345dp" 144 android:layout_width="match_parent"
229 android:layout_height="45dp" 145 android:layout_height="45dp"
146 android:layout_marginLeft="15dp"
147 android:layout_marginRight="15dp"
148 android:background="@android:color/white"
230 app:layout_constraintLeft_toLeftOf="parent" 149 app:layout_constraintLeft_toLeftOf="parent"
231 app:layout_constraintRight_toRightOf="parent" 150 app:layout_constraintRight_toRightOf="parent"
232 app:layout_constraintTop_toBottomOf="@id/view_3" 151 app:layout_constraintTop_toBottomOf="@id/view_3" />
233 android:background="@android:color/white" 152
234 />
235 <ImageView 153 <ImageView
236 android:layout_width="6.8dp" 154 android:layout_width="6.8dp"
237 android:layout_height="12dp" 155 android:layout_height="12dp"
156 android:layout_marginRight="15dp"
238 android:background="@mipmap/ycaj" 157 android:background="@mipmap/ycaj"
239 app:layout_constraintTop_toTopOf="@id/view_4"
240 app:layout_constraintBottom_toBottomOf="@id/view_4" 158 app:layout_constraintBottom_toBottomOf="@id/view_4"
241 app:layout_constraintRight_toRightOf="@id/view_4" 159 app:layout_constraintRight_toRightOf="@id/view_4"
242 android:layout_marginRight="15dp" 160 app:layout_constraintTop_toTopOf="@id/view_4" />
243 /> 161
244 <ImageView 162 <ImageView
245 android:layout_width="14dp" 163 android:layout_width="14dp"
246 android:layout_height="14dp" 164 android:layout_height="14dp"
247 app:layout_constraintTop_toTopOf="@id/view_4"
248 app:layout_constraintBottom_toBottomOf="@id/view_4"
249 app:layout_constraintLeft_toLeftOf="@id/view_4"
250 android:layout_marginLeft="15dp" 165 android:layout_marginLeft="15dp"
251 android:background="@mipmap/yincs" 166 android:background="@mipmap/yincs"
252 /> 167 app:layout_constraintBottom_toBottomOf="@id/view_4"
168 app:layout_constraintLeft_toLeftOf="@id/view_4"
169 app:layout_constraintTop_toTopOf="@id/view_4" />
253 170
254 <TextView 171 <TextView
255 android:layout_width="wrap_content" 172 android:layout_width="wrap_content"
256 android:layout_height="wrap_content" 173 android:layout_height="wrap_content"
174 android:layout_marginLeft="40dp"
175 android:text="隐私设置"
257 android:textColor="#333333" 176 android:textColor="#333333"
258 android:textSize="15dp" 177 android:textSize="15dp"
259 android:text="隐私设置"
260 app:layout_constraintTop_toTopOf="@id/view_4"
261 app:layout_constraintBottom_toBottomOf="@id/view_4" 178 app:layout_constraintBottom_toBottomOf="@id/view_4"
262 app:layout_constraintLeft_toLeftOf="@id/view_4" 179 app:layout_constraintLeft_toLeftOf="@id/view_4"
263 android:layout_marginLeft="40dp" 180 app:layout_constraintTop_toTopOf="@id/view_4" />
264 />
265 181
266 <View 182 <View
267 android:id="@+id/view_5" 183 android:id="@+id/view_5"
268 android:layout_width="345dp" 184 android:layout_width="match_parent"
269 android:layout_height="45dp" 185 android:layout_height="45dp"
186 android:layout_marginLeft="15dp"
187 android:layout_marginRight="15dp"
188 android:background="@android:color/white"
270 app:layout_constraintLeft_toLeftOf="parent" 189 app:layout_constraintLeft_toLeftOf="parent"
271 app:layout_constraintRight_toRightOf="parent" 190 app:layout_constraintRight_toRightOf="parent"
272 app:layout_constraintTop_toBottomOf="@id/view_4" 191 app:layout_constraintTop_toBottomOf="@id/view_4" />
273 android:background="@android:color/white" 192
274 />
275 <ImageView 193 <ImageView
276 android:layout_width="6.8dp" 194 android:layout_width="6.8dp"
277 android:layout_height="12dp" 195 android:layout_height="12dp"
196 android:layout_marginRight="15dp"
278 android:background="@mipmap/ycaj" 197 android:background="@mipmap/ycaj"
279 app:layout_constraintTop_toTopOf="@id/view_5"
280 app:layout_constraintBottom_toBottomOf="@id/view_5" 198 app:layout_constraintBottom_toBottomOf="@id/view_5"
281 app:layout_constraintRight_toRightOf="@id/view_5" 199 app:layout_constraintRight_toRightOf="@id/view_5"
282 android:layout_marginRight="15dp" 200 app:layout_constraintTop_toTopOf="@id/view_5" />
283 /> 201
284 <ImageView 202 <ImageView
285 android:layout_width="14dp" 203 android:layout_width="14dp"
286 android:layout_height="14dp" 204 android:layout_height="14dp"
287 app:layout_constraintTop_toTopOf="@id/view_5"
288 app:layout_constraintBottom_toBottomOf="@id/view_5"
289 app:layout_constraintLeft_toLeftOf="@id/view_5"
290 android:layout_marginLeft="15dp" 205 android:layout_marginLeft="15dp"
291 android:background="@mipmap/gywmm" 206 android:background="@mipmap/gywmm"
292 /> 207 app:layout_constraintBottom_toBottomOf="@id/view_5"
208 app:layout_constraintLeft_toLeftOf="@id/view_5"
209 app:layout_constraintTop_toTopOf="@id/view_5" />
293 210
294 <TextView 211 <TextView
295 android:layout_width="wrap_content" 212 android:layout_width="wrap_content"
296 android:layout_height="wrap_content" 213 android:layout_height="wrap_content"
214 android:layout_marginLeft="40dp"
215 android:text="关于我们"
297 android:textColor="#333333" 216 android:textColor="#333333"
298 android:textSize="15dp" 217 android:textSize="15dp"
app/src/main/res/layout/item_child.xml
File was created 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:layout_width="75dp"
3 android:layout_height="wrap_content"
4 android:layout_marginLeft="15dp"
5 android:layout_marginRight="15dp"
6 android:orientation="vertical">
7
8 <ImageView
9 android:id="@+id/iv_avatar"
10 android:layout_width="56dp"
11 android:layout_height="56dp"
12 android:layout_centerHorizontal="true"
13 android:layout_marginTop="8dp"
14 android:background="@mipmap/tjxss" />
15
16 <ImageView
17 android:id="@+id/iv_vip"
18 android:layout_width="20dp"
19 android:layout_height="18dp"
20 android:layout_alignRight="@+id/iv_avatar"
21 android:src="@mipmap/ic_vip" />
22
23 <TextView
24 android:id="@+id/tv_name"
25 android:layout_width="wrap_content"
26 android:layout_height="wrap_content"
27 android:layout_below="@+id/iv_avatar"
28 android:layout_centerHorizontal="true"
29 android:layout_marginTop="10dp"
30 android:ellipsize="end"
31 android:singleLine="true"
32 android:text="添加学生"
33 android:textColor="#000000"
34 android:textSize="13dp" />
35 </RelativeLayout>
36
37
app/src/main/res/layout/item_child_choose.xml
File was created 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:id="@+id/rl_child"
3 android:layout_width="match_parent"
4 android:layout_height="70dp"
5 android:layout_marginLeft="15dp"
6 android:layout_marginTop="15dp"
7 android:layout_marginRight="15dp"
8 android:background="@drawable/bg_solid_white_10">
9
10 <ImageView
11 android:id="@+id/iv_avatar"
12 android:layout_width="50dp"
13 android:layout_height="50dp"
14 android:layout_centerVertical="true"
15 android:layout_marginLeft="20dp" />
16
17 <ImageView
18 android:id="@+id/iv_vip"
19 android:layout_width="20dp"
20 android:layout_height="18dp"
21 android:layout_alignRight="@+id/iv_avatar"
22 android:src="@mipmap/ic_vip" />
23
24 <TextView
25 android:id="@+id/tv_name"
26 android:layout_width="wrap_content"
27 android:layout_height="wrap_content"
28 android:layout_centerVertical="true"
29 android:layout_marginLeft="15dp"
30 android:layout_toRightOf="@+id/iv_avatar"
31 android:textColor="#333333"
32 android:textSize="16sp" />
33
34 <ImageView
35 android:id="@+id/iv_select"
36 android:layout_width="15dp"
37 android:layout_height="15dp"
38 android:layout_alignParentRight="true"
39 android:src="@mipmap/wsyq"
40 android:layout_centerVertical="true"
41 android:layout_marginRight="20dp" />
42
43 <RelativeLayout
44 android:id="@+id/rl_add"
45 android:layout_width="match_parent"
46 android:layout_height="match_parent"
47 android:background="@drawable/bg_solid_white_10"
48 android:visibility="gone">
49
50 <LinearLayout
51 android:layout_width="wrap_content"
52 android:layout_height="wrap_content"
53 android:layout_centerInParent="true"
54 android:orientation="horizontal">
55
56 <ImageView
57 android:layout_width="20dp"
58 android:layout_height="20dp"
59 android:layout_gravity="center_vertical"
60 android:gravity="center_vertical"
61 android:src="@mipmap/ic_add" />
62
63 <TextView
64 android:layout_width="wrap_content"
65 android:layout_height="wrap_content"
66 android:layout_gravity="center_vertical"
67 android:layout_marginLeft="8dp"
68 android:gravity="center_vertical"
69 android:text="添加学生"
70 android:textColor="#FE5E09"
71 android:textSize="16sp" />
72 </LinearLayout>
73 </RelativeLayout>
74 </RelativeLayout>
app/src/main/res/layout/item_schedule.xml
File was created 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:layout_width="match_parent"
3 android:layout_height="wrap_content"
4 android:layout_marginLeft="15dp"
5 android:layout_marginTop="15dp"
6 android:layout_marginRight="15dp"
7 android:orientation="vertical">
8
9 <LinearLayout
10 android:layout_width="wrap_content"
11 android:layout_height="wrap_content"
12 android:orientation="horizontal">
13
14 <View
15 android:layout_width="1dp"
16 android:layout_height="15dp"
17 android:layout_gravity="center_vertical"
18 android:background="#FE5E09" />
19
20 <TextView
21 android:id="@+id/tv_date"
22 android:layout_width="wrap_content"
23 android:layout_height="wrap_content"
24 android:layout_gravity="center_vertical"
25 android:layout_marginLeft="10dp"
26 android:textColor="#333333"
27 android:textSize="13sp" />
28 </LinearLayout>
29
30 <LinearLayout
31 android:id="@+id/ll_schedule"
32 android:layout_width="match_parent"
33 android:layout_height="wrap_content"
34 android:orientation="vertical" />
35 </LinearLayout>
app/src/main/res/layout/item_video.xml
File was created 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:layout_width="match_parent"
3 android:layout_height="wrap_content">
4
5 <TextView
6 android:id="@+id/tv_name"
7 android:layout_width="match_parent"
8 android:layout_height="35dp"
9 android:layout_marginTop="15dp"
10 android:background="@drawable/bg_item_video_10"
11 android:gravity="center"
12 android:singleLine="true"
13 android:textColor="#333333"
14 android:textSize="13sp" />
15 </LinearLayout>
app/src/main/res/mipmap-hdpi/gx.png

847 Bytes | W: | H:

2.11 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-hdpi/ic_add.png

3.3 KB

app/src/main/res/mipmap-hdpi/ic_avatar_female.png

168 KB

app/src/main/res/mipmap-hdpi/ic_avatar_male.png

202 KB

app/src/main/res/mipmap-hdpi/ic_edit.png

2.39 KB

app/src/main/res/mipmap-hdpi/ic_parent_avatar.png

182 KB

app/src/main/res/mipmap-hdpi/ic_teacher_female.png

164 KB

app/src/main/res/mipmap-hdpi/ic_teacher_male.png

169 KB

app/src/main/res/mipmap-hdpi/ic_vip.png

8.46 KB

app/src/main/res/mipmap-hdpi/ssss.png

139 KB | W: | H:

990 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-hdpi/wsyq.png

563 Bytes | W: | H:

1.35 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/values/styles.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 3
4 4
5 <style name="ThemeSplash" parent="Theme.AppCompat.Light.NoActionBar"> 5 <style name="ThemeSplash" parent="Theme.AppCompat.Light.NoActionBar">
6 <item name="android:windowBackground">@drawable/welcome_bg</item> 6 <item name="android:windowBackground">@drawable/welcome_bg</item>
7 <item name="colorPrimaryDark">@android:color/transparent</item> 7 <item name="colorPrimaryDark">@android:color/transparent</item>
8 <item name="windowActionBar">false</item> 8 <item name="windowActionBar">false</item>
9 <item name="windowNoTitle">true</item> 9 <item name="windowNoTitle">true</item>
10 <item name="android:windowFullscreen">true</item> 10 <item name="android:windowFullscreen">true</item>
11 </style> 11 </style>
12 12
13 <style name="main_bottom_navigaton_menu_item"> 13 <style name="main_bottom_navigaton_menu_item">
14 <item name="android:layout_width">0dp</item> 14 <item name="android:layout_width">0dp</item>
15 <item name="android:layout_weight">1</item> 15 <item name="android:layout_weight">1</item>
16 <item name="android:layout_height">match_parent</item> 16 <item name="android:layout_height">match_parent</item>
17 <item name="android:background">@android:color/transparent</item> 17 <item name="android:background">@android:color/transparent</item>
18 <item name="android:button">@null</item> 18 <item name="android:button">@null</item>
19 <item name="android:gravity">center</item> 19 <item name="android:gravity">center</item>
20 <item name="android:textSize">11dp</item> 20 <item name="android:textSize">11dp</item>
21 <item name="android:drawablePadding">2dp</item> 21 <item name="android:drawablePadding">2dp</item>
22 </style> 22 </style>
23 23 <!--实现BottomSheetDialog圆角效果-->
24 24 <style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
25 <item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item>
26 </style>
27 <style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal">
28 <item name="android:background">@android:color/transparent</item>
29 <item name="android:navigationBarColor">@android:color/transparent</item>
30 <item name="behavior_peekHeight">500dp</item>
31 </style>
25 </resources> 32 </resources>
app/src/main/res/values/themes.xml
1 <resources xmlns:tools="http://schemas.android.com/tools"> 1 <resources xmlns:tools="http://schemas.android.com/tools">
2 <!-- Base application theme. --> 2 <!-- Base application theme. -->
3 <style name="Theme.Parent" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> 3 <style name="Theme.Parent" parent="Theme.AppCompat.Light.DarkActionBar">
4 <!-- Primary brand color. --> 4 <!-- Primary brand color. -->
5 <item name="colorPrimary">@color/purple_500</item> 5 <item name="colorPrimary">@color/purple_500</item>
6 <item name="colorPrimaryVariant">@color/purple_700</item> 6 <item name="colorPrimaryVariant">@color/purple_700</item>
7 <item name="colorOnPrimary">@color/white</item> 7 <item name="colorOnPrimary">@color/white</item>
8 <!-- Secondary brand color. --> 8 <!-- Secondary brand color. -->
9 <item name="colorSecondary">@color/teal_200</item> 9 <item name="colorSecondary">@color/teal_200</item>
10 <item name="colorSecondaryVariant">@color/teal_700</item> 10 <item name="colorSecondaryVariant">@color/teal_700</item>
11 <item name="colorOnSecondary">@color/black</item> 11 <item name="colorOnSecondary">@color/black</item>
12 <!-- Status bar color. --> 12 <!-- Status bar color. -->
13 <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> 13 <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
14 <!-- Customize your theme here. --> 14 <!-- Customize your theme here. -->
15 </style> 15 </style>
16 </resources> 16 </resources>
app/src/main/res/xml/file_provider_paths.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <paths>
3 <root-path
4 name="name"
5 path="" />
6 <external-cache-path
7 name="cache_root"
8 path="." />
9 </paths>
1 buildscript { 1 buildscript {
2 2
3 3
4 ext { 4 ext {
5 5
6 6
7 androidId = [ 7 androidId = [
8 compileSdkVersion: 32, 8 compileSdkVersion: 32,
9 minSdkVersion : 24, 9 minSdkVersion : 24,
10 targetSdkVersion : 32, 10 targetSdkVersion : 32,
11 versionCode : 1, 11 versionCode : 1,
12 versionName : "0.0.1" 12 versionName : "0.0.1"
13 13
14 14
15 ] 15 ]
16 16
17 17
18 url = [ 18 url = [
19 server_url: "https://mgr.hjx.com", //http 请求指令 19 server_url : "http://192.168.3.11:8088", //http 请求指令
20 20 server_url_online: "https://mgr.hjx.com", //http 请求指令
21 ] 21 ]
22 22
23 23
24 dependencies = [ 24 dependencies = [
25 appcompat : 'androidx.appcompat:appcompat:1.0.0', 25 appcompat : 'androidx.appcompat:appcompat:1.0.0',
26 constraint : 'androidx.constraintlayout:constraintlayout:1.1.3', 26 constraint : 'androidx.constraintlayout:constraintlayout:1.1.3',
27 cardview : 'androidx.cardview:cardview:1.0.0', 27 cardview : 'androidx.cardview:cardview:1.0.0',
28 recyclerview : 'androidx.recyclerview:recyclerview:1.0.0', 28 recyclerview : 'androidx.recyclerview:recyclerview:1.0.0',
29 material : 'com.google.android.material:material:1.0.0', 29 material : 'com.google.android.material:material:1.0.0',
30 // 依赖RxAndroid 2X 的依赖库 30 // 依赖RxAndroid 2X 的依赖库
31 // 增加RxJava 2X 的依赖库 31 // 增加RxJava 2X 的依赖库
32 rxandroid : 'io.reactivex.rxjava2:rxandroid:2.0.1', 32 rxandroid : 'io.reactivex.rxjava2:rxandroid:2.0.1',
33 rxjava : 'io.reactivex.rxjava2:rxjava:2.0.7', 33 rxjava : 'io.reactivex.rxjava2:rxjava:2.0.7',
34 34
35 // 以下需要使用Retrofit 35 // 以下需要使用Retrofit
36 //retrofit 36 //retrofit
37 retrofit : 'com.squareup.retrofit2:retrofit:2.1.0', 37 retrofit : 'com.squareup.retrofit2:retrofit:2.1.0',
38 //Gson converter 38 //Gson converter
39 converter : 'com.squareup.retrofit2:converter-gson:2.1.0', 39 converter : 'com.squareup.retrofit2:converter-gson:2.1.0',
40 //RxJava2 Adapter 40 //RxJava2 Adapter
41 retrofit2 : 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0', 41 retrofit2 : 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0',
42 //okhttp 42 //okhttp
43 okhttp : 'com.squareup.okhttp3:okhttp:3.8.1', 43 okhttp : 'com.squareup.okhttp3:okhttp:3.8.1',
44 logging : 'com.squareup.okhttp3:logging-interceptor:3.4.1', 44 logging : 'com.squareup.okhttp3:logging-interceptor:3.4.1',
45 utils : 'com.github.wang-developer:AndroidUtilsDemo:1.0.6', 45 utils : 'com.github.wang-developer:AndroidUtilsDemo:1.0.6',
46 commons_lang : 'org.apache.commons:commons-lang3:3.7', 46 commons_lang : 'org.apache.commons:commons-lang3:3.7',
47 commons_compress: 'org.apache.commons:commons-compress:1.19', 47 commons_compress: 'org.apache.commons:commons-compress:1.19',
48 commons_c_lang : 'commons-lang:commons-lang:2.3', 48 commons_c_lang : 'commons-lang:commons-lang:2.3',
49 commons_codec : 'commons-codec:commons-codec:1.7', 49 commons_codec : 'commons-codec:commons-codec:1.7',
50 eventbus : 'org.greenrobot:eventbus:3.2.0', 50 eventbus : 'org.greenrobot:eventbus:3.2.0',
51 eventbus2 : 'org.simple:androideventbus:1.0.5.1', 51 eventbus2 : 'org.simple:androideventbus:1.0.5.1',
52 glide : 'com.github.bumptech.glide:glide:3.7.0', 52 glide : 'com.github.bumptech.glide:glide:4.6.1',
53 permissions : 'com.github.getActivity:XXPermissions:11.6', 53 permissions : 'com.github.getActivity:XXPermissions:11.6',
54 orcode : 'cn.yipianfengye.android:zxing-library:2.2' 54 orcode : 'cn.yipianfengye.android:zxing-library:2.2'
55 // push : 'com.umeng.sdk:push:4.1.0', 55 // push : 'com.umeng.sdk:push:4.1.0',
56 // litepal : 'org.litepal.android:java:3.0.0', 56 // litepal : 'org.litepal.android:java:3.0.0',
57 57
58 58
59 // AlivcFFmpeg : 'com.aliyun.video.android:AlivcFFmpeg:2.0.0', 59 // AlivcFFmpeg : 'com.aliyun.video.android:AlivcFFmpeg:2.0.0',
60 60
61 // 61 //
62 // basequickadapter : 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34', 62 // basequickadapter : 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34',
63 // SwipeDelMenuLayout: 'com.github.mcxtzhang:SwipeDelMenuLayout:V1.3.0', 63 // SwipeDelMenuLayout: 'com.github.mcxtzhang:SwipeDelMenuLayout:V1.3.0',
64 // flycoTabLayout : 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar' 64 // flycoTabLayout : 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
65 65
66 66
67 ] 67 ]
68 } 68 }
69 69
70 70
71 repositories { 71 repositories {
72 google() 72 google()
73 jcenter() 73 jcenter()
74 maven { url 'https://maven.aliyun.com/repository/jcenter' } 74 maven { url 'https://maven.aliyun.com/repository/jcenter' }
75 maven { url 'https://maven.aliyun.com/repository/google' } 75 maven { url 'https://maven.aliyun.com/repository/google' }
76 maven { url 'https://maven.aliyun.com/repository/central' } 76 maven { url 'https://maven.aliyun.com/repository/central' }
77 maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } 77 maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
78 } 78 }
79 dependencies { 79 dependencies {
80 classpath 'com.android.tools.build:gradle:4.2.2' 80 classpath 'com.android.tools.build:gradle:4.2.2'
81 classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' 81 classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
82 classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 82 classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
83 classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3' 83 classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
84 classpath "com.alibaba:arouter-register:1.0.2" 84 classpath "com.alibaba:arouter-register:1.0.2"
85 // NOTE: Do not place your application dependencies here; they belong 85 // NOTE: Do not place your application dependencies here; they belong
86 // in the individual module build.gradle files 86 // in the individual module build.gradle files
87 } 87 }
88 88
89 89
90 } 90 }
91 91
92 92
93 allprojects { 93 allprojects {
94 repositories { 94 repositories {
95 google() 95 google()
96 jcenter() 96 jcenter()
97 maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } 97 maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
98 maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } 98 maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
99 maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } 99 maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
100 maven { url 'https://jitpack.io' } 100 maven { url 'https://jitpack.io' }
101 } 101 }
102 } 102 }
103 task clean(type: Delete) { 103 task clean(type: Delete) {
104 delete rootProject.buildDir 104 delete rootProject.buildDir
105 } 105 }
106 106
libs/common/build.gradle
1 apply plugin: 'com.android.library' 1 apply plugin: 'com.android.library'
2 apply from: '../../config.gradle' 2 apply from: '../../config.gradle'
3 3
4 4
5 5
6 def androidId = rootProject.ext.androidId 6 def androidId = rootProject.ext.androidId
7 def support = rootProject.ext.dependencies 7 def support = rootProject.ext.dependencies
8 def url = rootProject.ext.url 8 def url = rootProject.ext.url
9 9
10 10
11 android { 11 android {
12 compileSdkVersion androidId.compileSdkVersion 12 compileSdkVersion androidId.compileSdkVersion
13 13
14 14
15 defaultConfig { 15 defaultConfig {
16 minSdkVersion androidId.minSdkVersion 16 minSdkVersion androidId.minSdkVersion
17 targetSdkVersion androidId.targetSdkVersion 17 targetSdkVersion androidId.targetSdkVersion
18 versionCode androidId.versionCode 18 versionCode androidId.versionCode
19 versionName androidId.versionName 19 versionName androidId.versionName
20 20
21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
22 22
23 } 23 }
24 24
25 buildTypes { 25 buildTypes {
26 debug { 26 debug {
27 minifyEnabled false 27 minifyEnabled false
28 buildConfigField("String", "SERVER_URL", "\"${url.server_url}\"") 28 buildConfigField("String", "SERVER_URL", "\"${url.server_url_online}\"")
29
30 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 29 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
31 } 30 }
32 release { 31 release {
33 minifyEnabled false 32 minifyEnabled false
34 buildConfigField("String", "SERVER_URL", "\"${url.server_url}\"") 33 buildConfigField("String", "SERVER_URL", "\"${url.server_url_online}\"")
35 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 34 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
36 } 35 }
37 } 36 }
38 37
39 compileOptions { 38 compileOptions {
40 sourceCompatibility JavaVersion.VERSION_1_8 39 sourceCompatibility JavaVersion.VERSION_1_8
41 targetCompatibility JavaVersion.VERSION_1_8 40 targetCompatibility JavaVersion.VERSION_1_8
42 } 41 }
43 } 42 }
44 43
45 dependencies { 44 dependencies {
46 implementation fileTree(include: ['*.jar'], dir: 'libs') 45 implementation fileTree(include: ['*.jar'], dir: 'libs')
47 46
48 47
49 support.each { k, v -> implementation v } 48 support.each { k, v -> implementation v }
50 49
51 50
52 } 51 }
libs/common/src/main/java/com/prws/common/base/BaseFragment.java
1 package com.prws.common.base; 1 package com.prws.common.base;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.view.LayoutInflater; 5 import android.view.LayoutInflater;
6 import android.view.View; 6 import android.view.View;
7 import android.view.ViewGroup; 7 import android.view.ViewGroup;
8 8
9 import androidx.annotation.LayoutRes; 9 import androidx.annotation.LayoutRes;
10 import androidx.annotation.NonNull; 10 import androidx.annotation.NonNull;
11 import androidx.annotation.Nullable; 11 import androidx.annotation.Nullable;
12 import androidx.fragment.app.Fragment; 12 import androidx.fragment.app.Fragment;
13 13
14 14
15 import org.simple.eventbus.EventBus; 15 import org.simple.eventbus.EventBus;
16 16
17 import butterknife.ButterKnife;
18 import butterknife.Unbinder;
17 import io.reactivex.disposables.CompositeDisposable; 19 import io.reactivex.disposables.CompositeDisposable;
18 import io.reactivex.disposables.Disposable; 20 import io.reactivex.disposables.Disposable;
19 21
20 public abstract class BaseFragment extends Fragment { 22 public abstract class BaseFragment extends Fragment {
21 23
22 protected View mRootView; 24 protected View mRootView;
23 25
24 26 private Unbinder unbinder;
25 @Override 27 @Override
26 public void onCreate(@Nullable Bundle savedInstanceState) { 28 public void onCreate(@Nullable Bundle savedInstanceState) {
27 super.onCreate(savedInstanceState); 29 super.onCreate(savedInstanceState);
28 EventBus.getDefault().register(this); 30 EventBus.getDefault().register(this);
29 } 31 }
30 32
31 33
32 @Nullable 34 @Nullable
33 @Override 35 @Override
34 public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 36 public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
35 if (mRootView != null) { 37 if (mRootView != null) {
36 ViewGroup parent = (ViewGroup) mRootView.getParent(); 38 ViewGroup parent = (ViewGroup) mRootView.getParent();
37 if (parent != null) 39 if (parent != null)
38 parent.removeView(mRootView); 40 parent.removeView(mRootView);
39 } else { 41 } else {
40 mRootView = inflater.inflate(getLayoutRes(), container, false); 42 mRootView = inflater.inflate(getLayoutRes(), container, false);
41 } 43 }
44 unbinder = ButterKnife.bind(this, mRootView);
42 return mRootView; 45 return mRootView;
43 } 46 }
44 47
45 @Override 48 @Override
46 public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 49 public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
47 super.onViewCreated(view, savedInstanceState); 50 super.onViewCreated(view, savedInstanceState);
48 51
49 initDatas(); 52 initDatas();
50 } 53 }
51 54
52 protected abstract @LayoutRes 55 protected abstract @LayoutRes
53 int getLayoutRes(); 56 int getLayoutRes();
54 57
55 58
56 protected void initDatas() { 59 protected void initDatas() {
57 } 60 }
58 61
59 @Override 62 @Override
60 public void onAttach(Context context) { 63 public void onAttach(Context context) {
61 super.onAttach(context); 64 super.onAttach(context);
62 } 65 }
63 66
64 @Override 67 @Override
65 public void onDetach() { 68 public void onDetach() {
66 super.onDetach(); 69 super.onDetach();
67 } 70 }
68 71
69 @Override 72 @Override
70 public void onPause() { 73 public void onPause() {
71 super.onPause(); 74 super.onPause();
72 75
73 } 76 }
74 77
75 @Override 78 @Override
76 public void onResume() { 79 public void onResume() {
77 super.onResume(); 80 super.onResume();
78 81
79 } 82 }
80 83
81 @Override 84 @Override
82 public void onDestroy() { 85 public void onDestroy() {
83 super.onDestroy(); 86 super.onDestroy();
84 EventBus.getDefault().unregister(this); 87 EventBus.getDefault().unregister(this);
85 88 if (unbinder != null) {
89 unbinder.unbind();
90 }
86 } 91 }
87 92
88 93
89 protected void showErrorToast() { 94 protected void showErrorToast() {
90 // LogUtil.toast(MainApplication.getAppContext(),getString(R.string.service_error)); 95 // LogUtil.toast(MainApplication.getAppContext(),getString(R.string.service_error));
91 } 96 }
92 97
93 } 98 }
94 99
libs/common/src/main/java/com/prws/common/bean/Grade.java
File was created 1 package com.prws.common.bean;
2
3 public class Grade {
4 private int id;
5 private String grade;
6
7 public void setId(int id) {
8 this.id = id;
9 }
10
11 public void setGrade(String grade) {
12 this.grade = grade;
13 }
14
15 public int getId() {
16 return id;
17 }
18
19 public String getGrade() {
20 return grade;
21 }
22 }
23
libs/common/src/main/java/com/prws/common/bean/GradeAndSubject.java
File was created 1 package com.prws.common.bean;
2
3 import java.util.List;
4
5 public class GradeAndSubject {
6 private List<Subject> subjects;
7 private Grade grade;
8
9 public void setSubjects(List<Subject> subjects) {
10 this.subjects = subjects;
11 }
12
13 public void setGrade(Grade grade) {
14 this.grade = grade;
15 }
16
17 public List<Subject> getSubjects() {
18 return subjects;
19 }
20
21 public Grade getGrade() {
22 return grade;
23 }
24 }
25
libs/common/src/main/java/com/prws/common/bean/ResponseResult.java
File was created 1 package com.prws.common.bean;
2
3
4 import com.google.gson.annotations.SerializedName;
5
6 /**
7 * 统一响应类
8 *
9 * @author wfs
10 * @version 1.0
11 * @date 2023/6/27 10:27
12 */
13
14 public class ResponseResult<T> {
15
16 /**
17 * 状态码
18 */
19 @SerializedName(value = "code", alternate = "S")
20 private Integer code;
21 /**
22 * 提示信息,如果有错误时,前端可以获取该字段进行提示
23 */
24 @SerializedName(value = "msg", alternate = "M")
25 private String msg;
26 /**
27 * 查询到的结果数据,
28 */
29 @SerializedName(value = "data", alternate = "D")
30 private T data;
31
32 /**
33 * 成功标识
34 */
35 private Boolean success;
36
37
38 public void setCode(Integer code) {
39 this.code = code;
40 }
41
42 public void setMsg(String msg) {
43 this.msg = msg;
44 }
45
46 public void setData(T data) {
47 this.data = data;
48 }
49
50 public void setSuccess(Boolean success) {
51 this.success = success;
52 }
53
54 public Integer getCode() {
55 return code;
56 }
57
58 public String getMsg() {
59 return msg;
60 }
61
62 public T getData() {
63 return data;
64 }
65
66 public Boolean getSuccess() {
67 return success;
68 }
69 }
70
libs/common/src/main/java/com/prws/common/bean/ScheduleBean.java
File was created 1 package com.prws.common.bean;
2
3 import java.io.Serializable;
4 import java.util.List;
5
6 public class ScheduleBean implements Serializable {
7 private String startDate;
8 private String endDate;
9 private long totalTime;
10 private long studyTime;
11 private List<Video> list;
12
13 public void setStartDate(String startDate) {
14 this.startDate = startDate;
15 }
16
17 public void setEndDate(String endDate) {
18 this.endDate = endDate;
19 }
20
21 public void setTotalTime(long totalTime) {
22 this.totalTime = totalTime;
23 }
24
25 public void setStudyTime(long studyTime) {
26 this.studyTime = studyTime;
27 }
28
29 public void setList(List<Video> list) {
30 this.list = list;
31 }
32
33 public String getStartDate() {
34 return startDate;
35 }
36
37 public String getEndDate() {
38 return endDate;
39 }
40
41 public long getTotalTime() {
42 return totalTime;
43 }
44
45 public long getStudyTime() {
46 return studyTime;
47 }
48
49 public List<Video> getList() {
50 return list;
51 }
52 }
53
libs/common/src/main/java/com/prws/common/bean/Subject.java
File was created 1 package com.prws.common.bean;
2
3 import java.io.Serializable;
4
5 public class Subject implements Serializable {
6 private int id;
7 private String subject;
8
9 public void setId(int id) {
10 this.id = id;
11 }
12
13 public void setSubject(String subject) {
14 this.subject = subject;
15 }
16
17 public int getId() {
18 return id;
19 }
20
21 public String getSubject() {
22 return subject;
23 }
24 }
25
libs/common/src/main/java/com/prws/common/bean/Video.java
File was created 1 package com.prws.common.bean;
2
3 import java.io.Serializable;
4 import java.util.Date;
5
6 public class Video implements Serializable {
7
8 private Integer chapterId;
9 private String chapterName;
10 private Integer sectionId;
11 private String sectionName;
12 private Integer sectionChildId;
13 private String sectionChildName;
14 private Integer resourceId;
15 private String resourceName;
16 private String resourceUrl;
17 private Long resourceTime;
18 private String handoutName;
19 private String handoutUrl;
20 private Integer handoutId;
21 private Long playTime;
22 private String grade;
23 private String subject;
24
25 private Date studyTime;
26
27 public void setStudyTime(Date studyTime) {
28 this.studyTime = studyTime;
29 }
30
31 public Date getStudyTime() {
32 return studyTime;
33 }
34
35 public void setHandoutId(Integer handoutId) {
36 this.handoutId = handoutId;
37 }
38
39 public Integer getHandoutId() {
40 return handoutId;
41 }
42
43 public void setSubject(String subject) {
44 this.subject = subject;
45 }
46
47 public String getSubject() {
48 return subject;
49 }
50
51 public void setPlayTime(Long playTime) {
52 this.playTime = playTime;
53 }
54
55 public void setGrade(String grade) {
56 this.grade = grade;
57 }
58
59 public String getGrade() {
60 return grade;
61 }
62
63 public Long getPlayTime() {
64 return playTime;
65 }
66
67 public Integer getChapterId() {
68 return chapterId;
69 }
70
71 public void setChapterId(Integer chapterId) {
72 this.chapterId = chapterId;
73 }
74
75 public String getChapterName() {
76 return chapterName;
77 }
78
79 public void setChapterName(String chapterName) {
80 this.chapterName = chapterName;
81 }
82
83 public Integer getSectionId() {
84 return sectionId;
85 }
86
87 public void setSectionId(Integer sectionId) {
88 this.sectionId = sectionId;
89 }
90
91 public String getSectionName() {
92 return sectionName;
93 }
94
95 public void setSectionName(String sectionName) {
96 this.sectionName = sectionName;
97 }
98
99 public Integer getSectionChildId() {
100 return sectionChildId;
101 }
102
103 public void setSectionChildId(Integer sectionChildId) {
104 this.sectionChildId = sectionChildId;
105 }
106
107 public String getSectionChildName() {
108 return sectionChildName;
109 }
110
111 public void setSectionChildName(String sectionChildName) {
112 this.sectionChildName = sectionChildName;
113 }
114
115 public Integer getResourceId() {
116 return resourceId;
117 }
118
119 public void setResourceId(Integer resourceId) {
120 this.resourceId = resourceId;
121 }
122
123 public String getResourceName() {
124 return resourceName;
125 }
126
127 public void setResourceName(String resourceName) {
128 this.resourceName = resourceName;
129 }
130
131 public String getResourceUrl() {
132 return resourceUrl;
133 }
134
135 public void setResourceUrl(String resourceUrl) {
136 this.resourceUrl = resourceUrl;
137 }
138
139 public Long getResourceTime() {
140 return resourceTime;
141 }
142
143 public void setResourceTime(Long resourceTime) {
144 this.resourceTime = resourceTime;
145 }
146
147 public String getHandoutName() {
148 return handoutName;
149 }
150
151 public void setHandoutName(String handoutName) {
152 this.handoutName = handoutName;
153 }
154
155 public String getHandoutUrl() {
156 return handoutUrl;
157 }
158
159 public void setHandoutUrl(String handoutUrl) {
160 this.handoutUrl = handoutUrl;
161 }
162
163 public Long getRecodeTime() {
164 return playTime;
165 }
166
167 public void setRecodeTime(Long recodeTime) {
168 this.playTime = recodeTime;
169 }
170 }
171
libs/common/src/main/java/com/prws/common/net/NetWorks.java
1 package com.prws.common.net; 1 package com.prws.common.net;
2 2
3 3
4
5
6 import com.google.gson.Gson; 4 import com.google.gson.Gson;
7 import com.prws.common.BuildConfig; 5 import com.prws.common.BuildConfig;
8 import com.prws.common.bean.BaseEntity; 6 import com.prws.common.bean.BaseEntity;
7 import com.prws.common.bean.GradeAndSubject;
8 import com.prws.common.bean.ResponseResult;
9 import com.prws.common.bean.ScheduleBean;
10 import com.prws.common.utils.SharedPreferencesUtil;
9 11
10 import java.io.File; 12 import java.io.File;
13 import java.util.HashMap;
11 import java.util.List; 14 import java.util.List;
12 import java.util.Map; 15 import java.util.Map;
13 16
14 import io.reactivex.Observable; 17 import io.reactivex.Observable;
15 import io.reactivex.Observer; 18 import io.reactivex.Observer;
16 import io.reactivex.android.schedulers.AndroidSchedulers; 19 import io.reactivex.android.schedulers.AndroidSchedulers;
17 import io.reactivex.schedulers.Schedulers; 20 import io.reactivex.schedulers.Schedulers;
18 import okhttp3.MediaType; 21 import okhttp3.MediaType;
19 import okhttp3.MultipartBody; 22 import okhttp3.MultipartBody;
20 import okhttp3.RequestBody; 23 import okhttp3.RequestBody;
21 import okhttp3.ResponseBody; 24 import okhttp3.ResponseBody;
22 import retrofit2.Call; 25 import retrofit2.Call;
26 import retrofit2.Callback;
23 import retrofit2.http.Body; 27 import retrofit2.http.Body;
24 import retrofit2.http.DELETE; 28 import retrofit2.http.DELETE;
25 import retrofit2.http.FieldMap; 29 import retrofit2.http.FieldMap;
26 import retrofit2.http.FormUrlEncoded; 30 import retrofit2.http.FormUrlEncoded;
27 import retrofit2.http.GET; 31 import retrofit2.http.GET;
32 import retrofit2.http.Header;
28 import retrofit2.http.Headers; 33 import retrofit2.http.Headers;
29 import retrofit2.http.Multipart; 34 import retrofit2.http.Multipart;
30 import retrofit2.http.POST; 35 import retrofit2.http.POST;
31 import retrofit2.http.Part; 36 import retrofit2.http.Part;
37 import retrofit2.http.PartMap;
32 import retrofit2.http.Path; 38 import retrofit2.http.Path;
33 import retrofit2.http.Query; 39 import retrofit2.http.Query;
34 import retrofit2.http.QueryMap; 40 import retrofit2.http.QueryMap;
35 import retrofit2.http.Streaming; 41 import retrofit2.http.Streaming;
36 import retrofit2.http.Url; 42 import retrofit2.http.Url;
37 43
38 /** 44 /**
39 * 类名称:NetWorks 45 * 类名称:NetWorks
40 * 创建人: 46 * 创建人:
41 * 47 * <p>
42 * 类描述:网络请求的操作类 48 * 类描述:网络请求的操作类
43 */ 49 */
44 public class NetWorks extends RetrofitUtils { 50 public class NetWorks extends RetrofitUtils {
45 //服务器路径 51 //服务器路径
46 public static final NetService service_url = getMachineRetrofit(BuildConfig.SERVER_URL).create(NetService.class); 52 public static final NetService service_url = getMachineRetrofit(BuildConfig.SERVER_URL).create(NetService.class);
47 53
48 //设缓存有效期为1天 54 //设缓存有效期为1天
49 protected static final long CACHE_STALE_SEC = 60 * 60 * 24 * 1; 55 protected static final long CACHE_STALE_SEC = 60 * 60 * 24 * 1;
50 //查询缓存的Cache-Control设置,使用缓存 56 //查询缓存的Cache-Control设置,使用缓存
51 protected static final String CACHE_CONTROL_CACHE = "only-if-cached, max-stale=" + CACHE_STALE_SEC; 57 protected static final String CACHE_CONTROL_CACHE = "only-if-cached, max-stale=" + CACHE_STALE_SEC;
52 //查询网络的Cache-Control设置。不使用缓存 58 //查询网络的Cache-Control设置。不使用缓存
53 protected static final String CACHE_CONTROL_NETWORK = "max-age=0"; 59 protected static final String CACHE_CONTROL_NETWORK = "max-age=0";
54 60
55 61
56 private interface NetService{ 62 private interface NetService {
57 63
58 64
59 @GET("/api/v1/user/logout") 65 @GET("/api/v1/user/logout")
60 Observable<ResponseBody> logout(); 66 Observable<ResponseBody> logout();
61 67
62 @Multipart 68 @Multipart
63 @POST("/api/v1/user/upLoadAvatar") 69 @POST("/api/v1/user/upLoadAvatar")
64 Observable<ResponseBody> upLoadAvatar(@Part List<MultipartBody.Part> partLis); 70 Observable<ResponseBody> upLoadAvatar(@Header("Authorization") String token, @Part List<MultipartBody.Part> partLis);
65 71
66 72
67 @Headers("Content-Type: application/json") 73 @Headers("Content-Type: application/json")
68 @POST("/api/v1/user/editUser") 74 @POST("/api/v1/user/editUser")
69 Observable<ResponseBody> editUser(@Body RequestBody body); 75 Observable<ResponseBody> editUser(@Header("Authorization") String token, @Body RequestBody body);
70 76
71 @Headers("Content-Type: application/json") 77 @Headers("Content-Type: application/json")
72 @POST("/api/v1/user/changePassword") 78 @POST("/api/v1/user/changePassword")
73 Observable<ResponseBody> changePassword(@Body RequestBody body); 79 Observable<ResponseBody> changePassword(@Header("Authorization") String token, @Body RequestBody body);
74 80
75 81
76 @GET("/api/v1/user/searchById?") 82 @GET("/api/v1/user/searchById")
77 Observable<ResponseBody> searchById(@Query("userId") String userId); 83 Observable<ResponseBody> searchById(@Header("Authorization") String token, @Query("userId") String userId);
78 84
79 85
80 @Headers("Content-Type: application/json") 86 @Headers("Content-Type: application/json")
81 @POST("/api/v1/auth/login") 87 @POST("/api/v1/auth/login")
82 Observable<ResponseBody> login(@Body RequestBody body); 88 Observable<ResponseBody> login(@Body RequestBody body);
83 89
84 @GET("/api/v1/resource/listGradeAndSubject") 90 @GET("/api/v1/resource/listGradeAndSubject")
85 Observable<ResponseBody> listGradeAndSubject(); 91 Observable<ResponseResult<List<GradeAndSubject>>> listGradeAndSubject(@Header("Authorization") String token);
86 92
87 93
88 @GET("/api/v1/manager/generalQrCode") 94 @GET("/api/v1/manager/generalQrCode")
89 Observable<ResponseBody> generalQrCode(); 95 Observable<ResponseBody> generalQrCode();
90 96
91 @GET("/api/v1/parent/scanAndLogin?") 97 @GET("/api/v1/parent/scanAndLogin?")
92 Observable<ResponseBody> scanAndLogin(@Query("code") String code); 98 Observable<ResponseBody> scanAndLogin(@Header("Authorization") String token, @Query("code") String code);
93 99
94 @GET("/api/v1/parent/getChildrenList") 100 @GET("/api/v1/parent/getChildrenList")
95 Observable<ResponseBody> getChildrenList(); 101 Observable<ResponseBody> getChildrenList(@Header("Authorization") String token);
96 102
97 103
98 @Headers("Content-Type: application/json") 104 @Headers("Content-Type: application/json")
99 @POST("/api/v1/parent/registerParent") 105 @POST("/api/v1/parent/registerParent")
100 Observable<ResponseBody> registerParent(@Body RequestBody body); 106 Observable<ResponseBody> registerParent(@Body RequestBody body);
101 107
102 108
103 @GET("/api/v1/parent/listChildren") 109 @GET("/api/v1/parent/listChildren")
104 Observable<ResponseBody> listChildren(); 110 Observable<ResponseBody> listChildren(@Header("Authorization") String token);
105 111
106 112
107 @Headers("Content-Type: application/json") 113 @Headers("Content-Type: application/json")
108 @POST("/api/v1/parent/registerStudent") 114 @POST("/api/v1/parent/registerStudent")
109 Observable<ResponseBody> registerStudent(@Body RequestBody body); 115 Observable<ResponseBody> registerStudent(@Header("Authorization") String token, @Body RequestBody body);
110 116
111 @Headers("Content-Type: application/json") 117 @Headers("Content-Type: application/json")
112 @POST("/api/v1/parent/bindTeacher") 118 @POST("/api/v1/parent/bindTeacher")
113 Observable<ResponseBody> bindTeacher(@Body RequestBody body); 119 Observable<ResponseBody> bindTeacher(@Header("Authorization") String token, @Body RequestBody body);
114 120
121 @Multipart
122 @POST("/api/v1/user/upLoadAvatar")
123 Observable<ResponseResult<Map<String, String>>> uploadAvatar(@Header("Authorization") String token, @Part() MultipartBody.Part file);
115 124
116 125
126 @Multipart
127 @POST("/api/v1/student/editStudentAvatar")
128 Observable<ResponseResult<Map<String, String>>> uploadAvatar(@Header("Authorization") String token, @Part() MultipartBody.Part file, @PartMap Map<String, Object> map);
117 129
130 @Headers("Content-Type: application/json")
131 @POST("/api/v1/parent/editChild")
132 Observable<ResponseResult> editStudent(@Header("Authorization") String token, @Body RequestBody body);
118 133
134 @GET("/api/v1/student/getStudyPlanForThisWeek")
135 Observable<ResponseResult<ScheduleBean>> getWeekPlan(@Header("Authorization") String token, @Query("stuId") String stuId);
119 } 136 }
120 137
121 138
139 public static String getHeader() {
140 return (String) SharedPreferencesUtil.getData("token", "");
141 }
122 142
123 public static void logout(Observer<ResponseBody> observer) { 143 public static void logout(Observer<ResponseBody> observer) {
124 setSubscribe(service_url.logout(),observer); 144 setSubscribe(service_url.logout(), observer);
125 } 145 }
126 146
147 public static void editStudent(RequestBody body, Observer<ResponseResult> observable) {
148 setSubscribe(service_url.editStudent(getHeader(), body), observable);
149 }
127 150
151 public static void getWeekPlan(String id, Observer<ResponseResult<ScheduleBean>> observer) {
152 setSubscribe(service_url.getWeekPlan(getHeader(), id), observer);
153 }
128 154
129 public static void upLoadAvatar(List<MultipartBody.Part> partLis,Observer<ResponseBody> observer) { 155 public static void uploadStudentAvatar(File file, String stuId, Observer<ResponseResult<Map<String, String>>> observer) {
130 setSubscribe(service_url.upLoadAvatar(partLis),observer); 156 RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
157 MultipartBody.Part part = MultipartBody.Part.createFormData("file", file.getName(), requestBody);
158 Map<String, Object> map = new HashMap<>();
159 map.put("stuId", stuId);
160 setSubscribe(service_url.uploadAvatar(getHeader(), part, map), observer);
131 } 161 }
132 162
163 public static void uploadAvatar(File file, Observer<ResponseResult<Map<String, String>>> observer) {
164 RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
165 MultipartBody.Part part = MultipartBody.Part.createFormData("file", file.getName(), requestBody);
166 setSubscribe(service_url.uploadAvatar(getHeader(), part), observer);
167 }
133 168
134 public static void editUser(RequestBody body,Observer<ResponseBody> observer) { 169 public static void upLoadAvatar(List<MultipartBody.Part> partLis, Observer<ResponseBody> observer) {
135 setSubscribe(service_url.editUser(body),observer); 170 setSubscribe(service_url.upLoadAvatar(getHeader(), partLis), observer);
136 } 171 }
137 172
138 public static void changePassword(RequestBody body,Observer<ResponseBody> observer) { 173
139 setSubscribe(service_url.changePassword(body),observer); 174 public static void editUser(RequestBody body, Observer<ResponseBody> observer) {
175 setSubscribe(service_url.editUser(getHeader(), body), observer);
140 } 176 }
141 177
178 public static void changePassword(RequestBody body, Observer<ResponseBody> observer) {
179 setSubscribe(service_url.changePassword(getHeader(), body), observer);
180 }
142 181
143 public static void searchById(String userId,Observer<ResponseBody> observer) { 182
144 setSubscribe(service_url.searchById(userId),observer); 183 public static void searchById(String userId, Observer<ResponseBody> observer) {
184 setSubscribe(service_url.searchById(getHeader(), userId), observer);
145 } 185 }
146 186
147 187
148 public static void login(RequestBody body,Observer<ResponseBody> observer) { 188 public static void login(RequestBody body, Observer<ResponseBody> observer) {
149 setSubscribe(service_url.login(body),observer); 189 setSubscribe(service_url.login(body), observer);
150 } 190 }
151 191
152 public static void listGradeAndSubject(Observer<ResponseBody> observer) { 192 public static void listGradeAndSubject(Observer<ResponseResult<List<GradeAndSubject>>> observer) {
153 setSubscribe(service_url.listGradeAndSubject(),observer); 193 setSubscribe(service_url.listGradeAndSubject(getHeader()), observer);
154 } 194 }
155 195
156 196
157 public static void scanAndLogin(String code,Observer<ResponseBody> observer) { 197 public static void scanAndLogin(String code, Observer<ResponseBody> observer) {
158 setSubscribe(service_url.scanAndLogin(code),observer); 198 setSubscribe(service_url.scanAndLogin(getHeader(), code), observer);
159 } 199 }
160 200
161 public static void getChildrenList(Observer<ResponseBody> observer) { 201 public static void getChildrenList(Observer<ResponseBody> observer) {
162 setSubscribe(service_url.getChildrenList(),observer); 202 setSubscribe(service_url.getChildrenList(getHeader()), observer);
163 } 203 }
164 204
165 205
166 public static void registerParent(RequestBody body,Observer<ResponseBody> observer) { 206 public static void registerParent(RequestBody body, Observer<ResponseBody> observer) {
167 setSubscribe(service_url.registerParent(body),observer); 207 setSubscribe(service_url.registerParent(body), observer);
168 } 208 }
169 209
170 210
171 public static void listChildren(Observer<ResponseBody> observer) { 211 public static void listChildren(Observer<ResponseBody> observer) {
172 setSubscribe(service_url.listChildren(),observer); 212 setSubscribe(service_url.listChildren(getHeader()), observer);
173 } 213 }
174 214
175 215
176 public static void registerStudent(RequestBody body,Observer<ResponseBody> observer) { 216 public static void registerStudent(RequestBody body, Observer<ResponseBody> observer) {
177 setSubscribe(service_url.registerStudent(body),observer); 217 setSubscribe(service_url.registerStudent(getHeader(), body), observer);
178 } 218 }
179 219
180 public static void bindTeacher(RequestBody body,Observer<ResponseBody> observer) { 220 public static void bindTeacher(RequestBody body, Observer<ResponseBody> observer) {
181 setSubscribe(service_url.bindTeacher(body),observer); 221 setSubscribe(service_url.bindTeacher(getHeader(), body), observer);
182 } 222 }
183 223
184 224
185 public static RequestBody getMapRequestBody(Map map) { 225 public static RequestBody getMapRequestBody(Map map) {
186 return RequestBody.create(MediaType.parse("text/plain"), new Gson().toJson(map)); 226 return RequestBody.create(MediaType.parse("text/plain"), new Gson().toJson(map));
187 } 227 }
188 228
189 public static RequestBody getArrayRequestBody(List list){ 229 public static RequestBody getArrayRequestBody(List list) {
190 return RequestBody.create(MediaType.parse("text/plain"), new Gson().toJson(list)); 230 return RequestBody.create(MediaType.parse("text/plain"), new Gson().toJson(list));
191 } 231 }
192 232
193 public static RequestBody getFileRequestBody(File file) { 233 public static RequestBody getFileRequestBody(File file) {
194 return RequestBody.create(MediaType.parse("application/octet-stream"), file); 234 return RequestBody.create(MediaType.parse("application/octet-stream"), file);
195 } 235 }
236
196 public static RequestBody getFileRequestBody(byte[] bytes) { 237 public static RequestBody getFileRequestBody(byte[] bytes) {
197 return RequestBody.create(MediaType.parse("multipart/form-data"), bytes); 238 return RequestBody.create(MediaType.parse("multipart/form-data"), bytes);
198 } 239 }
199 240
200 public static RequestBody getObjectRequestBody(Object obj) { 241 public static RequestBody getObjectRequestBody(Object obj) {
201 return RequestBody.create(MediaType.parse("text/plain"), new Gson().toJson(obj)); 242 return RequestBody.create(MediaType.parse("text/plain"), new Gson().toJson(obj));
202 } 243 }
244
203 public static RequestBody getStringRequestBody(String str) { 245 public static RequestBody getStringRequestBody(String str) {
204 return RequestBody.create(MediaType.parse("text/plain"), str); 246 return RequestBody.create(MediaType.parse("text/plain"), str);
205 } 247 }
206 248
207 /** 249 /**
208 * 插入观察者 250 * 插入观察者
209 * 251 *
210 * @param observable 252 * @param observable
211 * @param observer 253 * @param observer
212 * @param <T> 254 * @param <T>
213 */ 255 */
214 public static <T> void setSubscribe(Observable<T> observable, Observer<T> observer) { 256 public static <T> void setSubscribe(Observable<T> observable, Observer<T> observer) {
215 observable.subscribeOn(Schedulers.io())//子线程访问网络 257 observable.subscribeOn(Schedulers.io())//子线程访问网络
216 .observeOn(AndroidSchedulers.mainThread())//回调到主线程 258 .observeOn(AndroidSchedulers.mainThread())//回调到主线程
217 .subscribe(observer); 259 .subscribe(observer);
218 } 260 }
219 261
libs/common/src/main/java/com/prws/common/utils/GlideHelper.java
1 package com.prws.common.utils; 1 package com.prws.common.utils;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.widget.ImageView; 4 import android.widget.ImageView;
5 5
6 import com.bumptech.glide.Glide; 6 import com.bumptech.glide.Glide;
7 import com.bumptech.glide.load.engine.DiskCacheStrategy; 7 import com.bumptech.glide.load.engine.DiskCacheStrategy;
8 8
9 import java.io.File; 9 import java.io.File;
10 10
11 /** 11 /**
12 * @author zhiqun.tang 12 * @author zhiqun.tang
13 * @Description: Glide 工具类 13 * @Description: Glide 工具类
14 * @date 2022/8/10 14 * @date 2022/8/10
15 */ 15 */
16 public class GlideHelper { 16 public class GlideHelper {
17 /** 17 /**
18 * 加载图片Url 18 * 加载图片Url
19 * 19 *
20 * @param mContext 20 * @param mContext
21 * @param url 21 * @param url
22 * @param imageView 22 * @param imageView
23 */ 23 */
24 public static void loadUrl(Context mContext, String url, ImageView imageView) { 24 public static void loadUrl(Context mContext, String url, ImageView imageView) {
25 if (mContext != null) { 25 if (mContext != null) {
26 Glide.with(mContext.getApplicationContext()) 26 Glide.with(mContext.getApplicationContext())
27 .load(url) 27 .load(url)
28 // .format(DecodeFormat.PREFER_RGB_565) 28 // .format(DecodeFormat.PREFER_RGB_565)
29 // 取消动画,防止第一次加载不出来 29 // 取消动画,防止第一次加载不出来
30 .dontAnimate()
31 //加载缩略图 30 //加载缩略图
32 .thumbnail(0.3f) 31 .thumbnail(0.3f)
33 .skipMemoryCache(true)
34 .diskCacheStrategy(DiskCacheStrategy.ALL)
35 .into(imageView); 32 .into(imageView);
36 } 33 }
37 } 34 }
38 35
39 /** 36 /**
40 * 加载图片Url 37 * 加载图片Url
41 * 38 *
42 * @param mContext 39 * @param mContext
43 * @param resourceId 40 * @param resourceId
44 * @param imageView 41 * @param imageView
45 */ 42 */
46 public static void loadUrl(Context mContext, int resourceId, ImageView imageView) { 43 public static void loadUrl(Context mContext, int resourceId, ImageView imageView) {
47 if (mContext != null) { 44 if (mContext != null) {
48 Glide.with(mContext.getApplicationContext()) 45 Glide.with(mContext.getApplicationContext())
49 .load(resourceId) 46 .load(resourceId)
50 // .format(DecodeFormat.PREFER_RGB_565) 47 // .format(DecodeFormat.PREFER_RGB_565)
51 // 取消动画,防止第一次加载不出来 48 // 取消动画,防止第一次加载不出来
52 .dontAnimate()
53 //加载缩略图 49 //加载缩略图
54 .thumbnail(0.3f) 50 .thumbnail(0.3f)
55 .skipMemoryCache(true)
56 .diskCacheStrategy(DiskCacheStrategy.ALL)
57 .into(imageView); 51 .into(imageView);
58 } 52 }
59 } 53 }
60 54
61 55
62 56
63 /** 57 /**
64 * 加载图片Url 58 * 加载图片Url
65 * 59 *
66 * @param mContext 60 * @param mContext
67 * @param url 61 * @param url
68 * @param imageView 62 * @param imageView
69 */ 63 */
70 public static void loadSmollUrl(Context mContext, String url, int w, int h, ImageView imageView) { 64 public static void loadSmollUrl(Context mContext, String url, int w, int h, ImageView imageView) {
71 if (mContext != null) { 65 if (mContext != null) {
72 Glide.with(mContext.getApplicationContext()) 66 Glide.with(mContext.getApplicationContext())
73 .load(url) 67 .load(url)
74 .override(w, h)
75 // .format(DecodeFormat.PREFER_RGB_565) 68 // .format(DecodeFormat.PREFER_RGB_565)
76 // 取消动画,防止第一次加载不出来 69 // 取消动画,防止第一次加载不出来
77 .dontAnimate()
78 //加载缩略图 70 //加载缩略图
79 .thumbnail(0.3f) 71 .thumbnail(0.3f)
80 .skipMemoryCache(true)
81 .diskCacheStrategy(DiskCacheStrategy.ALL)
82 .into(imageView); 72 .into(imageView);
83 } 73 }
84 } 74 }
85 75
86 /** 76 /**
87 * 加载图片File 77 * 加载图片File
88 * 78 *
89 * @param mContext 79 * @param mContext
90 * @param file 80 * @param file
91 * @param imageView 81 * @param imageView
92 */ 82 */
93 public static void loadFile(Context mContext, File file, ImageView imageView) { 83 public static void loadFile(Context mContext, File file, ImageView imageView) {
94 if (mContext != null) { 84 if (mContext != null) {
95 Glide.with(mContext.getApplicationContext()) 85 Glide.with(mContext.getApplicationContext())
96 .load(file) 86 .load(file)
97 // 取消动画,防止第一次加载不出来 87 // 取消动画,防止第一次加载不出来
98 .dontAnimate()
99 //加载缩略图 88 //加载缩略图
100 .thumbnail(0.3f) 89 .thumbnail(0.3f)
101 .skipMemoryCache(true)
102 .diskCacheStrategy(DiskCacheStrategy.ALL)
103 .into(imageView); 90 .into(imageView);
104 } 91 }
105 } 92 }
106 93
107 } 94 }
108 95
libs/common/src/main/java/com/prws/common/utils/ScreenUtils.java
1 package com.prws.common.utils; 1 package com.prws.common.utils;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.app.Dialog; 4 import android.app.Dialog;
5 import android.content.Context;
5 import android.view.View; 6 import android.view.View;
6 import android.view.Window; 7 import android.view.Window;
7 import android.view.WindowManager; 8 import android.view.WindowManager;
8 9
9 import androidx.fragment.app.DialogFragment; 10 import androidx.fragment.app.DialogFragment;
10 11
11 12
12 13
13 import java.util.Objects; 14 import java.util.Objects;
14 15
15 public class ScreenUtils { 16 public class ScreenUtils {
16 private static final int SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED = 0x00004000; 17 private static final int SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED = 0x00004000;
17 18
18 /** 19 /**
19 * 隐藏虚拟按键,并且全屏 20 * 隐藏虚拟按键,并且全屏
20 */ 21 */
21 public static void hideBottomUIMenu(Activity activity) { 22 public static void hideBottomUIMenu(Activity activity) {
22 // 隐藏虚拟按键,并且全屏 23 // 隐藏虚拟按键,并且全屏
23 // for new api versions. 24 // for new api versions.
24 View decorView = activity.getWindow().getDecorView(); 25 View decorView = activity.getWindow().getDecorView();
25 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 26 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
26 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY 27 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
27 | View.SYSTEM_UI_FLAG_FULLSCREEN; 28 | View.SYSTEM_UI_FLAG_FULLSCREEN;
28 // | SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED; 29 // | SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED;
29 decorView.setSystemUiVisibility(uiOptions); 30 decorView.setSystemUiVisibility(uiOptions);
30 } 31 }
31 32
32 /** 33 /**
33 * 隐藏虚拟按键,并且全屏 34 * 隐藏虚拟按键,并且全屏
34 */ 35 */
35 public static void hideBottomUIMenuAuto(Activity activity) { 36 public static void hideBottomUIMenuAuto(Activity activity) {
36 // 隐藏虚拟按键,并且全屏 37 // 隐藏虚拟按键,并且全屏
37 // for new api versions. 38 // for new api versions.
38 View decorView = activity.getWindow().getDecorView(); 39 View decorView = activity.getWindow().getDecorView();
39 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 40 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
40 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY 41 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
41 | View.SYSTEM_UI_FLAG_FULLSCREEN; 42 | View.SYSTEM_UI_FLAG_FULLSCREEN;
42 decorView.setSystemUiVisibility(uiOptions); 43 decorView.setSystemUiVisibility(uiOptions);
43 } 44 }
44 45
45 /** 46 /**
46 * 隐藏虚拟按键,并且全屏 47 * 隐藏虚拟按键,并且全屏
47 */ 48 */
48 public static void showBottomUIMenu(Activity activity) { 49 public static void showBottomUIMenu(Activity activity) {
49 // 显示虚拟键 50 // 显示虚拟键
50 View decorView = activity.getWindow().getDecorView(); 51 View decorView = activity.getWindow().getDecorView();
51 int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; 52 int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
52 decorView.setSystemUiVisibility(uiOptions); 53 decorView.setSystemUiVisibility(uiOptions);
53 } 54 }
54 55
55 56
56 /** 57 /**
57 * 隐藏虚拟按键,并且全屏 58 * 隐藏虚拟按键,并且全屏
58 */ 59 */
59 public static void hideDialogBottomUIMenuAuto(Dialog dialog) { 60 public static void hideDialogBottomUIMenuAuto(Dialog dialog) {
60 // 隐藏虚拟按键,并且全屏 61 // 隐藏虚拟按键,并且全屏
61 // for new api versions. 62 // for new api versions.
62 Window window = dialog.getWindow(); 63 Window window = dialog.getWindow();
63 assert window != null; 64 assert window != null;
64 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 65 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
65 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 66 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
66 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE 67 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
67 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 68 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
68 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 69 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
69 | View.SYSTEM_UI_FLAG_IMMERSIVE 70 | View.SYSTEM_UI_FLAG_IMMERSIVE
70 | View.SYSTEM_UI_FLAG_FULLSCREEN; 71 | View.SYSTEM_UI_FLAG_FULLSCREEN;
71 window.getDecorView().setSystemUiVisibility(uiOptions); 72 window.getDecorView().setSystemUiVisibility(uiOptions);
72 } 73 }
73 74
74 /** 75 /**
75 * 隐藏虚拟按键,并且全屏 76 * 隐藏虚拟按键,并且全屏
76 */ 77 */
77 public static void showDialogBottomUIMenu(Dialog dialog) { 78 public static void showDialogBottomUIMenu(Dialog dialog) {
78 // 显示虚拟键 79 // 显示虚拟键
79 Window window = dialog.getWindow(); 80 Window window = dialog.getWindow();
80 int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; 81 int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
81 assert window != null; 82 assert window != null;
82 window.getDecorView().setSystemUiVisibility(uiOptions); 83 window.getDecorView().setSystemUiVisibility(uiOptions);
83 } 84 }
84 85
85 /** 86 /**
86 * 隐藏虚拟按键,并且全屏 87 * 隐藏虚拟按键,并且全屏
87 */ 88 */
88 public static void hideDialogBottomUIMenu(Dialog dialog) { 89 public static void hideDialogBottomUIMenu(Dialog dialog) {
89 // 隐藏虚拟按键,并且全屏 90 // 隐藏虚拟按键,并且全屏
90 // for new api versions. 91 // for new api versions.
91 Window window = dialog.getWindow(); 92 Window window = dialog.getWindow();
92 assert window != null; 93 assert window != null;
93 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 94 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
94 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 95 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
95 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE 96 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
96 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 97 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
97 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 98 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
98 | View.SYSTEM_UI_FLAG_IMMERSIVE 99 | View.SYSTEM_UI_FLAG_IMMERSIVE
99 | View.SYSTEM_UI_FLAG_FULLSCREEN; 100 | View.SYSTEM_UI_FLAG_FULLSCREEN;
100 // | SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED; 101 // | SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED;
101 window.getDecorView().setSystemUiVisibility(uiOptions); 102 window.getDecorView().setSystemUiVisibility(uiOptions);
102 } 103 }
103 104
104 public static void hideDialogBottomUIMenu(DialogFragment dialog) { 105 public static void hideDialogBottomUIMenu(DialogFragment dialog) {
105 if (dialog == null)return; 106 if (dialog == null)return;
106 // 隐藏虚拟按键,并且全屏 107 // 隐藏虚拟按键,并且全屏
107 // for new api versions. 108 // for new api versions.
108 Window window = dialog.getDialog().getWindow(); 109 Window window = dialog.getDialog().getWindow();
109 assert window != null; 110 assert window != null;
110 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 111 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
111 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 112 int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
112 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE 113 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
113 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 114 | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
114 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 115 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
115 | View.SYSTEM_UI_FLAG_IMMERSIVE 116 | View.SYSTEM_UI_FLAG_IMMERSIVE
116 | View.SYSTEM_UI_FLAG_FULLSCREEN; 117 | View.SYSTEM_UI_FLAG_FULLSCREEN;
117 // | SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED; 118 // | SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED;
118 window.getDecorView().setSystemUiVisibility(uiOptions); 119 window.getDecorView().setSystemUiVisibility(uiOptions);
119 } 120 }
121
122 public static int dpToPx(Context context, int dpValue) {
123 float scale = context.getResources().getDisplayMetrics().density;
124 return Math.round(dpValue * scale);
125 }
120 } 126 }
121 127
libs/common/src/main/java/com/prws/common/utils/SharedPreferencesUtil.java
1 package com.prws.common.utils; 1 package com.prws.common.utils;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.content.SharedPreferences; 4 import android.content.SharedPreferences;
5 import android.util.Log; 5 import android.util.Log;
6 6
7 import com.google.gson.Gson; 7 import com.google.gson.Gson;
8 import com.google.gson.JsonArray; 8 import com.google.gson.JsonArray;
9 import com.google.gson.JsonElement; 9 import com.google.gson.JsonElement;
10 import com.google.gson.JsonObject; 10 import com.google.gson.JsonObject;
11 import com.google.gson.JsonParser; 11 import com.google.gson.JsonParser;
12 12
13 import java.util.ArrayList; 13 import java.util.ArrayList;
14 import java.util.HashMap; 14 import java.util.HashMap;
15 import java.util.List; 15 import java.util.List;
16 import java.util.Map; 16 import java.util.Map;
17 import java.util.Set; 17 import java.util.Set;
18 18
19 /** 19 /**
20 * Description: This's SharedPreferencesUtil 20 * Description: This's SharedPreferencesUtil
21 * Time: 2018/7/10 15:05 21 * Time: 2018/7/10 15:05
22 * 22 *
23 * @author lishiting 23 * @author lishiting
24 */ 24 */
25 public class SharedPreferencesUtil { 25 public class SharedPreferencesUtil {
26 private static SharedPreferencesUtil util; 26 private static SharedPreferencesUtil util;
27 private static SharedPreferences sp; 27 private static SharedPreferences sp;
28 28
29 private SharedPreferencesUtil(Context context, String name) { 29 private SharedPreferencesUtil(Context context, String name) {
30 sp = context.getSharedPreferences(name, Context.MODE_PRIVATE); 30 sp = context.getSharedPreferences(name, Context.MODE_PRIVATE);
31 } 31 }
32 32
33 /** 33 /**
34 * 初始化SharedPreferencesUtil,只需要初始化一次,建议在Application中初始化 34 * 初始化SharedPreferencesUtil,只需要初始化一次,建议在Application中初始化
35 * 35 *
36 * @param context 上下文对象 36 * @param context 上下文对象
37 * @param name SharedPreferences Name 37 * @param name SharedPreferences Name
38 */ 38 */
39 public static void getInstance(Context context, String name) { 39 public static void getInstance(Context context, String name) {
40 if (util == null) { 40 if (util == null) {
41 util = new SharedPreferencesUtil(context, name); 41 util = new SharedPreferencesUtil(context, name);
42 } 42 }
43 } 43 }
44 44
45 /** 45 /**
46 * 保存数据到SharedPreferences 46 * 保存数据到SharedPreferences
47 * 47 *
48 * @param key 键 48 * @param key 键
49 * @param value 需要保存的数据 49 * @param value 需要保存的数据
50 * @return 保存结果 50 * @return 保存结果
51 */ 51 */
52 public static boolean putData(String key, Object value) { 52 public static boolean putData(String key, Object value) {
53 boolean result; 53 boolean result;
54 SharedPreferences.Editor editor = sp.edit(); 54 SharedPreferences.Editor editor = sp.edit();
55 String type = value.getClass().getSimpleName(); 55 String type = value.getClass().getSimpleName();
56 try { 56 try {
57 switch (type) { 57 switch (type) {
58 case "Boolean": 58 case "Boolean":
59 editor.putBoolean(key, (Boolean) value); 59 editor.putBoolean(key, (Boolean) value);
60 break; 60 break;
61 case "Long": 61 case "Long":
62 editor.putLong(key, (Long) value); 62 editor.putLong(key, (Long) value);
63 break; 63 break;
64 case "Float": 64 case "Float":
65 editor.putFloat(key, (Float) value); 65 editor.putFloat(key, (Float) value);
66 break; 66 break;
67 case "String": 67 case "String":
68 editor.putString(key, (String) value); 68 editor.putString(key, (String) value);
69 break; 69 break;
70 case "Integer": 70 case "Integer":
71 editor.putInt(key, (Integer) value); 71 editor.putInt(key, (Integer) value);
72 break; 72 break;
73 default: 73 default:
74 Gson gson = new Gson(); 74 Gson gson = new Gson();
75 String json = gson.toJson(value); 75 String json = gson.toJson(value);
76 editor.putString(key, json); 76 editor.putString(key, json);
77 break; 77 break;
78 } 78 }
79 result = true; 79 result = true;
80 } catch (Exception e) { 80 } catch (Exception e) {
81 result = false; 81 result = false;
82 e.printStackTrace(); 82 e.printStackTrace();
83 } 83 }
84 editor.apply(); 84 editor.apply();
85 return result; 85 return result;
86 } 86 }
87 87
88 /** 88 /**
89 * 获取SharedPreferences中保存的数据 89 * 获取SharedPreferences中保存的数据
90 * 90 *
91 * @param key 键 91 * @param key 键
92 * @param defaultValue 获取失败默认值 92 * @param defaultValue 获取失败默认值
93 * @return 从SharedPreferences读取的数据 93 * @return 从SharedPreferences读取的数据
94 */ 94 */
95 public static Object getData(String key, Object defaultValue) { 95 public static Object getData(String key, Object defaultValue) {
96 Object result; 96 Object result;
97 String type = defaultValue.getClass().getSimpleName(); 97 String type = defaultValue.getClass().getSimpleName();
98 try { 98 try {
99 switch (type) { 99 switch (type) {
100 case "Boolean": 100 case "Boolean":
101 result = sp.getBoolean(key, (Boolean) defaultValue); 101 result = sp.getBoolean(key, (Boolean) defaultValue);
102 break; 102 break;
103 case "Long": 103 case "Long":
104 result = sp.getLong(key, (Long) defaultValue); 104 result = sp.getLong(key, (Long) defaultValue);
105 break; 105 break;
106 case "Float": 106 case "Float":
107 result = sp.getFloat(key, (Float) defaultValue); 107 result = sp.getFloat(key, (Float) defaultValue);
108 break; 108 break;
109 case "String": 109 case "String":
110 result = sp.getString(key, (String) defaultValue); 110 result = sp.getString(key, (String) defaultValue);
111 break; 111 break;
112 case "Integer": 112 case "Integer":
113 result = sp.getInt(key, (Integer) defaultValue); 113 result = sp.getInt(key, (Integer) defaultValue);
114 break; 114 break;
115 default: 115 default:
116 Gson gson = new Gson(); 116 Gson gson = new Gson();
117 String json = sp.getString(key, ""); 117 String json = sp.getString(key, "");
118 if (!json.equals("") && json.length() > 0) { 118 if (!json.equals("") && json.length() > 0) {
119 result = gson.fromJson(json, defaultValue.getClass()); 119 result = gson.fromJson(json, defaultValue.getClass());
120 } else { 120 } else {
121 result = defaultValue; 121 result = defaultValue;
122 } 122 }
123 break; 123 break;
124 } 124 }
125 } catch (Exception e) { 125 } catch (Exception e) {
126 result = null; 126 result = null;
127 e.printStackTrace(); 127 e.printStackTrace();
128 } 128 }
129 return result; 129 return result;
130 } 130 }
131 131
132 /** 132 /**
133 * 用于保存集合 133 * 用于保存集合
134 * 134 *
135 * @param key key 135 * @param key key
136 * @param list 集合数据 136 * @param list 集合数据
137 * @return 保存结果 137 * @return 保存结果
138 */ 138 */
139 public static <T> boolean putListData(String key, List<T> list) { 139 public static <T> boolean putListData(String key, List<T> list) {
140 boolean result; 140 boolean result;
141 String type = list.get(0).getClass().getSimpleName(); 141 String type = list.get(0).getClass().getSimpleName();
142 SharedPreferences.Editor editor = sp.edit(); 142 SharedPreferences.Editor editor = sp.edit();
143 JsonArray array = new JsonArray(); 143 JsonArray array = new JsonArray();
144 try { 144 try {
145 switch (type) { 145 switch (type) {
146 case "Boolean": 146 case "Boolean":
147 for (int i = 0; i < list.size(); i++) { 147 for (int i = 0; i < list.size(); i++) {
148 array.add((Boolean) list.get(i)); 148 array.add((Boolean) list.get(i));
149 } 149 }
150 break; 150 break;
151 case "Long": 151 case "Long":
152 for (int i = 0; i < list.size(); i++) { 152 for (int i = 0; i < list.size(); i++) {
153 array.add((Long) list.get(i)); 153 array.add((Long) list.get(i));
154 } 154 }
155 break; 155 break;
156 case "Float": 156 case "Float":
157 for (int i = 0; i < list.size(); i++) { 157 for (int i = 0; i < list.size(); i++) {
158 array.add((Float) list.get(i)); 158 array.add((Float) list.get(i));
159 } 159 }
160 break; 160 break;
161 case "String": 161 case "String":
162 for (int i = 0; i < list.size(); i++) { 162 for (int i = 0; i < list.size(); i++) {
163 array.add((String) list.get(i)); 163 array.add((String) list.get(i));
164 } 164 }
165 break; 165 break;
166 case "Integer": 166 case "Integer":
167 for (int i = 0; i < list.size(); i++) { 167 for (int i = 0; i < list.size(); i++) {
168 array.add((Integer) list.get(i)); 168 array.add((Integer) list.get(i));
169 } 169 }
170 break; 170 break;
171 default: 171 default:
172 Gson gson = new Gson(); 172 Gson gson = new Gson();
173 for (int i = 0; i < list.size(); i++) { 173 for (int i = 0; i < list.size(); i++) {
174 JsonElement obj = gson.toJsonTree(list.get(i)); 174 JsonElement obj = gson.toJsonTree(list.get(i));
175 array.add(obj); 175 array.add(obj);
176 } 176 }
177 break; 177 break;
178 } 178 }
179 editor.putString(key, array.toString()); 179 editor.putString(key, array.toString());
180 result = true; 180 result = true;
181 } catch (Exception e) { 181 } catch (Exception e) {
182 result = false; 182 result = false;
183 e.printStackTrace(); 183 e.printStackTrace();
184 } 184 }
185 editor.apply(); 185 editor.apply();
186 return result; 186 return result;
187 } 187 }
188 188
189 /** 189 /**
190 * 获取保存的List 190 * 获取保存的List
191 * 191 *
192 * @param key key 192 * @param key key
193 * @return 对应的Lis集合 193 * @return 对应的Lis集合
194 */ 194 */
195 public static <T> List<T> getListData(String key, Class<T> cls) { 195 public static <T> List<T> getListData(String key, Class<T> cls) {
196 List<T> list = new ArrayList<>(); 196 List<T> list = new ArrayList<>();
197 String json = sp.getString(key, ""); 197 String json = sp.getString(key, "");
198 if (!json.equals("") && json.length() > 0) { 198 if (!json.equals("") && json.length() > 0) {
199 Gson gson = new Gson(); 199 Gson gson = new Gson();
200 JsonArray array = new JsonParser().parse(json).getAsJsonArray(); 200 JsonArray array = new JsonParser().parse(json).getAsJsonArray();
201 for (JsonElement elem : array) { 201 for (JsonElement elem : array) {
202 list.add(gson.fromJson(elem, cls)); 202 list.add(gson.fromJson(elem, cls));
203 } 203 }
204 } 204 }
205 return list; 205 return list;
206 } 206 }
207 207
208 /** 208 /**
209 * 获删除数据 209 * 获删除数据
210 * 210 *
211 * @param key key 211 * @param key key
212 */ 212 */
213 public static void delData(String key) { 213 public static void delData(String key) {
214 SharedPreferences.Editor editor = sp.edit(); 214 SharedPreferences.Editor editor = sp.edit();
215 editor.remove(key); 215 editor.remove(key);
216 editor.apply(); 216 editor.apply();
217 } 217 }
218 218
219 219
220 /** 220 /**
221 * 用于保存集合 221 * 用于保存集合
222 * 222 *
223 * @param key key 223 * @param key key
224 * @param map map数据 224 * @param map map数据
225 * @return 保存结果 225 * @return 保存结果
226 */ 226 */
227 public static <K, V> boolean putHashMapData(String key, Map<K, V> map) { 227 public static <K, V> boolean putHashMapData(String key, Map<K, V> map) {
228 boolean result; 228 boolean result;
229 SharedPreferences.Editor editor = sp.edit(); 229 SharedPreferences.Editor editor = sp.edit();
230 try { 230 try {
231 Gson gson = new Gson(); 231 Gson gson = new Gson();
232 String json = gson.toJson(map); 232 String json = gson.toJson(map);
233 editor.putString(key, json); 233 editor.putString(key, json);
234 result = true; 234 result = true;
235 } catch (Exception e) { 235 } catch (Exception e) {
236 result = false; 236 result = false;
237 e.printStackTrace(); 237 e.printStackTrace();
238 } 238 }
239 editor.apply(); 239 editor.apply();
240 return result; 240 return result;
241 } 241 }
242 242
243 /** 243 /**
244 * 用于保存集合 244 * 用于保存集合
245 * 245 *
246 * @param key key 246 * @param key key
247 * @return HashMap 247 * @return HashMap
248 */ 248 */
249 public static <V> HashMap<String, V> getHashMapData(String key, Class<V> clsV) { 249 public static <V> HashMap<String, V> getHashMapData(String key, Class<V> clsV) {
250 String json = sp.getString(key, ""); 250 String json = sp.getString(key, "");
251 HashMap<String, V> map = new HashMap<>(); 251 HashMap<String, V> map = new HashMap<>();
252 Gson gson = new Gson(); 252 Gson gson = new Gson();
253 JsonObject obj = new JsonParser().parse(json).getAsJsonObject(); 253 JsonObject obj = new JsonParser().parse(json).getAsJsonObject();
254 Set<Map.Entry<String, JsonElement>> entrySet = obj.entrySet(); 254 Set<Map.Entry<String, JsonElement>> entrySet = obj.entrySet();
255 for (Map.Entry<String, JsonElement> entry : entrySet) { 255 for (Map.Entry<String, JsonElement> entry : entrySet) {
256 String entryKey = entry.getKey(); 256 String entryKey = entry.getKey();
257 JsonObject value = (JsonObject) entry.getValue(); 257 JsonObject value = (JsonObject) entry.getValue();
258 map.put(entryKey, gson.fromJson(value, clsV)); 258 map.put(entryKey, gson.fromJson(value, clsV));
259 } 259 }
260 Log.e("SharedPreferencesUtil", obj.toString()); 260 Log.e("SharedPreferencesUtil", obj.toString());
261 return map; 261 return map;
262 262
263 } 263 }
264 264
265 public static void clear(Context context) {
266 SharedPreferences preferences = context.getSharedPreferences("config", Context.MODE_PRIVATE);
267 SharedPreferences.Editor editor = preferences.edit();
268 editor.clear();
269 editor.commit();
270 }
271
265 } 272 }
266 273
libs/common/src/main/res/drawable/shape_bottom_sheet_dialog.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <shape xmlns:android="http://schemas.android.com/apk/res/android"
3 android:shape="rectangle">
4
5 <corners android:topLeftRadius="20dp"
6 android:topRightRadius="20dp"/>
7 <solid android:color="@color/white"/>
8
9 </shape>