Commit 66afddedbad0cbf77732c0f72b627efc8f466c89

Authored by zhanghaochen
1 parent 2bbfadef84
Exists in master

教师端,UI修改

Showing 48 changed files with 2061 additions and 191 deletions   Show diff stats
app/src/main/AndroidManifest.xml
... ... @@ -27,8 +27,10 @@
27 27 <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
28 28 <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
29 29  
30   - <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
  30 + <uses-permission
  31 + android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
31 32 tools:ignore="ScopedStorage" />
  33 +
32 34 <application
33 35 android:name=".App"
34 36 android:allowBackup="true"
... ... @@ -117,6 +119,12 @@
117 119 <activity
118 120 android:name=".ErrorDetailActivity"
119 121 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
  122 + <activity
  123 + android:name=".TeacherChooseActivity"
  124 + android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
  125 + <activity
  126 + android:name=".TeacherMainActivity"
  127 + android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
120 128  
121 129 <provider
122 130 android:name="androidx.core.content.FileProvider"
... ...
app/src/main/java/com/hjx/parent/ChooseActivity.java
... ... @@ -4,6 +4,7 @@ import android.content.Intent;
4 4 import android.text.TextUtils;
5 5 import android.view.View;
6 6 import android.widget.ImageView;
  7 +import android.widget.ListView;
7 8  
8 9 import androidx.annotation.NonNull;
9 10 import androidx.recyclerview.widget.LinearLayoutManager;
... ... @@ -144,6 +145,11 @@ public class ChooseActivity extends BaseActivity {
144 145 }
145 146 BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_child_choose, alist) {
146 147 @Override
  148 + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
  149 +
  150 + }
  151 +
  152 + @Override
147 153 protected void convert(@NonNull BaseViewHolder item, Object o) {
148 154 StudentBean studentBean = alist.get(item.getAdapterPosition());
149 155 item.setText(R.id.tv_name, studentBean.getNickName());
... ... @@ -186,9 +192,13 @@ public class ChooseActivity extends BaseActivity {
186 192 if (alist.size() > 0 && alist.size() - 1 >= select && alist.get(select) != null) {
187 193 StudentBean studentBean = alist.get(select);
188 194 if (studentBean.getStuId() != null) {
189   - Intent intent = new Intent(ChooseActivity.this, MainActivity.class);
190   - SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean));
191   - startActivity(intent);
  195 + if (getIntent().getBooleanExtra("needBack", false)) {
  196 + SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean));
  197 + } else {
  198 + Intent intent = new Intent(ChooseActivity.this, MainActivity.class);
  199 + SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean));
  200 + startActivity(intent);
  201 + }
192 202 finish();
193 203 }
194 204 }
... ...
app/src/main/java/com/hjx/parent/ErrorListActivity.java
... ... @@ -96,6 +96,7 @@ public class ErrorListActivity extends BaseActivity&lt;ActivityErrorListBinding&gt; im
96 96 binding.tvAdd.setOnClickListener(this);
97 97 binding.llDelete.setOnClickListener(this);
98 98 binding.tvSave.setOnClickListener(this);
  99 + binding.tvTitle.setText(studentBean.getStuName() + "的错题本");
99 100 binding.checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
100 101 @Override
101 102 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
... ... @@ -124,6 +125,20 @@ public class ErrorListActivity extends BaseActivity&lt;ActivityErrorListBinding&gt; im
124 125 }
125 126 });
126 127 refreshError();
  128 + binding.ivChange.setOnClickListener(new View.OnClickListener() {
  129 + @Override
  130 + public void onClick(View v) {
  131 + if (SharedPreferencesUtil.getData("role", "").equals("parent")) {
  132 + Intent intent = new Intent(context, ChooseActivity.class);
  133 + intent.putExtra("needBack", true);
  134 + startActivity(intent);
  135 + } else {
  136 + Intent intent = new Intent(context, TeacherChooseActivity.class);
  137 + intent.putExtra("needBack", true);
  138 + startActivity(intent);
  139 + }
  140 + }
  141 + });
127 142 }
128 143  
129 144 @Override
... ... @@ -132,7 +147,6 @@ public class ErrorListActivity extends BaseActivity&lt;ActivityErrorListBinding&gt; im
132 147 }
133 148  
134 149  
135   -
136 150 @Override
137 151 public void onClick(View v) {
138 152 switch (v.getId()) {
... ... @@ -615,6 +629,13 @@ public class ErrorListActivity extends BaseActivity&lt;ActivityErrorListBinding&gt; im
615 629  
616 630 @Override
617 631 protected void onResume() {
  632 + String student = (String) SharedPreferencesUtil.getData("student", "");
  633 + try {
  634 + studentBean = new Gson().fromJson(student, StudentBean.class);
  635 + } catch (Exception e) {
  636 +
  637 + }
  638 + binding.tvTitle.setText(studentBean.getStuName() + "的错题本");
618 639 refreshError();
619 640 super.onResume();
620 641 }
... ...
app/src/main/java/com/hjx/parent/LoginActivity.java
... ... @@ -82,9 +82,15 @@ public class LoginActivity extends BaseActivity {
82 82  
83 83 if (!TextUtils.isEmpty(student)) {
84 84 LogUtil.e(TAG, "role 不是空----");
85   - Intent intent = new Intent(this, MainActivity.class);
86   - startActivity(intent);
87   - finish();
  85 + if ((SharedPreferencesUtil.getData("role", "")).equals("parent")) {
  86 + Intent intent = new Intent(this, MainActivity.class);
  87 + startActivity(intent);
  88 + finish();
  89 + } else {
  90 + Intent intent = new Intent(this, TeacherMainActivity.class);
  91 + startActivity(intent);
  92 + finish();
  93 + }
88 94 return;
89 95 } else {
90 96 LogUtil.e(TAG, "role 是空----");
... ... @@ -169,14 +175,30 @@ public class LoginActivity extends BaseActivity {
169 175 boolean isSucceed = jo.getBoolean("success");
170 176 if (isSucceed) {
171 177 JSONObject jo2 = jo.getJSONObject("data");
172   - SharedPreferencesUtil.putData("phone", phone);
173   - SharedPreferencesUtil.putData("role", jo2.getString("role"));
174   - SharedPreferencesUtil.putData("userId", jo2.getString("userId"));
175   - SharedPreferencesUtil.putData("token", jo2.getString("token"));
176   - JSONObject user = new JSONObject(jo2.getString("user"));
177   - SharedPreferencesUtil.putData("photo", user.getString("photo"));
178   - startActivity(ChooseActivity.class);
179   - finish();
  178 + if ("parent".equals(jo2.getString("role"))) {
  179 + SharedPreferencesUtil.putData("phone", phone);
  180 + SharedPreferencesUtil.putData("role", jo2.getString("role"));
  181 + SharedPreferencesUtil.putData("userId", jo2.getString("userId"));
  182 + SharedPreferencesUtil.putData("token", jo2.getString("token"));
  183 + JSONObject user = new JSONObject(jo2.getString("user"));
  184 + SharedPreferencesUtil.putData("photo", user.getString("photo"));
  185 + SharedPreferencesUtil.putData("name", user.getString("userName"));
  186 + startActivity(ChooseActivity.class);
  187 + finish();
  188 + } else if ("member_advisor".equals(jo2.getString("role")) || "teaching_supervision".equals(jo2.getString("role"))) {
  189 + SharedPreferencesUtil.putData("phone", phone);
  190 + SharedPreferencesUtil.putData("role", jo2.getString("role"));
  191 + SharedPreferencesUtil.putData("userId", jo2.getString("userId"));
  192 + SharedPreferencesUtil.putData("token", jo2.getString("token"));
  193 + JSONObject user = new JSONObject(jo2.getString("user"));
  194 + SharedPreferencesUtil.putData("name", user.getString("userName"));
  195 + SharedPreferencesUtil.putData("photo", user.getString("photo"));
  196 + startActivity(TeacherChooseActivity.class);
  197 + finish();
  198 + } else {
  199 + showToast("您没有权限");
  200 + }
  201 +
180 202 } else {
181 203 Toast.makeText(LoginActivity.this, jo.getString("msg"), Toast.LENGTH_SHORT).show();
182 204 }
... ...
app/src/main/java/com/hjx/parent/MainActivity.java
1 1 package com.hjx.parent;
2 2  
  3 +import androidx.annotation.Nullable;
3 4 import androidx.appcompat.app.AppCompatActivity;
4 5 import androidx.constraintlayout.widget.ConstraintLayout;
5 6 import androidx.core.content.FileProvider;
... ... @@ -66,6 +67,13 @@ public class MainActivity extends BaseActivity {
66 67 ImageView iv_3, iv_4;
67 68 TextView tv_1, tv_4;
68 69  
  70 +
  71 + @Override
  72 + protected void onCreate(@Nullable Bundle savedInstanceState) {
  73 + super.onCreate(savedInstanceState);
  74 + fullScreen();
  75 + }
  76 +
69 77 @Override
70 78 protected void initView() {
71 79 showFragment(getHomeFragment(), R.id.rl_content);
... ... @@ -138,19 +146,21 @@ public class MainActivity extends BaseActivity {
138 146 @Override
139 147 protected void initListener() {
140 148 cl_home.setOnClickListener(view -> {
  149 + fullScreen();
141 150 showFragment(getHomeFragment(), R.id.rl_content);
142 151 iv_3.setBackgroundResource(R.mipmap.hoss);
143   - tv_1.setTextColor(Color.parseColor("#FE5E09"));
  152 + tv_1.setTextColor(Color.parseColor("#1C90F3"));
144 153 iv_4.setBackgroundResource(R.mipmap.wmus);
145 154 tv_4.setTextColor(Color.parseColor("#333333"));
146 155 });
147 156  
148 157 cl_me.setOnClickListener(view -> {
  158 + blackBar();
149 159 showFragment(getMeFragment(), R.id.rl_content);
150 160 iv_3.setBackgroundResource(R.mipmap.hous);
151 161 tv_1.setTextColor(Color.parseColor("#333333"));
152 162 iv_4.setBackgroundResource(R.mipmap.wmss);
153   - tv_4.setTextColor(Color.parseColor("#FE5E09"));
  163 + tv_4.setTextColor(Color.parseColor("#1C90F3"));
154 164 });
155 165 }
156 166  
... ...
app/src/main/java/com/hjx/parent/TeacherChooseActivity.java
... ... @@ -0,0 +1,192 @@
  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 TeacherChooseActivity 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.listStudent(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 + String str = responseBody.string().toString();
  96 + LogUtil.e("TAG", "----" + str);
  97 + JSONObject jo = new JSONObject(str);
  98 + boolean isSucceed = jo.getBoolean("success");
  99 + if (isSucceed) {
  100 + JSONArray jarr = jo.getJSONArray("data");
  101 + alist.clear();
  102 + for (int i = 0; i < jarr.length(); i++) {
  103 + JSONObject jo2 = jarr.getJSONObject(i);
  104 + Gson gson = new Gson();
  105 + StudentBean sb = gson.fromJson(jo2.toString(), StudentBean.class);
  106 + alist.add(sb);
  107 + }
  108 + loadList();
  109 + } else {
  110 +
  111 + }
  112 + } catch (Exception e) {
  113 + e.printStackTrace();
  114 + }
  115 + }
  116 +
  117 + @Override
  118 + public void onError(Throwable e) {
  119 +
  120 + }
  121 +
  122 + @Override
  123 + public void onComplete() {
  124 +
  125 + }
  126 + });
  127 + }
  128 +
  129 + public void loadList() {
  130 + String student = (String) SharedPreferencesUtil.getData("student", "");
  131 + try {
  132 + StudentBean studentBean = new Gson().fromJson(student, StudentBean.class);
  133 + for (int i = 0; i < alist.size(); i++) {
  134 + if (studentBean.getStuId().equals(alist.get(i).getStuId())) {
  135 + select = i;
  136 + break;
  137 + }
  138 + }
  139 + } catch (Exception e) {
  140 +
  141 + }
  142 + BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_child_choose, alist) {
  143 + @Override
  144 + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
  145 +
  146 + }
  147 +
  148 + @Override
  149 + protected void convert(@NonNull BaseViewHolder item, Object o) {
  150 + StudentBean studentBean = alist.get(item.getAdapterPosition());
  151 + item.setText(R.id.tv_name, studentBean.getStuName());
  152 + item.setBackgroundRes(R.id.rl_child, select == item.getAdapterPosition() ? R.drawable.bg_solid_white_10_or : R.drawable.bg_solid_white_10);
  153 + item.setImageResource(R.id.iv_select, select == item.getAdapterPosition() ? R.mipmap.gx : R.mipmap.wsyq);
  154 + item.setVisible(R.id.rl_add, false);
  155 + if (TextUtils.isEmpty(studentBean.getPhoto())) {
  156 + item.setImageResource(R.id.iv_avatar, studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
  157 + } else {
  158 + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(TeacherChooseActivity.this, 45));
  159 + RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
  160 + Glide.with(TeacherChooseActivity.this).load(studentBean.getPhoto()).apply(options).into((ImageView) item.getView(R.id.iv_avatar));
  161 + }
  162 + item.setVisible(R.id.iv_vip, !"虚拟".equals(studentBean.getTeacherIdentity()));
  163 + item.getConvertView().setOnClickListener(new View.OnClickListener() {
  164 + @Override
  165 + public void onClick(View view) {
  166 + select = item.getAdapterPosition();
  167 + notifyDataSetChanged();
  168 + }
  169 + });
  170 + }
  171 + };
  172 + recycle.setLayoutManager(new LinearLayoutManager(TeacherChooseActivity.this, LinearLayoutManager.VERTICAL, false));
  173 + recycle.setAdapter(adapter);
  174 + }
  175 +
  176 + @OnClick(R.id.tv_confirm)
  177 + public void confirm(View view) {
  178 + if (alist.size() > 0 && alist.size() - 1 >= select && alist.get(select) != null) {
  179 + StudentBean studentBean = alist.get(select);
  180 + if (studentBean.getStuId() != null) {
  181 + if (getIntent().getBooleanExtra("needBack", false)) {
  182 + SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean));
  183 + } else {
  184 + Intent intent = new Intent(TeacherChooseActivity.this, TeacherMainActivity.class);
  185 + SharedPreferencesUtil.putData("student", new Gson().toJson(studentBean));
  186 + startActivity(intent);
  187 + }
  188 + finish();
  189 + }
  190 + }
  191 + }
  192 +}
