Commit 16a469f2c75e6329d742d7c541012db7c176ca9e
1 parent
0b84364433
Exists in
master
兼容HTTP
Showing
5 changed files
with
9 additions
and
5 deletions
Show diff stats
app/build.gradle
| 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 { | 11 | signingConfigs { |
| 12 | 12 | ||
| 13 | config { | 13 | config { |
| 14 | keyAlias 'alias' | 14 | keyAlias 'alias' |
| 15 | keyPassword '123456' | 15 | keyPassword '123456' |
| 16 | storeFile file('key.jks') | 16 | storeFile file('key.jks') |
| 17 | storePassword '123456' | 17 | storePassword '123456' |
| 18 | } | 18 | } |
| 19 | debug { | 19 | debug { |
| 20 | } | 20 | } |
| 21 | } | 21 | } |
| 22 | compileSdk 32 | 22 | compileSdk 32 |
| 23 | 23 | ||
| 24 | defaultConfig { | 24 | defaultConfig { |
| 25 | applicationId "com.hjx.parent" | 25 | applicationId "com.hjx.parent" |
| 26 | minSdk 24 | 26 | minSdk 24 |
| 27 | targetSdk 32 | 27 | targetSdk 32 |
| 28 | versionCode 1 | 28 | versionCode 1 |
| 29 | versionName "1.0" | 29 | versionName "1.0" |
| 30 | 30 | ||
| 31 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | 31 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | android.applicationVariants.all { | 34 | android.applicationVariants.all { |
| 35 | variant -> | 35 | variant -> |
| 36 | variant.outputs.all { | 36 | variant.outputs.all { |
| 37 | //在这里修改apk文件名 | 37 | //在这里修改apk文件名 |
| 38 | outputFileName = "parent-${variant.name}-v${variant.versionName}.apk" | 38 | outputFileName = "parent-${variant.name}-v${variant.versionName}.apk" |
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | buildTypes { | 41 | buildTypes { |
| 42 | debug { | 42 | debug { |
| 43 | minifyEnabled false | 43 | minifyEnabled false |
| 44 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | 44 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| 45 | } | 45 | } |
| 46 | release { | 46 | release { |
| 47 | debuggable true | ||
| 47 | minifyEnabled false | 48 | minifyEnabled false |
| 48 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | 49 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| 49 | signingConfig signingConfigs.config | 50 | signingConfig signingConfigs.config |
| 50 | } | 51 | } |
| 51 | } | 52 | } |
| 52 | lintOptions { | 53 | lintOptions { |
| 53 | checkReleaseBuilds false | 54 | checkReleaseBuilds false |
| 54 | abortOnError false | 55 | abortOnError false |
| 55 | } | 56 | } |
| 56 | compileOptions { | 57 | compileOptions { |
| 57 | sourceCompatibility JavaVersion.VERSION_1_8 | 58 | sourceCompatibility JavaVersion.VERSION_1_8 |
| 58 | targetCompatibility JavaVersion.VERSION_1_8 | 59 | targetCompatibility JavaVersion.VERSION_1_8 |
| 59 | } | 60 | } |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | dependencies { | 63 | dependencies { |
| 63 | support.each { k, v -> implementation v } | 64 | support.each { k, v -> implementation v } |
| 64 | api project(path: ':libs:common') | 65 | api project(path: ':libs:common') |
| 65 | implementation 'androidx.appcompat:appcompat:1.5.1' | 66 | implementation 'androidx.appcompat:appcompat:1.5.1' |
| 66 | implementation 'com.google.android.material:material:1.6.1' | 67 | implementation 'com.google.android.material:material:1.6.1' |
| 67 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | 68 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' |
| 68 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50' | 69 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50' |
| 69 | } | 70 | } |
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 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | package="com.hjx.parent"> | 4 | package="com.hjx.parent"> |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> | 7 | <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> |
| 8 | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 --> | 8 | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 --> |
| 9 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 --> | 9 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 --> |
| 10 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 --> | 10 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 --> |
| 11 | <!-- 6.0系统需要添加权限才能获得wifi列表 --> | 11 | <!-- 6.0系统需要添加权限才能获得wifi列表 --> |
| 12 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | 12 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> |
| 13 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 13 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
| 14 | <uses-permission android:name="android.permission.INTERNET" /> | 14 | <uses-permission android:name="android.permission.INTERNET" /> |
| 15 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> | 15 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> |
| 16 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 16 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| 17 | 17 | ||
| 18 | <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> | 18 | <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> |
| 19 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 19 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 20 | <uses-permission android:name="android.permission.WAKE_LOCK" /> | 20 | <uses-permission android:name="android.permission.WAKE_LOCK" /> |
| 21 | <uses-permission android:name="android.permission.CAMERA" /> | 21 | <uses-permission android:name="android.permission.CAMERA" /> |
| 22 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | 22 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
| 23 | <uses-permission android:name="android.permission.VIBRATE" /> | 23 | <uses-permission android:name="android.permission.VIBRATE" /> |
| 24 | 24 | ||
| 25 | <application | 25 | <application |
| 26 | android:name=".MyApplication" | 26 | android:name=".MyApplication" |
| 27 | android:allowBackup="true" | 27 | android:allowBackup="true" |
| 28 | android:icon="@mipmap/icon" | 28 | android:icon="@mipmap/icon" |
| 29 | android:label="@string/app_name" | 29 | android:label="@string/app_name" |
| 30 | android:networkSecurityConfig="@xml/network_security_config" | ||
| 30 | android:supportsRtl="true" | 31 | android:supportsRtl="true" |
| 31 | android:theme="@style/Theme.Parent"> | 32 | android:theme="@style/Theme.Parent"> |
| 32 | <activity | 33 | <activity |
| 33 | android:name=".LoginActivity" | 34 | android:name=".LoginActivity" |
| 34 | android:exported="true" | 35 | android:exported="true" |
| 35 | android:theme="@style/ThemeSplash"> | 36 | android:theme="@style/ThemeSplash"> |
| 36 | <intent-filter> | 37 | <intent-filter> |
| 37 | <action android:name="android.intent.action.MAIN" /> | 38 | <action android:name="android.intent.action.MAIN" /> |
| 38 | <category android:name="android.intent.category.LAUNCHER" /> | 39 | <category android:name="android.intent.category.LAUNCHER" /> |
| 39 | </intent-filter> | 40 | </intent-filter> |
| 40 | </activity> | 41 | </activity> |
| 41 | <activity | 42 | <activity |
| 42 | android:name=".MainActivity" | 43 | android:name=".MainActivity" |
| 43 | android:launchMode="singleTask" | 44 | android:launchMode="singleTask" |
| 44 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 45 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 45 | <activity | 46 | <activity |
| 46 | android:name=".RegisterActivity" | 47 | android:name=".RegisterActivity" |
| 47 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 48 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 48 | <activity | 49 | <activity |
| 49 | android:name=".UserActivity" | 50 | android:name=".UserActivity" |
| 50 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 51 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 51 | <activity | 52 | <activity |
| 52 | android:name=".YinsiActivity" | 53 | android:name=".YinsiActivity" |
| 53 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 54 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 54 | <activity | 55 | <activity |
| 55 | android:name=".QRActivity" | 56 | android:name=".QRActivity" |
| 56 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 57 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 57 | <activity | 58 | <activity |
| 58 | android:name=".AddStudentActivity" | 59 | android:name=".AddStudentActivity" |
| 59 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 60 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 60 | <activity | 61 | <activity |
| 61 | android:name=".NickActivity" | 62 | android:name=".NickActivity" |
| 62 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 63 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 63 | <activity | 64 | <activity |
| 64 | android:name=".SexActivity" | 65 | android:name=".SexActivity" |
| 65 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 66 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 66 | <activity | 67 | <activity |
| 67 | android:name=".NianActivity" | 68 | android:name=".NianActivity" |
| 68 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 69 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 69 | <activity | 70 | <activity |
| 70 | android:name=".ShenActivity" | 71 | android:name=".ShenActivity" |
| 71 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 72 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 72 | <activity | 73 | <activity |
| 73 | android:name=".AccountActivity" | 74 | android:name=".AccountActivity" |
| 74 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 75 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 75 | 76 | ||
| 76 | <activity | 77 | <activity |
| 77 | android:name=".ChangePwdActivity" | 78 | android:name=".ChangePwdActivity" |
| 78 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 79 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 79 | <activity | 80 | <activity |
| 80 | android:name=".EditStudentActivity" | 81 | android:name=".EditStudentActivity" |
| 81 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 82 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 82 | <activity | 83 | <activity |
| 83 | android:name=".ChooseActivity" | 84 | android:name=".ChooseActivity" |
| 84 | android:theme="@style/Theme.AppCompat.NoActionBar" /> | 85 | android:theme="@style/Theme.AppCompat.NoActionBar" /> |
| 85 | 86 | ||
| 86 | <provider | 87 | <provider |
| 87 | android:name="androidx.core.content.FileProvider" | 88 | android:name="androidx.core.content.FileProvider" |
| 88 | android:authorities="com.hjx.parent.fileprovider" | 89 | android:authorities="com.hjx.parent.fileprovider" |
| 89 | android:exported="false" | 90 | android:exported="false" |
| 90 | android:grantUriPermissions="true"> | 91 | android:grantUriPermissions="true"> |
| 91 | <meta-data | 92 | <meta-data |
| 92 | android:name="android.support.FILE_PROVIDER_PATHS" | 93 | android:name="android.support.FILE_PROVIDER_PATHS" |
| 93 | android:resource="@xml/file_provider_paths" | 94 | android:resource="@xml/file_provider_paths" |
| 94 | tools:replace="android:resource" /> | 95 | tools:replace="android:resource" /> |
| 95 | </provider> | 96 | </provider> |
| 96 | </application> | 97 | </application> |
| 97 | 98 | ||
| 98 | </manifest> | 99 | </manifest> |
app/src/main/java/com/hjx/parent/ChooseActivity.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.text.TextUtils; | 4 | import android.text.TextUtils; |
| 5 | import android.view.View; | 5 | import android.view.View; |
| 6 | import android.widget.ImageView; | 6 | import android.widget.ImageView; |
| 7 | 7 | ||
| 8 | import androidx.annotation.NonNull; | 8 | import androidx.annotation.NonNull; |
| 9 | import androidx.recyclerview.widget.LinearLayoutManager; | 9 | import androidx.recyclerview.widget.LinearLayoutManager; |
| 10 | import androidx.recyclerview.widget.RecyclerView; | 10 | import androidx.recyclerview.widget.RecyclerView; |
| 11 | 11 | ||
| 12 | import com.bumptech.glide.Glide; | 12 | import com.bumptech.glide.Glide; |
| 13 | import com.bumptech.glide.load.resource.bitmap.RoundedCorners; | 13 | import com.bumptech.glide.load.resource.bitmap.RoundedCorners; |
| 14 | import com.bumptech.glide.request.RequestOptions; | 14 | import com.bumptech.glide.request.RequestOptions; |
| 15 | import com.chad.library.adapter.base.BaseQuickAdapter; | 15 | import com.chad.library.adapter.base.BaseQuickAdapter; |
| 16 | import com.chad.library.adapter.base.BaseViewHolder; | 16 | import com.chad.library.adapter.base.BaseViewHolder; |
| 17 | import com.google.gson.Gson; | 17 | import com.google.gson.Gson; |
| 18 | import com.hjx.parent.bean.StudentBean; | 18 | import com.hjx.parent.bean.StudentBean; |
| 19 | import com.prws.common.base.BaseActivity; | 19 | import com.prws.common.base.BaseActivity; |
| 20 | import com.prws.common.base.BasePresenter; | 20 | import com.prws.common.base.BasePresenter; |
| 21 | import com.prws.common.net.NetWorks; | 21 | import com.prws.common.net.NetWorks; |
| 22 | import com.prws.common.utils.LogUtil; | 22 | import com.prws.common.utils.LogUtil; |
| 23 | import com.prws.common.utils.ScreenUtils; | 23 | import com.prws.common.utils.ScreenUtils; |
| 24 | import com.prws.common.utils.SharedPreferencesUtil; | 24 | import com.prws.common.utils.SharedPreferencesUtil; |
| 25 | 25 | ||
| 26 | import org.json.JSONArray; | 26 | import org.json.JSONArray; |
| 27 | import org.json.JSONObject; | 27 | import org.json.JSONObject; |
| 28 | 28 | ||
| 29 | import java.util.ArrayList; | 29 | import java.util.ArrayList; |
| 30 | 30 | ||
| 31 | import butterknife.BindView; | 31 | import butterknife.BindView; |
| 32 | import butterknife.OnClick; | 32 | import butterknife.OnClick; |
| 33 | import io.reactivex.Observer; | 33 | import io.reactivex.Observer; |
| 34 | import io.reactivex.disposables.Disposable; | 34 | import io.reactivex.disposables.Disposable; |
| 35 | import okhttp3.ResponseBody; | 35 | import okhttp3.ResponseBody; |
| 36 | 36 | ||
| 37 | public class ChooseActivity extends BaseActivity { | 37 | public class ChooseActivity extends BaseActivity { |
| 38 | @BindView(R.id.recycle) | 38 | @BindView(R.id.recycle) |
| 39 | RecyclerView recycle; | 39 | RecyclerView recycle; |
| 40 | private int select = 0; | 40 | private int select = 0; |
| 41 | 41 | ||
| 42 | @Override | 42 | @Override |
| 43 | protected int layoutResId() { | 43 | protected int layoutResId() { |
| 44 | return R.layout.choose_activity; | 44 | return R.layout.choose_activity; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | @Override | 47 | @Override |
| 48 | public Object getContract() { | 48 | public Object getContract() { |
| 49 | return null; | 49 | return null; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | @Override | 52 | @Override |
| 53 | public BasePresenter getPresenter() { | 53 | public BasePresenter getPresenter() { |
| 54 | return null; | 54 | return null; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | @Override | 57 | @Override |
| 58 | protected void initView() { | 58 | protected void initView() { |
| 59 | 59 | ||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | @Override | 62 | @Override |
| 63 | protected void initListener() { | 63 | protected void initListener() { |
| 64 | 64 | ||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | @Override | 67 | @Override |
| 68 | protected void initData() { | 68 | protected void initData() { |
| 69 | 69 | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @Override | 72 | @Override |
| 73 | public void onNetChanged(int netWorkState) { | 73 | public void onNetChanged(int netWorkState) { |
| 74 | 74 | ||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | @Override | 77 | @Override |
| 78 | protected void onResume() { | 78 | protected void onResume() { |
| 79 | super.onResume(); | 79 | super.onResume(); |
| 80 | loadChildList(); | 80 | loadChildList(); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | ArrayList<StudentBean> alist = new ArrayList<>(); | 83 | ArrayList<StudentBean> alist = new ArrayList<>(); |
| 84 | 84 | ||
| 85 | public void loadChildList() { | 85 | public void loadChildList() { |
| 86 | NetWorks.listChildren(new Observer<ResponseBody>() { | 86 | NetWorks.listChildren(new Observer<ResponseBody>() { |
| 87 | @Override | 87 | @Override |
| 88 | public void onSubscribe(Disposable d) { | 88 | public void onSubscribe(Disposable d) { |
| 89 | 89 | ||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | @Override | 92 | @Override |
| 93 | public void onNext(ResponseBody responseBody) { | 93 | public void onNext(ResponseBody responseBody) { |
| 94 | try { | 94 | try { |
| 95 | 95 | ||
| 96 | String str = responseBody.string().toString(); | 96 | String str = responseBody.string().toString(); |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | LogUtil.e("TAG", "----" + str); | 99 | LogUtil.e("TAG", "----" + str); |
| 100 | JSONObject jo = new JSONObject(str); | 100 | JSONObject jo = new JSONObject(str); |
| 101 | boolean isSucceed = jo.getBoolean("success"); | 101 | boolean isSucceed = jo.getBoolean("success"); |
| 102 | if (isSucceed) { | 102 | if (isSucceed) { |
| 103 | JSONArray jarr = jo.getJSONArray("data"); | 103 | JSONArray jarr = jo.getJSONArray("data"); |
| 104 | alist.clear(); | 104 | alist.clear(); |
| 105 | for (int i = 0; i < jarr.length(); i++) { | 105 | for (int i = 0; i < jarr.length(); i++) { |
| 106 | JSONObject jo2 = jarr.getJSONObject(i); | 106 | JSONObject jo2 = jarr.getJSONObject(i); |
| 107 | Gson gson = new Gson(); | 107 | Gson gson = new Gson(); |
| 108 | StudentBean sb = gson.fromJson(jo2.toString(), StudentBean.class); | 108 | StudentBean sb = gson.fromJson(jo2.toString(), StudentBean.class); |
| 109 | alist.add(sb); | 109 | alist.add(sb); |
| 110 | } | 110 | } |
| 111 | if (alist.size() > 0) { | 111 | loadList(); |
| 112 | loadList(); | ||
| 113 | } | ||
| 114 | |||
| 115 | } else { | 112 | } else { |
| 116 | 113 | ||
| 117 | } | 114 | } |
| 118 | } catch (Exception e) { | 115 | } catch (Exception e) { |
| 119 | e.printStackTrace(); | 116 | e.printStackTrace(); |
| 120 | } | 117 | } |
| 121 | } | 118 | } |
| 122 | 119 | ||
| 123 | @Override | 120 | @Override |
| 124 | public void onError(Throwable e) { | 121 | public void onError(Throwable e) { |
| 125 | 122 | ||
| 126 | } | 123 | } |
| 127 | 124 | ||
| 128 | @Override | 125 | @Override |
| 129 | public void onComplete() { | 126 | public void onComplete() { |
| 130 | 127 | ||
| 131 | } | 128 | } |
| 132 | }); | 129 | }); |
| 133 | } | 130 | } |
| 134 | 131 | ||
| 135 | public void loadList() { | 132 | public void loadList() { |
| 136 | StudentBean sb = new StudentBean(); | 133 | StudentBean sb = new StudentBean(); |
| 137 | sb.setNickName("添加学生"); | 134 | sb.setNickName("添加学生"); |
| 138 | alist.add(sb); | 135 | alist.add(sb); |
| 139 | String student = (String) SharedPreferencesUtil.getData("student", ""); | 136 | String student = (String) SharedPreferencesUtil.getData("student", ""); |
| 140 | try { | 137 | try { |
| 141 | StudentBean studentBean = new Gson().fromJson(student, StudentBean.class); | 138 | StudentBean studentBean = new Gson().fromJson(student, StudentBean.class); |
| 142 | for (int i = 0; i < alist.size(); i++) { | 139 | for (int i = 0; i < alist.size(); i++) { |
| 143 | if (studentBean.getStuId().equals(alist.get(i).getStuId())) { | 140 | if (studentBean.getStuId().equals(alist.get(i).getStuId())) { |
| 144 | select = i; | 141 | select = i; |
| 145 | break; | 142 | break; |
| 146 | } | 143 | } |
| 147 | } | 144 | } |
| 148 | } catch (Exception e) { | 145 | } catch (Exception e) { |
| 149 | 146 | ||
| 150 | } | 147 | } |
| 151 | BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_child_choose, alist) { | 148 | BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_child_choose, alist) { |
| 152 | @Override | 149 | @Override |
| 153 | protected void convert(@NonNull BaseViewHolder item, Object o) { | 150 | protected void convert(@NonNull BaseViewHolder item, Object o) { |
| 154 | StudentBean studentBean = alist.get(item.getAdapterPosition()); | 151 | StudentBean studentBean = alist.get(item.getAdapterPosition()); |
| 155 | item.setText(R.id.tv_name, studentBean.getNickName()); | 152 | item.setText(R.id.tv_name, studentBean.getNickName()); |
| 156 | if (TextUtils.isEmpty(studentBean.getStuId())) { | 153 | if (TextUtils.isEmpty(studentBean.getStuId())) { |
| 157 | item.setVisible(R.id.rl_add, true); | 154 | item.setVisible(R.id.rl_add, true); |
| 158 | item.getConvertView().setOnClickListener(new View.OnClickListener() { | 155 | item.getConvertView().setOnClickListener(new View.OnClickListener() { |
| 159 | @Override | 156 | @Override |
| 160 | public void onClick(View view) { | 157 | public void onClick(View view) { |
| 161 | startActivity(new Intent(ChooseActivity.this, AddStudentActivity.class)); | 158 | startActivity(new Intent(ChooseActivity.this, AddStudentActivity.class)); |
| 162 | } | 159 | } |
| 163 | }); | 160 | }); |
| 164 | } else { | 161 | } else { |
| 165 | item.setBackgroundRes(R.id.rl_child, select == item.getAdapterPosition() ? R.drawable.bg_solid_white_10_or : R.drawable.bg_solid_white_10); | 162 | 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); | 163 | item.setImageResource(R.id.iv_select, select == item.getAdapterPosition() ? R.mipmap.gx : R.mipmap.wsyq); |
| 167 | item.setVisible(R.id.rl_add, false); | 164 | item.setVisible(R.id.rl_add, false); |
| 168 | if (TextUtils.isEmpty(studentBean.getPhoto())) { | 165 | 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); | 166 | item.setImageResource(R.id.iv_avatar, studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female); |
| 170 | } else { | 167 | } else { |
| 171 | RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(ChooseActivity.this, 45)); | 168 | RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(ChooseActivity.this, 45)); |
| 172 | RequestOptions options = RequestOptions.bitmapTransform(roundedCorners); | 169 | RequestOptions options = RequestOptions.bitmapTransform(roundedCorners); |
| 173 | Glide.with(ChooseActivity.this).load(studentBean.getPhoto()).apply(options).into((ImageView) item.getView(R.id.iv_avatar)); | 170 | Glide.with(ChooseActivity.this).load(studentBean.getPhoto()).apply(options).into((ImageView) item.getView(R.id.iv_avatar)); |
| 174 | } | 171 | } |
| 175 | item.setVisible(R.id.iv_vip, !"虚拟".equals(studentBean.getTeacherIdentity())); | 172 | item.setVisible(R.id.iv_vip, !"虚拟".equals(studentBean.getTeacherIdentity())); |
| 176 | item.getConvertView().setOnClickListener(new View.OnClickListener() { | 173 | item.getConvertView().setOnClickListener(new View.OnClickListener() { |
| 177 | @Override | 174 | @Override |
| 178 | public void onClick(View view) { | 175 | public void onClick(View view) { |
| 179 | select = item.getAdapterPosition(); | 176 | select = item.getAdapterPosition(); |
| 180 | notifyDataSetChanged(); | 177 | notifyDataSetChanged(); |
| 181 | } | 178 | } |
| 182 | }); | 179 | }); |
| 183 | } | 180 | } |
| 184 | } | 181 | } |
| 185 | }; | 182 | }; |
| 186 | recycle.setLayoutManager(new LinearLayoutManager(ChooseActivity.this, LinearLayoutManager.VERTICAL, false)); | 183 | recycle.setLayoutManager(new LinearLayoutManager(ChooseActivity.this, LinearLayoutManager.VERTICAL, false)); |
| 187 | recycle.setAdapter(adapter); | 184 | recycle.setAdapter(adapter); |
| 188 | } | 185 | } |
| 189 | 186 | ||
| 190 | @OnClick(R.id.tv_confirm) | 187 | @OnClick(R.id.tv_confirm) |
| 191 | public void confirm(View view) { | 188 | public void confirm(View view) { |
| 192 | if (alist.size() > 0 && alist.size() - 1 >= select && alist.get(select) != null) { | 189 | if (alist.size() > 0 && alist.size() - 1 >= select && alist.get(select) != null) { |
| 193 | StudentBean studentBean = alist.get(select); | 190 | StudentBean studentBean = alist.get(select); |
| 194 | Intent intent = new Intent(ChooseActivity.this, MainActivity.class); | 191 | Intent intent = new Intent(ChooseActivity.this, MainActivity.class); |
| 195 | SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean)); | 192 | SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean)); |
| 196 | startActivity(intent); | 193 | startActivity(intent); |
| 197 | finish(); | 194 | finish(); |
| 198 | } | 195 | } |
| 199 | } | 196 | } |
| 200 | } | 197 | } |
| 201 | 198 |
app/src/main/res/xml/network_security_config.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <network-security-config> | ||
| 3 | <base-config cleartextTrafficPermitted="true" /> | ||
| 4 | </network-security-config> | ||
| 5 | |||
| 6 |
build.gradle
| 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 : "http://192.168.3.11:8088", //http 请求指令 | 19 | server_url : "http://192.168.3.155:8088", //http 请求指令 |
| 20 | server_url_online: "https://mgr.hjx.com", //http 请求指令 | 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:4.6.1', | 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 |