Search in sources :

Example 1 with DialogFragment

use of android.support.v4.app.DialogFragment 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 2 with DialogFragment

use of android.support.v4.app.DialogFragment in project barcodescanner by dm77.

the class FullScannerActivity method showMessageDialog.

public void showMessageDialog(String message) {
    DialogFragment fragment = MessageDialogFragment.newInstance("Scan Results", message, this);
    fragment.show(getSupportFragmentManager(), "scan_results");
}
Also used : DialogFragment(android.support.v4.app.DialogFragment)

Example 3 with DialogFragment

use of android.support.v4.app.DialogFragment in project barcodescanner by dm77.

the class FullScannerActivity method closeDialog.

public void closeDialog(String dialogName) {
    FragmentManager fragmentManager = getSupportFragmentManager();
    DialogFragment fragment = (DialogFragment) fragmentManager.findFragmentByTag(dialogName);
    if (fragment != null) {
        fragment.dismiss();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) DialogFragment(android.support.v4.app.DialogFragment)

Example 4 with DialogFragment

use of android.support.v4.app.DialogFragment in project barcodescanner by dm77.

the class FullScannerActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle presses on the action bar items
    switch(item.getItemId()) {
        case R.id.menu_flash:
            mFlash = !mFlash;
            if (mFlash) {
                item.setTitle(R.string.flash_on);
            } else {
                item.setTitle(R.string.flash_off);
            }
            mScannerView.setFlash(mFlash);
            return true;
        case R.id.menu_auto_focus:
            mAutoFocus = !mAutoFocus;
            if (mAutoFocus) {
                item.setTitle(R.string.auto_focus_on);
            } else {
                item.setTitle(R.string.auto_focus_off);
            }
            mScannerView.setAutoFocus(mAutoFocus);
            return true;
        case R.id.menu_formats:
            DialogFragment fragment = FormatSelectorDialogFragment.newInstance(this, mSelectedIndices);
            fragment.show(getSupportFragmentManager(), "format_selector");
            return true;
        case R.id.menu_camera_selector:
            mScannerView.stopCamera();
            DialogFragment cFragment = CameraSelectorDialogFragment.newInstance(this, mCameraId);
            cFragment.show(getSupportFragmentManager(), "camera_selector");
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : DialogFragment(android.support.v4.app.DialogFragment)

Example 5 with DialogFragment

use of android.support.v4.app.DialogFragment in project barcodescanner by dm77.

the class FullScannerActivity method closeDialog.

public void closeDialog(String dialogName) {
    FragmentManager fragmentManager = getSupportFragmentManager();
    DialogFragment fragment = (DialogFragment) fragmentManager.findFragmentByTag(dialogName);
    if (fragment != null) {
        fragment.dismiss();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) DialogFragment(android.support.v4.app.DialogFragment)

Aggregations

DialogFragment (android.support.v4.app.DialogFragment)73 Fragment (android.support.v4.app.Fragment)29 FragmentTransaction (android.support.v4.app.FragmentTransaction)21 FragmentManager (android.support.v4.app.FragmentManager)9 Bundle (android.os.Bundle)8 View (android.view.View)8 SherlockDialogFragment (com.actionbarsherlock.app.SherlockDialogFragment)8 TextView (android.widget.TextView)7 AlertDialog (android.app.AlertDialog)5 DialogInterface (android.content.DialogInterface)4 OnClickListener (android.content.DialogInterface.OnClickListener)4 Intent (android.content.Intent)4 ListFragment (android.support.v4.app.ListFragment)4 AppCompatDialogFragment (android.support.v7.app.AppCompatDialogFragment)4 OnClickListener (android.view.View.OnClickListener)4 Button (android.widget.Button)4 ItemPinnedMessageDialogFragment (com.h6ah4i.android.example.advrecyclerview.common.fragment.ItemPinnedMessageDialogFragment)4 ProgressDialogFragment (com.wada811.android.dialogfragments.material.ProgressDialogFragment)4 Dialog (android.app.Dialog)3 ProgressDialogFragment (com.wada811.android.dialogfragments.traditional.ProgressDialogFragment)3