... ...
app/src/main/java/com/hjx/parent/TeacherMainActivity.java
... ... @@ -0,0 +1,274 @@
  1 +package com.hjx.parent;
  2 +
  3 +import android.app.Dialog;
  4 +import android.app.ProgressDialog;
  5 +import android.content.Intent;
  6 +import android.graphics.Color;
  7 +import android.net.Uri;
  8 +import android.os.Build;
  9 +import android.os.Looper;
  10 +import android.widget.ImageView;
  11 +import android.widget.TextView;
  12 +import android.widget.Toast;
  13 +
  14 +import androidx.constraintlayout.widget.ConstraintLayout;
  15 +import androidx.core.content.FileProvider;
  16 +
  17 +import com.google.gson.JsonObject;
  18 +import com.hjq.permissions.OnPermissionCallback;
  19 +import com.hjq.permissions.Permission;
  20 +import com.hjq.permissions.XXPermissions;
  21 +import com.hjx.parent.dialog.TipDialog;
  22 +import com.hjx.parent.fragment.ErrorFragment;
  23 +import com.hjx.parent.fragment.HomeFragment;
  24 +import com.hjx.parent.fragment.MeFragment;
  25 +import com.hjx.parent.fragment.TeacherFragment;
  26 +import com.prws.common.base.BaseActivity;
  27 +import com.prws.common.base.BasePresenter;
  28 +import com.prws.common.bean.GradeAndSubject;
  29 +import com.prws.common.bean.ResponseResult;
  30 +import com.prws.common.bean.UpdateBean;
  31 +import com.prws.common.net.NetWorks;
  32 +import com.prws.common.utils.DownloadUtil;
  33 +import com.prws.common.utils.SharedPreferencesUtil;
  34 +
  35 +import java.io.File;
  36 +import java.util.List;
  37 +
  38 +import io.reactivex.Observer;
  39 +import io.reactivex.disposables.Disposable;
  40 +import retrofit2.Call;
  41 +import retrofit2.Callback;
  42 +import retrofit2.Response;
  43 +
  44 +public class TeacherMainActivity extends BaseActivity {
  45 +
  46 + @Override
  47 + protected int layoutResId() {
  48 + return R.layout.activity_main;
  49 + }
  50 +
  51 + @Override
  52 + public Object getContract() {
  53 + return null;
  54 + }
  55 +
  56 + @Override
  57 + public BasePresenter getPresenter() {
  58 + return null;
  59 + }
  60 +
  61 +
  62 + ErrorFragment errorFragment;
  63 + TeacherFragment meFragment;
  64 + ConstraintLayout cl_home;
  65 + ConstraintLayout cl_me;
  66 + ImageView iv_3, iv_4;
  67 + TextView tv_1, tv_4;
  68 +
  69 + @Override
  70 + protected void initView() {
  71 + blackBar();
  72 + showFragment(getErrorFragment(), R.id.rl_content);
  73 + cl_home = findViewById(R.id.cl_home);
  74 + cl_me = findViewById(R.id.cl_me);
  75 + iv_3 = findViewById(R.id.iv_3);
  76 + iv_4 = findViewById(R.id.iv_4);
  77 + tv_1 = findViewById(R.id.tv_1);
  78 + tv_4 = findViewById(R.id.tv_4);
  79 + iv_3.setBackgroundResource(R.mipmap.hoss);
  80 + tv_1.setTextColor(Color.parseColor("#FE5E09"));
  81 + NetWorks.getBaiduToken(new Observer<JsonObject>() {
  82 + @Override
  83 + public void onSubscribe(Disposable d) {
  84 +
  85 + }
  86 +
  87 + @Override
  88 + public void onNext(JsonObject jsonObject) {
  89 + SharedPreferencesUtil.putData("baiduToken", jsonObject.get("access_token").getAsString());
  90 + }
  91 +
  92 + @Override
  93 + public void onError(Throwable e) {
  94 +
  95 + }
  96 +
  97 + @Override
  98 + public void onComplete() {
  99 +
  100 + }
  101 + });
  102 + NetWorks.listGradeAndSubject(new Observer<ResponseResult<List<GradeAndSubject>>>() {
  103 + @Override
  104 + public void onSubscribe(Disposable d) {
  105 +
  106 + }
  107 +
  108 + @Override
  109 + public void onNext(ResponseResult<List<GradeAndSubject>> listResponseResult) {
  110 + App.getInstance().setGradeAndSubjects(listResponseResult.getData());
  111 + }
  112 +
  113 + @Override
  114 + public void onError(Throwable e) {
  115 + e.toString();
  116 + }
  117 +
  118 + @Override
  119 + public void onComplete() {
  120 +
  121 + }
  122 + });
  123 + checkUpdate();
  124 + }
  125 +
  126 + public ErrorFragment getErrorFragment() {
  127 + if (errorFragment == null)
  128 + errorFragment = new ErrorFragment();
  129 + return errorFragment;
  130 + }
  131 +
  132 + public TeacherFragment getMeFragment() {
  133 + if (meFragment == null)
  134 + meFragment = new TeacherFragment();
  135 + return meFragment;
  136 + }
  137 +
  138 +
  139 + @Override
  140 + protected void initListener() {
  141 + cl_home.setOnClickListener(view -> {
  142 + showFragment(getErrorFragment(), R.id.rl_content);
  143 + iv_3.setBackgroundResource(R.mipmap.hoss);
  144 + tv_1.setTextColor(Color.parseColor("#1C90F3"));
  145 + iv_4.setBackgroundResource(R.mipmap.wmus);
  146 + tv_4.setTextColor(Color.parseColor("#333333"));
  147 + });
  148 +
  149 + cl_me.setOnClickListener(view -> {
  150 + showFragment(getMeFragment(), R.id.rl_content);
  151 + iv_3.setBackgroundResource(R.mipmap.hous);
  152 + tv_1.setTextColor(Color.parseColor("#333333"));
  153 + iv_4.setBackgroundResource(R.mipmap.wmss);
  154 + tv_4.setTextColor(Color.parseColor("#1C90F3"));
  155 + });
  156 + }
  157 +
  158 + @Override
  159 + protected void initData() {
  160 +
  161 + }
  162 +
  163 + @Override
  164 + public void onNetChanged(int netWorkState) {
  165 +
  166 + }
  167 +
  168 + public void downloadApk(String url, int versionCode) {
  169 + String filepath = getExternalFilesDir("apk").getPath() + "/" + versionCode + ".apk";
  170 + ProgressDialog dialog = new ProgressDialog(this);
  171 + dialog.setTitle("版本更新");
  172 + dialog.setMessage("正在下载新版本,请稍后");
  173 + dialog.setMax(100);
  174 + dialog.setProgress(0);
  175 + dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  176 + dialog.show();
  177 + DownloadUtil.download(url, filepath, new DownloadUtil.OnDownloadListener() {
  178 + @Override
  179 + public void onDownloadSuccess(String path) {
  180 + dialog.setProgress(100);
  181 + dialog.dismiss();
  182 + installApk(filepath);
  183 + }
  184 +
  185 + @Override
  186 + public void onDownloading(int progress) {
  187 + dialog.setProgress(progress);
  188 + }
  189 +
  190 + @Override
  191 + public void onDownloadFailed(String msg) {
  192 + dialog.dismiss();
  193 + Looper.prepare();
  194 + showToast("下载失败。");
  195 + Looper.loop();
  196 + }
  197 + });
  198 + }
  199 +
  200 + public void installApk(String path) {
  201 + //开启扫码界面
  202 + Intent intentUpdate = new Intent("android.intent.action.VIEW");
  203 + intentUpdate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  204 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //对Android N及以上的版本做判断
  205 + Uri apkUriN = FileProvider.getUriForFile(TeacherMainActivity.this,
  206 + getApplicationContext().getPackageName() + ".fileprovider", new File(path));
  207 + intentUpdate.addCategory("android.intent.category.DEFAULT");
  208 + intentUpdate.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); //天假Flag 表示我们需要什么权限
  209 + intentUpdate.setDataAndType(apkUriN, "application/vnd.android.package-archive");
  210 + } else {
  211 + Uri apkUri = Uri.fromFile(new File(path));
  212 + intentUpdate.setDataAndType(apkUri, "application/vnd.android.package-archive");
  213 + }
  214 + startActivity(intentUpdate);
  215 + }
  216 +
  217 + public void checkUpdate() {
  218 + NetWorks.checkUpdate(BuildConfig.VERSION_CODE, BuildConfig.APPLICATION_ID, new Callback<ResponseResult<UpdateBean>>() {
  219 + @Override
  220 + public void onResponse(Call<ResponseResult<UpdateBean>> call, Response<ResponseResult<UpdateBean>> response) {
  221 + if (response.body() != null && response.body().getCode() == 200) {
  222 + if (response.body().getData() != null) {
  223 + String msg = response.body().getData().getExplain();
  224 + String url = response.body().getData().getUrl();
  225 + int versionCode = response.body().getData().getVersion();
  226 + showUpdateDialog(msg, url, versionCode);
  227 + }
  228 + }
  229 + }
  230 +
  231 + @Override
  232 + public void onFailure(Call<ResponseResult<UpdateBean>> call, Throwable t) {
  233 + }
  234 + });
  235 + }
  236 +
  237 + public void showUpdateDialog(String msg, String url, int versionCode) {
  238 + TipDialog tipDialog = new TipDialog(this, "检测到新版本", msg, "升级", "取消", new TipDialog.TipDialogInterface() {
  239 + @Override
  240 + public void onConfirm(Dialog dialog) {
  241 + if (!XXPermissions.isGranted(TeacherMainActivity.this, Permission.MANAGE_EXTERNAL_STORAGE)) {
  242 + XXPermissions.with(TeacherMainActivity.this)
  243 + // 申请多个权限
  244 + .permission(Permission.MANAGE_EXTERNAL_STORAGE)
  245 + .request(new OnPermissionCallback() {
  246 + @Override
  247 + public void onGranted(List<String> permissions, boolean all) {
  248 + if (all) {
  249 + //开启扫码界面
  250 + downloadApk(url, versionCode);
  251 + } else {
  252 + Toast.makeText(TeacherMainActivity.this, "需要权限", Toast.LENGTH_SHORT).show();
  253 + }
  254 + }
  255 +
  256 + @Override
  257 + public void onDenied(List<String> permissions, boolean never) {
  258 + XXPermissions.startPermissionActivity(TeacherMainActivity.this, permissions);
  259 + }
  260 + });
  261 + } else {
  262 + downloadApk(url, versionCode);
  263 + }
  264 +
  265 + }
  266 +
  267 + @Override
  268 + public void onCancel(Dialog dialog) {
  269 + dialog.dismiss();
  270 + }
  271 + });
  272 + tipDialog.show();
  273 + }
  274 +}
0 275 \ No newline at end of file
... ...
app/src/main/java/com/hjx/parent/dialog/ErrorInputDialog.java
... ... @@ -37,9 +37,13 @@ import com.prws.common.bean.Subject;
37 37 import com.prws.common.bean.TopicBean;
38 38 import com.prws.common.net.NetWorks;
39 39 import com.prws.common.utils.CommonUtil;
  40 +import com.prws.common.utils.LogUtil;
40 41 import com.prws.common.utils.SharedPreferencesUtil;
41 42 import com.prws.common.utils.StringUtils;
42 43  
  44 +import org.json.JSONArray;
  45 +import org.json.JSONObject;
  46 +
43 47 import java.util.ArrayList;
44 48 import java.util.HashMap;
45 49 import java.util.List;
... ... @@ -47,6 +51,7 @@ import java.util.Map;
47 51  
48 52 import io.reactivex.Observer;
49 53 import io.reactivex.disposables.Disposable;
  54 +import okhttp3.ResponseBody;
