@ -0,0 +1,62 @@
|
|||||||
|
package com.example.leudaemialikeme.adapter;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.example.leudaemialikeme.R;
|
||||||
|
import com.example.leudaemialikeme.Recnews;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RecnewsAdapter extends RecyclerView.Adapter<RecnewsAdapter.ViewHolder> {
|
||||||
|
private List<Recnews> mRecnewsList;
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder{
|
||||||
|
ImageView image;
|
||||||
|
TextView theme;
|
||||||
|
TextView intro;
|
||||||
|
TextView visNum;
|
||||||
|
TextView time;
|
||||||
|
public ViewHolder(View view){
|
||||||
|
super(view);
|
||||||
|
image=(ImageView)view.findViewById(R.id.recNews_image);
|
||||||
|
theme=(TextView)view.findViewById(R.id.recNews_theme);
|
||||||
|
intro=(TextView)view.findViewById(R.id.recNews_intro);
|
||||||
|
visNum=(TextView)view.findViewById(R.id.recNews_visNum);
|
||||||
|
time=(TextView)view.findViewById(R.id.recNews_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public RecnewsAdapter(List<Recnews> recnewsList){
|
||||||
|
mRecnewsList=recnewsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.recnews_item,parent,false);
|
||||||
|
ViewHolder holder=new ViewHolder(view);
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecnewsAdapter.ViewHolder holder, int position) {
|
||||||
|
Recnews recnews=mRecnewsList.get(position);
|
||||||
|
holder.image.setImageResource(recnews.getImageNum());
|
||||||
|
holder.visNum.setText(String.valueOf(recnews.getVisNum()));
|
||||||
|
holder.intro.setText(recnews.getIntro());
|
||||||
|
holder.theme.setText(recnews.getTheme());
|
||||||
|
holder.time.setText(recnews.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mRecnewsList.size();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.example.leudaemialikeme;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Recnews implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private int imageNum;
|
||||||
|
private String theme;
|
||||||
|
private String intro;
|
||||||
|
private int visNum;
|
||||||
|
private String time;
|
||||||
|
public int getImageNum(){
|
||||||
|
return imageNum;
|
||||||
|
}
|
||||||
|
public void setImageNum(int imageNum){
|
||||||
|
this.imageNum=imageNum;
|
||||||
|
}
|
||||||
|
public String getTheme(){
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
public void setTheme(String theme){
|
||||||
|
this.theme=theme;
|
||||||
|
}
|
||||||
|
public String getIntro(){
|
||||||
|
return intro;
|
||||||
|
}
|
||||||
|
public void setIntro(String intro){
|
||||||
|
this.intro=intro;
|
||||||
|
}
|
||||||
|
public int getVisNum(){
|
||||||
|
return visNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisNum(int visNum) {
|
||||||
|
this.visNum = visNum;
|
||||||
|
}
|
||||||
|
public String getTime(){
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(String time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Recnews( int imageNum,String theme,String intro,int visNum, String time){
|
||||||
|
this.imageNum=imageNum;
|
||||||
|
this.intro=intro;
|
||||||
|
this.theme=theme;
|
||||||
|
this.time=time;
|
||||||
|
this.visNum=visNum;
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 21 KiB |
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
<solid android:color="#FFFFFF" />
|
||||||
|
</shape>
|