android.support.v7.widget.AppCompatEditText Java Examples

The following examples show how to use android.support.v7.widget.AppCompatEditText. 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: TintHelper.java    From APlayer with GNU General Public License v3.0 6 votes vote down vote up
public static void setTint(@NonNull EditText editText, @ColorInt int color, boolean useDarker) {
  final ColorStateList editTextColorStateList = new ColorStateList(new int[][]{
      new int[]{-android.R.attr.state_enabled},
      new int[]{android.R.attr.state_enabled, -android.R.attr.state_pressed,
          -android.R.attr.state_focused},
      new int[]{}
  }, new int[]{
      ContextCompat.getColor(editText.getContext(),
          useDarker ? R.color.ate_text_disabled_dark : R.color.ate_text_disabled_light),
      ContextCompat.getColor(editText.getContext(),
          useDarker ? R.color.ate_control_normal_dark : R.color.ate_control_normal_light),
      color
  });
  if (editText instanceof AppCompatEditText) {
    ((AppCompatEditText) editText).setSupportBackgroundTintList(editTextColorStateList);
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    editText.setBackgroundTintList(editTextColorStateList);
  }
  setCursorTint(editText, color);
}
 
Example #2
Source File: AddRouteActivity.java    From kute with Apache License 2.0 6 votes vote down vote up
/********** Overrides ***********/
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_route);
    days=null;
    //Initialise the views
    name=(AppCompatEditText)findViewById(R.id.routeName);
    source=(AppCompatTextView) findViewById(R.id.startPlace);
    destination=(AppCompatTextView) findViewById(R.id.destination);
    destination.setOnClickListener(this);
    source.setOnClickListener(this);
    time=(TextView)findViewById(R.id.startTime);
    seats=(AppCompatEditText)findViewById(R.id.seatsAvailable);
    backnav=(ImageButton)findViewById(R.id.backNav);
    backnav.setOnClickListener(this);
    add_button=(ImageButton)findViewById(R.id.addButton);
    add_button.setOnClickListener(this);
    set_days=(ImageButton)findViewById(R.id.setDaysButton);
    set_days.setOnClickListener(this);
    time_layout=(RelativeLayout)findViewById(R.id.timeLayout);
    time_layout.setOnClickListener(this);

}
 
Example #3
Source File: RecentActivityController.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
@ActionMethod(ids = R.id.bookmenu_rename)
public void renameBook(final ActionEx action) {
    final BookNode book = action.getParameter("source");
    if (book == null) {
        return;
    }

    final FileUtils.FilePath file = FileUtils.parseFilePath(book.path, CodecType.getAllExtensions());
    final EditText input = new AppCompatEditText(getManagedComponent());
    input.setSingleLine();
    input.setText(file.name);
    input.selectAll();

    final ActionDialogBuilder builder = new ActionDialogBuilder(getContext(), this);
    builder.setTitle(R.string.book_rename_title);
    builder.setMessage(R.string.book_rename_msg);
    builder.setView(input);
    builder.setPositiveButton(R.id.actions_doRenameBook, new Constant("source", book), new Constant("file", file),
            new EditableValue("input", input));
    builder.setNegativeButton().show();
}
 
Example #4
Source File: UserSelfProfileFragment.java    From kute with Apache License 2.0 6 votes vote down vote up
/****************************** Overrides *************************/
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    v=inflater.inflate(R.layout.self_profile_fragment,container,false);
    work_row=(RelativeLayout)v.findViewById(R.id.workRow);
    work_row_edit=(RelativeLayout)v.findViewById(R.id.workRowEdit);
    name=(TextView)v.findViewById(R.id.name);
    name_edit=(AppCompatEditText)v.findViewById(R.id.nameEdit);
    profile_picture=(RoundedImageView)v.findViewById(R.id.personImage);
    occupation=(TextView)v.findViewById(R.id.occupationName);
    occupation_edit=(AppCompatEditText)v.findViewById(R.id.occupationNameEdit);
    vehicle=(TextView)v.findViewById(R.id.vehicleName);
    vehicle_edit=(AppCompatEditText)v.findViewById(R.id.vehicleNameEdit);
    contact_phone=(TextView)v.findViewById(R.id.contactPhone);
    contact_phone_edit=(AppCompatEditText)v.findViewById(R.id.contactPhoneEdit);
    other_details=(TextView)v.findViewById(R.id.otherDetailsText);
    other_details_edit=(AppCompatEditText)v.findViewById(R.id.otherDetailsEdit);
    other_details_dropdown=(ImageButton)v.findViewById(R.id.otherDetailsDropdownIcon);
    return v;
}
 