50 55  
51 56 public class ErrorInputDialog extends Dialog {
52 57 private ImageActivity context;
... ... @@ -182,6 +187,7 @@ public class ErrorInputDialog extends Dialog {
182 187 loadError();
183 188 }
184 189  
  190 +
185 191 private void refreshSubject(List<Subject> subjects) {
186 192 List<String> s = new ArrayList<>();
187 193 for (Subject subject : subjects) {
... ...
app/src/main/java/com/hjx/parent/fragment/BaseBindingFragment.java
... ... @@ -0,0 +1,39 @@
  1 +package com.hjx.parent.fragment;
  2 +
  3 +import android.os.Bundle;
  4 +import android.view.LayoutInflater;
  5 +import android.view.View;
  6 +import android.view.ViewGroup;
  7 +
  8 +import androidx.annotation.NonNull;
  9 +import androidx.annotation.Nullable;
  10 +import androidx.fragment.app.Fragment;
  11 +import androidx.viewbinding.ViewBinding;
  12 +
  13 +public abstract class BaseBindingFragment<T extends ViewBinding> extends Fragment {
  14 +
  15 + private T binding;
  16 +
  17 + @Nullable
  18 + @Override
  19 + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  20 + // 调用onCreateViewBinding方法获取binding
  21 + binding = onCreateViewBinding(inflater, container);
  22 + return binding.getRoot();
  23 + }
  24 +
  25 + @Override
  26 + public void onDestroyView() {
  27 + super.onDestroyView();
  28 + // 引用置空处理
  29 + binding = null;
  30 + }
  31 +
  32 + // 子类使用该方法来使用binding
  33 + public T getBinding() {
  34 + return binding;
  35 + }
  36 +
  37 + // 由子类去重写
  38 + protected abstract T onCreateViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent);
  39 +}
0 40 \ No newline at end of file
... ...
app/src/main/java/com/hjx/parent/fragment/ErrorFragment.java
... ... @@ -0,0 +1,355 @@
  1 +package com.hjx.parent.fragment;
  2 +
  3 +import static android.app.Activity.RESULT_OK;
  4 +
  5 +import android.content.Intent;
  6 +import android.graphics.Bitmap;
  7 +import android.graphics.BitmapFactory;
  8 +import android.net.Uri;
  9 +import android.os.Bundle;
  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.view.ViewGroup;
  16 +import android.widget.ImageView;
  17 +import android.widget.LinearLayout;
  18 +import android.widget.Toast;
  19 +
  20 +import androidx.annotation.NonNull;
  21 +import androidx.annotation.Nullable;
  22 +import androidx.core.content.FileProvider;
  23 +import androidx.recyclerview.widget.LinearLayoutManager;
  24 +import androidx.recyclerview.widget.RecyclerView;
  25 +
  26 +import com.bumptech.glide.Glide;
  27 +import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
  28 +import com.bumptech.glide.request.RequestOptions;
  29 +import com.chad.library.adapter.base.BaseQuickAdapter;
  30 +import com.chad.library.adapter.base.BaseViewHolder;
  31 +import com.google.gson.Gson;
  32 +import com.hjq.permissions.OnPermissionCallback;
  33 +import com.hjq.permissions.Permission;
  34 +import com.hjq.permissions.XXPermissions;
  35 +import com.hjx.parent.ChooseActivity;
  36 +import com.hjx.parent.ErrorBookActivity;
  37 +import com.hjx.parent.ErrorListActivity;
  38 +import com.hjx.parent.ImageActivity;
  39 +import com.hjx.parent.R;
  40 +import com.hjx.parent.TeacherChooseActivity;
  41 +import com.hjx.parent.adapter.ErrorAdapter;
  42 +import com.hjx.parent.bean.StudentBean;
  43 +import com.hjx.parent.databinding.ActivityErrorBookBinding;
  44 +import com.hjx.parent.databinding.FragmentErrorBookBinding;
  45 +import com.prws.common.bean.PageInfo;
  46 +import com.prws.common.bean.ResponseResult;
  47 +import com.prws.common.bean.TopicBean;
  48 +import com.prws.common.net.NetWorks;
  49 +import com.prws.common.utils.BitmapUtils;
  50 +import com.prws.common.utils.CommonUtil;
  51 +import com.prws.common.utils.ScreenUtils;
  52 +import com.prws.common.utils.SharedPreferencesUtil;
  53 +import com.prws.common.utils.dialog.MyButtomDialog;
  54 +import com.zhangteng.imagepicker.bean.ImageInfo;
  55 +import com.zhangteng.imagepicker.config.ImagePickerConfig;
  56 +import com.zhangteng.imagepicker.config.ImagePickerEnum;
  57 +import com.zhangteng.imagepicker.config.ImagePickerOpen;
  58 +import com.zhangteng.imagepicker.imageloader.GlideImageLoader;
  59 +import com.zhangteng.utils.IHandlerCallBack;
  60 +
  61 +import java.io.File;
  62 +import java.util.ArrayList;
  63 +import java.util.Arrays;
  64 +import java.util.HashMap;
  65 +import java.util.List;
  66 +import java.util.Map;
  67 +
  68 +import io.reactivex.Observer;
  69 +import io.reactivex.disposables.Disposable;
  70 +
  71 +public class ErrorFragment extends BaseBindingFragment<FragmentErrorBookBinding> {
  72 + StudentBean studentBean;
  73 + private int subject;
  74 + private ErrorAdapter adapter;
  75 + private int REQUEST_CODE_IMAGE = 123;
  76 + private String filePath;
  77 +
  78 + @Override
  79 + protected FragmentErrorBookBinding onCreateViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent) {
  80 + return FragmentErrorBookBinding.inflate(inflater, parent, false);
  81 + }
  82 +
  83 + @Override
  84 + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
  85 + super.onViewCreated(view, savedInstanceState);
  86 + String student = (String) SharedPreferencesUtil.getData("student", "");
  87 + try {
  88 + studentBean = new Gson().fromJson(student, StudentBean.class);
  89 + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 45));
  90 + RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
  91 + if (TextUtils.isEmpty(studentBean.getPhoto())) {
  92 + getBinding().ivStudent.setImageResource(studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
  93 + } else {
  94 + Glide.with(getContext()).load(studentBean.getPhoto()).apply(options).into(getBinding().ivStudent);
  95 + }
  96 + getBinding().tvName.setText(studentBean.getStuName());
  97 + } catch (Exception e) {
  98 +
  99 + }
  100 + getBinding().rlTakePhoto.post(new Runnable() {
  101 + @Override
  102 + public void run() {
  103 + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getBinding().rlTakePhoto.getLayoutParams();
  104 + layoutParams.width = CommonUtil.getScreenWidth(getContext());
  105 + layoutParams.height = CommonUtil.getScreenWidth(getContext()) * 20 / 37;
  106 + getBinding().rlTakePhoto.setLayoutParams(layoutParams);
  107 + }
  108 + });
  109 + getBinding().tvChoose.setOnClickListener(new View.OnClickListener() {
  110 + @Override
  111 + public void onClick(View v) {
  112 + startActivity(new Intent(getContext(), TeacherChooseActivity.class));
  113 + getActivity().finish();
  114 + }
  115 + });
  116 + getBinding().rlTakePhoto.setOnClickListener(new View.OnClickListener() {
  117 + @Override
  118 + public void onClick(View v) {
  119 + if (!XXPermissions.isGranted(getContext(), Permission.CAMERA, Permission.WRITE_EXTERNAL_STORAGE)) {
  120 + XXPermissions.with(getContext())
  121 + // 申请多个权限
  122 + .permission(Permission.CAMERA).request(new OnPermissionCallback() {
  123 + @Override
  124 + public void onGranted(List<String> permissions, boolean all) {
  125 + if (all) {
  126 + //开启扫码界面
  127 + showButtonDialog();
  128 + } else {
  129 + Toast.makeText(getContext(), "需要权限", Toast.LENGTH_SHORT).show();
  130 + }
  131 + }
  132 +
  133 + @Override
  134 + public void onDenied(List<String> permissions, boolean never) {
  135 + XXPermissions.startPermissionActivity(getContext(), permissions);
  136 + }
  137 + });
  138 + } else {
  139 + showButtonDialog();
  140 + }
  141 +
  142 + }
  143 + });
  144 + BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_subject, Arrays.asList(getResources().getStringArray(R.array.filter_subject))) {
  145 + @Override
  146 + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
  147 +
  148 + }
  149 +
  150 + @Override
  151 + protected void convert(@NonNull BaseViewHolder item, Object o) {
  152 + item.setText(R.id.tv_subject, getResources().getStringArray(R.array.filter_subject)[item.getAdapterPosition()]);
  153 + switch (item.getAdapterPosition()) {
  154 + case 0:
  155 + item.setImageResource(R.id.iv_subject, R.mipmap.ic_chinese);
  156 + break;
  157 + case 1:
  158 + item.setImageResource(R.id.iv_subject, R.mipmap.ic_math);
  159 + break;
  160 + case 2:
  161 + item.setImageResource(R.id.iv_subject, R.mipmap.ic_english);
  162 + break;
  163 + case 3:
  164 + item.setImageResource(R.id.iv_subject, R.mipmap.ic_physics);
  165 + break;
  166 + case 4:
  167 + item.setImageResource(R.id.iv_subject, R.mipmap.ic_chemistry);
  168 + break;
  169 + }
  170 + ViewGroup.LayoutParams layoutParams = item.getView(R.id.rl_subject).getLayoutParams();
  171 + layoutParams.width = (CommonUtil.getScreenWidth(getContext()) - CommonUtil.dpToPx(getContext(), 30)) / 4;
  172 + item.getView(R.id.rl_subject).setLayoutParams(layoutParams);
  173 + item.getConvertView().setOnClickListener(new View.OnClickListener() {
  174 + @Override
  175 + public void onClick(View v) {
  176 + if (subject != item.getAdapterPosition()) {
  177 + subject = item.getAdapterPosition();
  178 + getError(getResources().getStringArray(R.array.filter_subject)[subject]);
  179 + }
  180 + }
  181 + });
  182 + }
  183 + };
  184 + getBinding().recycleSubject.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
  185 + getBinding().recycleSubject.setAdapter(adapter);
  186 + subject = 0;
  187 + getError(getResources().getStringArray(R.array.filter_subject)[subject]);
  188 + getBinding().llAll.setOnClickListener(new View.OnClickListener() {
  189 + @Override
  190 + public void onClick(View v) {
  191 + Intent intent = new Intent(getContext(), ErrorListActivity.class);
  192 + startActivity(intent);
  193 + }
  194 + });
  195 + }
  196 +
  197 + private void showButtonDialog() {
  198 + MyButtomDialog dialog = new MyButtomDialog(getActivity(), R.style.BottomSheetDialog);
  199 + View bottomView = LayoutInflater.from(getActivity()).inflate(R.layout.bottom_sheet_layout, null);
  200 + dialog.setContentView(bottomView);
  201 + bottomView.findViewById(R.id.take_photo).setOnClickListener(new View.OnClickListener() {
  202 + @Override
  203 + public void onClick(View view) {
  204 + dialog.dismiss();
  205 + Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  206 + //确保有相机来处理Intent
  207 + filePath = getActivity().getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg";
  208 + File photoFile = new File(filePath);
  209 + if (photoFile != null) {
  210 + //适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri
  211 + Uri photoUri = FileProvider.getUriForFile(getActivity(), "com.hjx.parent.fileprovider", photoFile);
  212 + takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
  213 + takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
  214 + startActivityForResult(takePictureIntent, REQUEST_CODE_IMAGE);
  215 + }
  216 + }
  217 + });
  218 + bottomView.findViewById(R.id.choose_photo).setOnClickListener(new View.OnClickListener() {
  219 + @Override
  220 + public void onClick(View view) {
  221 + dialog.dismiss();
  222 + ImagePickerConfig imagePickerConfig = new ImagePickerConfig.Builder().provider(getActivity().getPackageName() + ".fileprovider").imageLoader(new GlideImageLoader()) //图片加载器
  223 + .iHandlerCallBack(new HandlerCallBack()) //图片选择器生命周期监听(直接打开摄像头时无效)
  224 + .multiSelect(true) //是否多选
  225 + .isShowCamera(false).isVideoPicker(false) //是否选择视频 默认false
  226 + .isImagePicker(true).imagePickerType(ImagePickerEnum.PHOTO_PICKER) //选择器打开类型
  227 + .maxImageSelectable(9) //图片可选择数
  228 + .maxHeight(1920) //图片最大高度
  229 + .maxWidth(1920) //图片最大宽度
  230 + .maxImageSize(10) //图片最大大小Mb
  231 + .isCrop(false).pathList(new ArrayList<>()).pickerThemeColorRes(R.color.image_picker_white).pickerTitleColorRes(R.color.image_picker_text_black).cropThemeColorRes(R.color.image_picker_white).cropTitleColorRes(R.color.image_picker_text_black).pickerBackRes(R.mipmap.image_picker_back_black).pickerFolderRes(R.mipmap.image_picker_folder_black).build();
  232 + ImagePickerOpen.getInstance().setImagePickerConfig(imagePickerConfig).pathList(new ArrayList<>()).open(getActivity());
  233 +
  234 + }
  235 + });
  236 + bottomView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
  237 + @Override
  238 + public void onClick(View view) {
  239 + dialog.dismiss();
  240 + }
  241 + });
  242 + dialog.show();
  243 + }
  244 +
  245 + private void getError(String subject) {
  246 + if (studentBean != null) {
  247 + Map map = new HashMap();
  248 + map.put("subject", subject);
  249 + map.put("stuId", studentBean.getStuId());
  250 + map.put("pageSize", 5);
  251 + map.put("pageNum", 1);
  252 + NetWorks.getError(map, new Observer<ResponseResult<PageInfo<TopicBean>>>() {
  253 + @Override
  254 + public void onSubscribe(Disposable d) {
  255 +
  256 + }
  257 +
  258 + @Override
  259 + public void onNext(ResponseResult<PageInfo<TopicBean>> result) {
  260 + if (result.getData() != null && result.getCode() == 200) {
  261 + List<TopicBean> topicBeans = result.getData().getList();
  262 + loadError(topicBeans);
  263 + }
  264 + }
  265 +
  266 + @Override
  267 + public void onError(Throwable e) {
  268 + e.toString();
  269 + }
  270 +
  271 + @Override
  272 + public void onComplete() {
  273 +
  274 + }
  275 + });
  276 + }
  277 + }
  278 +
  279 + private void loadError(List<TopicBean> list) {
  280 + if (list.size() > 0) {
  281 + getBinding().recycleError.setVisibility(View.VISIBLE);
  282 + getBinding().llEmpty.setVisibility(View.GONE);
  283 + if (adapter != null) {
  284 + adapter.refresh(list);
  285 + } else {
  286 + adapter = new ErrorAdapter(getActivity(), list, false);
  287 + getBinding().recycleError.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.VERTICAL, false));
  288 + getBinding().recycleError.setAdapter(adapter);
  289 + }
  290 + } else {
  291 + getBinding().recycleError.setVisibility(View.GONE);
  292 + getBinding().llEmpty.setVisibility(View.VISIBLE);
  293 + }
  294 + }
  295 +
  296 + @Override
  297 + public void onResume() {
  298 + super.onResume();
  299 + getError(getResources().getStringArray(R.array.filter_subject)[subject]);
  300 + }
  301 +
  302 + public class HandlerCallBack implements IHandlerCallBack<ImageInfo> {
  303 + private String TAG = "---ImagePicker---";
  304 + List<ImageInfo> photoList = new ArrayList<>();
  305 +
  306 + @Override
  307 + public void onStart() {
  308 + Log.i(TAG, "onStart: 开启");
  309 + }
  310 +
  311 + @Override
  312 + public void onSuccess(List<ImageInfo> photoList) {
  313 + this.photoList = photoList;
  314 + Log.i(TAG, "onSuccess: 返回数据");
  315 + }
  316 +
  317 + @Override
  318 + public void onCancel() {
  319 + Log.i(TAG, "onCancel: 取消");
  320 + }
  321 +
  322 + @Override
  323 + public void onFinish(List<ImageInfo> selectImage) {
  324 + if (selectImage.size() == photoList.size()) {
  325 + List<String> strings = new ArrayList<>();
  326 + Intent intent = new Intent(getActivity(), ImageActivity.class);
  327 + for (ImageInfo imageInfo : selectImage) {
  328 + strings.add(imageInfo.getPath());
  329 + }
  330 + intent.putStringArrayListExtra("images", (ArrayList<String>) strings);
  331 + startActivity(intent);
  332 + }
  333 + }
  334 +
  335 + @Override
  336 + public void onError() {
  337 + Log.i(TAG, "onError: 出错");
  338 + }
  339 + }
  340 +
  341 + @Override
  342 + public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
  343 + super.onActivityResult(requestCode, resultCode, data);
  344 + if (requestCode == REQUEST_CODE_IMAGE && resultCode == RESULT_OK && !TextUtils.isEmpty(filePath)) {
  345 + Bitmap b = BitmapUtils.compress(BitmapFactory.decodeFile(filePath));
  346 + String path = getContext().getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg";
  347 + CommonUtil.saveBitmapToUri(b, path);
  348 + List<String> strings = new ArrayList<>();
  349 + Intent intent = new Intent(getContext(), ImageActivity.class);
  350 + strings.add(path);
  351 + intent.putStringArrayListExtra("images", (ArrayList<String>) strings);
  352 + startActivity(intent);
  353 + }
  354 + }
  355 +}
