Java 类android.support.v7.widget.AppCompatEditText 实例源码

项目:Rx_java2_soussidev    文件:VerifyCompacResultHelper.java   
public static RxVerifyCompacResult<AppCompatEditText> getFirstBadResultOrSuccess(
        List<RxVerifyCompacResult<AppCompatEditText>> results) {
    RxVerifyCompacResult<AppCompatEditText> firstBadResult = null;
    for (RxVerifyCompacResult<AppCompatEditText> result : results) {
        if (!result.isProper()) {
            firstBadResult = result;
            break;
        }
    }
    if (firstBadResult == null) {
        // if there is no bad result, then return first success
        return results.get(0);
    } else {
        return firstBadResult;
    }
}
项目:MTweaks-KernelAdiutorMOD    文件:BuildpropFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_buildprop_search, container, false);

    AppCompatEditText keyEdit = (AppCompatEditText) rootView.findViewById(R.id.key_edittext);
    AppCompatEditText valueEdit = (AppCompatEditText) rootView.findViewById(R.id.value_edittext);

    keyEdit.addTextChangedListener(mKeyWatcher);
    valueEdit.addTextChangedListener(mValueWatcher);

    if (mKeyText != null) {
        keyEdit.append(mKeyText);
    }
    if (mValueText != null) {
        valueEdit.append(mValueText);
    }

    mItemsText = (TextView) rootView.findViewById(R.id.found_text);
    setCount(mItemsCount);

    return rootView;
}
项目:MTweaks-KernelAdiutorMOD    文件:EditorActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_editor);

    initToolBar();
    String title = getIntent().getStringExtra(TITLE_INTENT);
    if (title != null) {
        getSupportActionBar().setTitle(title);
    }

    CharSequence text = getIntent().getCharSequenceExtra(TEXT_INTENT);
    mEditText = (AppCompatEditText) findViewById(R.id.edittext);
    if (text != null) {
        mEditText.append(text);
    }
}
项目:KernelAdiutor-Mod    文件:BuildpropFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_buildprop_search, container, false);

    AppCompatEditText keyEdit = (AppCompatEditText) rootView.findViewById(R.id.key_edittext);
    AppCompatEditText valueEdit = (AppCompatEditText) rootView.findViewById(R.id.value_edittext);

    keyEdit.addTextChangedListener(mKeyWatcher);
    valueEdit.addTextChangedListener(mValueWatcher);

    if (mKeyText != null) {
        keyEdit.append(mKeyText);
    }
    if (mValueText != null) {
        valueEdit.append(mValueText);
    }

    mItemsText = (TextView) rootView.findViewById(R.id.found_text);
    setCount(mItemsCount);

    return rootView;
}
项目:KernelAdiutor-Mod    文件:EditorActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_editor);

    initToolBar();
    String title = getIntent().getStringExtra(TITLE_INTENT);
    if (title != null) {
        getSupportActionBar().setTitle(title);
    }

    CharSequence text = getIntent().getCharSequenceExtra(TEXT_INTENT);
    mEditText = (AppCompatEditText) findViewById(R.id.edittext);
    if (text != null) {
        mEditText.append(text);
    }
}
项目:android-geohash    文件:ConverterFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    editGeohash = (AppCompatEditText) view.findViewById(R.id.edit_hash);
    editLat = (AppCompatEditText) view.findViewById(R.id.edit_lat);
    editLon = (AppCompatEditText) view.findViewById(R.id.edit_lon);
    textPrecision = (AppCompatTextView) view.findViewById(R.id.text_precision);
    seekPrecision = (AppCompatSeekBar) view.findViewById(R.id.seek_precision);

    editGeohash.addTextChangedListener(hashTextWatcher);
    editLat.addTextChangedListener(locationTextWatcher);
    editLon.addTextChangedListener(locationTextWatcher);
    seekPrecision.setOnSeekBarChangeListener(this);

    location = new Location("geohash_example");
    textPrecision.setText("Precision: " + 1);
}
项目:OSchina_resources_android    文件:DialogHelper.java   
/**
 * 获取一个输入对话框
 */
public static AlertDialog.Builder getInputDialog(
        Context context,
        String title,
        AppCompatEditText editText,
        String positiveText,
        String negativeText,
        boolean cancelable,
        DialogInterface.OnClickListener positiveListener,
        DialogInterface.OnClickListener negativeListener) {
    return getDialog(context)
            .setCancelable(cancelable)
            .setTitle(title)
            .setView(editText)
            .setPositiveButton(positiveText, positiveListener)
            .setNegativeButton(negativeText, negativeListener);
}
项目:OSchina_resources_android    文件:DialogHelper.java   
/**
 * 获取一个输入对话框
 */