Example #5
Source File: MainActivity.java    From KA27 with Apache License 2.0 6 votes vote down vote up
/**
 * Dialog which asks the user to enter his password
 *
 * @param password current encoded password
 */
private void askPassword(final String password) {
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.setPadding(30, 20, 30, 20);

    final AppCompatEditText mPassword = new AppCompatEditText(this);
    mPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    mPassword.setHint(getString(R.string.password));
    linearLayout.addView(mPassword);

    new AlertDialog.Builder(this).setView(linearLayout).setCancelable(false)
        .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (mPassword.getText().toString().equals(Utils.decodeString(password)))
                    new Task().execute();
                else {
                    Utils.toast(getString(R.string.password_wrong), MainActivity.this);
                    finish();
                }
            }
        }).show();
}
 
Example #6
Source File: UserInfoFragment.java    From AccountBook with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 显示修改用户名 Dialog
 */
@Override
public void showUpdateUsernameDialog() {
    // 回显用户名
    final AppCompatEditText editText = new AppCompatEditText(mContext);
    String username = mCilUsername.getRightText();
    editText.setText(username);
    new AlertDialog.Builder(mContext)
            .setTitle(UiUtils.getString(R.string.dialog_title_update_username))
            .setView(editText, DimenUtils.dp2px(15f), DimenUtils.dp2px(15f), DimenUtils.dp2px(15f), DimenUtils.dp2px(15f))
            .setNegativeButton(UiUtils.getString(R.string.dialog_cancel), null)
            .setPositiveButton(UiUtils.getString(R.string.dialog_affirm), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String newUsername = editText.getText().toString();
                    if(TextUtils.isEmpty(newUsername) || newUsername.length() > 16){
                        ToastUtils.show(mContext, UiUtils.getString(R.string.toast_username_length));
                    }else{
                        User user = UserUtils.getUser();
                        user.setUsername(newUsername);
                        ProgressUtils.show(mContext, UiUtils.getString(R.string.load_update));
                        mPresenter.saveUserInfo(user);
                    }
                }
            }).create().show();
}
 
Example #7
Source File: SelfRouteDetailActivity.java    From kute with Apache License 2.0 6 votes vote down vote up
public void connectViews(){
    editButton=(ImageButton)findViewById(R.id.editButton);
    backNav=(ImageButton)findViewById(R.id.backNav);
    route_name=(TextView)findViewById(R.id.routeNameText);
    no_seats=(TextView)findViewById(R.id.noSeats);
    to=(AppCompatTextView) findViewById(R.id.destination);
    from=(AppCompatTextView)findViewById(R.id.startPlace);
    time=(TextView)findViewById(R.id.startTime);
    days_button=(ImageButton)findViewById(R.id.daysSelect);
    days_button.setOnClickListener(this);
    delete_route=(Button)findViewById(R.id.deleteRoute);
    start_trip=(Button)findViewById(R.id.startTrip);
    delete_route.setOnClickListener(this);
    start_trip.setOnClickListener(this);
    no_of_seats_edit=(AppCompatEditText)findViewById(R.id.noSeatEdit);
    route_name_edit=(AppCompatEditText)findViewById(R.id.routeNameEdit); 
    to.setOnClickListener(this);
    from.setOnClickListener(this);
    backNav.setOnClickListener(this);
    editButton.setOnClickListener(this);
}
 
