Java Code Examples for android.widget.EditText#setOnEditorActionListener()

The following examples show how to use android.widget.EditText#setOnEditorActionListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PassphrasePromptActivity.java    From Silence with GNU General Public License v3.0 6 votes vote down vote up
private void initializeResources() {
  getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
  getSupportActionBar().setCustomView(R.layout.centered_app_title);

  ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);
  passphraseText       = (EditText)    findViewById(R.id.passphrase_edit);
  SpannableString hint = new SpannableString("  " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
  hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
  hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);

  passphraseText.setHint(hint);
  okButton.setOnClickListener(new OkButtonClickListener());
  passphraseText.setOnEditorActionListener(new PassphraseActionListener());
  passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
                                   EditorInfo.IME_ACTION_DONE);
}
 
Example 2
Source File: MainActivity.java    From cloud-cup-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Firebase.setAndroidContext(this);
    setContentView(R.layout.activity_main);

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .build();

    firebase = new Firebase(Consts.FIREBASE_URL);
    username = (TextView) findViewById(R.id.username);
    userImage = (ImageView) findViewById(R.id.user_image);
    code = (EditText) findViewById(R.id.code);
    code.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            join();
            return true;
        }
    });
    code.requestFocus();
}
 
Example 3
Source File: QueryableTimelineFragment.java    From twitt4droid with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
protected void setUpLayout(View layout) {
    super.setUpLayout(layout);
    searchEditText = (EditText) layout.findViewById(R.id.search_edit_text);
    searchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            switch (actionId) {
                case EditorInfo.IME_ACTION_SEARCH:
                    String text = v.getText().toString().trim();
                    if (text.length() > 0) {
                        lastQuery = text;
                        hideSoftKeyboard();
                        reloadTweetsIfPossible();
                    }
                    return true;
                default:
                    return false;
            }
        }
    });
}
 
Example 4
Source File: DialogHdmImportWordListReplace.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public DialogHdmImportWordListReplace(Activity context, int index,
                                      DialogHdmImportWordListReplaceListener listener) {
    super(context);
    this.activity = context;
    this.index = index;
    this.listener = listener;
    setContentView(R.layout.dialog_hdm_import_word_list_replace);
    et = (EditText) findViewById(R.id.et);
    tvError = (TextView) findViewById(R.id.tv_error);
    et.addTextChangedListener(textWatcher);
    et.setOnEditorActionListener(this);
    findViewById(R.id.btn_ok).setOnClickListener(this);
    findViewById(R.id.btn_cancel).setOnClickListener(this);
    setOnShowListener(this);
    imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
}
 
Example 5
Source File: UARTLogFragment.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
	final View view = inflater.inflate(R.layout.fragment_feature_uart_log, container, false);

	final EditText field = this.field = view.findViewById(R.id.field);
	field.setOnEditorActionListener((v, actionId, event) -> {
		if (actionId == EditorInfo.IME_ACTION_SEND) {
			onSendClicked();
			return true;
		}
		return false;
	});

	final Button sendButton = this.sendButton = view.findViewById(R.id.action_send);
	sendButton.setOnClickListener(v -> onSendClicked());
	return view;
}
 
Example 6
Source File: MainActivity.java    From SizeAdjustingTextView with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mMessageEditText = (EditText)findViewById(R.id.text_input);
    mMessageEditText.setOnEditorActionListener(actionListener);
    mTopMessageBox = (SizeAdjustingTextView)findViewById(R.id.topBox);

    mMiddleLeftBox = (SizeAdjustingTextView)findViewById(R.id.middleLeftBox);
    mMiddleRightBox = (SizeAdjustingTextView)findViewById(R.id.middleRightBox);

    mBottomLeftBox = (SizeAdjustingTextView)findViewById(R.id.bottomLeftBox);
    mBottomMiddleBox = (SizeAdjustingTextView)findViewById(R.id.bottomMiddleBox);
    mBottomRightBox = (SizeAdjustingTextView)findViewById(R.id.bottomRightBox);
}
 
Example 7
Source File: FragmentComposeMessage.java    From ploggy with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.compose_message, container, false);

    mSetPictureButton = (ImageButton)view.findViewById(R.id.compose_message_set_picture_button);
    mPictureThumbnail = (ImageView)view.findViewById(R.id.compose_message_picture_thumbnail);
    mContentEdit = (EditText)view.findViewById(R.id.compose_message_content_edit);
    mSendButton = (ImageButton)view.findViewById(R.id.compose_message_send_button);

    mSetPictureButton.setOnClickListener(this);

    mPictureThumbnail.setVisibility(View.GONE);
    mPictureThumbnail.setOnClickListener(this);
    registerForContextMenu(mPictureThumbnail);

    InputFilter[] filters = new InputFilter[1];
    filters[0] = new InputFilter.LengthFilter(Protocol.MAX_MESSAGE_LENGTH);
    mContentEdit.setFilters(filters);
    mContentEdit.setOnEditorActionListener(this);

    mSendButton.setOnClickListener(this);

    return view;
}
 
Example 8
Source File: EnterPhoneNumberFragment.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private void setUpNumberInput() {
  EditText numberInput = number.getInput();

  numberInput.addTextChangedListener(new NumberChangedListener());

  number.setOnFocusChangeListener((v, hasFocus) -> {
    if (hasFocus) {
      scrollView.postDelayed(() -> scrollView.smoothScrollTo(0, register.getBottom()), 250);
    }
  });

  numberInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
  numberInput.setOnEditorActionListener((v, actionId, event) -> {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
      hideKeyboard(requireContext(), v);
      handleRegister(requireContext());
      return true;
    }
    return false;
  });
}
 
Example 9
Source File: DialogPassword.java    From bither-android with Apache License 2.0 5 votes vote down vote up
private void initView() {
    container = findViewById(R.id.fl_container);
    llInput = (LinearLayout) findViewById(R.id.ll_input);
    llChecking = (LinearLayout) findViewById(R.id.ll_checking);
    tvTitle = (TextView) findViewById(R.id.tv_title);
    tvError = (TextView) findViewById(R.id.tv_error);
    etPassword = (EditText) findViewById(R.id.et_password);
    etPasswordConfirm = (EditText) findViewById(R.id.et_password_confirm);
    btnOk = (Button) findViewById(R.id.btn_ok);
    btnCancel = (Button) findViewById(R.id.btn_cancel);
    tvPasswordLength = (TextView) findViewById(R.id.tv_password_length);
    tvPasswordStrength = (TextView) findViewById(R.id.tv_password_strength);
    pbPasswordStrength = (ProgressBar) findViewById(R.id.pb_password_strength);
    flPasswordStrength = (FrameLayout) findViewById(R.id.fl_password_strength);
    kv = (PasswordEntryKeyboardView) findViewById(R.id.kv);
    etPassword.addTextChangedListener(passwordWatcher);
    etPasswordConfirm.addTextChangedListener(passwordWatcher);
    etPassword.setOnEditorActionListener(this);
    etPasswordConfirm.setOnEditorActionListener(this);
    configureCheckPre();
    configureEditTextActionId();
    btnOk.setOnClickListener(okClick);
    btnCancel.setOnClickListener(cancelClick);
    btnOk.setEnabled(false);
    passwordCheck.setCheckListener(passwordCheckListener);
    kv.registerEditText(etPassword, etPasswordConfirm);
}
 
Example 10
Source File: MainActivity.java    From demo-android-chat with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Make sure we have a mUsername
    setupUsername();

    setTitle("Chatting as " + mUsername);

    // Setup our Wilddog mWilddogRef
    mWilddogRef = WilddogSync.getInstance().getReference().child("chat");


    // Setup our input methods. Enter key on the keyboard or pushing the send button
    EditText inputText = (EditText) findViewById(R.id.messageInput);
    inputText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_NULL && keyEvent.getAction() == KeyEvent.ACTION_DOWN) {
                sendMessage();
            }
            return true;
        }
    });

    findViewById(R.id.sendButton).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendMessage();
        }
    });

}
 
Example 11
Source File: AnagramsActivity.java    From jterm-cswithandroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_anagrams);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    AssetManager assetManager = getAssets();
    try {
        InputStream inputStream = assetManager.open("words.txt");
        dictionary = new AnagramDictionary(inputStream);
    } catch (IOException e) {
        Toast toast = Toast.makeText(this, "Could not load dictionary", Toast.LENGTH_LONG);
        toast.show();
    }
    // Set up the EditText box to process the content of the box when the user hits 'enter'
    final EditText editText = (EditText) findViewById(R.id.editText);
    editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
    editText.setImeOptions(EditorInfo.IME_ACTION_GO);
    editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_GO) {
                processWord(editText);
                handled = true;
            }
            return handled;
        }
    });
}
 
