|
|
|
@ -7,13 +7,21 @@ import android.view.ViewGroup;
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
|
|
|
|
import com.example.leudaemialikeme.Adapter.RecnewsAdapter;
|
|
|
|
|
import com.example.leudaemialikeme.R;
|
|
|
|
|
import com.example.leudaemialikeme.Recnews;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class InvitationChannelFragment extends Fragment {
|
|
|
|
|
private static final String ARG_CATEGORY_TITLE = "category_title";
|
|
|
|
|
private String invitationCategoryTitle = "Default";
|
|
|
|
|
private TextView mTitleField;
|
|
|
|
|
private List<Recnews> recNews=new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
public InvitationChannelFragment() {
|
|
|
|
|
// Required empty public constructor
|
|
|
|
@ -35,15 +43,55 @@ public class InvitationChannelFragment extends Fragment {
|
|
|
|
|
}catch (java.lang.NullPointerException e){
|
|
|
|
|
System.out.println("TesFragment getArg error!");
|
|
|
|
|
}
|
|
|
|
|
initRecNews();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
|
|
Bundle savedInstanceState) {
|
|
|
|
|
View view;
|
|
|
|
|
view = inflater.inflate(R.layout.fragment_invitation_channel, container, false);
|
|
|
|
|
mTitleField = (TextView)view.findViewById(R.id.invitationCategoryTitle);
|
|
|
|
|
mTitleField.setText(invitationCategoryTitle);
|
|
|
|
|
if(invitationCategoryTitle.equals("全部")){
|
|
|
|
|
view = inflater.inflate(R.layout.recyclerview,container,false);
|
|
|
|
|
RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.list_community);
|
|
|
|
|
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
|
|
|
|
|
recyclerView.setLayoutManager(layoutManager);
|
|
|
|
|
RecnewsAdapter adapter = new RecnewsAdapter(recNews);
|
|
|
|
|
recyclerView.setAdapter(adapter);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
view = inflater.inflate(R.layout.fragment_invitation_channel, container, false);
|
|
|
|
|
mTitleField = (TextView)view.findViewById(R.id.invitationCategoryTitle);
|
|
|
|
|
mTitleField.setText(invitationCategoryTitle);
|
|
|
|
|
}
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initRecNews(){
|
|
|
|
|
for(int i=0;i<2;i++){
|
|
|
|
|
Recnews news1=new Recnews(R.drawable.rec_news1,
|
|
|
|
|
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
|
|
|
|
|
"急性淋巴细胞白血病(ALL)是儿童最常见的恶性肿瘤,其中约85%为……"
|
|
|
|
|
,102,"2021-11-6 09:19:54"
|
|
|
|
|
);
|
|
|
|
|
recNews.add(news1);
|
|
|
|
|
Recnews news2=new Recnews(R.drawable.rec_news2,
|
|
|
|
|
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
|
|
|
|
|
"急性淋巴细胞白血病(ALL)是儿童最常见的恶性肿瘤,其中约85%为……"
|
|
|
|
|
,100,"2021-12-6 03:19:54"
|
|
|
|
|
);
|
|
|
|
|
recNews.add(news2);
|
|
|
|
|
Recnews news3=new Recnews(R.drawable.rec_news3,
|
|
|
|
|
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
|
|
|
|
|
"急性淋巴细胞白血病(ALL)是儿童最常见的恶性肿瘤,其中约85%为……"
|
|
|
|
|
,100,"2021-12-6 03:19:54"
|
|
|
|
|
);
|
|
|
|
|
recNews.add(news3);
|
|
|
|
|
Recnews news4=new Recnews(R.drawable.rec_news4,
|
|
|
|
|
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
|
|
|
|
|
"急性淋巴细胞白血病(ALL)是儿童最常见的恶性肿瘤,其中约85%为……"
|
|
|
|
|
,100,"2021-12-6 03:19:54"
|
|
|
|
|
);
|
|
|
|
|
recNews.add(news4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|