Example #8
Source File: TodoListActivity.java    From TodoFluxArchitecture with Apache License 2.0 6 votes vote down vote up
private void showEditDialog(TodoItem item) {

        View customView = LayoutInflater.from(this).inflate(R.layout.dialog_todo_edit, null);
        final AppCompatEditText editText = ButterKnife.findById(customView, R.id.inputEditText);
        editText.setText(item.getDescription());
        editText.setSelection(item.getDescription().length());

        materialDialog = new MaterialDialog.Builder(this)
                .customView(customView, false)
                .positiveColorRes(R.color.positive_color)
                .negativeColorRes(R.color.positive_color)
                .positiveText(R.string.action_sure)
                .negativeText(R.string.action_cancel)
                .onPositive((dialog, which) -> {
                    String text = editText.getText().toString();
                    if (!TextUtils.isEmpty(text)) {
                        actionCreator.createItemEditAction(item.getId(), text, item.isCompleted(), item.isStared());
                        dialog.dismiss();
                    }
                })
                .build();


        materialDialog.show();
    }
 
Example #9
Source File: Term.java    From Ansole with GNU General Public License v2.0 6 votes vote down vote up
private void doRenameWindow() {
    final AppCompatEditText editText = new AppCompatEditText(this);
    editText.setText(getCurrentTermSession().getTitle());
    final AlertDialog.Builder b = new AlertDialog.Builder(this);
    b.setTitle(R.string.input_window_title);
    b.setView(editText);
    b.setPositiveButton(android.R.string.yes,
            new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    doChangeWindowTitle(editText.getText().toString());
                }
            });
    b.setNegativeButton(android.R.string.no, null);
    b.show();
}
 
Example #10
Source File: LoginFragment.java    From ESeal with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_login, container, false);

    loginName = (AppCompatEditText) view.findViewById(R.id.login_name);
    loginPassword = (AppCompatEditText) view.findViewById(R.id.login_password);

    AppCompatButton signInButton = (AppCompatButton) view.findViewById(R.id.sign_in_button);
    signInButton.setOnClickListener(__ -> {
        if (isInputDataValid()) {
            String name = loginName.getText().toString();
            String password = loginPassword.getText().toString();
            mPresenter.saveUser(name, password);
            mPresenter.attemptLogin(name, password, false);
        } else {
            showInputDataError();
        }
    });
    return view;
}
 
Example #11
Source File: MarkdownEditText.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
private void addLink(){
    AlertDialog.Builder builder=new AlertDialog.Builder(getContext());
    final View view= LayoutInflater.from(getContext()).inflate(R.layout.dialog_link,null);
    builder.setView(view);
    builder.setCancelable(false);
    builder.setPositiveButton(getContext().getString(android.R.string.ok), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String text=((AppCompatEditText)view.findViewById(R.id.text)).getText().toString().trim();
            String link=((AppCompatEditText)view.findViewById(R.id.link)).getText().toString().trim();
            if(link.isEmpty()){
                return;
            }else {
                text=text.isEmpty()?"link":text;
                addMarkAtCursor("["+text+"]("+link+")");
            }
        }
    });
    builder.setNegativeButton(getContext().getString(android.R.string.cancel),null);
    builder.show();
}
 
Example #12
Source File: PhotoLayout.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
private void initImgContainer(){
    LinearLayout linearLayout=new LinearLayout(getContext());
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    imageView=new AppCompatImageView(getContext());
    LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    imageView.setLayoutParams(lp);
    linearLayout.addView(imageView);
    imageView.setOnClickListener(this);
    editText=new AppCompatEditText(getContext());
    linearLayout.addView(editText);
    editText.setVisibility(GONE);
    editText.setTextAppearance(getContext(),R.style.NoteTextAppearance);
    editText.setGravity(Gravity.CENTER);
    editText.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if(keyCode==KeyEvent.KEYCODE_DEL&&editText.getText().toString().isEmpty()){
                editText.setVisibility(GONE);
            }
            return false;
        }
    });
    this.addView(linearLayout);
}
 
Example #13
Source File: EditTextDialog.java    From Cornowser with MIT License 6 votes vote down vote up
private void init() {
    mEditText = (AppCompatEditText)
            LayoutInflater.from(getContext()).inflate(R.layout.widget_ac_edittext_xquid, null);
    mEditText.setSingleLine();
    if(!mTitle.isEmpty()) mEditText.setHint(mTitle);
    if(!mTitle.isEmpty()) mEditText.getEditableText().insert(0, mDefaultText);
    mEditText.setHighlightColor(ContextCompat.getColor(getContext(), R.color.blue_600));
    mEditText.setTextColor(Color.BLACK);

    onClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    };
}
 