... ...
app/src/main/java/com/hjx/parent/fragment/HomeFragment.java
... ... @@ -117,7 +117,7 @@ public class HomeFragment extends BaseFragment {
117 117 if (TextUtils.isEmpty(studentBean.getPhoto())) {
118 118 iv_2.setImageResource(studentBean.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
119 119 } else {
120   - RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 20));
  120 + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 30));
121 121 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
122 122 Glide.with(getActivity()).load(studentBean.getPhoto()).apply(options).into(iv_2);
123 123 }
... ... @@ -176,7 +176,7 @@ public class HomeFragment extends BaseFragment {
176 176 }
177 177 }
178 178  
179   - @OnClick({R.id.iv_2, R.id.tv_name})
  179 + @OnClick({R.id.iv_3, R.id.tv_name})
180 180 public void choose(View view) {
181 181 Intent intent = new Intent(getActivity(), ChooseActivity.class);
182 182 startActivity(intent);
... ...
app/src/main/java/com/hjx/parent/fragment/TeacherFragment.java
... ... @@ -0,0 +1,232 @@
  1 +package com.hjx.parent.fragment;
  2 +
  3 +import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
  4 +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
  5 +
  6 +import android.app.AlertDialog;
  7 +import android.content.DialogInterface;
  8 +import android.content.Intent;
  9 +import android.graphics.drawable.Drawable;
  10 +import android.os.Bundle;
  11 +import android.text.TextUtils;
  12 +import android.view.LayoutInflater;
  13 +import android.view.MotionEvent;
  14 +import android.view.View;
  15 +import android.view.ViewGroup;
  16 +import android.webkit.WebSettings;
  17 +import android.webkit.WebView;
  18 +import android.widget.ImageView;
  19 +import android.widget.LinearLayout;
  20 +
  21 +import androidx.annotation.NonNull;
  22 +import androidx.annotation.Nullable;
  23 +import androidx.recyclerview.widget.LinearLayoutManager;
  24 +import androidx.recyclerview.widget.RecyclerView;
  25 +
  26 +import com.bumptech.glide.Glide;
  27 +import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
  28 +import com.bumptech.glide.request.RequestOptions;
  29 +import com.bumptech.glide.request.target.SimpleTarget;
  30 +import com.bumptech.glide.request.transition.Transition;
  31 +import com.chad.library.adapter.base.BaseQuickAdapter;
  32 +import com.chad.library.adapter.base.BaseViewHolder;
  33 +import com.google.gson.Gson;
  34 +import com.hjx.parent.AccountActivity;
  35 +import com.hjx.parent.ErrorDetailActivity;
  36 +import com.hjx.parent.LoginActivity;
  37 +import com.hjx.parent.R;
  38 +import com.hjx.parent.TeacherChooseActivity;
  39 +import com.hjx.parent.bean.StudentBean;
  40 +import com.hjx.parent.databinding.FragmentTeacherBinding;
  41 +import com.prws.common.bean.Record;
  42 +import com.prws.common.net.NetWorks;
  43 +import com.prws.common.utils.CommonUtil;
  44 +import com.prws.common.utils.LogUtil;
  45 +import com.prws.common.utils.ScreenUtils;
  46 +import com.prws.common.utils.SharedPreferencesUtil;
  47 +import com.prws.common.utils.StringUtils;
  48 +
  49 +import org.json.JSONArray;
  50 +import org.json.JSONObject;
  51 +
  52 +import java.text.SimpleDateFormat;
  53 +import java.util.ArrayList;
  54 +import java.util.logging.SimpleFormatter;
  55 +
  56 +import io.reactivex.Observer;
  57 +import io.reactivex.disposables.Disposable;
  58 +import okhttp3.ResponseBody;
  59 +
  60 +public class TeacherFragment extends BaseBindingFragment<FragmentTeacherBinding> {
  61 + ArrayList<Record> alist = new ArrayList<>();
  62 +
  63 + @Override
  64 + protected FragmentTeacherBinding onCreateViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent) {
  65 + return FragmentTeacherBinding.inflate(inflater, parent, false);
  66 + }
  67 +
  68 + @Override
  69 + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
  70 + super.onViewCreated(view, savedInstanceState);
  71 + String photo = (String) SharedPreferencesUtil.getData("photo", "");
  72 + if (!TextUtils.isEmpty(photo)) {
  73 + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 45));
  74 + RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
  75 + Glide.with(getContext()).load(photo).apply(options).into(getBinding().ivTeacher);
  76 + }
  77 + String name = (String) SharedPreferencesUtil.getData("name", "");
  78 + getBinding().tvTeacher.setText(name);
  79 + getBinding().tvAnswerName.setText("亲爱的" + name + "老师");
  80 + getBinding().logout.setOnClickListener(new View.OnClickListener() {
  81 + @Override
  82 + public void onClick(View v) {
  83 + logout();
  84 + }
  85 + });
  86 + NetWorks.listRecord(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 + String str = responseBody.string().toString();
  96 + LogUtil.e("TAG", "----" + str);
  97 + JSONObject jo = new JSONObject(str);
  98 + boolean isSucceed = jo.getBoolean("success");
  99 + if (isSucceed) {
  100 + JSONArray jarr = jo.getJSONArray("data");
  101 + if (jarr.length() > 0) {
  102 + getBinding().tvNum.setText("您有" + jarr.length() + "个题目需要答疑");
  103 + alist.clear();
  104 + for (int i = 0; i < jarr.length(); i++) {
  105 + JSONObject jo2 = jarr.getJSONObject(i);
  106 + Gson gson = new Gson();
  107 + Record sb = gson.fromJson(jo2.toString(), Record.class);
  108 + alist.add(sb);
  109 + }
  110 + loadList();
  111 + } else {
  112 + getBinding().tvNum.setText("您暂时没有题目需要答疑");
  113 + }
  114 + } else {
  115 +
  116 + }
  117 + } catch (Exception e) {
  118 + e.printStackTrace();
  119 + }
  120 + }
  121 +
  122 + @Override
  123 + public void onError(Throwable e) {
  124 +
  125 + }
  126 +
  127 + @Override
  128 + public void onComplete() {
  129 +
  130 + }
  131 + });
  132 +
  133 + }
  134 +
  135 + private void loadList() {
  136 + BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_record, alist) {
  137 + @Override
  138 + protected void convert(@NonNull BaseViewHolder item, Object o) {
  139 + Record record = alist.get(item.getAdapterPosition());
  140 + item.setText(R.id.tv_name, record.getStuName());
  141 + item.setText(R.id.tv_date, "提问时间:" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(record.getAskTime()));
  142 + if (TextUtils.isEmpty(record.getPhoto())) {
  143 + item.setImageResource(R.id.iv_student, record.getGender() == 0 ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
  144 + } else {
  145 + RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 45));
  146 + RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
  147 + Glide.with(getContext()).load(record.getPhoto()).apply(options).into((ImageView) item.getView(R.id.iv_student));
  148 + }
  149 + if (TextUtils.isEmpty(record.getContent())) {
  150 + item.setGone(R.id.iv_topic, true);
  151 + item.setGone(R.id.webview, false);
  152 + int maxWidth = CommonUtil.getScreenWidth(getContext()) - CommonUtil.dpToPx(getContext(), 60);
  153 + Glide.with(getContext()).load(record.getQuestionUrl()).into(new SimpleTarget<Drawable>() {
  154 + @Override
  155 + public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
  156 + int width = resource.getIntrinsicWidth();
  157 + int height = resource.getIntrinsicHeight();
  158 + int newHeight = maxWidth * height / width;
  159 + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) item.getView(R.id.iv_topic).getLayoutParams();
  160 + layoutParams.width = maxWidth;
  161 + layoutParams.height = newHeight;
  162 + item.getView(R.id.iv_topic).setLayoutParams(layoutParams);
  163 + ((ImageView) item.getView(R.id.iv_topic)).setImageDrawable(resource);
  164 + }
  165 + });
  166 + } else {
  167 + item.setGone(R.id.iv_topic, false);
  168 + item.setGone(R.id.webview, true);
  169 + WebView webView = item.getView(R.id.webview);
  170 + String linkCss = "<link rel=\"stylesheet\" href=\"file:///android_asset/style.css\" type=\"text/css\">";
  171 + StringBuilder sb = new StringBuilder(4096);
  172 + if (!TextUtils.isEmpty(record.getLabel())) {
  173 + sb.append(record.getLabel());
  174 + }
  175 + sb.append(record.getContent());
  176 + if (record.getOptions() != null && record.getOptionsList().size() > 0) {
  177 + sb.append("<div class='pt1'>");
  178 + sb.append(StringUtils.OptionsHtml(record.getOptionsList(), null));
  179 + sb.append("</div>");
  180 + }
  181 + String body = "<html><header>" + linkCss + "</header>" + sb.toString() + "</body></html>";
  182 + webView.loadDataWithBaseURL(linkCss, body, "text/html", "UTF-8", null);
  183 + webView.setVisibility(View.VISIBLE);
  184 + webView.setOnTouchListener(new View.OnTouchListener() {
  185 + @Override
  186 + public boolean onTouch(View v, MotionEvent event) {
  187 + return true;
  188 + }
  189 + });
  190 + }
  191 + }
  192 +
  193 + @Override
  194 + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
  195 +
  196 + }
  197 + };
  198 + getBinding().recycleError.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
  199 + getBinding().recycleError.setAdapter(adapter);
  200 + }
  201 +
  202 + public void logout() {
  203 + AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
  204 + builder.setTitle("温馨提示");
  205 + builder.setMessage("是否退出登录?");
  206 + builder.setCancelable(false);
  207 + builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
  208 + @Override
  209 + public void onClick(DialogInterface dialogInterface, int i) {
  210 + dialogInterface.dismiss();
  211 + }
  212 + });
  213 + builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
  214 + @Override
  215 + public void onClick(DialogInterface dialogInterface, int i) {
  216 + SharedPreferencesUtil.clear(getContext());
  217 + restartApp();
  218 + }
  219 + });
  220 + builder.show();
  221 + }
  222 +
  223 + private void restartApp() {
  224 + //重启app,这一步一定要加上,如果不重启app,可能打开新的页面显示的语言会不正确
  225 + Intent intent = new Intent(getContext(), LoginActivity.class);
  226 + intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
  227 + startActivity(intent);
  228 + android.os.Process.killProcess(android.os.Process.myPid());
  229 + System.exit(0);
  230 + }
  231 +
  232 +}
... ...
app/src/main/res/drawable/bg_home.png

160 KB

app/src/main/res/drawable/bg_item_schedule.xml
... ... @@ -0,0 +1,9 @@
  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="#E8F4FE" />
  6 +
  7 + <corners android:radius="5dp" />
  8 +
  9 +</shape>
0 10 \ No newline at end of file
... ...
app/src/main/res/drawable/bg_solid_white_30.xml
... ... @@ -0,0 +1,10 @@
  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="#FFFFFF" />
  6 +
  7 + <corners
  8 + android:radius="30dp" />
  9 +
  10 +</shape>
0 11 \ No newline at end of file
... ...
app/src/main/res/drawable/bg_student.xml
... ... @@ -0,0 +1,11 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:shape="rectangle">
  4 + <gradient
  5 + android:angle="90"
  6 + android:endColor="#E7F4FF"
  7 + android:startColor="#FFFFFF" />
  8 + <corners
  9 + android:topLeftRadius="11dp"
  10 + android:topRightRadius="11dp" />
  11 +</shape>
0 12 \ No newline at end of file
... ...
app/src/main/res/drawable/bg_teacher.xml
... ... @@ -0,0 +1,10 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:shape="rectangle">
  4 + <gradient
  5 + android:angle="90"
  6 + android:centerColor="#F8F8F8"
  7 + android:endColor="#CDE6FB"
  8 + android:startColor="#F8F8F8" />
  9 +
  10 +</shape>
