第二阶段冲刺2
今天写了部分学生功能代码如下
以下是我们团队做的关于学生的几个功能
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
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); } } |