Search in sources :

Example 1 with DatePickerFragment

use of org.eyeseetea.malariacare.views.DatePickerFragment in project pictureapp by EyeSeeTea.

the class NewReceiptBalanceFragment method initViews.

private void initViews(View view) {
    date = (TextView) view.findViewById(R.id.new_receipt_balance_date);
    rdt = (EditText) view.findViewById(R.id.new_receipt_balance_rdt);
    act6 = (EditText) view.findViewById(R.id.new_receipt_balance_act6);
    act12 = (EditText) view.findViewById(R.id.new_receipt_balance_act12);
    act18 = (EditText) view.findViewById(R.id.new_receipt_balance_act18);
    act24 = (EditText) view.findViewById(R.id.new_receipt_balance_act24);
    pq = (EditText) view.findViewById(R.id.new_receipt_balance_pq);
    cq = (EditText) view.findViewById(R.id.new_receipt_balance_cq);
    putTodayDate();
    view.findViewById(R.id.new_receipt_balance_back).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            backPressed();
        }
    });
    view.findViewById(R.id.new_receipt_balance_submit).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            submitPressed();
        }
    });
    final DatePickerFragment datePickerFragment = new DatePickerFragment();
    datePickerFragment.setOnDateSetListener(new DatePickerDialog.OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            NumberFormat formatter = new DecimalFormat("00");
            date.setText(year + "/" + formatter.format(monthOfYear) + "/" + formatter.format(dayOfMonth));
        }
    });
    date.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            datePickerFragment.show(getFragmentManager(), TAG);
        }
    });
}
Also used : DatePickerFragment(org.eyeseetea.malariacare.views.DatePickerFragment) DatePickerDialog(android.app.DatePickerDialog) DecimalFormat(java.text.DecimalFormat) DatePicker(android.widget.DatePicker) TextView(android.widget.TextView) View(android.view.View) NumberFormat(java.text.NumberFormat)

Aggregations

DatePickerDialog (android.app.DatePickerDialog)1 View (android.view.View)1 DatePicker (android.widget.DatePicker)1 TextView (android.widget.TextView)1 DecimalFormat (java.text.DecimalFormat)1 NumberFormat (java.text.NumberFormat)1 DatePickerFragment (org.eyeseetea.malariacare.views.DatePickerFragment)1