0 11 \ No newline at end of file
... ...
app/src/main/res/drawable/bg_teacher_answer.png

65.2 KB

app/src/main/res/drawable/ic_filter_black.png

178 Bytes

app/src/main/res/layout/activity_error_list.xml
... ... @@ -19,6 +19,15 @@
19 19 android:text="错题本"
20 20 android:textColor="#333333"
21 21 android:textSize="18sp" />
  22 +
  23 + <ImageView
  24 + android:layout_width="30dp"
  25 + android:id="@+id/iv_change"
  26 + android:src="@mipmap/ic_change"
  27 + android:padding="5dp"
  28 + android:layout_toRightOf="@+id/tv_title"
  29 + android:layout_centerVertical="true"
  30 + android:layout_height="30dp"/>
22 31  
23 32 <CheckBox
24 33 android:id="@+id/checkbox"
... ...
app/src/main/res/layout/activity_main.xml
... ... @@ -11,101 +11,94 @@
11 11 android:id="@+id/rl_content"
12 12 android:layout_width="match_parent"
13 13 android:layout_height="0dp"
14   - app:layout_constraintLeft_toLeftOf="parent"
15   - app:layout_constraintTop_toTopOf="parent"
16 14 app:layout_constraintBottom_toTopOf="@id/cl_1"
17   - />
  15 + app:layout_constraintLeft_toLeftOf="parent"
  16 + app:layout_constraintTop_toTopOf="parent" />
18 17  
19 18  
20 19 <androidx.constraintlayout.widget.ConstraintLayout
21 20 android:id="@+id/cl_1"
22 21 android:layout_width="match_parent"
23 22 android:layout_height="50dp"
24   - app:layout_constraintBottom_toBottomOf="parent"
25 23 android:background="@drawable/bg_solid_white_20"
26   - >
  24 + app:layout_constraintBottom_toBottomOf="parent">
27 25  
28 26 <View
29 27 android:id="@+id/view_5"
30 28 android:layout_width="1dp"
31 29 android:layout_height="1dp"
32   - app:layout_constraintLeft_toLeftOf="parent"
33   - app:layout_constraintRight_toRightOf="parent"
34 30 app:layout_constraintBottom_toBottomOf="parent"
35   - />
  31 + app:layout_constraintLeft_toLeftOf="parent"
  32 + app:layout_constraintRight_toRightOf="parent" />
36 33  
37 34 <androidx.constraintlayout.widget.ConstraintLayout
38 35 android:id="@+id/cl_home"
39 36 android:layout_width="0dp"
40 37 android:layout_height="0dp"
41   - app:layout_constraintLeft_toLeftOf="parent"
42 38 app:layout_constraintBottom_toBottomOf="parent"
43   - app:layout_constraintTop_toTopOf="@id/cl_1"
  39 + app:layout_constraintLeft_toLeftOf="parent"
44 40 app:layout_constraintRight_toRightOf="@id/view_5"
45   - >
  41 + app:layout_constraintTop_toTopOf="@id/cl_1">
  42 +
46 43 <ImageView
47 44 android:id="@+id/iv_3"
48 45 android:layout_width="27dp"
49 46 android:layout_height="24dp"
50   - app:layout_constraintLeft_toLeftOf="parent"
51   - app:layout_constraintRight_toRightOf="parent"
52   - app:layout_constraintTop_toTopOf="parent"
53 47 android:layout_marginTop="5dp"
54 48 android:background="@mipmap/hous"
55   - />
  49 + app:layout_constraintLeft_toLeftOf="parent"
  50 + app:layout_constraintRight_toRightOf="parent"
  51 + app:layout_constraintTop_toTopOf="parent" />
56 52  
57 53 <TextView
58 54 android:id="@+id/tv_1"
59 55 android:layout_width="wrap_content"
60 56 android:layout_height="wrap_content"
61   - app:layout_constraintLeft_toLeftOf="parent"
62   - app:layout_constraintRight_toRightOf="parent"
63   - app:layout_constraintTop_toBottomOf="@id/iv_3"
64 57 android:layout_marginTop="5dp"
65   - android:textSize="11dp"
66   - android:textColor="@drawable/select_t_1"
67 58 android:text="首页"
68   - />
  59 + android:textColor="@drawable/select_t_1"
  60 + android:textSize="11dp"
  61 + app:layout_constraintLeft_toLeftOf="parent"
  62 + app:layout_constraintRight_toRightOf="parent"
  63 + app:layout_constraintTop_toBottomOf="@id/iv_3" />
69 64  
70 65  
71 66 </androidx.constraintlayout.widget.ConstraintLayout>
  67 +
72 68 <androidx.constraintlayout.widget.ConstraintLayout
73 69 android:id="@+id/cl_me"
74 70 android:layout_width="0dp"
75 71 android:layout_height="0dp"
76   - app:layout_constraintLeft_toLeftOf="@id/view_5"
77 72 app:layout_constraintBottom_toBottomOf="parent"
78   - app:layout_constraintTop_toTopOf="@id/cl_1"
  73 + app:layout_constraintLeft_toLeftOf="@id/view_5"
79 74 app:layout_constraintRight_toRightOf="parent"
80   - >
  75 + app:layout_constraintTop_toTopOf="@id/cl_1">
  76 +
81 77 <ImageView
82 78 android:id="@+id/iv_4"
83 79 android:layout_width="22dp"
84 80 android:layout_height="25dp"
85   - app:layout_constraintLeft_toLeftOf="parent"
86   - app:layout_constraintRight_toRightOf="parent"
87   - app:layout_constraintTop_toTopOf="parent"
88 81 android:layout_marginTop="5dp"
89 82 android:background="@mipmap/wmus"
90   - />
  83 + app:layout_constraintLeft_toLeftOf="parent"
  84 + app:layout_constraintRight_toRightOf="parent"
  85 + app:layout_constraintTop_toTopOf="parent" />
91 86  
92 87 <TextView
93 88 android:id="@+id/tv_4"
94 89 android:layout_width="wrap_content"
95 90 android:layout_height="wrap_content"
96   - app:layout_constraintLeft_toLeftOf="parent"
97   - app:layout_constraintRight_toRightOf="parent"
98   - app:layout_constraintTop_toBottomOf="@id/iv_4"
99 91 android:layout_marginTop="5dp"
100   - android:textSize="11dp"
101   - android:textColor="@drawable/select_t_1"
102 92 android:text="我的"
103   - />
  93 + android:textColor="@drawable/select_t_1"
  94 + android:textSize="11dp"
  95 + app:layout_constraintLeft_toLeftOf="parent"
  96 + app:layout_constraintRight_toRightOf="parent"
  97 + app:layout_constraintTop_toBottomOf="@id/iv_4" />
104 98  
105 99 </androidx.constraintlayout.widget.ConstraintLayout>
106 100  
107 101  
108   -
109 102 </androidx.constraintlayout.widget.ConstraintLayout>
110 103  
111 104 </androidx.constraintlayout.widget.ConstraintLayout>
112 105 \ No newline at end of file
... ...
app/src/main/res/layout/dialog_add_error.xml
... ... @@ -132,6 +132,34 @@
132 132 android:scrollbars="none" />
133 133  
134 134 <TextView
  135 + android:id="@+id/tv_student"
  136 + android:layout_width="wrap_content"
  137 + android:layout_height="wrap_content"
  138 + android:layout_centerVertical="true"
  139 + android:layout_marginLeft="20dp"
  140 + android:layout_marginTop="20dp"
  141 + android:text="学生"
  142 + android:textColor="@color/text_title"
  143 + android:visibility="gone"
  144 + android:textSize="15sp"
  145 + android:textStyle="bold" />
  146 +
  147 + <androidx.appcompat.widget.AppCompatSpinner
  148 + android:id="@+id/spinner_student"
  149 + style="@style/customSpinnerStyle"
  150 + android:layout_width="match_parent"
  151 + android:layout_height="40dp"
  152 + android:layout_centerHorizontal="true"
  153 + android:layout_marginLeft="20dp"
  154 + android:layout_marginTop="10dp"
  155 + android:layout_marginRight="20dp"
  156 + android:visibility="gone"
  157 + android:background="@drawable/selector_for_custom_spinner"
  158 + android:entries="@array/filter_subject"
  159 + android:popupBackground="@drawable/shape_for_custom_spinner"
  160 + android:scrollbars="none" />
  161 +
  162 + <TextView
135 163 android:layout_width="wrap_content"
136 164 android:layout_height="wrap_content"
137 165 android:layout_centerVertical="true"
... ...
app/src/main/res/layout/fragment_error_book.xml
... ... @@ -0,0 +1,140 @@
  1 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + android:layout_width="match_parent"
  3 + android:layout_height="match_parent"
  4 + android:orientation="vertical">
  5 +
  6 + <RelativeLayout
  7 + android:layout_width="match_parent"
  8 + android:layout_height="40dp"
  9 + android:layout_marginTop="20dp">
  10 +
  11 + <ImageView
  12 + android:id="@+id/iv_student"
  13 + android:layout_width="35dp"
  14 + android:layout_height="35dp"
  15 + android:layout_centerVertical="true"
  16 + android:layout_marginLeft="15dp" />
  17 +
  18 + <TextView
  19 + android:id="@+id/tv_name"
  20 + android:layout_width="wrap_content"
  21 + android:layout_height="wrap_content"
  22 + android:layout_centerVertical="true"
  23 + android:layout_marginLeft="10dp"
  24 + android:layout_toRightOf="@+id/iv_student"
  25 + android:textColor="#333333"
  26 + android:textSize="16sp" />
  27 +
  28 + <TextView
  29 + android:id="@+id/tv_choose"
  30 + android:layout_width="wrap_content"
  31 + android:layout_height="wrap_content"
  32 + android:layout_alignParentRight="true"
  33 + android:layout_centerVertical="true"
  34 + android:layout_marginRight="15dp"
  35 + android:drawableRight="@drawable/ic_filter_black"
  36 + android:drawablePadding="5dp"
  37 + android:text="选择学生"
  38 + android:textColor="#333333"
  39 + android:textSize="14sp" />
  40 +
  41 + </RelativeLayout>
  42 +
  43 + <RelativeLayout
  44 + android:id="@+id/rl_take_photo"
  45 + android:layout_width="match_parent"
  46 + android:layout_height="200dp"
  47 + android:background="@mipmap/ic_take_photo">
  48 +
  49 + <TextView
  50 + android:layout_width="wrap_content"
  51 + android:layout_height="wrap_content"
  52 + android:layout_alignParentRight="true"
  53 + android:layout_centerVertical="true"
  54 + android:layout_marginRight="70dp"
  55 + android:text="录入错题"
  56 + android:textColor="#EDF6FF"
  57 + android:textSize="22sp"
  58 + android:textStyle="bold" />
  59 + </RelativeLayout>
  60 +
  61 + <RelativeLayout
  62 + android:layout_width="match_parent"
  63 + android:layout_height="25dp">
  64 +
  65 + <TextView
  66 + android:layout_width="wrap_content"
  67 + android:layout_height="wrap_content"
  68 + android:layout_marginLeft="15dp"
  69 + android:text="最近录入错题"
  70 + android:textColor="#333333"
  71 + android:textSize="16sp"
  72 + android:textStyle="bold" />
  73 +
  74 + <LinearLayout
  75 + android:id="@+id/ll_all"
  76 + android:layout_width="wrap_content"
  77 + android:layout_height="wrap_content"
  78 + android:layout_alignParentRight="true"
  79 + android:layout_centerVertical="true"
  80 + android:layout_marginRight="15dp">
  81 +
  82 + <TextView
  83 + android:layout_width="wrap_content"
  84 + android:layout_height="wrap_content"
  85 + android:layout_gravity="center_vertical"
  86 + android:text="查看全部"
  87 + android:textColor="#666666"
  88 + android:textSize="12sp" />
  89 +
  90 + <ImageView
  91 + android:layout_width="9dp"
  92 + android:layout_height="10dp"
  93 + android:layout_gravity="center_vertical"
  94 + android:layout_marginLeft="5dp"
  95 + android:src="@mipmap/ic_arrow_right" />
  96 + </LinearLayout>
  97 + </RelativeLayout>
  98 +
  99 + <androidx.recyclerview.widget.RecyclerView
  100 + android:id="@+id/recycle_subject"
  101 + android:layout_width="match_parent"
  102 + android:layout_height="wrap_content"
  103 + android:layout_marginLeft="15dp"
  104 + android:layout_marginTop="15dp"
  105 + android:layout_marginRight="15dp" />
  106 +
  107 + <RelativeLayout
  108 + android:layout_width="match_parent"
  109 + android:layout_height="match_parent">
  110 +
  111 + <androidx.recyclerview.widget.RecyclerView
  112 + android:id="@+id/recycle_error"
  113 + android:layout_width="match_parent"
  114 + android:layout_height="wrap_content"
  115 + android:layout_marginTop="15dp" />
  116 +
  117 + <LinearLayout
  118 + android:id="@+id/ll_empty"
  119 + android:layout_width="wrap_content"
  120 + android:layout_height="wrap_content"
  121 + android:layout_centerHorizontal="true"
  122 + android:layout_marginTop="30dp"
  123 + android:orientation="vertical"
  124 + android:visibility="gone">
  125 +
  126 + <ImageView
  127 + android:layout_width="155dp"
  128 + android:layout_height="130dp"
  129 + android:src="@mipmap/ic_empty" />
  130 +
  131 + <TextView
  132 + android:layout_width="wrap_content"
  133 + android:layout_height="wrap_content"
  134 + android:layout_gravity="center_horizontal"
  135 + android:text="暂无错题~" />
  136 + </LinearLayout>
  137 + </RelativeLayout>
  138 +
  139 +
  140 +</LinearLayout>
