Skip to content

wangshaolei/NumberKeyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NumberKeyboard

Custom keyboardview with two ways:

  1. Override systems's sys.xml of keyboardview
  2. Custom the layout and slove the touchListener's question and so on...

For example: MeiTuan's Merchant or NuoMi's Merchant app, Number Keyboard

Show parts codes:

    public class MainActivity extends AppCompatActivity implements View.OnClickListener, NumberKeyboardUtil.OnPopuWindowListener
    private void initView(){
        etCode = ButterKnife.findById(inputLayout, R.id.et_code);
        keyboardPopupwindow = NumberKeyboardPopupWindow.getInstance(this).onCreate(this);
        NumberKeyboardUtil.getInstance().setOnTouchListener(etCode, keyboardPopupwindow, this);
        NumberKeyboardUtil.getInstance().disableCopyAndPaste(etCode);
    }
    @Override
    public void showPopuWindow() {
        etCode.requestFocus();
        keyboardPopupwindow.showAsDropDown(llTop);
    }

    @Override
    public void dismiss() {
        etCode.getText().clear();
        etCode.clearFocus();
        keyboardPopupwindow.dismiss();
    }

    @Override
    public void insertStr(String str) {
        int index = etCode.getSelectionStart();
        if (index < 0 || index >= etCode.getText().toString().length()) {
            etCode.append(str);
        } else {
            etCode.getEditableText().insert(index, str);
        }
    }

    @Override
    public void check() {
        Toast.makeText(this, "check", Toast.LENGTH_SHORT).show();
    }

Thanks:

Jakewharton-Butterknife

About

For example meituan's mechant NumberKeyboard

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages