Java Code Examples for android.support.v7.widget.AppCompatEditText

The following are top voted examples for showing how to use android.support.v7.widget.AppCompatEditText. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: weixzz-app   File: NewStatusActivity.java   Source Code and License 7 votes vote down vote up
@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);
        }
    });


}
 
Example 2
Project: GestureFun   File: DeleteOnSwipeEditText.java   Source Code and License 7 votes vote down vote up
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);
}
 
Example 3
Project: Rx_java2_soussidev   File: VerifyCompacResultHelper.java   Source Code and License 6 votes vote down vote up
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;
    }
}
 
Example 4
Project: MTweaks-KernelAdiutorMOD   File: BuildpropFragment.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 5
Project: MTweaks-KernelAdiutorMOD   File: EditorActivity.java   Source Code and License 6 votes vote down vote up
@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);
    }
}
 
Example 6
Project: KernelAdiutor-Mod   File: BuildpropFragment.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 7
Project: KernelAdiutor-Mod   File: EditorActivity.java   Source Code and License 6 votes vote down vote up
@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);
    }
}
 
Example 8
Project: android-geohash   File: ConverterFragment.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 9
Project: OSchina_resources_android   File: DialogHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 获取一个输入对话框
 */
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);
}
 
Example 10
Project: OSchina_resources_android   File: DialogHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 获取一个输入对话框
 */
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);
}
 
Example 11
Project: MetadataEditor   File: TintHelper.java   Source Code and License 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 12
Project: SelectName   File: SelectActivity.java   Source Code and License 6 votes vote down vote up
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);
    }
 
Example 13
Project: ProjectTemplate   File: DialogHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 获取一个输入对话框
 */
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);
}
 
Example 14
Project: ProjectTemplate   File: DialogHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 获取一个输入对话框
 */
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);
}
 
Example 15
Project: AidlBestPractice   File: MainActivity.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 16
Project: AidlBestPractice   File: MainActivity.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 17
Project: EasyUtils   File: TestETBActivity.java   Source Code and License 6 votes vote down vote up
@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();
        }
    });
}
 
Example 18
Project: ESeal   File: LoginFragment.java   Source Code and License 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 19
Project: app-theme-engine-master   File: TintHelper.java   Source Code and License 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_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);
    }
}
 
Example 20
Project: TodoFluxArchitecture   File: TodoListActivity.java   Source Code and License 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 21
Project: deathly_adiutor_free   File: MainActivity.java   Source Code and License 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 22
Project: KA27   File: MainActivity.java   Source Code and License 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 23
Project: kernel_adiutor   File: MainActivity.java   Source Code and License 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 24
Project: nono-android   File: MarkdownEditText.java   Source Code and License 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 25
Project: nono-android   File: PhotoLayout.java   Source Code and License 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 26
Project: Superuser-UI   File: TintHelper.java   Source Code and License 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 27
Project: PowerSwitch_Android   File: ConfigureReceiverDialogPage3SetupFragment.java   Source Code and License 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 28
Project: mage-android   File: MageNumberControl.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 29
Project: mage-android   File: MageSelectView.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 30
Project: applivery-android-sdk   File: UserFeedbackView.java   Source Code and License 6 votes vote down vote up
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();
  }
 
Example 31
Project: AwesomeSplash   File: UIUtil.java   Source Code and 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 32
Project: FRC-Krawler   File: EventInfoFragment.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 33
Project: 4pdaClient-plus   File: BasePreferencesActivity.java   Source Code and License 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 34
Project: KernelAdiutor   File: EditorActivity.java   Source Code and License 6 votes vote down vote up
@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);
    }
}
 
Example 35
Project: Ansole   File: Term.java   Source Code and License 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 36
Project: WeatherDoge   File: OptionsActivity.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 37
Project: MaterialPreferenceLibrary   File: EditTextPreference.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 38
Project: material-dialogs   File: MaterialEditTextPreference.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 39
Project: tiempobus   File: MainActivity.java   Source Code and License 6 votes vote down vote up
/**
 * 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
    }

}
 
Example 40
Project: tiempobus   File: MainActivity.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
    }

}