public static AlertDialog.Builder getInputDialog(
        Context context, String title,
        AppCompatEditText editText,
        String positiveText,
        String negativeText,
        boolean cancelable,
        DialogInterface.OnClickListener positiveListener) {
    return getInputDialog(
            context,
            title,
            editText,
            positiveText,
            negativeText,
            cancelable,
            positiveListener,
            null);
}
项目:MetadataEditor    文件:TintHelper.java   
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);
}
项目:SelectName    文件:SelectActivity.java   
private void initView() {

        btnSave = (Button) findViewById(R.id.btnSave);
        btnSave.setOnClickListener(this);
        btndel = (Button) findViewById(R.id.btndel);
        btndel.setOnClickListener(this);
        btnupdate = (Button) findViewById(R.id.btnupdate);
        btnupdate.setOnClickListener(this);
        btnQuery = (Button) findViewById(R.id.btnQuery);
        btnQuery.setOnClickListener(this);
        tvTextView = (TextView) findViewById(R.id.tv);
        tvTextView.setFocusable(true);

        etFirstName = (AppCompatEditText) findViewById(R.id.etFirstName);
        etFirstName.setOnClickListener(this);
        btn_back = (ImageView) findViewById(R.id.btn_back);
        btn_back.setOnClickListener(this);
    }
项目:weixzz-app    文件:NewStatusActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.status_add_new);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("发送微博");

    final AppCompatEditText editText = (AppCompatEditText) findViewById(R.id.inputText);

    findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String status = editText.getText().toString();
            new UpdateStatusAsync().execute(status);
        }
    });


}
项目:GestureFun    文件:DeleteOnSwipeEditText.java   
protected void init(Context context, AttributeSet attrs) {
    setOrientation(VERTICAL);
    inflate(context, R.layout.layout_delete_on_swipe_edit_text, this);
    editText = (AppCompatEditText) getChildAt(0);
    //Threshold cannot be bigger than EditText itself
    if (attrs != null) {
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.DeleteOnSwipeEditText);
        setHint(ta.getString(R.styleable.DeleteOnSwipeEditText_android_hint));
        int threshold = ta.getInt(R.styleable.DeleteOnSwipeEditText_hrskrs_threshold, INVALID);
        if (threshold > MIN_THRESHOLD) {
            DEFAULT_THRESHOLD = threshold;
        }
        int swipeMode = ta.getInt(R.styleable.DeleteOnSwipeEditText_hrskrs_swipe_mode, INVALID);
        if (swipeMode == 1) {
            DEFAULT_SWIPE = SINGLE_FINGER_SWIPE;
        }
        ta.recycle();
    }
    //EditText touch listener
    editText.setOnTouchListener(this);
}
项目:ProjectTemplate    文件:DialogHelper.java   
/**
 * 获取一个输入对话框
 */
public static AlertDialog.Builder getInputDialog(
        Context context,
        String title,
        AppCompatEditText editText,
        String positiveText,
        String negativeText,
        boolean cancelable,
        DialogInterface.OnClickListener positiveListener,
        DialogInterface.OnClickListener negativeListener) {
    return getDialog(context)
            .setCancelable(cancelable)
            .setTitle(title)
            .setView(editText)
            .setPositiveButton(positiveText, positiveListener)
            .setNegativeButton(negativeText, negativeListener);
}
项目:ProjectTemplate    文件:DialogHelper.java   
/**
 * 获取一个输入对话框
 */
