Example usage for android.app DialogFragment show

List of usage examples for android.app DialogFragment show

Introduction

In this page you can find the example usage for android.app DialogFragment show.

Prototype

public int show(FragmentTransaction transaction, String tag) 

Source Link

Document

Display the dialog, adding the fragment using an existing transaction and then committing the transaction.

Usage

From source file:com.antew.redditinpictures.library.ui.RedditFragmentActivity.java

public void handleLoginAndLogout() {
    if (!RedditLoginInformation.isLoggedIn()) {
        LoginDialogFragment loginFragment = LoginDialogFragment.newInstance();
        loginFragment.show(getFragmentManager(), Constants.Dialog.DIALOG_LOGIN);
    } else {//from  w w  w  .ja  v a  2s.  c om
        DialogFragment logoutFragment = LogoutDialogFragment.newInstance(RedditLoginInformation.getUsername());
        logoutFragment.show(getFragmentManager(), Constants.Dialog.DIALOG_LOGOUT);
    }
}

From source file:com.google.sample.devicelab.MainActivity.java

private void displayGAEUrlDialog() {
    DialogFragment dialog = new SetGAEIdDialogFragment();
    dialog.show(getFragmentManager(), "SetGAEIdDialogFragment");
}

From source file:de.uulm.graphicalpasswords.openmiba.MIBACreatePasswordActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    // WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_miba_create_password);

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    rounds_to_do = Integer.parseInt(sharedPref.getString("miba_length", "1"));
    min_rounds = rounds_to_do;

    Bundle bundle = new Bundle();
    bundle.putInt("length", rounds_to_do);
    DialogFragment intro = new IntroDialogFragment();
    intro.setArguments(bundle);/*from  w ww .  ja  va2 s .c  o m*/
    intro.show(getFragmentManager(), "intro");

    // Show the Up button in the action bar.
    setupActionBar();

    setViews();
    seenPictureIds.add(R.drawable.ccp000);
}

From source file:com.paranoid.gerrit.GerritControllerActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    Intent intent;//w ww.  j  a  va2 s.  c om
    switch (item.getItemId()) {
    case R.id.menu_save:
        intent = new Intent(this, PrefsActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        startActivity(intent);
        return true;
    case R.id.menu_help:
        showHelpDialog();
        return true;
    case R.id.menu_refresh:
        refreshTabs();
        return true;
    case R.id.menu_team_instance:
        DialogFragment newFragment = new GerritSwitcher();
        String tag = getResources().getString(R.string.choose_gerrit_instance);
        // Must use getFragmentManager not getSupportFragmentManager here
        newFragment.show(getFragmentManager(), tag);
        return true;
    case R.id.menu_projects:
        intent = new Intent(this, ProjectsList.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        startActivity(intent);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:de.uulm.graphicalpasswords.openmiba.MIBACreatePasswordActivity.java

private void setViews() {
    tblLayout = (TableLayout) findViewById(R.id.tableLayout);
    btnBack = (Button) findViewById(R.id.miba_btnBack);
    btnBack.setOnClickListener(new View.OnClickListener() {

        @Override/* w  ww.j a v  a  2s .  c o m*/
        public void onClick(View v) {
            back();
        }
    });
    btnDone = (Button) findViewById(R.id.miba_btnCreateMasterKey);

    tvRound = (TextView) this.findViewById(R.id.tvRound);
    tvRound.setText(getString(R.string.label_round) + " 1");

    linlGrid = new LinearLayout[2][4];
    linlGrid[0][0] = (LinearLayout) this.findViewById(R.id.square1);
    linlGrid[1][0] = (LinearLayout) this.findViewById(R.id.square2);
    linlGrid[0][1] = (LinearLayout) this.findViewById(R.id.square3);
    linlGrid[1][1] = (LinearLayout) this.findViewById(R.id.square4);
    linlGrid[0][2] = (LinearLayout) this.findViewById(R.id.square5);
    linlGrid[1][2] = (LinearLayout) this.findViewById(R.id.square6);
    linlGrid[0][3] = (LinearLayout) this.findViewById(R.id.square7);
    linlGrid[1][3] = (LinearLayout) this.findViewById(R.id.square8);

    for (int y = 0; y < 4; y++) {
        for (int x = 0; x < 2; x++) {
            linlGrid[x][y].setBackgroundColor(colors_off[x][y]);
        }

    }

    // get width and height from mainpanel
    // can not use display width/height because of notification bar
    ViewTreeObserver vto = tblLayout.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {

            // get values of portrait mode

            Display display = getWindowManager().getDefaultDisplay();

            if (display.getRotation() == Surface.ROTATION_0) {
                width = tblLayout.getWidth();
                height = tblLayout.getHeight();
            } else {
                height = tblLayout.getWidth();
                width = tblLayout.getHeight();
            }

            Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ccp000);
            bmp = Bitmap.createScaledBitmap(bmp, width, height, true);
            Drawable d = new BitmapDrawable(getResources(), bmp);
            tblLayout.setBackgroundDrawable(d);

            touchlistener = new TouchListener(linlGrid, width, height, handler);
            tblLayout.setOnTouchListener(touchlistener);
            // remove listener again otherwise it gets called twice
            tblLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        }
    });

    btnDone.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            DialogFragment dialog = new RememberPasswordDialogFragment();
            dialog.show(getFragmentManager(), "remember");
        }
    });
    btnDone.setVisibility(View.VISIBLE);
}

