use of android.widget.EditText in project android by owncloud.
the class RenameFileDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mTargetFile = getArguments().getParcelable(ARG_TARGET_FILE);
// Inflate the layout for the dialog
LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.edit_box_dialog, null);
// Setup layout
String currentName = mTargetFile.getFileName();
EditText inputText = ((EditText) v.findViewById(R.id.user_input));
inputText.setText(currentName);
int selectionStart = 0;
int extensionStart = mTargetFile.isFolder() ? -1 : currentName.lastIndexOf(".");
int selectionEnd = (extensionStart >= 0) ? extensionStart : currentName.length();
if (selectionStart >= 0 && selectionEnd >= 0) {
inputText.setSelection(Math.min(selectionStart, selectionEnd), Math.max(selectionStart, selectionEnd));
}
inputText.requestFocus();
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(v).setPositiveButton(R.string.common_ok, this).setNegativeButton(R.string.common_cancel, this).setTitle(R.string.rename_dialog_title);
Dialog d = builder.create();
d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return d;
}
use of android.widget.EditText in project android by owncloud.
the class CreateFolderDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mParentFolder = getArguments().getParcelable(ARG_PARENT_FOLDER);
// Inflate the layout for the dialog
LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.edit_box_dialog, null);
// Setup layout
EditText inputText = ((EditText) v.findViewById(R.id.user_input));
inputText.setText("");
inputText.requestFocus();
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(v).setPositiveButton(R.string.common_ok, this).setNegativeButton(R.string.common_cancel, this).setTitle(R.string.uploader_info_dirname);
Dialog d = builder.create();
d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return d;
}
use of android.widget.EditText in project mobile-android by photo.
the class MemePanel method beginEditText.
/**
* Begin edit text.
*
* @param view
* the view
*/
private void beginEditText(final DrawableHighlightView view) {
mLogger.info("beginEditText", view);
EditText editText = null;
if (view == topHv) {
editText = editTopText;
} else if (view == bottomHv) {
editText = editBottomText;
}
if (editText != null) {
mEditTextWatcher.view = null;
editText.removeTextChangedListener(mEditTextWatcher);
final EditableDrawable editable = (EditableDrawable) view.getContent();
final String oldText = (String) editable.getText();
editText.setText(oldText);
editText.setSelection(editText.length());
editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
editText.requestFocusFromTouch();
Handler handler = new Handler();
ResultReceiver receiver = new ResultReceiver(handler);
if (!mInputManager.showSoftInput(editText, 0, receiver)) {
// TODO: verify
mInputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
mEditTextWatcher.view = view;
editText.setOnEditorActionListener(this);
editText.addTextChangedListener(mEditTextWatcher);
((ImageViewDrawableOverlay) mImageView).setSelectedHighlightView(view);
((EditableDrawable) view.getContent()).setText(((EditableDrawable) view.getContent()).getText());
view.forceUpdate();
}
}
use of android.widget.EditText in project mobile-android by photo.
the class MemePanel method endEditText.
/**
* End edit text.
*
* @param view
* the view
*/
private void endEditText(final DrawableHighlightView view) {
mLogger.info("endEditText", view);
mEditTextWatcher.view = null;
EditText editText = null;
if (view == topHv)
editText = editTopText;
else if (view == bottomHv)
editText = editBottomText;
if (editText != null) {
editText.removeTextChangedListener(mEditTextWatcher);
if (mInputManager.isActive(editText)) {
mInputManager.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
editText.clearFocus();
}
// this will send the focus to the bottom panel
// but also creating a bad visual effect
//mOptionView.requestFocus();
}
use of android.widget.EditText in project mobile-android by photo.
the class AccountLogin method forgotPasswordButtonAction.
public void forgotPasswordButtonAction(View view) {
CommonUtils.debug(TAG, "Recover user password");
TrackerUtils.trackButtonClickEvent("forgot_password_button", AccountLogin.this);
EditText editText = (EditText) findViewById(R.id.edit_email);
String email = editText.getText().toString();
if (!GuiUtils.validateBasicTextData(new String[] { email }, new int[] { R.string.field_email })) {
return;
}
getRecoverPasswordFragment().recoverPassword(email);
}
Aggregations