Example usage for android.support.v4.app DialogFragment show

List of usage examples for android.support.v4.app DialogFragment show

Introduction

In this page you can find the example usage for android.support.v4.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.stylovid.fastbattery.CurrentInfoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.current_info, container, false);

    bl = BatteryLevel.getInstance(getActivity(), pfrag.res.getInteger(R.integer.bl_inSampleSize));
    blv = (ImageView) view.findViewById(R.id.battery_level_view);
    blv.setImageBitmap(bl.getBitmap());/*from  w  w  w. j  a va 2  s.c  o m*/

    battery_use_b = (Button) view.findViewById(R.id.battery_use_b);

    view.findViewById(R.id.vital_stats).setOnClickListener(vsListener);
    current_icon = view.findViewById(R.id.current_icon);

    tv_temp = (TextView) view.findViewById(R.id.temp);
    tv_health = (TextView) view.findViewById(R.id.health);
    tv_voltage = (TextView) view.findViewById(R.id.voltage);
    tv_current = (TextView) view.findViewById(R.id.current);
    plugged_icon = (ImageView) view.findViewById(R.id.plugged_icon);

    bindButtons();

    setSizes(getActivity().getResources().getConfiguration());

    if (!android.support.v4.app.NotificationManagerCompat.from(getActivity()).areNotificationsEnabled()
            && !showingNotificationBlockDialog) {
        showingNotificationBlockDialog = true;
        DialogFragment df = new NotificationsDisabledDialogFragment();
        df.setTargetFragment(this, 0);
        df.show(getFragmentManager(), "TODO: What is this string for?3");
    }

    return view;
}

From source file:edu.cmu.cylab.starslinger.view.ComposeFragment.java

private void showChangeFileOptions() {
    DialogFragment newFragment = ComposeAlertDialogFragment.newInstance(BaseActivity.DIALOG_FILEOPTIONS);
    newFragment.show(getFragmentManager(), "dialog");
}

From source file:com.cmput301w15t15.travelclaimsapp.activitys.EditClaimActivity.java

/**
 * Shows datePicker dialog.// w  w w . j  a va2s  .c  o  m
 * @param View v
 */
public void showTruitonDatePickerDialog(View v) {
    if (v == claimStartDate) {
        Start = true;
    } else {
        Start = false;
    }

    DialogFragment newFragment = new DatePickerFragment();
    newFragment.show(getSupportFragmentManager(), "datePicker");
}

From source file:com.sdrtouch.rtlsdr.DeviceOpenActivity.java