From source file:com.mediatek.galleryfeature.stereo.fancycolor.FancyColorActivity.java

private void showLoadingProgress() {
    MtkLog.d(TAG, "<showLoadingProgress>");
    DialogFragment fragment;
    if (mLoadingProgressDialog != null) {
        fragment = mLoadingProgressDialog.get();
        if (fragment != null) {
            if (!fragment.isAdded()) {
                fragment.show(getFragmentManager(), null);
            }//from   w  w w . jav  a  2  s .c o  m
            return;
        }
    }

    final DialogFragment genProgressDialog = new ProgressFragment(" ");
    genProgressDialog.setCancelable(false);
    genProgressDialog.show(getFragmentManager(), null);
    genProgressDialog.setStyle(R.style.RefocusDialog, genProgressDialog.getTheme());
    mLoadingProgressDialog = new WeakReference<DialogFragment>(genProgressDialog);
}

From source file:it.gmariotti.cardslib.demo.extras.MainActivity.java

private void openDialogFragment(DialogFragment dialogStandardFragment) {
    if (dialogStandardFragment != null) {
        FragmentManager fm = getFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        Fragment prev = fm.findFragmentByTag("carddemo_dialog_extras");
        if (prev != null) {
            ft.remove(prev);/*ww  w.j av a 2  s  . c  o m*/
        }
        //ft.addToBackStack(null);

        dialogStandardFragment.show(ft, "carddemo_dialog_extras");
    }
}

From source file:com.mediatek.galleryfeature.stereo.fancycolor.FancyColorActivity.java

private void showSavingProgress(String albumName) {
    DialogFragment fragment;

    if (mSavingProgressDialog != null) {
        fragment = mSavingProgressDialog.get();
        if (fragment != null) {
            if (!fragment.isAdded()) {
                fragment.show(getFragmentManager(), null);
            }//from   www .  j av a  2 s . c om
            return;
        }
    }
    String progressText;
    if (albumName == null) {
        progressText = getString(R.string.saving_image);
    } else {
        progressText = getString(R.string.m_refocus_saving_image, albumName);
    }
    final DialogFragment genProgressDialog = new ProgressFragment(progressText);
    genProgressDialog.setCancelable(false);
    genProgressDialog.show(getFragmentManager(), null);
    genProgressDialog.setStyle(R.style.RefocusDialog, genProgressDialog.getTheme());
    mSavingProgressDialog = new WeakReference<DialogFragment>(genProgressDialog);
}

From source file:com.plusapp.pocketbiceps.app.MainActivity.java

private void showSortDialog() {
    FragmentManager fm = getFragmentManager();
    DialogFragment sortFragment = new SortDialogFragment();
    sortFragment.show(fm, "SORT_DIALOG");
}

From source file:com.cyanogenmod.messaging.quickmessage.QuickMessagePopup.java

/**
 * display the sim select dialog for multi sim phones
 *//*from www .  j  a v  a2  s. c om*/
private void showSimSelector(Activity activity, final ComposeMessageView.OnSimSelectedCallback cb) {
    final TelecomManager telecomMgr = (TelecomManager) activity.getSystemService(Context.TELECOM_SERVICE);
    final List<PhoneAccountHandle> handles = telecomMgr.getCallCapablePhoneAccounts();
    final List<PhoneAccountHandle> filteredHandles = new ArrayList<>();

    //trim out SIP accounts
    for (PhoneAccountHandle handle : handles) {
        PhoneAccount phoneAccount = PhoneUtils.getAccountOrNull(activity, handle);
        if (phoneAccount != null) {
            Uri address = phoneAccount.getAddress();
            if (address != null && !TextUtils.equals(address.getScheme(), PhoneAccount.SCHEME_SIP)) {
                filteredHandles.add(handle);
            }
        }
    }

    final SelectPhoneAccountDialogFragment.SelectPhoneAccountListener listener = new SelectPhoneAccountDialogFragment.SelectPhoneAccountListener() {
        @Override
        public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, boolean setDefault) {
            // we need the subId and we only have a PhoneAccountHandle
            TelephonyManager telephonyManager = (TelephonyManager) mContext
                    .getSystemService(Context.TELEPHONY_SERVICE);
            Iterator<PhoneAccountHandle> phoneAccounts = telecomMgr.getCallCapablePhoneAccounts()
                    .listIterator();
            int subId = 0; // defaulting to 0, just in case
            while (phoneAccounts.hasNext()) {
                PhoneAccountHandle p = phoneAccounts.next();
                if (p.getId().equals(selectedAccountHandle.getId())) {
                    PhoneAccount phoneAccount = telecomMgr.getPhoneAccount(p);
                    subId = telephonyManager.getSubIdForPhoneAccount(phoneAccount);
                }
            }
            cb.onSimSelected(subId);
        }

        @Override
        public void onDialogDismissed() {
        }
    };

    DialogFragment dialogFragment = SelectPhoneAccountDialogFragment.newInstance(
            R.string.select_phone_account_title, false /* canSetDefault */, filteredHandles, listener);
    dialogFragment.show(activity.getFragmentManager(), "SELECT_PHONE_ACCOUNT_DIALOG_FRAGMENT");
}