diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/WorkListViewAdapter.java b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/WorkListViewAdapter.java new file mode 100644 index 0000000..5dd6392 --- /dev/null +++ b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/WorkListViewAdapter.java @@ -0,0 +1,73 @@ +package org.ntlab.acanthus_client.views.main_menu_ui.edit; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; +import android.content.Context; + +import org.ntlab.acanthus_client.R; + +public class WorkListViewAdapter extends BaseAdapter { + + private final LayoutInflater inflater; + private final int layoutId; + private final String[] animationName; + private final String[] lastUpdate; + + //参照保存データ + static class ViewHolder{ + TextView textViewName; + TextView textViewDate; + } + + //コンテキスト + public WorkListViewAdapter(Context context, int layoutId, String[] animationName, String[] lastUpdate) { + super(); + this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + this.layoutId = layoutId; + this.animationName = animationName; + this.lastUpdate = lastUpdate; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder viewHolder; + //Viewのinflate(拡張) + if (convertView == null){ + //fragment_edit.xmlにlistView用のレイアウトを入れ込む + convertView = inflater.inflate(layoutId, parent, false); + //ViewHolderの生成とレイアウト内テキストのセット + viewHolder = new ViewHolder(); + viewHolder.textViewName = convertView.findViewById(R.id.textViewName); + viewHolder.textViewDate = convertView.findViewById(R.id.textViewDate); + convertView.setTag(viewHolder); + }else { + //既に初期セットの処理がされている場合、再利用する + viewHolder = (ViewHolder) convertView.getTag(); + } + + //ViewHolder内のtextViewName,Dateに各ポジションのデータをセット + viewHolder.textViewName.setText(animationName[position]); + viewHolder.textViewDate.setText(lastUpdate[position]); + + return convertView; + } + + @Override + public int getCount() { + return 0; + } + + @Override + public Object getItem(int position) { + return null; + } + + @Override + public long getItemId(int position) { + return 0; + } + +}