List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager
public FragmentManager getSupportFragmentManager()
From source file:bbct.android.common.activity.FilterCards.java
private void onConfirm() { Bundle filterArgs = new Bundle(); FragmentActivity activity = Objects.requireNonNull(getActivity()); for (int i = 0; i < TEXT_FIELDS.length; i++) { EditText input = activity.findViewById(TEXT_FIELDS[i]); if (input.isEnabled() && input.getText().toString().length() > 0) { String key = EXTRAS[i]; filterArgs.putString(key, input.getText().toString()); }//from w w w . ja v a 2 s . c o m } BaseballCardList cardList = BaseballCardList.getInstance(filterArgs); activity.getSupportFragmentManager().beginTransaction().replace(R.id.fragment_holder, cardList) .addToBackStack(FILTERED_LIST).commit(); }
From source file:com.app.blockydemo.ui.fragment.FormulaEditorFragment.java
private void onUserDismiss() { formulaEditorEditText.endEdit();/* w ww . java 2 s . c o m*/ currentFormula.prepareToRemove(); FragmentActivity activity = getActivity(); FragmentManager fragmentManager = activity.getSupportFragmentManager(); FragmentTransaction fragTransaction = fragmentManager.beginTransaction(); fragTransaction.hide(this); fragTransaction.show(fragmentManager.findFragmentByTag(ScriptFragment.TAG)); fragTransaction.commit(); resetActionBar(); BottomBar.showBottomBar(activity); BottomBar.showPlayButton(activity); }
From source file:com.gokuai.yunkuandroidsdk.imageutils.ImageWorker.java
public void addImageCache(FragmentActivity activity, String diskCacheDirectoryName) { mImageCacheParams = new ImageCache.ImageCacheParams(activity, diskCacheDirectoryName); mImageCacheParams.setMemCacheSizePercent(0.25f);//FIXME mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); }
From source file:ro.expectations.expenses.ui.backup.BackupFragment.java
private void showBackupAlertDialog() { FragmentActivity activity = getActivity(); if (activity != null && isResumed()) { AlertDialogFragment/*from w w w . j a va 2s. c o m*/ .newInstance(getString(R.string.success), getString(R.string.database_backup_successful), true) .show(activity.getSupportFragmentManager(), "BackupAlertDialogFragment"); } else { mLaunchRestoreAlertDialog = true; } }
From source file:ro.expectations.expenses.ui.backup.BackupFragment.java
private void showRestoreAlertDialog() { FragmentActivity activity = getActivity(); if (activity != null && isResumed()) { AlertDialogFragment/*from w w w . java2 s.c o m*/ .newInstance(getString(R.string.success), getString(R.string.database_restore_successful), true) .show(activity.getSupportFragmentManager(), "RestoreAlertDialogFragment"); } else { mLaunchRestoreAlertDialog = true; } }
From source file:at.alladin.rmbt.android.terms.RMBTCheckFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { if (!(getActivity() instanceof RMBTMainActivity)) firstTime = false;//from w ww . ja va 2 s .c om final View v = inflater.inflate(R.layout.ndt_check, container, false); if (!firstTime) v.findViewById(R.id.termsNdtButtonBack).setVisibility(View.GONE); final TextView textTitle = (TextView) v.findViewById(R.id.check_fragment_title); textTitle.setText(checkType.getTitleId()); checkBox = (CheckBox) v.findViewById(R.id.ndtCheckBox); checkBox.setText(checkType.getTextId()); if (savedInstanceState != null) { checkBox.setChecked(savedInstanceState.getBoolean("isChecked")); } else { checkBox.setChecked(checkType.isDefaultIsChecked()); } final Button buttonAccept = (Button) v.findViewById(R.id.termsNdtAcceptButton); if (!firstTime) { checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { buttonAccept.setEnabled(isChecked); } }); } final WebView wv = (WebView) v.findViewById(R.id.ndtInfoWebView); wv.loadUrl(checkType.getTemplateFile()); buttonAccept.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final FragmentActivity activity = getActivity(); switch (checkType) { case NDT: ConfigHelper.setNDT(activity, checkBox.isChecked()); ConfigHelper.setNDTDecisionMade(activity, true); break; case LOOP_MODE: ConfigHelper.setLoopMode(activity, checkBox.isChecked()); break; } activity.getSupportFragmentManager().popBackStack(checkType.getFragmentTag(), FragmentManager.POP_BACK_STACK_INCLUSIVE); if (firstTime && CheckType.NDT.equals(checkType)) { ((RMBTMainActivity) activity).initApp(false); } else { getActivity().setResult(checkBox.isChecked() ? Activity.RESULT_OK : Activity.RESULT_CANCELED); getActivity().finish(); } } }); new Handler().postDelayed(new Runnable() { @Override public void run() { buttonAccept.setEnabled(firstTime || checkBox.isChecked()); } }, 500); final Button buttonBack = (Button) v.findViewById(R.id.termsNdtBackButton); buttonBack.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { getActivity().getSupportFragmentManager().popBackStack(); } }); return v; }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog informing the user about what went wrong while trying to * registrate her device with GCM./* w w w. j a v a 2 s . c o m*/ * * @param errorCode * the error message's resource ID within <tt>strings.xml</tt> * @param activity * the caller activity * @param finishActivityOnOk * whether the call comes from an activity with no UI that * requires clicks on ok (or back) to call * {@link Activity#finish()} on the caller activity */ public static void onRegistrationError(final int errorCode, final FragmentActivity activity, final boolean finishActivityOnOk) { new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder; if (finishActivityOnOk) { builder = getNoUiBuilder(activity); } else { builder = getBuilder(activity); } builder.setMessage(getString(R.string.gcm_registration_error, getString(errorCode))); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // just hide dialog } }); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(!finishActivityOnOk); return dialog; } }.show(activity.getSupportFragmentManager(), "gcm_error"); }
From source file:com.jlabs.peepaid.searchviewlay.SearchViewLayout.java
/*** * Set the support version fragment which would be shown in the expanded state * @param activity to get support version of fragment manager, activity must be a FragmentActivity * @param contentSupportFragment support version of fragment which needs to be shown. * @throws RuntimeException if content fragment already set *//* www . jav a 2 s .c o m*/ public void setExpandedContentSupportFragment(FragmentActivity activity, android.support.v4.app.Fragment contentSupportFragment) { mExpandedContentSupportFragment = contentSupportFragment; mSupportFragmentManager = activity.getSupportFragmentManager(); mExpandedHeight = Utils.getSizeOfScreen(activity).y; }
From source file:com.example.ustc_pc.myapplication.heightPerformanceImageView.ImageWorker.java
/** * Adds an {@link ImageCache} to this {@link ImageWorker} to handle disk and memory bitmap * caching./* ww w .jav a 2 s . c om*/ * @param activity * @param diskCacheDirectoryName See * {@link ImageCache.ImageCacheParams#ImageCacheParams(android.content.Context, String)}. */ public void addImageCache(FragmentActivity activity, String diskCacheDirectoryName) { mImageCacheParams = new ImageCache.ImageCacheParams(activity, diskCacheDirectoryName); mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams); new CacheImageViewAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); }
From source file:com.intuit.qboecoui.feeds.util.ImageWorker.java
/** * Adds an {@link ImageCache} to this {@link ImageWorker} to handle disk and memory bitmap * caching.//ww w .j a va 2s. c o m * @param activity * @param diskCacheDirectoryName See * {@link ImageCache.ImageCacheParams#ImageCacheParams(Context, String)}. */ public void addImageCache(FragmentActivity activity, String diskCacheDirectoryName) { mImageCacheParams = new ImageCacheParams(activity, diskCacheDirectoryName); mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); }