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.lovejoy777sarootool.rootool.fragments.BrowserFragment.java

private void listItemAction(File file) {
    String item_ext = FilenameUtils.getExtension(file.getName());

    if (item_ext.equalsIgnoreCase("zip") || item_ext.equalsIgnoreCase("rar")) {
        final DialogFragment dialog = UnpackDialog.instantiate(file);
        dialog.show(fm, BrowserActivity.TAG_DIALOG);
    } else {/*from w  ww.j a  v a 2  s . c o  m*/
        SimpleUtils.openFile(mActivity, file);
    }
}

From source file:com.lovejoy777sarootool.rootool.fragments.BrowserFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.folderinfo:
        final DialogFragment dirInfo = new DirectoryInfoDialog();
        dirInfo.show(fm, BrowserActivity.TAG_DIALOG);
        return true;
    case R.id.search:
        Intent sintent = new Intent(mActivity, SearchActivity.class);
        startActivity(sintent);//from   ww w . j ava 2s.c o m
        return true;
    case R.id.paste:
        final PasteTaskExecutor ptc = new PasteTaskExecutor(mActivity, mCurrentPath);
        ptc.start();
        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.coinblesk.client.wallet.WalletAddressList.java

private void showCollectRefundOptionsDialog(Coin amount) {
    // there are two options for the user:
    // (1) user pays to current receive address of this wallet, i.e. in order to lock the funds again.
    // (2) user pays to custom address (external wallet)
    DialogFragment optionsDialog = CollectRefundOptionsDialog.newInstance(amount);
    optionsDialog.setTargetFragment(this, 0);
    optionsDialog.show(getFragmentManager(), "collect_refund_options_dialog");
}

From source file:cmput301.f13t01.readstory.ReadFragmentActivity.java

/**
 * displays screen specific help//from  w  ww.ja  v  a  2s  .  c  om
 */
private void onSelectHelp() {
    android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
    android.app.Fragment prev = getFragmentManager().findFragmentByTag("help_dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    android.app.DialogFragment newFragment = (android.app.DialogFragment) HelpFragment
            .newInstance(HelpMessage.READ_STORY);
    newFragment.show(ft, "help_dialog");
}

From source file:cmput301.f13t01.editstory.EditStoryActivity.java

/**
 * Display selection of fragment/* ww  w . jav a 2s . c o m*/
 */
public void showFragmentSelection() {
    android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
    android.app.Fragment prev = getFragmentManager().findFragmentByTag("choice_dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    android.app.DialogFragment newFragment = (android.app.DialogFragment) StoryFragmentListFragment
            .newInstance();
    newFragment.show(ft, "choice_dialog");
}

From source file:net.hockeyapp.android.internal.CheckUpdateTask.java

private void showUpdateFragment(final JSONArray updateInfo) {
    FragmentTransaction fragmentTransaction = activity.getFragmentManager().beginTransaction();
    fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);

    Fragment existingFragment = activity.getFragmentManager().findFragmentByTag("hockey_update_dialog");
    if (existingFragment != null) {
        fragmentTransaction.remove(existingFragment);
    }/*from   w  ww.j  a  v  a  2 s  .co  m*/
    fragmentTransaction.addToBackStack(null);

    // Create and show the dialog
    Class<? extends UpdateFragment> fragmentClass = UpdateFragment.class;
    if (listener != null) {
        fragmentClass = listener.getUpdateFragmentClass();
    }

    try {
        Method method = fragmentClass.getMethod("newInstance", JSONArray.class, String.class);
        DialogFragment updateFragment = (DialogFragment) method.invoke(null, updateInfo, getURLString("apk"));
        updateFragment.show(fragmentTransaction, "hockey_update_dialog");
    } catch (Exception e) {
        Log.d(Constants.TAG, "An exception happened while showing the update fragment:");
        e.printStackTrace();
        Log.d(Constants.TAG, "Showing update activity instead.");
        startUpdateIntent(updateInfo, false);
    }
}

From source file:cmput301.f13t01.editstory.EditStoryActivity.java

private void onSelectHelp() {
    android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
    android.app.Fragment prev = getFragmentManager().findFragmentByTag("help_dialog");
    if (prev != null) {
        ft.remove(prev);//w w w .  j a  va2 s .com
    }
    ft.addToBackStack(null);

    android.app.DialogFragment newFragment = (android.app.DialogFragment) HelpFragment
            .newInstance(HelpMessage.EDIT_STORY);
    newFragment.show(ft, "help_dialog");
}

From source file:com.doomy.decode.ScanActivity.java

@Override
public void onItemClick(AdapterView<?> listview, View v, int position, long id) {
    Scan myContact = (Scan) listview.getItemAtPosition(position);

    String myFormat = myContact.getFormat().toString();
    String myContent = myContact.getContent().toString();

    DialogFragment mFragment = ResultDialogFragment.newInstance(myFormat, myContent, false, this);
    mFragment.show(ScanActivity.this.getFragmentManager(), "result");
}

From source file:com.digitalobstaclecourse.bluefinder.FindCar.java

public void onItemSelected(String id, String type) {
    if (getUsesRemaining() > 0 || hasInfiniteLicense()) {
        //Log.d(TAG, "Item selected: " + id);
        if (mDataAccess.locationsExistForId(id)) {
            if (mTwoPane) {
                //Log.d(TAG, "item selected = " + id);
                Bundle arguments = new Bundle();
                arguments.putString("DEVICE_ID", id);
                ((FindCarMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                        .displayLocationsForDevice(id);
            } else {
                Intent detailIntent = new Intent(this, FindCarLocatorActivity.class);
                detailIntent.putExtra("DEVICE_ID", id);
                startActivity(detailIntent);
            }/*w  w  w  . ja  va  2 s  .c  o m*/
            mDataAccess.increment_number_of_locations();
            refresh_action_view();
        } else {
            Toast.makeText(this, "No locations recorded for this device", Toast.LENGTH_SHORT).show();
        }
    } else {
        DialogFragment newFragment = new BuyInAppDialogFragment();
        newFragment.show(getFragmentManager(), "purchase_dialog");
    }
}

From source file:com.coinblesk.client.CurrentBalanceFragment.java

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

    recyclerView = (RecyclerView) view.findViewById(R.id.txhistoryview);
    View empty = view.findViewById(R.id.txhistory_emptyview);
    recyclerView.setEmptyView(empty);/*from   www.  ja  v  a 2s  .c  o m*/
    transactionAdapter = new TransactionWrapperRecyclerViewAdapter(new ArrayList<TransactionWrapper>());
    recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
    recyclerView.setAdapter(transactionAdapter);
    updateTransactions();

    ImageView switcher = (ImageView) view.findViewById(R.id.balance_switch_image_view);
    switcher.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (SharedPrefUtils.isBitcoinPrimaryBalance(getActivity())) {
                SharedPrefUtils.setFiatPrimaryBalance(getActivity());
            } else {
                SharedPrefUtils.setBitcoinPrimaryBalance(getActivity());
            }
            refreshBalance();
        }
    });

    TextView t1 = (TextView) view.findViewById(R.id.balance_large);
    TextView t2 = (TextView) view.findViewById(R.id.balance_large_currency);
    TextView t3 = (TextView) view.findViewById(R.id.balance_small);
    TextView t4 = (TextView) view.findViewById(R.id.balance_small_currency);

    View.OnLongClickListener listener = new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            DialogFragment fragment = CurrencyDialogFragment.newInstance();
            if (fragment != null) {
                fragment.show(CurrentBalanceFragment.this.getFragmentManager(), TAG);
            }
            return true;
        }
    };

    t1.setOnLongClickListener(listener);
    t2.setOnLongClickListener(listener);
    t3.setOnLongClickListener(listener);
    t4.setOnLongClickListener(listener);
    return view;
}