Java 类android.support.v4.app.DialogFragment 实例源码

项目:RNLearn_Project1    文件:DatePickerDialogTestCase.java   
public void testCallback() throws Throwable {
  final WritableMap options = new WritableNativeMap();
  options.putDouble("date", getDateInMillis(2020, 5, 6));

  final DialogFragment datePickerFragment = showDialog(options);

  runTestOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          ((DatePickerDialog) datePickerFragment.getDialog())
              .getButton(DialogInterface.BUTTON_POSITIVE).performClick();
        }
      });

  getInstrumentation().waitForIdleSync();
  waitForBridgeAndUIIdle();

  assertEquals(0, mRecordingModule.getErrors());
  assertEquals(1, mRecordingModule.getDates().size());
  assertEquals(2020, (int) mRecordingModule.getDates().get(0)[0]);
  assertEquals(5, (int) mRecordingModule.getDates().get(0)[1]);
  assertEquals(6, (int) mRecordingModule.getDates().get(0)[2]);
}
项目:RNLearn_Project1    文件:TimePickerDialogTestCase.java   
public void testDismissCallback() throws Throwable {
  final DialogFragment fragment = showDialog(null);

  assertEquals(0, mRecordingModule.getDismissed());

  runTestOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          fragment.getDialog().dismiss();
        }
      });

  getInstrumentation().waitForIdleSync();
  waitForBridgeAndUIIdle();

  assertEquals(0, mRecordingModule.getErrors());
  assertEquals(0, mRecordingModule.getTimes().size());
  assertEquals(1, mRecordingModule.getDismissed());
}
项目:KUtils-master    文件:ErrorDialogManager.java   
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);
    // Execute pending commits before finding to avoid multiple error fragments being shown
    FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    DialogFragment errorFragment = (DialogFragment) factory
            .prepareErrorFragment(event, finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
项目:VanGogh    文件:BaseDialogFragment.java   
/**
 * 监听返回键
 */
private void onBackPressed() {
    //设置窗口以对话框样式显示
    setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Dialog);
    //设置对话框背景色,否则有虚框
    getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    getDialog().setCancelable(isCancelable);
    getDialog().setCanceledOnTouchOutside(isCancelableTouchOutSide);

    getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
                if (isBack) {
                    onCancel();
                }
                return !isBack;
            }

            return false;
        }
    });
}
项目:OKEventBus    文件:ErrorDialogManager.java   
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);
    // Execute pending commits before finding to avoid multiple error fragments being shown
    FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    DialogFragment errorFragment = (DialogFragment) factory
            .prepareErrorFragment(event, finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
项目:UiLib    文件:GuideActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_guide);
    ArrayList<Integer> layouts = new ArrayList<>();

    List<Integer> list = Arrays.asList(R.layout.view_guide_one,
            R.layout.view_guide_two,
            R.layout.view_guide_three,
            R.layout.view_guide_four);
    layouts.addAll(list);


    DialogFragment guideFg = GuideFragment.newInstance(0.85f, 0.7f, layouts);
    FragmentManager fm = getSupportFragmentManager();
    guideFg.show(fm, "guide fg");
}
项目:RNLearn_Project1    文件:DatePickerDialogTestCase.java   
public void testCallback() throws Throwable {
  final WritableMap options = new WritableNativeMap();
  options.putDouble("date", getDateInMillis(2020, 5, 6));

  final DialogFragment datePickerFragment = showDialog(options);

  runTestOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          ((DatePickerDialog) datePickerFragment.getDialog())
              .getButton(DialogInterface.BUTTON_POSITIVE).performClick();
        }
      });

  getInstrumentation().waitForIdleSync();
  waitForBridgeAndUIIdle();

  assertEquals(0, mRecordingModule.getErrors());
  assertEquals(1, mRecordingModule.getDates().size());
  assertEquals(2020, (int) mRecordingModule.getDates().get(0)[0]);
  assertEquals(5, (int) mRecordingModule.getDates().get(0)[1]);
  assertEquals(6, (int) mRecordingModule.getDates().get(0)[2]);
}
项目:OKEventBus    文件:ErrorDialogManager.java   
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);

    // Execute pending commits before finding to avoid multiple error fragments being shown
    android.app.FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    android.app.DialogFragment existingFragment = (android.app.DialogFragment) fm
            .findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    android.app.DialogFragment errorFragment = (android.app.DialogFragment) factory.prepareErrorFragment(event,
            finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
项目:Hexis    文件:EditItemDialogFragment.java   
/**
 * Factory method for creating the DialogFragment with a listener.
 * @param item        QuadrantItem being manipulated
 * @param listener    Listener for passing back the information to update item in QuadrantItem
 * @return            New EditItemDialogFragment instance
 */
public static DialogFragment newInstance(QuadrantItem item, ModifyItemListener listener,
                                         String title) {

  // Initialize new EditItemDialogFragment fragment
  DialogFragment dialog = new EditItemDialogFragment();

  // Pass itemUid to onCreateDialog
  Bundle args = new Bundle();
  args.putParcelable("quadrantItem", item);
  dialog.setArguments(args);

  // Set the listener
  ((EditItemDialogFragment) dialog).setListener(listener);
  ((ModifyItemDialogFragment) dialog).setTitle(title);

  // Return the dialog
  return dialog;
}
项目:Options    文件:DialogListOption.java   
@Override
protected View createView(ViewGroup parent) {
    View root = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.dialog_option, parent, false);

    TextView title = (TextView) root.findViewById(R.id.preference_dialog_title);
    TextView detail = (TextView) root.findViewById(R.id.preference_dialog_description);
    mDetailTextView = new WeakReference<>(detail);

    title.setText(getTitle());
    detail.setText(getSelection().getName());

    root.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            DialogFragment fragment = ListDialogFragment.create(getValues(), getSelection());
            fragment.setTargetFragment(getFragment(), getOptionId());
            fragment.show(getFragment().getFragmentManager(), DIALOG_TAG);
        }
    });

    return root;
}
项目:Chidori    文件:ErrorDialogManager.java   
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);
    // Execute pending commits before finding to avoid multiple error fragments being shown
    FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    DialogFragment errorFragment = (DialogFragment) factory
            .prepareErrorFragment(event, finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
项目:Chidori    文件:ErrorDialogManager.java   
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);

    // Execute pending commits before finding to avoid multiple error fragments being shown
    android.app.FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    android.app.DialogFragment existingFragment = (android.app.DialogFragment) fm
            .findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    android.app.DialogFragment errorFragment = (android.app.DialogFragment) factory.prepareErrorFragment(event,
            finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
项目:RNLearn_Project1    文件:DatePickerDialogTestCase.java   
public void testPresetDate() {
  final WritableMap options = new WritableNativeMap();
  options.putDouble("date", getDateInMillis(2020, 5, 6));

  final DialogFragment datePickerFragment = showDialog(options);
  final DatePicker datePicker =
      ((DatePickerDialog) datePickerFragment.getDialog()).getDatePicker();

  assertEquals(2020, datePicker.getYear());
  assertEquals(5, datePicker.getMonth());
  assertEquals(6, datePicker.getDayOfMonth());
}
项目:ActivityDiary    文件:MainActivity.java   
@Override
public void onNoteEditPositiveClock(String str, DialogFragment dialog) {
    ContentValues values = new ContentValues();
    values.put(ActivityDiaryContract.Diary.NOTE, str);

    mQHandler.startUpdate(0,
            null,
            mCurrentDiaryUri,
            values,
            null, null);
    mNoteTextView.setText(str);
    ActivityHelper.helper.setCurrentNote(str);
}
项目:zabbkit-android    文件:LoadingDialogActivity.java   
protected boolean dismissDialog() {
    boolean isVisible = false;
    Fragment prev = getSupportFragmentManager().findFragmentByTag(LoadingDialog.DIALOG_TAG);
    if (prev != null) {
        DialogFragment df = (DialogFragment) prev;
        df.dismiss();
        isVisible = true;
    }
    return isVisible;
}
项目:FCM-for-Mojo    文件:HttpUriPreference.java   
@NonNull
@Override
protected DialogFragment onCreateDialogFragment(String key) {
    final HttpUriPreferenceDialogFragment fragment = new HttpUriPreferenceDialogFragment();
    final Bundle b  = new Bundle(1);
    b.putString(PreferenceDialogFragment.ARG_KEY, key);
    b.putString(HttpUriPreferenceDialogFragment.ARG_KEY_USERNAME, keyUsername);
    b.putString(HttpUriPreferenceDialogFragment.ARG_KEY_PASSWORD, keyPassword);
    fragment.setArguments(b);
    return fragment;
}
项目:MakiLite    文件:MainActivity.java   
@Override
public void onCreateHomeScreenShortcutCreate(DialogFragment dialog) {

    Intent bookmarkShortcut = new Intent();
    bookmarkShortcut.setAction(Intent.ACTION_VIEW);
    bookmarkShortcut.setData(Uri.parse(UrlCleaner));
    Intent shortcutMaker = new Intent();
    shortcutMaker.putExtra("duplicate", false);
    shortcutMaker.putExtra("android.intent.extra.shortcut.INTENT", bookmarkShortcut);
    shortcutMaker.putExtra("android.intent.extra.shortcut.ICON", favoriteIcon);
    shortcutMaker.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    sendBroadcast(shortcutMaker);
}
项目:pracler    文件:MyMusicListFragment.java   
public void showDialog(ArrayList<Boolean> state) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    //String inputText = inputTextField.getText().toString();

    DialogFragment newFragment = MyDialogFragment.newInstance(state, list);
    newFragment.show(ft, "dialog");

}
项目:Ships    文件:OpenDeviceActivity.java   
private void showDialog(final DialogFragment dialog, final String nameOfFragment) {
    final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    final Fragment prev = getSupportFragmentManager().findFragmentByTag(nameOfFragment);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    dialog.show(ft, nameOfFragment);
}
项目:Neuronizer    文件:FileDialogs.java   
private static void showFileDialog(FragmentActivity activity, FileDialog dialog) {
    Bundle args = new Bundle();
    args.putString(FileDialog.EXTENSION, REPOSITORY_EXTENSION);
    dialog.setArguments(args);
    dialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppTheme);
    dialog.show(activity.getSupportFragmentManager(), OpenFileDialog.class.getName());
}
项目:ELM327    文件:MainActivity.java   
private void showChooserDialog(DialogFragment dialogFragment)
{
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag(TAG_DIALOG);
    if (prev != null)
    {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    dialogFragment.show(ft, "dialog");
}
项目:TDList    文件:MainActivity.java   
@Override
public void onDialogPositiveClick(DialogFragment dialog, TaskItem dataModel) {
    int position=TaskItem.findTaskPosition((ArrayList) mainList,dataModel.getTask());
    Log.d("MainActivity",mainList.get(position).getDeadlineDate()+", new: "+dataModel.getDeadlineDate());
    mainList.get(position).setDeadlineDate(dataModel.getDeadlineDate());
    ad.notifyDataSetChanged();
}
项目:MyAnimeViewer    文件:LibraryMaterialFragment.java   
public void dismissDialog() {
    final FragmentManager fm = getFragmentManager();
    if (fm == null)
        return;
    Fragment prev = fm.findFragmentByTag("cadfragment");
    if (prev != null) {
        DialogFragment df = (DialogFragment) prev;
        df.dismiss();
    }
}
项目:Runnest    文件:SideBarActivity.java   
/**
 * click 'Close'in the Memo Dialog.
 * @param dialog the Memo Dialog.
 */
@Override
public void onMemoDialogCloseClick(DialogFragment dialog){

    if(dialog == null){
        throw new IllegalArgumentException("Invalid argument 'dialog' on onMemoDialogCloseClick method");
    }
}
项目:RNLearn_Project1    文件:DatePickerDialogTestCase.java   
private DialogFragment showDialog(WritableMap options) {
  getTestModule().showDatePickerDialog(options);

  waitForBridgeAndUIIdle();
  getInstrumentation().waitForIdleSync();

  return (DialogFragment) getActivity().getSupportFragmentManager()
      .findFragmentByTag(DatePickerDialogModule.FRAGMENT_TAG);
}
项目:redpacketui-open    文件:RPBaseDialogFragment.java   
public void showAllowingStateLost(DialogFragment fragment, FragmentActivity activity) {
    if (activity != null) {
        FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
        ft.add(fragment, RPConstant.RP_PACKET_DIALOG_TAG);
        ft.commitAllowingStateLoss();
    }
}
项目:Alligator    文件:DialogFragmentHelper.java   
public void hideDialog() {
    DialogFragment dialogFragment = (DialogFragment) mFragmentManager.findFragmentByTag(TAG);
    if (dialogFragment == null) {
        throw new IllegalStateException("Dialog is not visible.");
    }

    dialogFragment.dismiss();
    mFragmentManager.executePendingTransactions();
}
项目:RNLearn_Project1    文件:TimePickerDialogTestCase.java   
private DialogFragment showDialog(WritableMap options) {
  getTestModule().showTimePickerDialog(options);

  waitForBridgeAndUIIdle();
  getInstrumentation().waitForIdleSync();

  return (DialogFragment) getActivity().getSupportFragmentManager()
      .findFragmentByTag(TimePickerDialogModule.FRAGMENT_TAG);
}
项目:zabbkit-android    文件:LoadingDialogActivity.java   
protected void showDialog() {
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag(LoadingDialog.DIALOG_TAG);
    if (prev == null) {
        ft.addToBackStack(null);
        DialogFragment newFragment = LoadingDialog.newInstance();
        newFragment.show(ft, LoadingDialog.DIALOG_TAG);
    }
}
项目:Runnest    文件:SideBarActivity.java   
/**
 * click 'Accept' in a Challenge Dialog.
 * @param dialog the Challenge Dialog.
 */
@Override
public void onSendChallengeDialogPositiveClick(DialogFragment dialog) {

    if(dialog == null){
        throw new IllegalArgumentException("Invalid argument 'dialog' on onSendChallengeDialogPositiveClick method");
    }

    Challenge.Type challengeType = ((RequestChallengeDialogFragment)dialog).getType();
    int firstValue = ((RequestChallengeDialogFragment)dialog).getFirstValue();
    int secondValue = ((RequestChallengeDialogFragment)dialog).getSecondValue();

    // Send message
    String from = ((AppRunnest) getApplication()).getUser().getEmail();
    String to = FirebaseHelper.getFireBaseMail(challengedUserEmail);
    String sender = ((AppRunnest) getApplication()).getUser().getName();

    Random rnd = new Random();
    int rndNumber = 100000 + rnd.nextInt(900000);
    String message = Integer.toString(rndNumber);
    Date timestampId = new Date();
    Message challengeRequestMessage = new Message(from, to, sender, challengedUserName,
            Message.Type.CHALLENGE_REQUEST, message, timestampId, firstValue, secondValue, challengeType);

    FirebaseHelper firebaseHelper = new FirebaseHelper();
    firebaseHelper.sendMessage(challengeRequestMessage);


    Intent intent = new Intent(this, ChallengeActivity.class);
    intent.putExtra("type", challengeType);
    intent.putExtra("firstValue", firstValue);
    intent.putExtra("secondValue", secondValue);
    intent.putExtra("owner", true);
    intent.putExtra("opponent", challengedUserName);
    intent.putExtra("msgId", message);

    searchView.setQuery("", false);
    //TODO define result code
    startActivityForResult(intent, 1);
}
项目:Blockly    文件:BlocklyActivityHelper.java   
/**
 * Shows a dialog UI to the user. Only one dialog will be shown at a time and if there is
 * already an existing one it will be replaced. This can be used for showing application or
 * block specific UIs, such as a mutator UI. When the user finishes using the fragment
 * {@link #closeDialogFragment()} should be called.
 *
 * @param fragment The fragment to show.
 */
public void showDialogFragment(@NonNull DialogFragment fragment) {
    if (fragment == mDialogFragment) {
        return;
    }

    FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
    if (mDialogFragment != null) {
        ft.remove(mDialogFragment);
    }
    fragment.show(ft, "blockly_dialog");
    mDialogFragment = fragment;
}
项目:TherapyGuide    文件:DiaryFragment.java   
@Override
public void showDiaryEntryDeletionMessage(final int position) {
    mDeletionPosition = position;
    DialogFragment newFragment = new DeleteDiaryEntryDialogFragment();
    newFragment.setTargetFragment(this, ENTRY_DELETION_REQ_CODE);
    newFragment.show(getFragmentManager(), "delete entry");
}
项目:BaseCore    文件:TBaseButtomFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(DialogFragment.STYLE_NO_TITLE, R.style.BottomDialog);
    //创建Presenter
    mPresenter = createPresenter();
    //内存泄漏
    //关联View
    mPresenter.attachView((V) this);
    mDisposableContainer = new ListCompositeDisposable();
    mActivityContext = getContext();
    L.logFile("创建fragment:" + getClass().getSimpleName());

}
项目:KernelAdiutor-Mod    文件:ViewUtils.java   
public static void showDialog(FragmentManager manager, DialogFragment fragment) {
    FragmentTransaction ft = manager.beginTransaction();
    Fragment prev = manager.findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    fragment.show(ft, "dialog");
}
项目:BilibiliClient    文件:CardPickerDialog.java   
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);
  setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppTheme_AppCompat_Dialog_Alert);
  mCurrentTheme = ThemeHelper.getTheme(getActivity());
}
项目:underlx    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Action bar menu item selected

    switch (item.getItemId()) {
        case R.id.menu_debug:
            new AsyncTask<Void, Void, String>() {

                @Override
                protected String doInBackground(Void... voids) {
                    if (locBound) {
                        return locService.dumpDebugInfo();
                    }
                    return "";
                }

                @Override
                protected void onPostExecute(String s) {
                    if (!isFinishing() && isVisible) {
                        DialogFragment newFragment = HtmlDialogFragment.newInstance(s, false);
                        newFragment.show(getSupportFragmentManager(), "debugtext");
                    }
                }
            }.execute();
            return true;
    }

    return super.onOptionsItemSelected(item);
}
项目:android-chessclock    文件:TimeControlFragment.java   
/**
 * Launch Stage Editor Dialog where the user can manipulate the Stage's properties.
 */