Example #14
Source File: ConfigureReceiverDialogPage3SetupFragment.java    From PowerSwitch_Android with GNU General Public License v3.0 6 votes vote down vote up
private ArrayList<UniversalButton> getCurrentUniversalButtons() {
    ArrayList<UniversalButton> buttons = new ArrayList<>();

    for (int i = 0; i < buttonsList.getChildCount(); i++) {
        LinearLayout universalButtonLayout = (LinearLayout) buttonsList.getChildAt(i);

        LinearLayout nameLayout = (LinearLayout) universalButtonLayout.getChildAt(0);
        AppCompatEditText nameEditText = (AppCompatEditText) nameLayout.getChildAt(0);
        AppCompatEditText signalEditText = (AppCompatEditText) universalButtonLayout.getChildAt(1);

        buttons.add(new UniversalButton(null, nameEditText.getText().toString(), null, signalEditText.getText()
                .toString()));
    }

    return buttons;
}
 
Example #15
Source File: UIUtil.java    From AwesomeSplash with MIT License 6 votes vote down vote up
public static void hideSoftKeyOutsideET(final Activity a, View view) {

        // if the view is not instance of AutoResizeEditText
        // i.e. if the user taps outside of the box
        if (!(view instanceof AppCompatEditText)) {

            view.setOnTouchListener(new View.OnTouchListener() {

                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    //hide the keyboard
                    hideKeyboard(a);
                    return false;
                }
            });
        }
        // If a layout container, iterate over children and seed recursion.
        if (view instanceof ViewGroup) {
            for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
                View innerView = ((ViewGroup) view).getChildAt(i);
                hideSoftKeyOutsideET(a, innerView);
            }
        }
    }
 
Example #16
Source File: BasePreferencesActivity.java    From 4pdaClient-plus with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this,attrs);
            case "Spinner":
                return new AppCompatSpinner(this,attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this,attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this,attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this,attrs);
        }
    }

    return null;
}
 
Example #17
Source File: NoteEditActivity.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void registerWidget() {

	title_zone = $(R.id.title_zone);
	noteEditTitle = $(R.id.note_edit_title);
	editTextWrapper =$(R.id.note_edit_editText);
	titleEditText = (AppCompatEditText) findViewById(R.id.note_edit_title);
	editTextWrapper.setFocusable(true);
	editTextWrapper.setFocusableInTouchMode(true);
	editTextWrapper.requestFocus();
	editTextWrapper.setAfterTextChangedCallback(afterTextChangedCallback,layoutChangeListener);
}
 
Example #18
Source File: EditTextPreferenceCompat.java    From MaterialPreferenceCompat with MIT License 5 votes vote down vote up
public EditTextPreferenceCompat(Context context, AttributeSet attrs) {
	super(context, attrs);
	int fallback = 0;
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		fallback = context.getTheme().obtainStyledAttributes(new int[]{R.attr.colorAccent}).getColor(0, 0);
	}
	mColor = context.getTheme().obtainStyledAttributes(new int[]{R.attr.colorAccent}).getColor(0, fallback);

	mEditText = new AppCompatEditText(context, attrs);
	mEditText.setEnabled(true);
}
 
Example #19
Source File: MarkdownEditText.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
private void init(){
    Context context=getContext();
    View view=View.inflate(context, R.layout.markdown_edittext,this);
    editText=(AppCompatEditText)view.findViewById(R.id.markdown_edit);
    LinearLayout linearLayout=(LinearLayout) view.findViewById(R.id.span_toolbar);
    for(int i=0;i<linearLayout.getChildCount();i++){
        linearLayout.getChildAt(i).setOnClickListener(this);
    }
    editText.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_ENTER:
                    if (KeyEvent.ACTION_DOWN == event.getAction()) {
                        int index = getParagraphStart();
                        String text = editText.getText().toString().substring(index);
                        int index2 = text.indexOf("- ");
                        if (index2 >= 0 && text.substring(0, index2).trim().isEmpty()) {
                            if (editText.getSelectionStart() < editText.getSelectionEnd()) {
                                editText.getEditableText().replace(editText.getSelectionStart(), editText.getSelectionEnd(), "\n" + text.substring(0, index2) + "- ");
                            } else {
                                editText.getEditableText().insert(editText.getSelectionStart(), "\n" + text.substring(0, index2) + "- ");
                            }
                            return true;
                        }
                    }
                    break;
            }
            return false;
        }
    });
}
 