public void showDialog(final DialogFragment dialog) {

    final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    final Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);//  w  ww. j a  v  a  2s . co m
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    try {
        dialog.show(ft, "dialog");
    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:com.schautup.activities.BaseActivity.java

/**
 * Show  {@link android.support.v4.app.DialogFragment}.
 *
 * @param dlgFrg//from w  ww  . j  av  a  2  s  . com
 *       An instance of {@link android.support.v4.app.DialogFragment}.
 * @param tagName
 *       Tag name for dialog, default is "dlg". To grantee that only one instance of {@link
 *       android.support.v4.app.DialogFragment} can been seen.
 */
protected void showDialogFragment(DialogFragment dlgFrg, String tagName) {
    try {
        if (dlgFrg != null) {
            DialogFragment dialogFragment = dlgFrg;
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            // Ensure that there's only one dialog to the user.
            Fragment prev = getSupportFragmentManager().findFragmentByTag("dlg");
            if (prev != null) {
                ft.remove(prev);
            }
            try {
                if (TextUtils.isEmpty(tagName)) {
                    dialogFragment.show(ft, "dlg");
                } else {
                    dialogFragment.show(ft, tagName);
                }
            } catch (Exception _e) {
            }
        }
    } catch (Exception _e) {
    }
}

From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.activities.SensorSettingsActivity.java

private void openSelectDeviceDialog() {
    BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    if (mBluetoothAdapter != null) {
        BluetoothDevice[] mAllBondedDevices = (BluetoothDevice[]) mBluetoothAdapter.getBondedDevices()
                .toArray(new BluetoothDevice[0]);

        int mDeviceIndex = 0;
        if (mAllBondedDevices.length > 0) {
            int deviceCount = mAllBondedDevices.length;
            String[] deviceNames = new String[deviceCount];
            for (int i = 0; i < deviceCount; i++) {
                BluetoothDevice device = mAllBondedDevices[i];
                deviceNames[i] = device.getName() + "\n|" + device.getAddress();
                if (deviceMacAdd.equals(device.getAddress())) {
                    mDeviceIndex = i;//from   w w w. j  a va2s .  c o  m
                }
            }
            DialogFragment deviceDialog = new SelectDeviceDialogFragment();
            Bundle args = new Bundle();
            args.putStringArray("names", deviceNames);
            args.putInt("position", mDeviceIndex);
            args.putBoolean("device", true);
            deviceDialog.setArguments(args);
            getFragmentManager().beginTransaction();
            deviceDialog.show(getSupportFragmentManager().beginTransaction(), "deviceDialog");
        }
    }
}

From source file:edu.cmu.cylab.starslinger.view.ComposeFragment.java

protected void showHelp(String title, String msg) {
    Bundle args = new Bundle();
    args.putString(extra.RESID_TITLE, title);
    args.putString(extra.RESID_MSG, msg);
    DialogFragment newFragment = ComposeAlertDialogFragment.newInstance(BaseActivity.DIALOG_HELP, args);
    newFragment.show(getFragmentManager(), "dialog");
}

From source file:com.nbossard.packlist.gui.MainActivity.java

/**
 * Opens the provided fragment in a dialog.
 *
 * @param parDialogStandardFragment fragment to be opened
 *//* w ww . j  a  v  a 2  s.  c  o m*/
@DebugLog
private void openDialogFragment(final DialogFragment parDialogStandardFragment) {
    if (parDialogStandardFragment != null) {
        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        Fragment prev = fm.findFragmentByTag("changelogdemo_dialog");
        if (prev != null) {
            ft.remove(prev);
        }
        parDialogStandardFragment.show(ft, "changelogdemo_dialog");
    }
}

From source file:com.quarterfull.newsAndroid.ssl.MemorizingTrustManager.java

void interact(final X509Certificate[] chain, CertificateException cause) throws CertificateException {
    /* prepare the MTMDecision blocker object */
    MTMDecision choice = new MTMDecision();
    final int myId = createDecisionId(choice);
    final String certMessage = certChainMessage(chain, cause);

    BroadcastReceiver decisionReceiver = new BroadcastReceiver() {
        public void onReceive(Context ctx, Intent i) {
            interactResult(i);/*from   w  w  w . j ava2s  . c  o  m*/
        }
    };
    mContext.registerReceiver(decisionReceiver,
            new IntentFilter(DECISION_INTENT + "/" + mContext.getPackageName()));
    masterHandler.post(new Runnable() {
        public void run() {
            Intent ni = new Intent(mContext, MemorizingDialogFragment.class);
            ni.setData(Uri.parse(MemorizingTrustManager.class.getName() + "/" + myId));

            Bundle bundle = new Bundle();
            bundle.putString(DECISION_INTENT_APP, mContext.getPackageName());
            bundle.putInt(DECISION_INTENT_ID, myId);
            bundle.putString(DECISION_INTENT_CERT, certMessage);

            DialogFragment dialog = new MemorizingDialogFragment();
            dialog.setArguments(bundle);
            try {
                dialog.show(((FragmentActivity) getUI()).getSupportFragmentManager(), "NoticeDialogFragment");
            } catch (Exception ex) {
                Log.e(TAG, "startActivity: " + ex);
                startActivityNotification(ni, certMessage);
            }
        }
    });

    Log.d(TAG, "openDecisions: " + openDecisions);
    Log.d(TAG, "waiting on " + myId);
    try {
        synchronized (choice) {
            choice.wait();
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    mContext.unregisterReceiver(decisionReceiver);
    Log.d(TAG, "finished wait on " + myId + ": " + choice.state);
    switch (choice.state) {
    case MTMDecision.DECISION_ALWAYS:
        storeCert(chain);
    case MTMDecision.DECISION_ONCE:
        break;
    default:
        throw (cause);
    }
}

From source file:com.remotedroid.app.SelectComputerActivity.java

/**
 * On create.//from   ww w . j a  v  a2s  .  c o  m
 *
 * @param savedInstanceState the saved instance state
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_computer_browser);

    mAdapter = new ArrayAdapter<Computer>(this, android.R.layout.simple_list_item_1);

    mList = (ListView) findViewById(R.id.lstComputers);
    mList.setAdapter(mAdapter);
    mList.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            mSelectedComputer = mAdapter.getItem(arg2);

            ServerUtils.stopSearch();

            if (mLoader != null)
                mLoader.cancel(false);

            DialogFragment dialog = ComputerOptionsDialog.newInstance(SelectComputerActivity.this,
                    mSelectedComputer);
            dialog.show(SelectComputerActivity.this.getSupportFragmentManager(), "OptionsDialog");
        }
    });

    mLabel = (TextView) findViewById(R.id.textView1);
    mProg = (ProgressBar) findViewById(R.id.progressBar1);

    mLoader = new ComputerList();
    mLoader.execute();

}