0 141 \ No newline at end of file
... ...
app/src/main/res/layout/fragment_home.xml
... ... @@ -8,8 +8,21 @@
8 8 <View
9 9 android:id="@+id/view_1"
10 10 android:layout_width="match_parent"
11   - android:layout_height="44dp"
12   - android:background="@android:color/white"
  11 + android:layout_height="170dp"
  12 + android:background="@drawable/bg_home"
  13 + app:layout_constraintTop_toTopOf="parent" />
  14 +
  15 + <TextView
  16 + android:id="@+id/tv_title"
  17 + android:layout_width="wrap_content"
  18 + android:layout_height="wrap_content"
  19 + android:layout_marginTop="35dp"
  20 + android:text="首页"
  21 + android:textColor="@color/white"
  22 + android:textSize="20sp"
  23 + android:textStyle="bold"
  24 + app:layout_constraintLeft_toLeftOf="parent"
  25 + app:layout_constraintRight_toRightOf="parent"
13 26 app:layout_constraintTop_toTopOf="parent" />
14 27  
15 28 <ImageView
... ... @@ -18,62 +31,62 @@
18 31 android:layout_height="16dp"
19 32 android:layout_marginLeft="15dp"
20 33 android:background="@mipmap/icon_back"
  34 + android:visibility="gone"
21 35 app:layout_constraintBottom_toBottomOf="@id/view_1"
22 36 app:layout_constraintLeft_toLeftOf="parent"
23 37 app:layout_constraintTop_toTopOf="@id/view_1" />
24 38  
25 39 <ImageView
26 40 android:id="@+id/iv_2"
27   - android:layout_width="31dp"
28   - android:layout_height="31dp"
29   - android:layout_marginLeft="35dp"
30   - android:background="@mipmap/txz"
  41 + android:layout_width="55dp"
  42 + android:layout_height="55dp"
  43 + android:layout_marginLeft="25dp"
  44 + android:background="@drawable/bg_solid_white_30"
  45 + android:padding="1dp"
  46 + android:src="@mipmap/txz"
31 47 app:layout_constraintBottom_toBottomOf="@id/view_1"
32 48 app:layout_constraintLeft_toLeftOf="parent"
33   - app:layout_constraintTop_toTopOf="@id/view_1" />
  49 + app:layout_constraintTop_toBottomOf="@id/tv_title" />
34 50  
35 51 <TextView
36 52 android:id="@+id/tv_name"
37 53 android:layout_width="wrap_content"
38 54 android:layout_height="wrap_content"
39   - android:layout_marginLeft="6.5dp"
40   - android:textColor="#333333"
41   - android:textSize="15dp"
42   - app:layout_constraintBottom_toBottomOf="@id/view_1"
  55 + android:layout_marginLeft="20dp"
  56 + android:textColor="@color/white"
  57 + android:textSize="18sp"
  58 + app:layout_constraintBottom_toBottomOf="@id/iv_2"
43 59 app:layout_constraintLeft_toRightOf="@id/iv_2"
44   - app:layout_constraintTop_toTopOf="@id/view_1" />
  60 + app:layout_constraintTop_toTopOf="@id/iv_2" />
45 61  
46 62 <ImageView
47 63 android:id="@+id/iv_3"
48   - android:layout_width="8dp"
49   - android:layout_height="5dp"
50   - android:layout_marginLeft="5dp"
51   - android:background="@mipmap/xxan"
52   - app:layout_constraintBottom_toBottomOf="@id/view_1"
  64 + android:layout_width="35dp"
  65 + android:layout_height="35dp"
  66 + android:padding="5dp"
  67 + android:src="@mipmap/xxan"
  68 + app:layout_constraintBottom_toBottomOf="@id/iv_2"
53 69 app:layout_constraintLeft_toRightOf="@id/tv_name"
54   - app:layout_constraintTop_toTopOf="@id/view_1" />
  70 + app:layout_constraintTop_toTopOf="@id/iv_2" />
55 71  
56 72 <ImageView
57 73 android:id="@+id/iv_sapmiao"
58   - android:layout_width="match_parent"
59   - android:layout_height="167dp"
60   - android:layout_marginLeft="15dp"
61   - android:layout_marginTop="60dp"
62   - android:layout_marginRight="15dp"
63   - android:background="@mipmap/ssss"
64   - app:layout_constraintLeft_toLeftOf="parent"
  74 + android:layout_width="35dp"
  75 + android:layout_height="35dp"
  76 + android:layout_marginRight="20dp"
  77 + android:padding="5dp"
  78 + android:src="@mipmap/ssss"
  79 + app:layout_constraintBottom_toBottomOf="@id/iv_2"
65 80 app:layout_constraintRight_toRightOf="parent"
66   - app:layout_constraintTop_toTopOf="parent" />
  81 + app:layout_constraintTop_toTopOf="@id/iv_2" />
67 82  
68 83  
69 84 <LinearLayout
70 85 android:id="@+id/view_2"
71 86 android:layout_width="match_parent"
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"
  87 + android:layout_height="130dp"
  88 + android:layout_marginTop="160dp"
  89 + android:background="@drawable/bg_student"
77 90 android:orientation="horizontal"
78 91 app:layout_constraintLeft_toLeftOf="parent"
79 92 app:layout_constraintRight_toRightOf="parent"
... ... @@ -82,6 +95,7 @@
82 95 <LinearLayout
83 96 android:layout_width="0dp"
84 97 android:layout_height="wrap_content"
  98 + android:layout_gravity="center_vertical"
85 99 android:layout_weight="1"
86 100 android:orientation="vertical">
87 101  
... ... @@ -97,19 +111,20 @@
97 111 android:layout_width="wrap_content"
98 112 android:layout_height="wrap_content"
99 113 android:layout_gravity="center_horizontal"
100   - android:layout_marginTop="8dp"
  114 + android:layout_marginTop="10dp"
101 115 android:text="应用管理"
102 116 android:textColor="#333333"
103   - android:textSize="13dp"
  117 + android:textSize="14sp"
104 118 app:layout_constraintLeft_toLeftOf="@id/iv_21"
105 119 app:layout_constraintRight_toRightOf="@id/iv_21"
106 120 app:layout_constraintTop_toBottomOf="@id/iv_21" />
107 121 </LinearLayout>
108 122  
109 123 <LinearLayout
110   - android:layout_width="0dp"
111 124 android:id="@+id/ll_error"
  125 + android:layout_width="0dp"
112 126 android:layout_height="wrap_content"
  127 + android:layout_gravity="center_vertical"
113 128 android:layout_weight="1"
114 129 android:orientation="vertical">
115 130  
... ... @@ -127,47 +142,20 @@
127 142 android:layout_width="wrap_content"
128 143 android:layout_height="wrap_content"
129 144 android:layout_gravity="center_horizontal"
130   - android:layout_marginTop="8dp"
  145 + android:layout_marginTop="10dp"
131 146 android:text="小星错题"
132 147 android:textColor="#333333"
133   - android:textSize="13dp"
  148 + android:textSize="14sp"
134 149 app:layout_constraintLeft_toLeftOf="@id/iv_22"
135 150 app:layout_constraintRight_toRightOf="@id/iv_22"
136 151 app:layout_constraintTop_toBottomOf="@id/iv_22" />
137 152 </LinearLayout>
138 153  
139   - <LinearLayout
140   - android:layout_width="0dp"
141   - android:layout_height="wrap_content"
142   - android:layout_weight="1"
143   - android:orientation="vertical">
144   -
145   - <ImageView
146   - android:id="@+id/iv_23"
147   - android:layout_width="50dp"
148   - android:layout_height="50dp"
149   - android:layout_gravity="center_horizontal"
150   - android:layout_marginTop="15dp"
151   - android:background="@mipmap/ffsj"
152   - app:layout_constraintLeft_toLeftOf="@id/view_2"
153   - app:layout_constraintTop_toTopOf="@id/view_2" />
154   -
155   - <TextView
156   - android:layout_width="wrap_content"
157   - android:layout_height="wrap_content"
158   - android:layout_gravity="center_horizontal"
159   - android:layout_marginTop="8dp"
160   - android:text="分发试卷"
161   - android:textColor="#333333"
162   - android:textSize="13dp"
163   - app:layout_constraintLeft_toLeftOf="@id/iv_23"
164   - app:layout_constraintRight_toRightOf="@id/iv_23"
165   - app:layout_constraintTop_toBottomOf="@id/iv_23" />
166   - </LinearLayout>
167 154  
168 155 <LinearLayout
169 156 android:layout_width="0dp"
170 157 android:layout_height="wrap_content"
  158 + android:layout_gravity="center_vertical"
171 159 android:layout_weight="1"
172 160 android:orientation="vertical">
173 161  
... ... @@ -185,10 +173,10 @@
185 173 android:layout_width="wrap_content"
186 174 android:layout_height="wrap_content"
187 175 android:layout_gravity="center_horizontal"
188   - android:layout_marginTop="8dp"
  176 + android:layout_marginTop="10dp"
189 177 android:text="设备管理"
190 178 android:textColor="#333333"
191   - android:textSize="13dp"
  179 + android:textSize="14sp"
192 180 app:layout_constraintLeft_toLeftOf="@id/iv_24"
193 181 app:layout_constraintRight_toRightOf="@id/iv_24"
194 182 app:layout_constraintTop_toBottomOf="@id/iv_24" />
... ... @@ -199,49 +187,44 @@
199 187 android:id="@+id/view_3"
200 188 android:layout_width="match_parent"
201 189 android:layout_height="match_parent"
202   - android:layout_marginLeft="15dp"
203   - android:layout_marginTop="357dp"
204   - android:layout_marginRight="15dp"
  190 + android:layout_marginTop="305dp"
205 191 android:layout_marginBottom="20dp"
206   - android:background="@drawable/bg_solid_white_10"
  192 + android:background="@color/white"
207 193 android:orientation="vertical"
208 194 app:layout_constraintLeft_toLeftOf="parent"
209 195 app:layout_constraintRight_toRightOf="parent"
210   - app:layout_constraintTop_toTopOf="parent">
  196 + app:layout_constraintTop_toBottomOf="@+id/view_2">
211 197  
212   - <RelativeLayout
  198 + <LinearLayout
213 199 android:id="@+id/rl_schedule"
214   - android:layout_width="match_parent"
  200 + android:layout_width="wrap_content"
215 201 android:layout_height="wrap_content"
  202 + android:layout_centerHorizontal="true"
216 203 android:layout_marginTop="15dp"
217   - android:layout_marginRight="10dp">
  204 + android:layout_marginRight="10dp"
  205 + android:orientation="horizontal">
  206 +
  207 + <ImageView
  208 + android:layout_width="25dp"
  209 + android:layout_height="22dp"
  210 + android:layout_centerVertical="true"
  211 + android:layout_gravity="center_vertical"
  212 + android:layout_marginRight="5dp"
  213 + android:layout_toLeftOf="@+id/tv_31"
  214 + android:src="@mipmap/ic_schedule" />
218 215  
219 216 <TextView
220 217 android:id="@+id/tv_31"
221 218 android:layout_width="wrap_content"
222 219 android:layout_height="wrap_content"
223   - android:layout_centerHorizontal="true"
  220 + android:layout_gravity="center_vertical"
224 221 android:text="本周学习计划"
225 222 android:textColor="#333333"
226   - android:textSize="15dp" />
  223 + android:textSize="19sp"
  224 + android:textStyle="bold" />
227 225  
228 226  
229   - <View
230   - android:layout_width="25dp"
231   - android:layout_height="1dp"
232   - android:layout_centerVertical="true"
233   - android:layout_marginRight="10dp"
234   - android:layout_toLeftOf="@+id/tv_31"
235   - android:background="#EEEEEE" />
236   -
237   - <View
238   - android:layout_width="25dp"
239   - android:layout_height="1dp"
240   - android:layout_centerVertical="true"
241   - android:layout_marginLeft="10dp"
242   - android:layout_toRightOf="@+id/tv_31"
243   - android:background="#EEEEEE" />
244   - </RelativeLayout>
  227 + </LinearLayout>
245 228  
246 229  
247 230 <ImageView
... ...
app/src/main/res/layout/fragment_me.xml
... ... @@ -3,7 +3,7 @@
3 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 4 android:layout_width="match_parent"
5 5 android:layout_height="match_parent"
6   - android:background="#F4F6F8">
  6 + android:background="@drawable/bg_teacher">
7 7  
8 8 <androidx.constraintlayout.widget.Group
9 9 android:id="@+id/group_1"
... ... @@ -15,7 +15,7 @@
15 15 android:id="@+id/view_1"
16 16 android:layout_width="match_parent"
17 17 android:layout_height="44dp"
18   - android:background="@android:color/white"
  18 + android:layout_marginTop="20dp"
19 19 app:layout_constraintTop_toTopOf="parent" />
20 20  
21 21 <TextView
... ... @@ -24,6 +24,7 @@
24 24 android:text="个人中心"
25 25 android:textColor="#333333"
26 26 android:textSize="18dp"
  27 + android:textStyle="bold"
27 28 app:layout_constraintBottom_toBottomOf="@id/view_1"
28 29 app:layout_constraintLeft_toLeftOf="@id/view_1"
29 30 app:layout_constraintRight_toRightOf="@id/view_1"
... ... @@ -32,25 +33,27 @@
32 33  
33 34 <ImageView
34 35 android:id="@+id/iv_toux"
35   - android:layout_width="57dp"
36   - android:layout_height="57dp"
  36 + android:layout_width="60dp"
  37 + android:layout_height="60dp"
37 38 android:layout_marginLeft="15dp"
38   - android:layout_marginTop="63dp"
39   - android:background="@mipmap/ic_parent_avatar"
  39 + android:layout_marginTop="25dp"
  40 + android:background="@drawable/bg_solid_white_30"
  41 + android:padding="1dp"
  42 + android:src="@mipmap/ic_parent_avatar"
40 43 app:layout_constraintLeft_toLeftOf="parent"
41   - app:layout_constraintTop_toTopOf="parent" />
  44 + app:layout_constraintTop_toBottomOf="@+id/view_1" />