Example #20
Source File: CommunityEditActivity.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void registerWidget() {
    noteEditTitle = $(R.id.note_edit_title);
    editTextWrapper =$(R.id.note_edit_editText);
    titleEditText = (AppCompatEditText) findViewById(R.id.note_edit_title);
    editTextWrapper.setFocusable(true);
    editTextWrapper.setFocusableInTouchMode(true);
    editTextWrapper.requestFocus();
}
 
Example #21
Source File: ViewerActivityController.java    From document-viewer with GNU General Public License v3.0 5 votes vote down vote up
public void askPassword(final String fileName, final int promtId) {
    final EditText input = new AppCompatEditText(getManagedComponent());
    input.setSingleLine(true);
    input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    final ActionDialogBuilder builder = new ActionDialogBuilder(getManagedComponent(), this);
    builder.setTitle(fileName).setMessage(promtId).setView(input);
    builder.setPositiveButton(R.id.actions_redecodingWithPassword, new EditableValue("input", input));
    builder.setNegativeButton(R.id.mainmenu_close).show();
}
 
Example #22
Source File: MaterialEditTextPreference.java    From talk-android with MIT License 5 votes vote down vote up
public MaterialEditTextPreference(Context context, AttributeSet attrs) {
    super(context, attrs);
    int fallback;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        fallback = DialogUtils.resolveColor(context, android.R.attr.colorAccent);
    else fallback = 0;
    fallback = DialogUtils.resolveColor(context, R.attr.colorAccent, fallback);
    mColor = DialogUtils.resolveColor(context, R.attr.md_widget_color, fallback);

    mEditText = new AppCompatEditText(context, attrs);
    // Give it an ID so it can be saved/restored
    mEditText.setId(android.R.id.edit);
    mEditText.setEnabled(true);
}
 
Example #23
Source File: SettingsFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
private void deletePasswordDialog(final String password) {
    if (password.isEmpty()) {
        Utils.toast(getString(R.string.set_password_first), getActivity());
        return;
    }

    LinearLayout linearLayout = new LinearLayout(getActivity());
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.setPadding(30, 20, 30, 20);

    final AppCompatEditText mPassword = new AppCompatEditText(getActivity());
    mPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    mPassword.setHint(getString(R.string.password));
    linearLayout.addView(mPassword);

    new AlertDialog.Builder(getActivity(),
            (Utils.DARKTHEME ? R.style.AlertDialogStyleDark : R.style.AlertDialogStyleLight)).setView(linearLayout)
        .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (!mPassword.getText().toString().equals(Utils.decodeString(password))) {
                    Utils.toast(getString(R.string.password_wrong), getActivity());
                    return;
                }

                Utils.saveString("password", "", getActivity());
            }
        }).show();
}
 
Example #24
Source File: MainActivity.java    From AndroidTint with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    AppCompatEditText et1 = (AppCompatEditText) findViewById(R.id.et_1);
    AppCompatEditText et2 = (AppCompatEditText) findViewById(R.id.et_2);

    EmTintUtils.setTint(et1, 0xffff00ff);
    EmTintUtils.setTint(et2, 0xff00ffff);

}
 
Example #25
Source File: EmTintUtils.java    From AndroidTint with Apache License 2.0 5 votes vote down vote up
public static void setTint(@NonNull EditText editText, @ColorInt int color) {
    ColorStateList editTextColorStateList = createEditTextColorStateList(editText.getContext(), color);
    if (editText instanceof AppCompatEditText) {
        ((AppCompatEditText) editText).setSupportBackgroundTintList(editTextColorStateList);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        editText.setBackgroundTintList(editTextColorStateList);
    }
}
 