public static AlertDialog.Builder getInputDialog(
        Context context, String title,
        AppCompatEditText editText,
        String positiveText,
        String negativeText,
        boolean cancelable,
        DialogInterface.OnClickListener positiveListener) {
    return getInputDialog(
            context,
            title,
            editText,
            positiveText,
            negativeText,
            cancelable,
            positiveListener,
            null);
}
项目:AidlBestPractice    文件:MainActivity.java   
private void showAddDialog() {
    View customView = LayoutInflater.from(this).inflate(R.layout.dialog_book_add, null);
    final AppCompatEditText editText = ButterKnife.findById(customView, R.id.inputEditText);

    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(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    String name = editText.getText().toString();
                    addBook(name);
                }
            })
            .build();


    materialDialog.show();
}
项目:AidlBestPractice    文件:MainActivity.java   
private void showFilterDialog() {
    View customView = LayoutInflater.from(this).inflate(R.layout.dialog_book_filter, null);
    final AppCompatEditText editText = ButterKnife.findById(customView, R.id.inputEditText);

    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(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    String filter = editText.getText().toString();
                    filterBookList(filter);
                }
            })
            .build();


    materialDialog.show();
}
项目:EasyUtils    文件:TestETBActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_text_block);
    ButterKnife.bind(this);

    mTextBlock.setOnUpdateViewListener(new EditTextBlock.UpdateViewListener() {
        @Override
        public void onRemove(EditTextBlock editTextBlock) {
            mLayout.removeView(editTextBlock);
        }

        @Override
        public void onEditTextFocusChange(AppCompatEditText v, boolean hasFocus, EditTextBlock textBlock) {
            Snackbar.make(mLayout,"焦点改变",Snackbar.LENGTH_SHORT).show();
        }
    });
}
项目:ESeal    文件:LoginFragment.java   
@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;
}
项目:app-theme-engine-master    文件:TintHelper.java   
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_disabled_edittext_dark : R.color.ate_disabled_edittext_light),
            Util.resolveColor(editText.getContext(), R.attr.colorControlNormal),
            color
    });
    if (editText instanceof AppCompatEditText) {
        ((AppCompatEditText) editText).setSupportBackgroundTintList(editTextColorStateList);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        editText.setBackgroundTintList(editTextColorStateList);
    }
}
项目:TodoFluxArchitecture    文件:TodoListActivity.java   
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();
    }