42 45  
43 46 <TextView
44 47 android:id="@+id/tv_name"
45 48 android:layout_width="wrap_content"
46 49 android:layout_height="wrap_content"
47   - android:layout_marginLeft="88dp"
48   - android:layout_marginTop="72dp"
  50 + android:layout_marginLeft="20dp"
49 51 android:text="名字"
50 52 android:textColor="#333333"
51   - android:textSize="20dp"
52   - app:layout_constraintLeft_toLeftOf="parent"
53   - app:layout_constraintTop_toTopOf="parent" />
  53 + android:textSize="18sp"
  54 + app:layout_constraintBottom_toBottomOf="@+id/iv_toux"
  55 + app:layout_constraintLeft_toRightOf="@+id/iv_toux"
  56 + app:layout_constraintTop_toTopOf="@+id/iv_toux" />
54 57  
55 58 <TextView
56 59 android:id="@+id/tv_phone"
... ... @@ -69,15 +72,15 @@
69 72 <LinearLayout
70 73 android:id="@+id/view_2"
71 74 android:layout_width="match_parent"
72   - android:layout_height="140dp"
  75 + android:layout_height="160dp"
73 76 android:layout_marginLeft="15dp"
74   - android:layout_marginTop="140dp"
  77 + android:layout_marginTop="20dp"
75 78 android:layout_marginRight="15dp"
76   - android:background="@drawable/bg_solid_white_10"
  79 + android:background="@drawable/bg_soild_blue_25"
77 80 android:orientation="vertical"
78 81 app:layout_constraintLeft_toLeftOf="parent"
79 82 app:layout_constraintRight_toRightOf="parent"
80   - app:layout_constraintTop_toTopOf="parent">
  83 + app:layout_constraintTop_toBottomOf="@+id/iv_toux">
81 84  
82 85 <TextView
83 86 android:id="@+id/tv_title"
... ... @@ -85,22 +88,25 @@
85 88 android:layout_height="wrap_content"
86 89 android:layout_marginLeft="15dp"
87 90 android:layout_marginTop="15dp"
  91 + android:layout_marginBottom="10dp"
88 92 android:text="学生"
89   - android:textColor="#333333"
90   - android:textSize="16dp" />
  93 + android:textColor="@color/white"
  94 + android:textSize="18sp"
  95 + android:textStyle="bold" />
91 96  
92 97 <androidx.recyclerview.widget.RecyclerView
93 98 android:id="@+id/recycle"
94 99 android:layout_width="match_parent"
95 100 android:layout_height="match_parent"
96 101 android:layout_marginLeft="15dp"
97   - android:layout_marginRight="15dp" />
  102 + android:layout_marginRight="15dp"
  103 + android:layout_marginBottom="15dp" />
98 104 </LinearLayout>
99 105  
100 106 <View
101 107 android:id="@+id/view_3"
102 108 android:layout_width="match_parent"
103   - android:layout_height="45dp"
  109 + android:layout_height="50dp"
104 110 android:layout_marginLeft="15dp"
105 111 android:layout_marginTop="15dp"
106 112 android:layout_marginRight="15dp"
... ... @@ -111,8 +117,8 @@
111 117 app:layout_goneMarginTop="241dp" />
112 118  
113 119 <ImageView
114   - android:layout_width="6.8dp"
115   - android:layout_height="12dp"
  120 + android:layout_width="8dp"
  121 + android:layout_height="14dp"
116 122 android:layout_marginRight="15dp"
117 123 android:background="@mipmap/ycaj"
118 124 app:layout_constraintBottom_toBottomOf="@id/view_3"
... ... @@ -134,7 +140,7 @@
134 140 android:layout_marginLeft="40dp"
135 141 android:text="账户设置"
136 142 android:textColor="#333333"
137   - android:textSize="15dp"
  143 + android:textSize="16sp"
138 144 app:layout_constraintBottom_toBottomOf="@id/view_3"
139 145 app:layout_constraintLeft_toLeftOf="@id/view_3"
140 146 app:layout_constraintTop_toTopOf="@id/view_3" />
... ... @@ -142,7 +148,7 @@
142 148 <View
143 149 android:id="@+id/view_4"
144 150 android:layout_width="match_parent"
145   - android:layout_height="45dp"
  151 + android:layout_height="50dp"
146 152 android:layout_marginLeft="15dp"
147 153 android:layout_marginRight="15dp"
148 154 android:background="@android:color/white"
... ... @@ -151,8 +157,8 @@
151 157 app:layout_constraintTop_toBottomOf="@id/view_3" />
152 158  
153 159 <ImageView
154   - android:layout_width="6.8dp"
155   - android:layout_height="12dp"
  160 + android:layout_width="8dp"
  161 + android:layout_height="14dp"
156 162 android:layout_marginRight="15dp"
157 163 android:background="@mipmap/ycaj"
158 164 app:layout_constraintBottom_toBottomOf="@id/view_4"
... ... @@ -174,7 +180,7 @@
174 180 android:layout_marginLeft="40dp"
175 181 android:text="隐私政策"
176 182 android:textColor="#333333"
177   - android:textSize="15dp"
  183 + android:textSize="16sp"
178 184 app:layout_constraintBottom_toBottomOf="@id/view_4"
179 185 app:layout_constraintLeft_toLeftOf="@id/view_4"
180 186 app:layout_constraintTop_toTopOf="@id/view_4" />
... ... @@ -182,7 +188,7 @@
182 188 <View
183 189 android:id="@+id/view_5"
184 190 android:layout_width="match_parent"
185   - android:layout_height="45dp"
  191 + android:layout_height="50dp"
186 192 android:layout_marginLeft="15dp"
187 193 android:layout_marginRight="15dp"
188 194 android:background="@android:color/white"
... ... @@ -191,8 +197,8 @@
191 197 app:layout_constraintTop_toBottomOf="@id/view_4" />
192 198  
193 199 <ImageView
194   - android:layout_width="6.8dp"
195   - android:layout_height="12dp"
  200 + android:layout_width="8dp"
  201 + android:layout_height="14dp"
196 202 android:layout_marginRight="15dp"
197 203 android:background="@mipmap/ycaj"
198 204 app:layout_constraintBottom_toBottomOf="@id/view_5"
... ... @@ -214,7 +220,7 @@
214 220 android:layout_marginLeft="40dp"
215 221 android:text="关于我们"
216 222 android:textColor="#333333"
217   - android:textSize="15dp"
  223 + android:textSize="16sp"
218 224 app:layout_constraintBottom_toBottomOf="@id/view_5"
219 225 app:layout_constraintLeft_toLeftOf="@id/view_5"
220 226 app:layout_constraintTop_toTopOf="@id/view_5" />
... ... @@ -222,7 +228,7 @@
222 228 <View
223 229 android:id="@+id/view_6"
224 230 android:layout_width="match_parent"
225   - android:layout_height="45dp"
  231 + android:layout_height="50dp"
226 232 android:layout_marginLeft="15dp"
227 233 android:layout_marginRight="15dp"
228 234 android:background="@drawable/bg_solid_white_10_bottom"
... ... @@ -245,7 +251,7 @@
245 251 android:layout_marginLeft="40dp"
246 252 android:text="当前版本"
247 253 android:textColor="#333333"
248   - android:textSize="15dp"
  254 + android:textSize="16sp"
249 255 app:layout_constraintBottom_toBottomOf="@id/view_6"
250 256 app:layout_constraintLeft_toLeftOf="@id/view_6"
251 257 app:layout_constraintTop_toTopOf="@id/view_6" />
... ...
app/src/main/res/layout/fragment_teacher.xml
... ... @@ -0,0 +1,111 @@
  1 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + android:layout_width="match_parent"
  3 + android:layout_height="match_parent"
  4 + android:background="@drawable/bg_teacher"
  5 + android:orientation="vertical">
  6 +
  7 + <RelativeLayout
  8 + android:layout_width="match_parent"
  9 + android:layout_height="40dp"
  10 + android:layout_marginTop="20dp">
  11 +
  12 + <TextView
  13 + android:layout_width="wrap_content"
  14 + android:layout_height="wrap_content"
  15 + android:layout_centerInParent="true"
  16 + android:text="个人中心"
  17 + android:textColor="#333333"
  18 + android:textSize="19sp" />
  19 +
  20 + </RelativeLayout>
  21 +
  22 + <RelativeLayout
  23 + android:layout_width="match_parent"
  24 + android:layout_height="65dp">
  25 +
  26 + <ImageView
  27 + android:id="@+id/iv_teacher"
  28 + android:layout_width="65dp"
  29 + android:layout_height="65dp"
  30 + android:layout_marginLeft="25dp"
  31 + android:src="@mipmap/ic_teacher" />
  32 +
  33 + <TextView
  34 + android:id="@+id/tv_teacher"
  35 + android:layout_width="wrap_content"
  36 + android:layout_height="wrap_content"
  37 + android:layout_centerVertical="true"
  38 + android:layout_marginLeft="15dp"
  39 + android:layout_toRightOf="@+id/iv_teacher"
  40 + android:textColor="#333333"
  41 + android:textSize="18sp" />
  42 + </RelativeLayout>
  43 +
  44 + <RelativeLayout
  45 + android:layout_width="match_parent"
  46 + android:layout_height="90dp"
  47 + android:layout_marginLeft="5dp"
  48 + android:layout_marginRight="5dp"
  49 + android:background="@drawable/bg_teacher_answer">
  50 +
  51 + <LinearLayout
  52 + android:layout_width="wrap_content"
  53 + android:layout_height="wrap_content"
  54 + android:layout_centerVertical="true"
  55 + android:layout_marginLeft="25dp"
  56 + android:orientation="vertical">
  57 +
  58 + <TextView
  59 + android:id="@+id/tv_answer_name"
  60 + android:layout_width="wrap_content"
  61 + android:layout_height="wrap_content"
  62 + android:textColor="@color/white"
  63 + android:textSize="14sp" />
  64 +
  65 + <TextView
  66 + android:id="@+id/tv_num"
  67 + android:layout_width="wrap_content"
  68 + android:layout_height="wrap_content"
  69 + android:layout_marginTop="5dp"
  70 + android:textColor="@color/white"
  71 + android:textSize="12sp" />
  72 +
  73 +
  74 + </LinearLayout>
  75 +
  76 + <ImageView
  77 + android:layout_width="70dp"
  78 + android:layout_height="60dp"
  79 + android:layout_alignParentRight="true"
  80 + android:layout_centerVertical="true"
  81 + android:layout_marginRight="35dp"
  82 + android:src="@mipmap/ic_book" />
  83 + </RelativeLayout>
  84 +
  85 + <RelativeLayout
  86 + android:layout_width="match_parent"
  87 + android:layout_height="match_parent">
  88 +
  89 + <androidx.recyclerview.widget.RecyclerView
  90 + android:id="@+id/recycle_error"
  91 + android:layout_width="match_parent"
  92 + android:layout_height="match_parent"
  93 + android:layout_above="@+id/logout"
  94 + android:layout_marginTop="15dp"
  95 + android:layout_marginBottom="30dp" />
  96 +
  97 + <Button
  98 + android:id="@+id/logout"
  99 + android:layout_width="250dp"
  100 + android:layout_height="40dp"
  101 + android:layout_alignParentBottom="true"
  102 + android:layout_centerHorizontal="true"
  103 + android:layout_marginBottom="30dp"
  104 + android:background="@drawable/bg_soild_blue_5"
  105 + android:text="退出登录"
  106 + android:textColor="@color/white"
  107 + android:textSize="18sp" />
  108 + </RelativeLayout>
  109 +
  110 +
  111 +</LinearLayout>
0 112 \ No newline at end of file
... ...
app/src/main/res/layout/item_child.xml
... ... @@ -7,11 +7,13 @@
7 7  
8 8 <ImageView
9 9 android:id="@+id/iv_avatar"
10   - android:layout_width="56dp"
11   - android:layout_height="56dp"
  10 + android:layout_width="60dp"
  11 + android:layout_height="60dp"
12 12 android:layout_centerHorizontal="true"
13 13 android:layout_marginTop="8dp"
14   - android:background="@mipmap/tjxss" />
  14 + android:padding="1dp"
  15 + android:background="@drawable/bg_solid_white_30"
  16 + android:src="@mipmap/tjxss" />
15 17  
16 18 <ImageView
17 19 android:id="@+id/iv_vip"
... ... @@ -30,7 +32,7 @@
30 32 android:ellipsize="end"
31 33 android:singleLine="true"
32 34 android:text="添加学生"
33   - android:textColor="#000000"
34   - android:textSize="13dp" />
  35 + android:textColor="@color/white"
  36 + android:textSize="14dp" />
