第二阶段SCRUM
1、整个项目预期的任务量 :两个月
2、 目前已经花的时间:将近三个月还剩余的时间
3、SCRUM 会议的照片一张
4、产品的状态
产品能够让学生提交作业,并且提醒学生有作业,有考试等。老师能够发布作业,并且查看学生提交的作业和考试等。
package com.example.shazidouhuiapp.activity; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.shazidouhuiapp.Bean.User; import com.example.shazidouhuiapp.R; import com.example.shazidouhuiapp.Util.Utils; import org.json.JSONException; import org.json.JSONObject; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.SaveListener; import cn.smssdk.EventHandler; import cn.smssdk.SMSSDK; public class mobloging extends AppCompatActivity { private Button buttonCode,buttonLogin; private EditText editTextPhoneNum,editTextCode,editPassword; private TextView fogetPassword,Register; private String phoneNum,code,pass; private EventHandler eh; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); initview(); eh = new EventHandler() { @Override public void afterEvent(int event, int result, Object data) { if (result == SMSSDK.RESULT_COMPLETE){ //回调完成 if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) { //提交验证码成功 runOnUiThread(new Runnable() { @Override public void run() { pass=editPassword.getText().toString().trim();; phoneNum=editTextPhoneNum.getText().toString().trim(); BmobUser user=new BmobUser(); user.setPassword(pass); user.setUsername(phoneNum); user.login(new SaveListener<User>() { @Override public void done(User user, BmobException e) { if(e==null){ Toast.makeText(mobloging.this, "登陆成功", Toast.LENGTH_SHORT).show(); if(user.getType().equals("student")){ startActivity(new Intent(mobloging.this,studentinterface.class)); } else if(user.getType().equals("teacher")){ startActivity(new Intent(mobloging.this,teacherinterface.class)); } } else { Toast.makeText(mobloging.this, "登陆失败"+e.getMessage(), Toast.LENGTH_LONG).show(); } } }); } }); }else if (event == SMSSDK.EVENT_GET_VOICE_VERIFICATION_CODE){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mobloging.this,"语音验证发送",Toast.LENGTH_SHORT).show(); } }); } else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE){ //获取验证码成功 runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mobloging.this,"验证码已发送",Toast.LENGTH_SHORT).show(); } }); }else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES){ Log.i("test","test"); } }else{ ((Throwable)data).printStackTrace(); Throwable throwable = (Throwable) data; throwable.printStackTrace(); Log.i("1234",throwable.toString()); try { JSONObject obj = new JSONObject(throwable.getMessage()); final String des = obj.optString("detail"); if (!TextUtils.isEmpty(des)){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mobloging.this,des,Toast.LENGTH_SHORT).show(); } }); } } catch (JSONException e) { e.printStackTrace(); } } } }; // fogetPassword.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // startActivity(new Intent(mobloging.this,resetPassword.class)); // } // }); Register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(mobloging.this,register.class)); } }); //注册一个事件回调监听,用于处理SMSSDK接口请求的结果 SMSSDK.registerEventHandler(eh); buttonCode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { phoneNum = editTextPhoneNum.getText().toString(); if(!phoneNum.isEmpty()){ if(Utils.checkTel(phoneNum)){ //利用正则表达式获取检验手机号 // 获取验证码 SMSSDK.getVerificationCode("86", phoneNum); }else{ Toast.makeText(getApplicationContext(),"请输入有效的手机号",Toast.LENGTH_LONG).show(); } }else { Toast.makeText(getApplicationContext(),"请输入手机号",Toast.LENGTH_LONG).show(); return; } phoneNum = editTextPhoneNum.getText().toString(); } }); buttonLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { code = editTextCode.getText().toString(); if(!code.isEmpty()){ //提交验证码 SMSSDK.submitVerificationCode("86", phoneNum, code); }else{ Toast.makeText(getApplicationContext(),"请输入验证码",Toast.LENGTH_LONG).show(); return; } } }); } private void initview() { // private Button buttonCode,buttonLogin; // private EditText editTextPhoneNum,editTextCode,editPassword; buttonCode=findViewById(R.id.verify_getVerify); buttonLogin=findViewById(R.id.loginButton); editPassword=findViewById(R.id.password); editTextCode=findViewById(R.id.verify_verifyCode); editTextPhoneNum=findViewById(R.id.phoneNumber); fogetPassword=findViewById(R.id.fogetPassword); Register=findViewById(R.id.Register); } // 使用完EventHandler需注销,否则可能出现内存泄漏 @Override protected void onDestroy() { super.onDestroy(); SMSSDK.unregisterEventHandler(eh); } }
package com.example.shazidouhuiapp.activity; import androidx.appcompat.app.AppCompatActivity; import android.Manifest; import android.content.ContentResolver; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.example.shazidouhuiapp.Bean.IpetUser; import com.example.shazidouhuiapp.MainActivity; import com.example.shazidouhuiapp.R; import com.example.shazidouhuiapp.Util.RealPathFromUriUtils; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import butterknife.ButterKnife; import cn.bmob.v3.Bmob; import cn.bmob.v3.datatype.BmobFile; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.UpdateListener; import cn.bmob.v3.listener.UploadFileListener; import de.hdodenhof.circleimageview.CircleImageView; import permissions.dispatcher.NeedsPermission; import permissions.dispatcher.RuntimePermissions; @RuntimePermissions public class Receivecamera extends AppCompatActivity { private String id,parentid; public static final int CHOOSE_PHOTO=2; private String mpath=null; private CircleImageView headImage; private Button registreButtonSignup; private BmobFile file; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.photo); Intent a=getIntent(); id=a.getStringExtra("id"); parentid=a.getStringExtra("parentid"); initview(); ButterKnife.bind(this); registreButtonSignup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); /* 开启Pictures画面Type设定为image */ intent.setType("image/*"); /* 使用Intent.ACTION_GET_CONTENT这个Action */ intent.setAction(Intent.ACTION_GET_CONTENT); /* 取得相片后返回本画面 */ startActivityForResult(intent, 1); } }); } public final static int REQUEST_CODE_SOME_FEATURES_PERMISSIONS=1; @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { switch (requestCode) { case REQUEST_CODE_SOME_FEATURES_PERMISSIONS: { for (int i = 0; i < permissions.length; i++) { if (grantResults[i] == PackageManager.PERMISSION_GRANTED) { Log.e("TTT","Permissions --> " + "Permission Granted: " + permissions[i]); } else if (grantResults[i] == PackageManager.PERMISSION_DENIED) { Log.e("TTT","Permissions --> " + "Permission Denied: " + permissions[i]); } } } break; default: { super.onRequestPermissionsResult(requestCode, permissions, grantResults); } } } private void initview() { registreButtonSignup=findViewById(R.id.registre_button_signup); headImage=findViewById(R.id.head_image); } @NeedsPermission(Manifest.permission.CAMERA) protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (data==null){ Log.d("hhhhhhhhhhhhhhhhhhhhhhh", "data是空得: "); return; } if (resultCode == RESULT_OK) { Uri uri = data.getData(); mpath = RealPathFromUriUtils.getRealPathFromUri(this, data.getData()); Log.d("mathimage", mpath+"000000000000000000000000000000000000000"); //上传头像 file=new BmobFile(new File(mpath)); Log.d("filefile", file.toString()); file.uploadblock(new UploadFileListener() { @Override public void done(BmobException e) { if(e==null){ saveFile(file); } else{ Log.d("jiazaishibai1", "上传失败了呢"+e.getMessage()+"00000"+e.getErrorCode()); } } }); ContentResolver cr = this.getContentResolver(); try { Log.d("qwe",mpath+""); Bitmap bitmap = BitmapFactory.decodeStream(cr.openInputStream(data.getData())); /* 将Bitmap设定到ImageView */ headImage.setImageBitmap(bitmap); } catch (FileNotFoundException e) { Log.d("qwe", e.getMessage(),e); } } else{ Toast.makeText(this, "疗伤烧肉粽", Toast.LENGTH_SHORT).show(); Log.d("nalinali", "出错了,reault不ok"); } super.onActivityResult(requestCode, resultCode, data); } private void saveFile(BmobFile file) { IpetUser user=new IpetUser(id); user.setUser_pic(file); user.update(new UpdateListener() { @Override public void done(BmobException e) { if(e==null){ Toast.makeText(Receivecamera.this,"上传成功",Toast.LENGTH_SHORT).show(); }else { Toast.makeText(Receivecamera.this,"上传失败"+e.getMessage()+"0000"+e.getErrorCode(),Toast.LENGTH_SHORT).show(); Log.d("shangchuan", e.getMessage()+"+++"+e.getErrorCode()); Log.d("idnameddd", "done: "+id); } } }); } }
package com.example.shazidouhuiapp.activity; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.shazidouhuiapp.Bean.User; import com.example.shazidouhuiapp.R; import com.example.shazidouhuiapp.Util.Utils; import org.json.JSONException; import org.json.JSONObject; import java.util.List; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.FindListener; import cn.bmob.v3.listener.SaveListener; import cn.smssdk.EventHandler; import cn.smssdk.SMSSDK; public class register extends AppCompatActivity { private Button buttonCode,buttonLoginStudent,buttonLoginTeacher; private EditText editTextPhoneNum,editTextCode,editPassword; private String phoneNum,code,pass; private EventHandler eh; private int flag=1;//学生按钮 private int flag2=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); initview(); eh = new EventHandler() { @Override public void afterEvent(int event, int result, Object data) { if (result == SMSSDK.RESULT_COMPLETE){ //回调完成 if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) { //提交验证码成功 runOnUiThread(new Runnable() { @Override public void run() { flag2=0; BmobQuery<User> bmobQuery=new BmobQuery<>(); bmobQuery.addWhereEqualTo("username", phoneNum+""); bmobQuery.findObjects(new FindListener<User>(){ @Override public void done(List<User> list, BmobException e) { if(e==null){ if(list.size()!=0){ Toast.makeText(register.this, "此手机号已被注册", Toast.LENGTH_SHORT).show(); } else if(list.size()==0){ User user=new User(); if(flag==1){ user.setType("student"); user.setUsername(phoneNum); user.setPassword(pass); user.setMobilePhoneNumberVerified(true); user.setMobilePhoneNumber(phoneNum); user.signUp(new SaveListener<User>() { @Override public void done(User user, BmobException e) { if(e==null){ Toast.makeText(register.this, "注册成功", Toast.LENGTH_SHORT).show(); startActivity(new Intent(register.this,splash.class)); } else { Toast.makeText(register.this, "注册失败"+e.getMessage(), Toast.LENGTH_LONG).show(); } } }); } else if(flag==0){ user.setType("teacher"); user.setUsername(phoneNum); user.setPassword(pass); user.setMobilePhoneNumberVerified(true); user.setMobilePhoneNumber(phoneNum); user.signUp(new SaveListener<User>() { @Override public void done(User user, BmobException e) { if(e==null){ Toast.makeText(register.this, "注册成功", Toast.LENGTH_SHORT).show(); startActivity(new Intent(register.this,teacherinterface.class)); } else { Toast.makeText(register.this, "注册失败"+e.getMessage(), Toast.LENGTH_LONG).show(); } } }); } Toast.makeText(register.this,"注册成功",Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(register.this, "出问题了呢", Toast.LENGTH_SHORT).show(); } } } }); } }); }else if (event == SMSSDK.EVENT_GET_VOICE_VERIFICATION_CODE){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(register.this,"语音验证发送",Toast.LENGTH_SHORT).show(); } }); } else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE){ //获取验证码成功 runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(register.this,"验证码已发送",Toast.LENGTH_SHORT).show(); } }); }else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES){ Log.i("test","test"); } }else{ ((Throwable)data).printStackTrace(); Throwable throwable = (Throwable) data; throwable.printStackTrace(); Log.i("1234",throwable.toString()); try { JSONObject obj = new JSONObject(throwable.getMessage()); final String des = obj.optString("detail"); if (!TextUtils.isEmpty(des)){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(register.this,des,Toast.LENGTH_SHORT).show(); } }); } } catch (JSONException e) { e.printStackTrace(); } } } }; //注册一个事件回调监听,用于处理SMSSDK接口请求的结果 SMSSDK.registerEventHandler(eh); buttonCode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { phoneNum = editTextPhoneNum.getText().toString(); pass=editPassword.getText().toString().trim(); if(!phoneNum.isEmpty()){ if(Utils.checkTel(phoneNum)){ //利用正则表达式获取检验手机号 // 获取验证码 if(!pass.isEmpty()){ if(Utils.checkPssword(pass)){ SMSSDK.getVerificationCode("86", phoneNum); } else { Toast.makeText(register.this, "请输入符合要求的密码", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(register.this, "请输入密码", Toast.LENGTH_SHORT).show(); } }else{ Toast.makeText(getApplicationContext(),"请输入有效的手机号",Toast.LENGTH_LONG).show(); } }else { Toast.makeText(getApplicationContext(),"请输入手机号",Toast.LENGTH_LONG).show(); return; } phoneNum = editTextPhoneNum.getText().toString(); } }); buttonLoginStudent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { code = editTextCode.getText().toString(); if(!code.isEmpty()){ //提交验证码 SMSSDK.submitVerificationCode("86", phoneNum, code); }else{ Toast.makeText(getApplicationContext(),"请输入验证码",Toast.LENGTH_LONG).show(); return; } } }); buttonLoginTeacher.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { code = editTextCode.getText().toString(); if(!code.isEmpty()){ //提交验证码 flag=0;//老师按钮 SMSSDK.submitVerificationCode("86", phoneNum, code); }else{ Toast.makeText(getApplicationContext(),"请输入验证码",Toast.LENGTH_LONG).show(); return; } } }); } private void initview() { // private Button buttonCode,buttonLoginStudent,buttonLoginTeacher; // private EditText editTextPhoneNum,editTextCode,editPassword; buttonCode=findViewById(R.id.register_getVerify); buttonLoginStudent=findViewById(R.id.loginButtonsStudent); buttonLoginTeacher=findViewById(R.id.loginButtonTeacher); editTextPhoneNum=findViewById(R.id.register_phoneNumber); editPassword=findViewById(R.id.register_setPassword); editTextCode=findViewById(R.id.register_verifyCode); } // 使用完EventHandler需注销,否则可能出现内存泄漏 @Override protected void onDestroy() { super.onDestroy(); SMSSDK.unregisterEventHandler(eh); } }
package com.example.shazidouhuiapp.activity; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.shazidouhuiapp.Bean.User; import com.example.shazidouhuiapp.R; import com.example.shazidouhuiapp.Util.Utils; import org.json.JSONException; import org.json.JSONObject; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.SaveListener; import cn.bmob.v3.listener.UpdateListener; import cn.smssdk.EventHandler; import cn.smssdk.SMSSDK; public class resetPassword extends AppCompatActivity { private Button buttonCode,buttonLogin; private EditText editTextPhoneNum,editTextCode,editPassword; private String phoneNum,code,pass,oldpass; private EventHandler eh; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_passwordreset); initview(); eh = new EventHandler() { @Override public void afterEvent(int event, int result, Object data) { if (result == SMSSDK.RESULT_COMPLETE){ //回调完成 if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) { //提交验证码成功 runOnUiThread(new Runnable() { @Override public void run() { pass=editPassword.getText().toString().trim();; phoneNum=editTextPhoneNum.getText().toString().trim(); BmobUser user=new BmobUser(); user.setUsername(phoneNum); user.setPassword(pass); user.update(new UpdateListener() { @Override public void done(BmobException e) { if(e==null){ Toast.makeText(resetPassword.this, "修改成功", Toast.LENGTH_SHORT).show(); startActivity(new Intent(resetPassword.this,splash.class)); } else{ Toast.makeText(resetPassword.this, "修改失败"+e.getMessage(), Toast.LENGTH_LONG).show(); } } }); } }); }else if (event == SMSSDK.EVENT_GET_VOICE_VERIFICATION_CODE){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(resetPassword.this,"语音验证发送",Toast.LENGTH_SHORT).show(); } }); } else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE){ //获取验证码成功 runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(resetPassword.this,"验证码已发送",Toast.LENGTH_SHORT).show(); } }); }else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES){ Log.i("test","test"); } }else{ ((Throwable)data).printStackTrace(); Throwable throwable = (Throwable) data; throwable.printStackTrace(); Log.i("1234",throwable.toString()); try { JSONObject obj = new JSONObject(throwable.getMessage()); final String des = obj.optString("detail"); if (!TextUtils.isEmpty(des)){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(resetPassword.this,des,Toast.LENGTH_SHORT).show(); } }); } } catch (JSONException e) { e.printStackTrace(); } } } }; //注册一个事件回调监听,用于处理SMSSDK接口请求的结果 SMSSDK.registerEventHandler(eh); buttonCode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { phoneNum = editTextPhoneNum.getText().toString(); pass=editPassword.getText().toString(); if(!phoneNum.isEmpty()){ if(Utils.checkTel(phoneNum)){ //利用正则表达式获取检验手机号 // 获取验证码 if(!pass.isEmpty()){ if(Utils.checkPssword(pass)){ SMSSDK.getVerificationCode("86", phoneNum); } else { Toast.makeText(resetPassword.this, "请输入符合要求的密码", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(resetPassword.this, "请输入密码", Toast.LENGTH_SHORT).show(); } }else{ Toast.makeText(getApplicationContext(),"请输入有效的手机号",Toast.LENGTH_LONG).show(); } }else { Toast.makeText(getApplicationContext(),"请输入手机号",Toast.LENGTH_LONG).show(); return; } phoneNum = editTextPhoneNum.getText().toString(); } }); buttonLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { code = editTextCode.getText().toString(); if(!code.isEmpty()){ //提交验证码 SMSSDK.submitVerificationCode("86", phoneNum, code); }else{ Toast.makeText(getApplicationContext(),"请输入验证码",Toast.LENGTH_LONG).show(); return; } } }); } private void initview() { // private Button buttonCode,buttonLogin; // private EditText editTextPhoneNum,editTextCode,editPassword; buttonCode=findViewById(R.id.reset_getVerify); buttonLogin=findViewById(R.id.resetButton); editPassword=findViewById(R.id.newPassword); editTextCode=findViewById(R.id.reset_verifyCode); editTextPhoneNum=findViewById(R.id.reset_phoneNumber); } // 使用完EventHandler需注销,否则可能出现内存泄漏 @Override protected void onDestroy() { super.onDestroy(); SMSSDK.unregisterEventHandler(eh); } }
package com.example.shazidouhuiapp.activity; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.example.shazidouhuiapp.Bean.User; import com.example.shazidouhuiapp.MainActivity; import com.example.shazidouhuiapp.R; import java.util.Timer; import java.util.TimerTask; import cn.bmob.v3.Bmob; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.QueryListener; import cn.bmob.v3.listener.SaveListener; public class splash extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); Timer timer = new Timer(); timer.schedule(timertask, 2000); Bmob.initialize(this,"e575c228703fd6ae7b822919edc18236"); } TimerTask timertask = new TimerTask() { @Override public void run() { BmobUser currentUser = BmobUser.getCurrentUser(User.class); //逻辑判断是否登录,登陆了进入对应用户界面 if (currentUser!=null) { String id=currentUser.getObjectId(); BmobQuery<User> query=new BmobQuery<>(); query.getObject(id, new QueryListener<User>() { @Override public void done(User user, BmobException e) { if(user.getType().equals("student")){ startActivity(new Intent(splash.this, studentinterface.class)); } else if(user.getType().equals("teacher")){ startActivity(new Intent(splash.this,teacherinterface.class)); } } }); } else { // BmobUser user=new BmobUser(); // user.setUsername("15159538296"); // user.setPassword("123456"); // user.login(new SaveListener<User>() { // // @Override // public void done(User user, BmobException e) { // startActivity(new Intent(splash.this, studentinterface.class)); // } // }); startActivity(new Intent(splash.this,mobloging.class)); } } }; }
package com.example.shazidouhuiapp.activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.example.shazidouhuiapp.Adapter.HomeAdatpter; import com.example.shazidouhuiapp.Adapter.readReceiveAdapter; import com.example.shazidouhuiapp.Adapter.receiveAdapter; import com.example.shazidouhuiapp.Bean.User; import com.example.shazidouhuiapp.Bean.homework; import com.example.shazidouhuiapp.Bean.homeworkContent; import com.example.shazidouhuiapp.R; import java.util.ArrayList; import java.util.List; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.BmobUser; import cn.bmob.v3.datatype.BmobPointer; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.FindListener; public class student_readover_receive extends AppCompatActivity { private String id; private RecyclerView rv; private SwipeRefreshLayout srlayout; private TextView helloquestion; // private TextView HelloHome; // private TextView username,ok; private LinearLayout homesearch; List<homeworkContent> data; private readReceiveAdapter readreceiveAdapter; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.student_unfinished_question); initView(); //初始刷新 Refresh(); srlayout.setColorSchemeResources(android.R.color.holo_green_light,android.R.color.holo_red_light,android.R.color.holo_blue_light); srlayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { //刷新; Refresh(); } }); } private void Refresh() { Intent a=getIntent(); id=a.getStringExtra("id"); String title=a.getStringExtra("title"); helloquestion.setText(title); homework homework=new homework(); homework.setObjectId(id+""); BmobQuery<homeworkContent> query=new BmobQuery(); query.addWhereRelatedTo("homeworkContent",new BmobPointer(homework)); query.findObjects(new FindListener<homeworkContent>() { @Override public void done(List<homeworkContent> list, BmobException e) { if(e==null){ data=list; readreceiveAdapter =new readReceiveAdapter(student_readover_receive.this,data,id); rv.setLayoutManager(new LinearLayoutManager(student_readover_receive.this)); rv.setAdapter(readreceiveAdapter); } else { Toast.makeText(student_readover_receive.this, "题目数据获取失败", Toast.LENGTH_SHORT).show(); } } }); } private void initView() { rv = findViewById(R.id.question_recyclerview); srlayout =findViewById(R.id.question_swipe); helloquestion=findViewById(R.id.helloquestion); } }
package com.example.shazidouhuiapp.activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.example.shazidouhuiapp.Adapter.HomeAdatpter; import com.example.shazidouhuiapp.Adapter.receiveAdapter; import com.example.shazidouhuiapp.Bean.User; import com.example.shazidouhuiapp.Bean.homework; import com.example.shazidouhuiapp.Bean.homeworkContent; import com.example.shazidouhuiapp.R; import java.util.ArrayList; import java.util.List; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.BmobUser; import cn.bmob.v3.datatype.BmobPointer; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.FindListener; public class student_unfinished_receive extends AppCompatActivity { private String id; private RecyclerView rv; private SwipeRefreshLayout srlayout; private TextView helloquestion; // private TextView HelloHome; // private TextView username,ok; private LinearLayout homesearch; List<homeworkContent> data; private receiveAdapter receiveAdapter; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.student_unfinished_question); initView(); //初始刷新 Refresh(); srlayout.setColorSchemeResources(android.R.color.holo_green_light,android.R.color.holo_red_light,android.R.color.holo_blue_light); srlayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { //刷新; Refresh(); } }); } private void Refresh() { Intent a=getIntent(); id=a.getStringExtra("id"); String title=a.getStringExtra("title"); helloquestion.setText(title+""); homework homework=new homework(); homework.setObjectId(id+""); BmobQuery<homeworkContent> query=new BmobQuery(); query.addWhereRelatedTo("homeworkContent",new BmobPointer(homework)); query.findObjects(new FindListener<homeworkContent>() { @Override public void done(List<homeworkContent> list, BmobException e) { if(e==null){ data=list; receiveAdapter =new receiveAdapter(student_unfinished_receive.this,data,id); rv.setLayoutManager(new LinearLayoutManager(student_unfinished_receive.this)); rv.setAdapter(receiveAdapter); } else { Toast.makeText(student_unfinished_receive.this, "题目数据获取失败", Toast.LENGTH_SHORT).show(); } } }); } private void initView() { rv = findViewById(R.id.question_recyclerview); srlayout =findViewById(R.id.question_swipe); helloquestion=findViewById(R.id.helloquestion); } }
package com.example.shazidouhuiapp.activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import com.example.shazidouhuiapp.Adapter.receiveAdapter; import com.example.shazidouhuiapp.Bean.homework; import com.example.shazidouhuiapp.Bean.homeworkContent; import com.example.shazidouhuiapp.R; import java.util.List; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.datatype.BmobPointer; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.FindListener; import cn.bmob.v3.listener.QueryListener; import cn.bmob.v3.listener.UpdateListener; public class student_unfinished_receive_question extends AppCompatActivity { private TextView question,score,status; private EditText myanswer; private Button submit,camera; private ImageView returnview; private String id,parent; private homeworkContent hom; private homework homework; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.student_unfinished_recieve); initview(); initdata(); returnview.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void initdata() { //另外一种 Intent a=getIntent(); id=a.getStringExtra("id"); parent=a.getStringExtra("parentid"); hom=new homeworkContent(); homework=new homework(); hom.setObjectId(id+""); homework.setObjectId(parent+""); String mquestion=a.getStringExtra("question"); String mscore=a.getStringExtra("score"); String mstatus=a.getStringExtra("status"); if(mstatus.equals("true")){ status.setText("已完成"); } else if(mstatus.equals("false")){ status.setText("未完成"); } question.setText(mquestion); score.setText(mscore); camera.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in=new Intent(student_unfinished_receive_question.this,Receivecamera.class); in.putExtra("id",id+""); in.putExtra("parentid",parent+""); startActivity(in); } }); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String answer=myanswer.getText().toString().trim(); if(answer.isEmpty()){ Toast.makeText(student_unfinished_receive_question.this, "请输入你的答案", Toast.LENGTH_SHORT).show(); } else { hom.setMyAnswer(answer); hom.setStatus(true); hom.update(new UpdateListener() { @Override public void done(BmobException e) { if(e==null){ BmobQuery<homeworkContent> query=new BmobQuery(); query.addWhereRelatedTo("homeworkContent",new BmobPointer(homework)); query.findObjects(new FindListener<homeworkContent>() { @Override public void done(List<homeworkContent> list, BmobException e) { if(e==null){ int flag=0; for (homeworkContent homew:list ) { if(homew.isStatus()==true){ flag++; } } Toast.makeText(student_unfinished_receive_question.this, "本小题提交成功", Toast.LENGTH_SHORT).show(); if(flag>=(list.size()-1)){ homework.setStatus(true); homework.update(new UpdateListener() { @Override public void done(BmobException e) { if(e==null){ Toast.makeText(student_unfinished_receive_question.this, "您已完成本次作业所有题目", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(student_unfinished_receive_question.this, "本次作业更新失败"+e.getMessage(), Toast.LENGTH_SHORT).show(); } } }); } } else { Toast.makeText(student_unfinished_receive_question.this, "获取题目数据失败", Toast.LENGTH_SHORT).show(); } } }); } else{ Log.d("提交失败", e.getMessage()+""); Toast.makeText(student_unfinished_receive_question.this, "提交失败"+e.getMessage(), Toast.LENGTH_LONG).show(); } } }); } } }); } private void initview() { question=findViewById(R.id.receive_question_question); score=findViewById(R.id.receive_question_score); status=findViewById(R.id.receive_question_status); myanswer=findViewById(R.id.receive_myanswer); returnview=findViewById(R.id.receiveback); submit=findViewById(R.id.receive_submit); camera=findViewById(R.id.camera); } }
package com.example.shazidouhuiapp.activity; import android.os.Bundle; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; import com.ashokvarma.bottomnavigation.BottomNavigationBar; import com.ashokvarma.bottomnavigation.BottomNavigationItem; import com.example.shazidouhuiapp.Adapter.setAdapter; import com.example.shazidouhuiapp.R; import com.example.shazidouhuiapp.fragment.FragmentMine; import com.example.shazidouhuiapp.fragment.FragmentReadOver; import com.example.shazidouhuiapp.fragment.FragmentUnfinished; import java.util.ArrayList; import java.util.List; public class studentinterface extends AppCompatActivity implements BottomNavigationBar.OnTabSelectedListener, ViewPager.OnPageChangeListener { private ViewPager viewPager; private BottomNavigationBar bottomNavigationBar; private List<Fragment> fragmentList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewPager=findViewById(R.id.viewpager); bottomNavigationBar=findViewById(R.id.bottom); initView(); } private void initView() { initViewPager(); initBottom(); } private void initBottom() { bottomNavigationBar.setTabSelectedListener(this); bottomNavigationBar.clearAll(); bottomNavigationBar.setMode(BottomNavigationBar.MODE_FIXED); bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_DEFAULT); bottomNavigationBar.setBarBackgroundColor(R.color.white).setActiveColor(R.color.colorbasel) .setInActiveColor(R.color.black); bottomNavigationBar.addItem(new BottomNavigationItem(R.drawable.homepage_fill,"未完成作业").setInactiveIconResource(R.drawable.homepage)) .addItem(new BottomNavigationItem(R.drawable.mobilephone_fill,"已批改作业").setInactiveIconResource(R.drawable.mobilephone)) .addItem(new BottomNavigationItem(R.drawable.mine_fill,"我的").setInactiveIconResource(R.drawable.mine)) .setFirstSelectedPosition(0) .initialise(); } private void initViewPager() { viewPager.setOffscreenPageLimit(3); //配置fragment fragmentList=new ArrayList<>(); //三个底部导航栏的实例化 fragmentList.add(new FragmentUnfinished()); fragmentList.add(new FragmentReadOver()); fragmentList.add(new FragmentMine()); viewPager.setAdapter(new setAdapter(getSupportFragmentManager(),fragmentList)); viewPager.addOnPageChangeListener(this); viewPager.setCurrentItem(0); } @Override public void onTabSelected(int position) { } @Override public void onTabUnselected(int position) { } @Override public void onTabReselected(int position) { viewPager.setCurrentItem(position); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { bottomNavigationBar.selectTab(position); } @Override public void onPageScrollStateChanged(int state) { } }
package com.example.shazidouhuiapp.activity; import android.os.Bundle; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.example.shazidouhuiapp.R; public class teacherinterface extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.teacher); Toast.makeText(this, "来到了老师界面", Toast.LENGTH_SHORT).show(); } }