Example 12
Source File: DialogUtils.java    From RedReader with GNU General Public License v3.0 5 votes vote down vote up
public static void showSearchDialog (Context context, int titleRes, final OnSearchListener listener) {
	final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
	final EditText editText = (EditText) LayoutInflater.from(context).inflate(R.layout.dialog_editbox, null);

	TextView.OnEditorActionListener onEnter = new TextView.OnEditorActionListener() {
		@Override
		public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
			performSearch(editText, listener);
			return true;
		}
	};
	editText.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
	editText.setOnEditorActionListener(onEnter);

	alertBuilder.setView(editText);
	alertBuilder.setTitle(titleRes);

	alertBuilder.setPositiveButton(R.string.action_search, new DialogInterface.OnClickListener() {
		@Override
		public void onClick(DialogInterface dialog, int which) {
			performSearch(editText, listener);
		}
	});

	alertBuilder.setNegativeButton(R.string.dialog_cancel, null);

	final AlertDialog alertDialog = alertBuilder.create();
	alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
	alertDialog.show();
}
 
Example 13
Source File: SettingFeedbackFragment.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle)
{
    View view = layoutinflater.inflate(0x7f030043, viewgroup, false);
    a = (EditText)view.findViewById(0x7f0a0119);
    b = (EditText)view.findViewById(0x7f0a0118);
    c = view.findViewById(0x7f0a011a);
    c.setOnClickListener(this);
    b.setOnEditorActionListener(new bE(this));
    ((TextView)view.findViewById(0x7f0a0034)).setOnClickListener(new bF(this));
    return view;
}
 
Example 14
Source File: PassphraseCreationDialogFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.sync_custom_passphrase, null);
    mEnterPassphrase = (EditText) view.findViewById(R.id.passphrase);
    mConfirmPassphrase = (EditText) view.findViewById(R.id.confirm_passphrase);

    mConfirmPassphrase.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                tryToSubmitPassphrase();
            }
            return false;
        }
    });

    TextView instructionsView =
            (TextView) view.findViewById(R.id.custom_passphrase_instructions);
    instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
    instructionsView.setText(getInstructionsText());

    AlertDialog dialog = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setView(view)
            .setTitle(R.string.sync_passphrase_type_custom_dialog_title)
            .setPositiveButton(R.string.save, null)
            .setNegativeButton(R.string.cancel, null)
            .create();
    dialog.getDelegate().setHandleNativeActionModesEnabled(false);
    return dialog;
}
 
Example 15
Source File: RMBTSyncEnterCodeFragment.java    From open-rmbt with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState)
{
    
    view = inflater.inflate(R.layout.sync_enter_code, container, false);
    
    syncButton = (Button) view.findViewById(R.id.button);
    
    overlay = (LinearLayout) view.findViewById(R.id.overlay);
    
    codeField = (EditText) view.findViewById(R.id.code);
    
    final RMBTSyncEnterCodeFragment tmp = this;
    
    listener = new OnClickListener()
    {
        @Override
        public void onClick(final View v)
        {
            
            final String syncCode = codeField.getText().toString().toUpperCase(Locale.US);
            
            if (syncCode.length() == 12)
            {
                if (syncTask == null || syncTask != null || syncTask.isCancelled())
                {
                    overlay.setVisibility(View.VISIBLE);
                    overlay.setClickable(true);
                    overlay.bringToFront();
                    
                    syncButton.setOnClickListener(null);
                    // codeField.setClickable(false);
                    
                    syncTask = new CheckSyncTask(getActivity());
                    
                    syncTask.setEndTaskListener(tmp);
                    syncTask.execute(syncCode);
                }
            }
            else
                codeField.setError(getActivity().getString(R.string.sync_enter_code_length));
        }
    };
    
    codeField.setOnEditorActionListener(new OnEditorActionListener()
    {
        @Override
        public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event)
        {
            listener.onClick(v);
            return true;
        }
    });
    
    syncButton.setOnClickListener(listener);
    
    return view;
}
 