Example #26
Source File: LoginActivity.java    From ESeal with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme_NoActionBar_TextAppearance);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);
    loginName = (AppCompatEditText) findViewById(R.id.login_name);
    loginPassword = (AppCompatEditText) findViewById(R.id.login_password);
}
 
Example #27
Source File: DialogFactory.java    From QuickNote with Apache License 2.0 5 votes vote down vote up
public static EditText showInputDialog(Context context, String title, String content, DialogInterface.OnClickListener positiveListener) {
    Builder builder = new Builder(context);
    builder.setTitle(title);
    builder.setMessage(content);
    AppCompatEditText input = new AppCompatEditText(context);
    builder.setView(input, PADDING, PADDING, PADDING, PADDING);
    builder.setNegativeButton(CANCEL_TIP, null);
    builder.setPositiveButton(SURE_TIP, positiveListener);
    builder.show();
    return input;
}
 
Example #28
Source File: ChatThemeCreator.java    From ForPDA with GNU General Public License v3.0 5 votes vote down vote up
public ChatThemeCreator(QmsChatFragment fragment) {
    this.fragment = fragment;
    viewStub = (ViewStub) this.fragment.findViewById(R.id.toolbar_content);
    viewStub.setLayoutResource(R.layout.toolbar_qms_new_theme);
    viewStub.inflate();
    nickField = (AppCompatAutoCompleteTextView) this.fragment.findViewById(R.id.qms_theme_nick_field);
    titleField = (AppCompatEditText) this.fragment.findViewById(R.id.qms_theme_title_field);
    this.userId = this.fragment.currentChat.getUserId();
    this.userNick = this.fragment.currentChat.getNick();
    this.themeTitle = this.fragment.currentChat.getTitle();
    initCreatorViews();
}
 
Example #29
Source File: MDTintHelper.java    From talk-android with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
public static void setTint(EditText editText, int color) {
    ColorStateList editTextColorStateList = createEditTextColorStateList(editText.getContext(), color);
    if (editText instanceof AppCompatEditText) {
        ((AppCompatEditText) editText).setSupportBackgroundTintList(editTextColorStateList);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        editText.setBackgroundTintList(editTextColorStateList);
    }
}
 
Example #30
Source File: IpInputEditText.java    From v9porn with MIT License 5 votes vote down vote up
private void pressTextChange(Editable s, AppCompatEditText currenAppCompatEditText, AppCompatEditText preFouceAppCompatEditText, AppCompatEditText nextFouceAppCompatEditText) {
    String text = s.toString();

    //回退上一个
    if (TextUtils.isEmpty(s)) {
        focusEditViewAndMoveSelection(preFouceAppCompatEditText);
        return;
    }

    if (!text.startsWith(ZERO_WIDTH_SPACE)) {
        text = text.replace(ZERO_WIDTH_SPACE, "");
        text = ZERO_WIDTH_SPACE + text;
        currenAppCompatEditText.setText(text);
        moveSelectionToLast(currenAppCompatEditText);
    }
    //输入未达到最大,但包含点,则说明当前输入完成
    if (text.contains(POINT_STR)) {
        //替换掉点,重新设置文本
        text = text.replace(POINT_STR, "");
        currenAppCompatEditText.setText(text);
        if (!TextUtils.isEmpty(text.replace(ZERO_WIDTH_SPACE, ""))) {
            //聚焦到下一个控件
            focusEditViewAndMoveSelection(nextFouceAppCompatEditText);
        }


        //达到最大,输入完成
    } else if (text.length() >= SUB_MAX_LENGTH) {
        int subIp = Integer.parseInt(text.replace(ZERO_WIDTH_SPACE, ""));
        //检查ip断合法性
        if (subIp >= MAX_IP_NUM) {
            //清空重新输入
            currenAppCompatEditText.setText(ZERO_WIDTH_SPACE);
        } else {
            //验证通过,聚焦到下一个控件
            focusEditViewAndMoveSelection(nextFouceAppCompatEditText);
        }
    }
}