Search in sources :

Example 1 with RecurrencePickerDialogFragment

use of com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment in project android-betterpickers by code-troopers.

the class SampleRecurrenceBasicUsage method onResume.

@Override
public void onResume() {
    // Example of reattaching to the fragment
    super.onResume();
    RecurrencePickerDialogFragment rpd = (RecurrencePickerDialogFragment) getSupportFragmentManager().findFragmentByTag(FRAG_TAG_RECUR_PICKER);
    if (rpd != null) {
        rpd.setOnRecurrenceSetListener(this);
    }
}
Also used : RecurrencePickerDialogFragment(com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment)

Example 2 with RecurrencePickerDialogFragment

use of com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment in project android-betterpickers by code-troopers.

the class SampleRecurrenceDismissListener method onResume.

@Override
public void onResume() {
    // Example of reattaching to the fragment
    super.onResume();
    RecurrencePickerDialogFragment rpd = (RecurrencePickerDialogFragment) getSupportFragmentManager().findFragmentByTag(FRAG_TAG_RECUR_PICKER);
    if (rpd != null) {
        rpd.setOnRecurrenceSetListener(this);
    }
}
Also used : RecurrencePickerDialogFragment(com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment)

Example 3 with RecurrencePickerDialogFragment

use of com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment in project android-betterpickers by code-troopers.

the class SampleRecurrenceForcedOn method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_button);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button button = (Button) findViewById(R.id.button);
    mResultTextView.setText(R.string.no_value);
    button.setText(R.string.recurrence_picker_set);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentManager fm = getSupportFragmentManager();
            Bundle bundle = new Bundle();
            Time time = new Time();
            time.setToNow();
            bundle.putLong(RecurrencePickerDialogFragment.BUNDLE_START_TIME_MILLIS, time.toMillis(false));
            bundle.putString(RecurrencePickerDialogFragment.BUNDLE_TIME_ZONE, time.timezone);
            bundle.putBoolean(RecurrencePickerDialogFragment.BUNDLE_HIDE_SWITCH_BUTTON, true);
            // may be more efficient to serialize and pass in EventRecurrence
            bundle.putString(RecurrencePickerDialogFragment.BUNDLE_RRULE, mRrule);
            RecurrencePickerDialogFragment dialogFragment = (RecurrencePickerDialogFragment) fm.findFragmentByTag(FRAG_TAG_RECUR_PICKER);
            if (dialogFragment != null) {
                dialogFragment.dismiss();
            }
            dialogFragment = new RecurrencePickerDialogFragment();
            dialogFragment.setArguments(bundle);
            dialogFragment.setOnRecurrenceSetListener(SampleRecurrenceForcedOn.this);
            dialogFragment.show(fm, FRAG_TAG_RECUR_PICKER);
        }
    });
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Button(android.widget.Button) Bundle(android.os.Bundle) RecurrencePickerDialogFragment(com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment) Time(android.text.format.Time) TextView(android.widget.TextView) View(android.view.View)

Example 4 with RecurrencePickerDialogFragment

use of com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment in project android-betterpickers by code-troopers.

the class SampleRecurrenceForcedOn method onResume.

@Override
public void onResume() {
    // Example of reattaching to the fragment
    super.onResume();
    RecurrencePickerDialogFragment rpd = (RecurrencePickerDialogFragment) getSupportFragmentManager().findFragmentByTag(FRAG_TAG_RECUR_PICKER);
    if (rpd != null) {
        rpd.setOnRecurrenceSetListener(this);
    }
}
Also used : RecurrencePickerDialogFragment(com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment)

Example 5 with RecurrencePickerDialogFragment

use of com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment in project android-betterpickers by code-troopers.

the class SampleRecurrenceBasicUsage method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_button);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button button = (Button) findViewById(R.id.button);
    mResultTextView.setText(R.string.no_value);
    button.setText(R.string.recurrence_picker_set);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentManager fm = getSupportFragmentManager();
            Bundle bundle = new Bundle();
            Time time = new Time();
            time.setToNow();
            bundle.putLong(RecurrencePickerDialogFragment.BUNDLE_START_TIME_MILLIS, time.toMillis(false));
            bundle.putString(RecurrencePickerDialogFragment.BUNDLE_TIME_ZONE, time.timezone);
            // may be more efficient to serialize and pass in EventRecurrence
            bundle.putString(RecurrencePickerDialogFragment.BUNDLE_RRULE, mRrule);
            RecurrencePickerDialogFragment rpd = (RecurrencePickerDialogFragment) fm.findFragmentByTag(FRAG_TAG_RECUR_PICKER);
            if (rpd != null) {
                rpd.dismiss();
            }
            rpd = new RecurrencePickerDialogFragment();
            rpd.setArguments(bundle);
            rpd.setOnRecurrenceSetListener(SampleRecurrenceBasicUsage.this);
            rpd.show(fm, FRAG_TAG_RECUR_PICKER);
        }
    });
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Button(android.widget.Button) Bundle(android.os.Bundle) RecurrencePickerDialogFragment(com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment) Time(android.text.format.Time) TextView(android.widget.TextView) View(android.view.View)

Aggregations

RecurrencePickerDialogFragment (com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment)6 Bundle (android.os.Bundle)3 FragmentManager (android.support.v4.app.FragmentManager)3 Time (android.text.format.Time)3 View (android.view.View)3 Button (android.widget.Button)3 TextView (android.widget.TextView)3