@Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        getToolbar().setTitle(R.string.pd_name_edit);
        final String data = getArguments().getString(PARAM1);
        boolean onlyNumber = getArguments().getBoolean(PARAM2, false);
        if (onlyNumber) {
            editText.setInputType(
                    InputType.TYPE_CLASS_NUMBER
                    | InputType.TYPE_NUMBER_FLAG_SIGNED
                            | InputType.TYPE_NUMBER_FLAG_DECIMAL);
        }
        editText.setText(data);
        editText.setSelection(editText.getText().length());
        canNotEdit = getArguments().getBoolean(PARAM4);
        if (canNotEdit) {
            editText.setEnabled(false);
        } else {
            editText.requestFocus();
        }

        getToolbar().getMenu().add(-1, -1, 0, R.string.pd_name_save).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        getToolbar().setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                String curValue = editText.getText().toString();
                if (!TextUtils.equals(curValue, data)) {
                    notifyResult(curValue);
                } else {
                    Utils.toast(R.string.pd_no_change);
                }
                return true;
            }
        });
    }
Created by linjiang on 03/06/2018.

PARAM1: Default content
PARAM2: only allow number or not
PARAM3: Quick input options
PARAM4: if can edit
pandora-core/src/main/java/tech/linjiang/pandora/ui/fragment/EditFragment.java