35 37 </RelativeLayout>
36 38  
... ...
app/src/main/res/layout/item_record.xml
... ... @@ -0,0 +1,66 @@
  1 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="wrap_content"
  5 + android:layout_marginTop="15dp"
  6 + android:background="@drawable/bg_item_video_10"
  7 + android:orientation="vertical">
  8 +
  9 + <RelativeLayout
  10 + android:layout_width="match_parent"
  11 + android:layout_height="35dp"
  12 + android:layout_marginTop="10dp">
  13 +
  14 + <ImageView
  15 + android:id="@+id/iv_student"
  16 + android:layout_width="35dp"
  17 + android:layout_height="35dp"
  18 + android:layout_marginLeft="15dp" />
  19 +
  20 + <TextView
  21 + android:id="@+id/tv_name"
  22 + android:layout_width="wrap_content"
  23 + android:layout_height="wrap_content"
  24 + android:layout_centerVertical="true"
  25 + android:layout_marginLeft="10dp"
  26 + android:layout_toRightOf="@+id/iv_student"
  27 + android:textColor="#333333"
  28 + android:textSize="14sp" />
  29 +
  30 + <TextView
  31 + android:id="@+id/tv_date"
  32 + android:layout_width="wrap_content"
  33 + android:layout_height="wrap_content"
  34 + android:layout_alignParentRight="true"
  35 + android:layout_centerVertical="true"
  36 + android:layout_marginRight="15dp"
  37 + android:textColor="#666666"
  38 + android:textSize="12sp" />
  39 + </RelativeLayout>
  40 +
  41 + <LinearLayout
  42 + android:layout_width="match_parent"
  43 + android:layout_height="wrap_content"
  44 + android:orientation="vertical">
  45 +
  46 + <WebView
  47 + android:id="@+id/webview"
  48 + android:layout_width="match_parent"
  49 + android:layout_height="wrap_content"
  50 + android:layout_marginLeft="15dp"
  51 + android:layout_marginTop="10dp"
  52 + android:layout_marginRight="15dp"
  53 + android:scrollbars="none"
  54 + tools:ignore="WebViewLayout" />
  55 +
  56 + <ImageView
  57 + android:id="@+id/iv_topic"
  58 + android:layout_width="match_parent"
  59 + android:layout_height="wrap_content"
  60 + android:layout_marginLeft="15dp"
  61 + android:layout_marginTop="15dp"
  62 + android:layout_marginRight="15dp"
  63 + android:layout_marginBottom="15dp" />
  64 +
  65 + </LinearLayout>
  66 +</LinearLayout>
0 67 \ No newline at end of file
... ...
app/src/main/res/layout/item_schedule.xml
... ... @@ -15,7 +15,7 @@
15 15 android:layout_width="1dp"
16 16 android:layout_height="15dp"
17 17 android:layout_gravity="center_vertical"
18   - android:background="#FE5E09" />
  18 + android:background="#1C90F3" />
19 19  
20 20 <TextView
21 21 android:id="@+id/tv_date"
... ... @@ -24,7 +24,7 @@
24 24 android:layout_gravity="center_vertical"
25 25 android:layout_marginLeft="10dp"
26 26 android:textColor="#333333"
27   - android:textSize="13sp" />
  27 + android:textSize="15sp" />
28 28 </LinearLayout>
29 29  
30 30 <LinearLayout
... ...
app/src/main/res/layout/item_video.xml
... ... @@ -5,11 +5,11 @@
5 5 <TextView
6 6 android:id="@+id/tv_name"
7 7 android:layout_width="match_parent"
8   - android:layout_height="35dp"
  8 + android:layout_height="40dp"
9 9 android:layout_marginTop="15dp"
10   - android:background="@drawable/bg_item_video_10"
  10 + android:background="@drawable/bg_item_schedule"
11 11 android:gravity="center"
12 12 android:singleLine="true"
13 13 android:textColor="#333333"
14   - android:textSize="13sp" />
  14 + android:textSize="14sp" />
15 15 </LinearLayout>
16 16 \ No newline at end of file
... ...
app/src/main/res/mipmap-hdpi/hoss.png

847 Bytes | W: | H:

2.36 KB | W: | H:

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

832 Bytes | W: | H:

2.09 KB | W: | H:

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

2.1 KB

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

2.65 KB

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

5.19 KB | W: | H:

7.39 KB | W: | H:

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

990 KB | W: | H:

1.58 KB | W: | H:

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

3.37 KB | W: | H:

7.24 KB | W: | H:

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

1.2 KB | W: | H:

1.7 KB | W: | H:

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

1.25 KB | W: | H:

1.54 KB | W: | H:

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

348 Bytes | W: | H:

2.9 KB | W: | H:

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

5.01 KB | W: | H:

5.51 KB | W: | H:

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

362 Bytes | W: | H:

463 Bytes | W: | H:

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

4.26 KB | W: | H:

5.03 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/ic_book.png

53.5 KB

app/src/main/res/mipmap-xxhdpi/ic_teacher.png

54.8 KB

libs/common/src/main/java/com/prws/common/base/BaseActivity.java
... ... @@ -93,12 +93,30 @@ public abstract class BaseActivity&lt;P extends BasePresenter, CONTRACT&gt; extends Ap
93 93 public void showWhiteStatus() {
94 94 Window window = getWindow();
95 95 window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
96   - window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
  96 + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
97 97 window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
98 98 window.setStatusBarColor(Color.TRANSPARENT);
99 99 }
100 100  
101 101  
  102 + public void fullScreen(){
  103 + Window window = getWindow();
  104 + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  105 + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  106 + | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
  107 + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  108 + window.setStatusBarColor(Color.TRANSPARENT);
  109 + }
  110 +
  111 + protected void blackBar() {
  112 + Window window = getWindow();
  113 + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  114 + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  115 + | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
  116 + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  117 + window.setStatusBarColor(Color.TRANSPARENT);
  118 + }
  119 +
102 120 @Override
103 121 protected void onResume() {
104 122 super.onResume();
... ...
libs/common/src/main/java/com/prws/common/bean/Record.java
... ... @@ -0,0 +1,292 @@
  1 +package com.prws.common.bean;
  2 +
  3 +import com.google.gson.annotations.SerializedName;
  4 +
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +
  8 +public class Record {
  9 +
  10 + @SerializedName("subject")
  11 + private String subject;
  12 + @SerializedName("sid")
  13 + private String sid;
  14 + @SerializedName("degree")
  15 + private Double degree;
  16 + @SerializedName("cate")
  17 + private Integer cate;
  18 + @SerializedName("cateName")
  19 + private String cateName;
  20 + @SerializedName("label")
  21 + private String label;
  22 + @SerializedName("content")
  23 + private String content;
  24 + @SerializedName("options")
  25 + private String options;
  26 + @SerializedName("optionsList")
  27 + private List<String> optionsList;
  28 + @SerializedName("points")
  29 + private String points;
  30 + @SerializedName("pointsList")
  31 + private List<KeyValue> pointsList;
  32 + @SerializedName("topics")
  33 + private String topics;
  34 + @SerializedName("topicsList")
  35 + private List<KeyValue> topicsList;
  36 + @SerializedName("analyse")
  37 + private String analyse;
  38 + @SerializedName("method")
  39 + private String method;
  40 + @SerializedName("discuss")
  41 + private String discuss;
  42 + @SerializedName("answers")
  43 + private String answers;
  44 + @SerializedName("answersList")
  45 + private List<String> answersList;
  46 + @SerializedName("displayAnswer")
  47 + private String displayAnswer;
  48 + @SerializedName("askId")
  49 + private Integer askId;
  50 + @SerializedName("stuId")
  51 + private String stuId;
  52 + @SerializedName("stuName")
  53 + private String stuName;
  54 + @SerializedName("photo")
  55 + private String photo;
  56 + @SerializedName("questionUrl")
  57 + private String questionUrl;
  58 + @SerializedName("askTime")
  59 + private Date askTime;
  60 + private int gender;
  61 +
  62 + public static class KeyValue {
  63 + @SerializedName("Key")
  64 + private String key;
  65 + @SerializedName("Value")
  66 + private String value;
  67 +
  68 + public void setKey(String key) {
  69 + this.key = key;
  70 + }
  71 +
  72 + public void setValue(String value) {
  73 + this.value = value;
  74 + }
  75 +
  76 + public String getKey() {
  77 + return key;
  78 + }
  79 +
  80 + public String getValue() {
  81 + return value;
  82 + }
  83 + }
  84 +
  85 + public void setGender(int gender) {
  86 + this.gender = gender;
  87 + }
  88 +
  89 + public int getGender() {
  90 + return gender;
  91 + }
  92 +
  93 + public void setSubject(String subject) {
  94 + this.subject = subject;
  95 + }
  96 +
  97 + public void setSid(String sid) {
  98 + this.sid = sid;
  99 + }
  100 +
  101 + public void setDegree(Double degree) {
  102 + this.degree = degree;
  103 + }
  104 +
  105 + public void setCate(Integer cate) {
  106 + this.cate = cate;
  107 + }
  108 +
  109 + public void setCateName(String cateName) {
  110 + this.cateName = cateName;
  111 + }
  112 +
  113 + public void setLabel(String label) {
  114 + this.label = label;
  115 + }
  116 +
  117 + public void setContent(String content) {
  118 + this.content = content;
  119 + }
  120 +
  121 + public void setOptions(String options) {
  122 + this.options = options;
  123 + }
  124 +
  125 + public void setOptionsList(List<String> optionsList) {
  126 + this.optionsList = optionsList;
  127 + }
  128 +
  129 + public void setPoints(String points) {
  130 + this.points = points;
  131 + }
  132 +
  133 + public void setPointsList(List<KeyValue> pointsList) {
  134 + this.pointsList = pointsList;
  135 + }
  136 +
  137 + public void setTopics(String topics) {
  138 + this.topics = topics;
  139 + }
  140 +
  141 + public void setTopicsList(List<KeyValue> topicsList) {
  142 + this.topicsList = topicsList;
  143 + }
  144 +
  145 + public void setAnalyse(String analyse) {
  146 + this.analyse = analyse;
  147 + }
  148 +
  149 + public void setMethod(String method) {
  150 + this.method = method;
  151 + }
  152 +
  153 + public void setDiscuss(String discuss) {
  154 + this.discuss = discuss;
  155 + }
  156 +
  157 + public void setAnswers(String answers) {
  158 + this.answers = answers;
  159 + }
  160 +
  161 + public void setAnswersList(List<String> answersList) {
  162 + this.answersList = answersList;
  163 + }
  164 +
  165 + public void setDisplayAnswer(String displayAnswer) {
  166 + this.displayAnswer = displayAnswer;
  167 + }
  168 +
  169 + public void setAskId(Integer askId) {
  170 + this.askId = askId;
  171 + }
  172 +
  173 + public void setStuId(String stuId) {
  174 + this.stuId = stuId;
  175 + }
  176 +
  177 + public void setStuName(String stuName) {
  178 + this.stuName = stuName;
  179 + }
  180 +
  181 + public void setPhoto(String photo) {
  182 + this.photo = photo;
  183 + }
  184 +
  185 + public void setQuestionUrl(String questionUrl) {
  186 + this.questionUrl = questionUrl;
  187 + }
  188 +
  189 + public void setAskTime(Date askTime) {
  190 + this.askTime = askTime;
  191 + }
  192 +
  193 + public String getSubject() {
  194 + return subject;
  195 + }
  196 +
  197 + public String getSid() {
  198 + return sid;
  199 + }
  200 +
  201 + public Double getDegree() {
  202 + return degree;
  203 + }
  204 +
  205 + public Integer getCate() {
  206 + return cate;
  207 + }
  208 +
  209 + public String getCateName() {
  210 + return cateName;
  211 + }
  212 +
  213 + public String getLabel() {
  214 + return label;
  215 + }
  216 +
  217 + public String getContent() {
  218 + return content;
  219 + }
  220 +
  221 + public String getOptions() {
  222 + return options;
  223 + }
  224 +
  225 + public List<String> getOptionsList() {
  226 + return optionsList;
  227 + }
  228 +
  229 + public String getPoints() {
  230 + return points;
  231 + }
  232 +
  233 + public List<KeyValue> getPointsList() {
  234 + return pointsList;
  235 + }
  236 +
  237 + public String getTopics() {
  238 + return topics;
  239 + }
  240 +
  241 + public List<KeyValue> getTopicsList() {
  242 + return topicsList;
  243 + }
  244 +
  245 + public String getAnalyse() {
  246 + return analyse;
  247 + }
  248 +
  249 + public String getMethod() {
  250 + return method;
  251 + }
  252 +
  253 + public String getDiscuss() {
  254 + return discuss;
  255 + }
  256 +
  257 + public String getAnswers() {
  258 + return answers;
  259 + }
  260 +
  261 + public List<String> getAnswersList() {
  262 + return answersList;
  263 + }
  264 +
  265 + public String getDisplayAnswer() {
  266 + return displayAnswer;
  267 + }
  268 +
  269 + public Integer getAskId() {
  270 + return askId;
  271 + }
  272 +
  273 + public String getStuId() {
  274 + return stuId;
  275 + }
  276 +
  277 + public String getStuName() {
  278 + return stuName;
  279 + }
  280 +
  281 + public String getPhoto() {
  282 + return photo;
  283 + }
  284 +
  285 + public String getQuestionUrl() {
  286 + return questionUrl;
  287 + }
  288 +
  289 + public Date getAskTime() {
  290 + return askTime;
  291 + }
  292 +}
... ...
libs/common/src/main/java/com/prws/common/net/NetWorks.java
... ... @@ -173,6 +173,11 @@ public class NetWorks extends RetrofitUtils {
173 173 @GET("api/v1/resource/checkUpdate")
174 174 Call<ResponseResult<UpdateBean>> checkUpdate(@Query("version") int version, @Query("packageName") String packageName, @Query("type") int type);
175 175  
  176 + @GET("api/v1/teacher/getStudentList")
  177 + Observable<ResponseBody> getStudentList(@Header("Authorization") String token, @Query("userId") String id);
  178 +
  179 + @GET("api/v1/answer/listRecordForTeacher")
  180 + Observable<ResponseBody> getRecordList(@Header("Authorization") String token, @Query("userId") String id);
176 181 }
177 182  
178 183  
... ... @@ -303,6 +308,14 @@ public class NetWorks extends RetrofitUtils {
303 308 setSubscribe(service_url.listChildren(getHeader()), observer);
304 309 }
305 310  
  311 + public static void listStudent(Observer<ResponseBody> observer) {
  312 + setSubscribe(service_url.getStudentList(getHeader(), (String) SharedPreferencesUtil.getData("userId", "")), observer);
  313 + }
  314 +
  315 + public static void listRecord(Observer<ResponseBody> observer) {
  316 + setSubscribe(service_url.getRecordList(getHeader(), (String) SharedPreferencesUtil.getData("userId", "")), observer);
  317 + }
  318 +
306 319  
307 320 public static void registerStudent(RequestBody body, Observer<ResponseBody> observer) {
308 321 setSubscribe(service_url.registerStudent(getHeader(), body), observer);
... ...