Example 16
Source File: SearchEngineListPreference.java    From Ninja with Apache License 2.0 4 votes vote down vote up
private void showEditDialog() {
    final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
    AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    builder.setCancelable(true);

    FrameLayout layout = (FrameLayout) LayoutInflater.from(getContext()).inflate(R.layout.dialog_edit, null, false);
    builder.setView(layout);

    final AlertDialog dialog = builder.create();
    dialog.show();

    final EditText editText = (EditText) layout.findViewById(R.id.dialog_edit);
    editText.setHint(R.string.dialog_se_hint);
    String custom = sp.getString(getContext().getString(R.string.sp_search_engine_custom), "");
    editText.setText(custom);
    editText.setSelection(custom.length());
    showSoftInput(editText);

    editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId != EditorInfo.IME_ACTION_DONE) {
                return false;
            }

            String domain = editText.getText().toString().trim();
            if (domain.isEmpty()) {
                NinjaToast.show(getContext(), R.string.toast_input_empty);
                return true;
            } else if (!BrowserUnit.isURL(domain)) {
                NinjaToast.show(getContext(), R.string.toast_invalid_domain);
                return true;
            } else {
                sp.edit().putString(getContext().getString(R.string.sp_search_engine), "5").commit();
                sp.edit().putString(getContext().getString(R.string.sp_search_engine_custom), domain).commit();

                hideSoftInput(editText);
                dialog.hide();
                dialog.dismiss();
                return false;
            }
        }
    });
}
 
Example 17
Source File: ColorPickerDialog.java    From LyricHere with Apache License 2.0 4 votes vote down vote up
private void setUp(int color) {

        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        mLayout = inflater.inflate(R.layout.dialog_color_picker, null);
        mLayout.getViewTreeObserver().addOnGlobalLayoutListener(this);

        mOrientation = getContext().getResources().getConfiguration().orientation;
        setContentView(mLayout);

        setTitle(R.string.dialog_color_picker);

        mColorPicker = (ColorPickerView) mLayout.findViewById(R.id.color_picker_view);
        mOldColor = (ColorPickerPanelView) mLayout.findViewById(R.id.old_color_panel);
        mNewColor = (ColorPickerPanelView) mLayout.findViewById(R.id.new_color_panel);

        mHexVal = (EditText) mLayout.findViewById(R.id.hex_val);
        mHexVal.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
        mHexDefaultTextColor = mHexVal.getTextColors();

        mHexVal.setOnEditorActionListener(new TextView.OnEditorActionListener() {

            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
                    String s = mHexVal.getText().toString();
                    if (s.length() > 5 || s.length() < 10) {
                        try {
                            int c = ColorPickerPreference.convertToColorInt(s.toString());
                            mColorPicker.setColor(c, true);
                            mHexVal.setTextColor(mHexDefaultTextColor);
                        } catch (IllegalArgumentException e) {
                            mHexVal.setTextColor(Color.RED);
                        }
                    } else {
                        mHexVal.setTextColor(Color.RED);
                    }
                    return true;
                }
                return false;
            }
        });

        ((LinearLayout) mOldColor.getParent()).setPadding(
                Math.round(mColorPicker.getDrawingOffset()),
                0,
                Math.round(mColorPicker.getDrawingOffset()),
                0
        );

        mOldColor.setOnClickListener(this);
        mNewColor.setOnClickListener(this);
        mColorPicker.setOnColorChangedListener(this);
        mOldColor.setColor(color);
        mColorPicker.setColor(color, true);

    }
 
Example 18
Source File: QuickAddDialogFragment.java    From opentasks with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{

    // create ContextThemeWrapper from the original Activity Context with the custom theme
    final Context contextThemeWrapperLight = new ContextThemeWrapper(getActivity(), R.style.ThemeOverlay_AppCompat_Light);
    final Context contextThemeWrapperDark = new ContextThemeWrapper(getActivity(), R.style.Base_Theme_AppCompat);

    LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapperLight);
    View view = localInflater.inflate(R.layout.fragment_quick_add_dialog, container);

    ViewGroup headerContainer = (ViewGroup) view.findViewById(R.id.header_container);
    localInflater = inflater.cloneInContext(contextThemeWrapperDark);
    localInflater.inflate(R.layout.fragment_quick_add_dialog_header, headerContainer);

    if (savedInstanceState == null)
    {
        if (mListId >= 0)
        {
            mSelectedListId = mListId;
        }
    }

    mColorBackground = view.findViewById(R.id.color_background);
    mColorBackground.setBackgroundColor(mLastColor);

    mListSpinner = (Spinner) view.findViewById(R.id.task_list_spinner);
    mTaskListAdapter = new TasksListCursorSpinnerAdapter(getActivity(), R.layout.list_spinner_item_selected_quick_add, R.layout.list_spinner_item_dropdown);
    mListSpinner.setAdapter(mTaskListAdapter);
    mListSpinner.setOnItemSelectedListener(this);

    mEditText = (EditText) view.findViewById(android.R.id.input);
    mEditText.requestFocus();
    getDialog().getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    mEditText.setOnEditorActionListener(this);
    mEditText.addTextChangedListener(this);

    mConfirmation = view.findViewById(R.id.created_confirmation);
    mContent = view.findViewById(R.id.content);

    mSaveButton = view.findViewById(android.R.id.button1);
    mSaveButton.setOnClickListener(this);
    mSaveAndNextButton = view.findViewById(android.R.id.button2);
    mSaveAndNextButton.setOnClickListener(this);
    view.findViewById(android.R.id.edit).setOnClickListener(this);

    mAuthority = AuthorityUtil.taskAuthority(getActivity());

    afterTextChanged(mEditText.getEditableText());

    setListUri(TaskLists.getContentUri(mAuthority), LIST_LOADER_VISIBLE_LISTS_FILTER);

    return view;
}
 