private void showStageEditorDialog() {

    // Get correct Stage.
    Stage stage = mTimeControl.getStageManager().getStages()[mEditableStageIndex];

    // Setup Stage Editor Dialog.
    DialogFragment newFragment = new StageEditorDialogFragment(getActivity(), stage);
    newFragment.setTargetFragment(this, REQUEST_STAGE_DIALOG);

    // Launch Stage Editor Dialog.
    newFragment.show(getActivity().getSupportFragmentManager(), TAG_STAGE_EDITOR_DIALOG_FRAGMENT);
}
项目:SimpleAvatarPicker    文件:MainActivity.java   
private void dismissPictureChooserDialog() {
    Fragment prev = getSupportFragmentManager().findFragmentByTag("fragment_dialog");
    if (prev != null) {
        DialogFragment df = (DialogFragment) prev;
        df.dismissAllowingStateLoss();
    }
}
项目:RetroMusicPlayer    文件:SettingsActivity.java   
@Nullable
@Override
public DialogFragment onCreatePreferenceDialog(Preference preference) {
    if (preference instanceof NowPlayingScreenPreference) {
        return NowPlayingScreenPreferenceDialog.newInstance();
    } else if (preference instanceof BlacklistPreference) {
        return BlacklistPreferenceDialog.newInstance();
    } else if (preference instanceof LibraryPreference) {
        return LibraryPreferenceDialog.newInstance();
    }
    return super.onCreatePreferenceDialog(preference);
}
项目:Hexis    文件:QuadrantFragment.java   
@Override
public void onItemLongClick(QuadrantItem item) {
  FragmentManager manager = getActivity().getSupportFragmentManager();

  // Get a new instance of the AddItemDialogFragment
  DialogFragment dialog =
      EditItemDialogFragment.newInstance(item,
          new AddItemOnClickListener(presenter.getMatrixPresenter().getPager()),
          getString(R.string.edit_item));

  // Show the dialog and set its tag.
  dialog.show(manager, "Edit Item");
}