package com.usai.redant.CommonEditor;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.DatePicker;

import com.usai.redant.redantmobile.R;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DatePickerActivity extends AppCompatActivity {

    public static class Builder {
        public Intent build(Context context, Date date, SimpleDateFormat formatter,int pickerMode,String time,int group,int child) {

            if (context == null) {
                return null;
            }
            Intent intent = new Intent(context,DatePickerActivity.class);

            if (date != null) {

            }
            if (formatter != null) {

            }
            if (time != null) {

            }

            return intent;
        }
    }

    private DatePicker datePicker;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_date_picker);

        datePicker = (DatePicker) findViewById(R.id.date_picker);
    }

    @Override
    public void finish() {

        Intent intent = getIntent();
        String select_date = datePicker.getMonth() + 1 + "/" + datePicker.getDayOfMonth() + "/" + datePicker.getYear();

        String key = intent.getStringExtra("value");
        intent.putExtra(key,select_date);

        setResult(RESULT_OK,intent);

        super.finish();
    }
}
