package com.example.yochi.shiftcal;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.provider.ContactsContract;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.Date;
import java.sql.Timestamp;

/**
 * Created by yochi on 2017/01/17.
 */
class DateAdapter extends BaseAdapter {

    private Context mContext;
    private LayoutInflater mLayoutInflater;
    private SQLiteDatabase mydb;
    private Timestamp top = null;

    private static class DateViewHolder {
        public TextView  title;
        public TextView  contents;
    }

    DateAdapter(Context context) {
      mContext = context;
      mLayoutInflater = LayoutInflater.from(context);

      if(top == null){
        top = new Timestamp(new Date().getTime());

      }

      MySQLiteOpenHelper hlpr = new MySQLiteOpenHelper(mContext);
      mydb = hlpr.getWritableDatabase();
      Cursor cursor = mydb.query("cal", new String[] {"_id", "data"}, null, null, null, null, "_id DESC");

    }

    public int getCount() {
        return 7*6;
    }

    public Object getItem(int position) {
        // 日にち計算
        return position + "日";
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {

      DateViewHolder holder;
      if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.date_layout, null);
        holder = new DateViewHolder();
        convertView.setTag(holder);
      } else {
          holder = (DateViewHolder)convertView.getTag();
      }

      holder.title.setText((String)getItem(position));

      return convertView;
    }
}

@@ -876,16 +876,55 @@
  null)%7B%0A
+        // %E7%8F%BE%E5%9C%A8%E6%9C%88%E3%81%AE%EF%BC%91%E6%97%A5%E3%81%AE%E6%9B%9C%E6%97%A5%E3%81%8B%E3%82%89%E3%82%AB%E3%83%AC%E3%83%B3%E3%83%80%E3%83%BC%E8%A1%A8%E7%A4%BA%E3%81%AE%E5%B7%A6%E4%B8%8A%E6%97%A5%E4%BB%98%E3%82%92%E6%B1%82%E3%82%81%E3%82%8B%0A
         

add comment