Example usage for android.app DatePickerDialog setMessage

List of usage examples for android.app DatePickerDialog setMessage

Introduction

In this page you can find the example usage for android.app DatePickerDialog setMessage.

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:net.niyonkuru.koodroid.ui.UsageFragment.java

@Override
public boolean onMenuItemClick(MenuItem item) {
    int id = item.getItemId();

    switch (id) {
    case R.id.edit_billing_cycle:
        Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        cal.setTime((Date) mPeriodFrom.getTag());

        DatePickerDialog dialog = new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
            @Override//from  w  w  w  .ja  v  a  2  s  .  c  o m
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                ContentValues values = new ContentValues(1);
                values.put(Settings.BILLING_CYCLE, dayOfMonth);
                mContext.getContentResolver().insert(Settings.CONTENT_URI, values);
            }
        }, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE));

        dialog.setMessage(getResources().getString(R.string.billing_cycle_dialog));

        //                DatePicker datePicker = dialog.getDatePicker();
        //                datePicker.setMaxDate(System.currentTimeMillis());

        dialog.show();

        return true;
    case R.id.enable_airtime: {
        getLoaderManager().restartLoader(AIRTIME_TOKEN, null, this);
    }
    case R.id.disable_airtime:
        View airtimeContent = getView().findViewById(R.id.airtime_content);
        AnimUtils.show(airtimeContent);

        toggleService(Settings.AIRTIME_SERVICE, id == R.id.enable_airtime);

        /* refresh the widget to show or hide data */
        IntentUtils.updateWidget(mContext);

        return true;
    case R.id.refresh_airtime:
        sync(SyncService.AIRTIME);
        return true;
    case R.id.enable_data: {
        LoaderManager loaderManager = getLoaderManager();

        loaderManager.restartLoader(DATA_TOKEN, null, this);
        loaderManager.restartLoader(TEXT_TOKEN, null, this);
    }
    case R.id.disable_data:
        View dataContent = getView().findViewById(R.id.data_content);
        AnimUtils.show(dataContent);

        View textContent = getView().findViewById(R.id.text_content);
        AnimUtils.show(textContent);

        toggleService(Settings.USAGE_SERVICE, id == R.id.enable_data);

        /* refresh the widget to show or hide data */
        IntentUtils.updateWidget(mContext);

        return true;
    case R.id.refresh_data:
        sync(SyncService.USAGE);
        return true;
    case R.id.detail_data:
        mCallBack.onShowDataTransactions(getSubscriber());
        return true;
    }

    return false;
}