Example 19
Source File: LoginActivity.java    From CameraV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	packageName = this.getPackageName();

	setContentView(R.layout.activity_login);
	rootView = findViewById(R.id.llRoot);
	
	boolean prefStealthIcon = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("prefStealthIcon",false);
	if (prefStealthIcon)
	{
		ImageView iv = (ImageView)findViewById(R.id.loginLogo);
		iv.setImageResource(R.drawable.ic_launcher_alt);
	}

	password = (EditText) findViewById(R.id.login_password);
	password.setImeOptions(EditorInfo.IME_ACTION_DONE);
	password.setOnEditorActionListener(new OnEditorActionListener ()
	{
		@Override
		public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
			 if (actionId == EditorInfo.IME_ACTION_SEARCH ||
		                actionId == EditorInfo.IME_ACTION_DONE ||
		                event.getAction() == KeyEvent.ACTION_DOWN &&
		                event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {			
						doLogin ();
						
					}
				   return true;
		}
		
	});

	/**
	commit = (Button) findViewById(R.id.login_commit);
	commit.setOnClickListener(this);
	*/

	waiter = (ProgressBar) findViewById(R.id.login_waiter);
	
	checkForCrashes();
	checkForUpdates();
}
 
Example 20
Source File: LoginDialogFragment.java    From openshop.io-android with MIT License 4 votes vote down vote up
private void prepareInputBoxes(View view) {
    // Registration form
    loginRegistrationEmailWrapper = view.findViewById(R.id.login_registration_email_wrapper);
    loginRegistrationPasswordWrapper = view.findViewById(R.id.login_registration_password_wrapper);
    loginRegistrationGenderWoman = view.findViewById(R.id.login_registration_sex_woman);
    EditText registrationPassword = loginRegistrationPasswordWrapper.getEditText();
    if (registrationPassword != null) {
        registrationPassword.setOnTouchListener(new OnTouchPasswordListener(registrationPassword));
    }


    // Login email form
    loginEmailEmailWrapper = view.findViewById(R.id.login_email_email_wrapper);
    EditText loginEmail = loginEmailEmailWrapper.getEditText();
    if (loginEmail != null) loginEmail.setText(SettingsMy.getUserEmailHint());
    loginEmailPasswordWrapper = view.findViewById(R.id.login_email_password_wrapper);
    EditText emailPassword = loginEmailPasswordWrapper.getEditText();
    if (emailPassword != null) {
        emailPassword.setOnTouchListener(new OnTouchPasswordListener(emailPassword));
        emailPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_SEND || actionId == 124) {
                    invokeLoginWithEmail();
                    return true;
                }
                return false;
            }
        });
    }

    loginEmailForgottenEmailWrapper = view.findViewById(R.id.login_email_forgotten_email_wrapper);
    EditText emailForgottenPassword = loginEmailForgottenEmailWrapper.getEditText();
    if (emailForgottenPassword != null)
        emailForgottenPassword.setText(SettingsMy.getUserEmailHint());

    // Simple accounts whisperer.
    Account[] accounts = AccountManager.get(getActivity()).getAccounts();
    String[] addresses = new String[accounts.length];
    for (int i = 0; i < accounts.length; i++) {
        addresses[i] = accounts[i].name;
        Timber.e("Sets autocompleteEmails: %s", accounts[i].name);
    }

    ArrayAdapter<String> emails = new ArrayAdapter<>(getActivity(), android.R.layout.simple_dropdown_item_1line, addresses);
    AutoCompleteTextView textView = view.findViewById(R.id.login_registration_email_text_auto);
    textView.setAdapter(emails);
}