团队冲刺0207
今天主要对作业状态的设计进行修改
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);
}
}