项目:deathly_adiutor_free    文件:MainActivity.java   
/**
 * 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();
}
项目:KA27    文件:MainActivity.java   
/**
 * 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();
}
项目:kernel_adiutor    文件:MainActivity.java   
/**
 * 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();
}
项目:nono-android    文件:MarkdownEditText.java   
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();
}
项目:nono-android    文件:PhotoLayout.java   
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);
}
项目:Superuser-UI    文件:TintHelper.java   
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);
}
项目:PowerSwitch_Android    文件:ConfigureReceiverDialogPage3SetupFragment.java   
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;
}
项目:mage-android    文件:MageNumberControl.java   
public MageNumberControl(Context context, AttributeSet attrs, double min, double max) {
    super(context, attrs);

    this.min = min;
    this.max = max;
    this.propertyType = MagePropertyType.NUMBER;

    AppCompatEditText editText = new AppCompatEditText(context, attrs);
    editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    editText.addTextChangedListener(this);
    addView(editText);

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MageFormElement);
    setPropertyKey(typedArray.getString(R.styleable.MageFormElement_propertyKey));
    setPropertyType(MagePropertyType.getPropertyType(typedArray.getInt(R.styleable.MageFormElement_propertyType, 0)));
    typedArray.recycle();
}
项目:mage-android    文件:MageSelectView.java   
public MageSelectView(Context context, AttributeSet attrs, JsonObject jsonObject, Boolean isMultiSelect) {
    super(context, attrs);
    this.jsonObject = jsonObject;
    this.isMultiSelect = isMultiSelect;

    AppCompatEditText editText = new AppCompatEditText(context, attrs);
    editText.setFocusableInTouchMode(false);
    editText.setFocusable(true);
    editText.setTextIsSelectable(false);
    editText.setCursorVisible(false);
    editText.setClickable(false);
    editText.addTextChangedListener(this);
    addView(editText);

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MageFormElement);
    setPropertyKey(typedArray.getString(R.styleable.MageFormElement_propertyKey));
    setPropertyType(MagePropertyType.getPropertyType(typedArray.getInt(R.styleable.MageFormElement_propertyType, 0)));
    typedArray.recycle();
}
项目:applivery-android-sdk    文件:UserFeedbackView.java   
private void initViewElements(View view) {

    cancelButton = (ImageButton) view.findViewById(R.id.applivery_feedback_cancel_button);
    okButton = (ImageButton) view.findViewById(R.id.applivery_feedback_ok_button);
    sendButton = (ImageButton) view.findViewById(R.id.applivery_feedback_send_button);
    feedbackButton = (LinearLayout) view.findViewById(R.id.applivery_tab_button_selector_feedback);
    bugButton = (LinearLayout) view.findViewById(R.id.applivery_tab_button_selector_bug);
    screenshot = (DrawingImageView) view.findViewById(R.id.appliveryScreenShot);
    feedbackImage = (ImageView) view.findViewById(R.id.applivery_feedback_image);
    feedbackMessage = (AppCompatEditText) view.findViewById(R.id.applivery_feedback_description);
    feedbackFormContainer = (LinearLayout) view.findViewById(R.id.applivery_feedback_form);
    screenShotSwitch = (SwitchCompat) view.findViewById(R.id.attach_screenshot_switch);

    initViewState();

    initElementActions();
  }
项目:AwesomeSplash    文件:UIUtil.java   
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);
            }
        }
    }
项目:FRC-Krawler    文件:EventInfoFragment.java   
private AlertDialog buildEditDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    AppCompatEditText name = new AppCompatEditText(getActivity());
    name.setText(mEvent.getName());
    int padding = Util.getPixelsFromDp(getActivity(), 16);
    name.setPadding(padding, padding, padding, padding);
    builder.setView(name);
    builder.setTitle("Edit Event");
    builder.setPositiveButton("Ok", (dialog, which) -> {
        mEvent.setName(name.getText().toString());
        mEvent.update();
        ((BaseActivity) getActivity()).setActionBarSubtitle(mEvent.getName());
    });
    builder.setNegativeButton("Cancel", null);
    return builder.create();
}
项目:4pdaClient-plus    文件:BasePreferencesActivity.java   
@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;
}
项目:KernelAdiutor    文件:EditorActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_editor);

    initToolBar();
    String title = getIntent().getStringExtra(TITLE_INTENT);
    if (title != null) {
        getSupportActionBar().setTitle(title);
    }

    CharSequence text = getIntent().getCharSequenceExtra(TEXT_INTENT);
    mEditText = (AppCompatEditText) findViewById(R.id.edittext);
    if (text != null) {
        mEditText.append(text);
    }
}
项目:Ansole    文件:Term.java   
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();
}
项目:WeatherDoge    文件:OptionsActivity.java   
@Nullable
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    // Provide colorized/tinted widgets on non-Material devices
    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;
}
项目:MaterialPreferenceLibrary    文件:EditTextPreference.java   
@Override
protected void init(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) {
    super.init(context, attrs, defStyleAttr, defStyleRes);
    mEditText = new AppCompatEditText(context, attrs);

    // Give it an ID so it can be saved/restored
    mEditText.setId(android.R.id.edit);

    /*
     * The preference framework and view framework both have an 'enabled'
     * attribute. Most likely, the 'enabled' specified in this XML is for
     * the preference framework, but it was also given to the view framework.
     * We reset the enabled state.
     */
    mEditText.setEnabled(true);
    setDialogLayoutResource(R.layout.mpl__edittext_dialog_preference);
}
项目:material-dialogs    文件:MaterialEditTextPreference.java   
private void init(Context context, AttributeSet attrs) {
  PrefUtil.setLayoutResource(context, this, 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);
  color = DialogUtils.resolveColor(context, R.attr.md_widget_color, fallback);

  editText = new AppCompatEditText(context, attrs);
  // Give it an ID so it can be saved/restored
  editText.setId(android.R.id.edit);
  editText.setEnabled(true);
}
项目:tiempobus    文件:MainActivity.java   
/**
 * Cargar al pulsar boton o otra accion
 */
private void accionCargar() {

    AppCompatEditText txtPoste = (AppCompatEditText) findViewById(R.id.campo_poste);

    try {
        int tmpPoste = Integer.parseInt(txtPoste.getText().toString());
        if (tmpPoste > 0 && tmpPoste < 9999) {
            paradaActual = tmpPoste;

            SharedPreferences.Editor editor = preferencias.edit();
            editor.putInt("parada_inicio", paradaActual);
            editor.commit();

            handler.sendEmptyMessageDelayed(MSG_RECARGA, DELAY_RECARGA);

        }
    } catch (NumberFormatException e) {
        // Si no ha metido un numero correcto no hacemos nada
    }

}
项目:tiempobus    文件:MainActivity.java   
/**
 * Pulsar recarga de tiempos
 */
private void recargarTiempos() {

    AppCompatEditText txtPoste = (AppCompatEditText) findViewById(R.id.campo_poste);

    try {
        int tmpPoste = Integer.parseInt(txtPoste.getText().toString());
        if (tmpPoste > 0 && tmpPoste < 9999) {
            paradaActual = tmpPoste;
            handler.sendEmptyMessageDelayed(MSG_RECARGA, DELAY_RECARGA);

        }
    } catch (NumberFormatException e) {
        // No hay numero. Recargar con el ultimo usado
        handler.sendEmptyMessageDelayed(MSG_RECARGA, DELAY_RECARGA);
    }

}