• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android library that provides a simple number keyboard view.

Number Keyboard

Android library that provides a number keyboard view.

screenshot

Usage

Step 1

Add the JitPack repository to your build.gradle file:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Step 2

Add the dependency:

dependencies {
	compile 'com.github.davidmigloz:number-keyboard:3.1.0'
}

CHANGELOG

Step 3

Use NumberKeyboard view in your layout:

<com.davidmiguel.numberkeyboard.NumberKeyboard
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:keyboard="http://schemas.android.com/apk/res-auto"
    ...
    keyboard:numberkeyboard_keyboardType="integer"
    ... />

Attributes

  • keyboard:numberkeyboard_keyboardType="[integer|decimal|fingerprint|custom]" (required): defines the type of keyboard.
    • integer: numbers and backspace keys.
    • decimal: numbers, comma and backspace keys.
    • fingerprint: numbers, fingerprint and backspace keys.
    • custom: numbers and defined auxiliary keys.
  • keyboard:numberkeyboard_keyWidth="[dimension]" (default: match_parent): key width (wrap_content not allowed).
  • keyboard:numberkeyboard_keyHeight="[dimension]" (default: match_parent): key height (wrap_content not allowed).
  • keyboard:numberkeyboard_keyPadding="[dimension]" (default: 16dp): key padding.
  • keyboard:numberkeyboard_numberKeyBackground="[reference]" (default: circle): number keys background drawable.
  • keyboard:numberkeyboard_numberKeyTextColor="[reference]" (default: dark blue): number keys text color.
  • keyboard:numberkeyboard_numberKeyTypeface="[reference]" (default: dark blue): number keys text color.
  • keyboard:numberkeyboard_numberKeyTypeface="[reference]" (default: none): number keys text typeface.
  • keyboard:numberkeyboard_numberKeyTextSize="[dimension]" (default: none): number keys text size (if it is not set, the text auto scales to fit the key).
  • keyboard:numberkeyboard_leftAuxBtnBackground="[reference]" (default: none): if keyboardType="custom", left auxiliary button background.
  • keyboard:numberkeyboard_rightAuxBtnIcon="[reference]" (default: none): if keyboardType="custom", icon shown in right auxiliary button.
  • keyboard:numberkeyboard_rightAuxBtnBackground="[reference]" (default: none): if keyboardType="custom", right auxiliary button background.

Methods

  • hideLeftAuxButton(): hides left auxiliary button.
  • showLeftAuxButton(): shows left auxiliary button.
  • hideRightAuxButton(): hides right auxiliary button.
  • showRightAuxButton(): shows right auxiliary button.
  • setKeyWidth(): sets key width in px.
  • setKeyHeight(): sets key height in px.
  • setKeyPadding(): sets key padding in px.
  • setNumberKeyBackground(): sets number keys background.
  • setNumberKeyTextColor(): sets number keys text color.
  • setNumberKeyTypeface(): sets number keys text typeface.
  • setNumberKeyTextSize(): sets number keys text size in pixels.
  • setLeftAuxButtonIcon(): sets left auxiliary button icon.
  • setRightAuxButtonIcon(): sets right auxiliary button icon.
  • setLeftAuxButtonBackground(): sets left auxiliary button background.
  • setRightAuxButtonBackground(): sets right auxiliary button background.

Callback

To listen to keyboard events, you have to use NumberKeyboardListener:

  • onNumberClicked(): invoked when a number key is clicked.
  • onLeftAuxButtonClicked(): invoked when the left auxiliary button is clicked.
  • onRightAuxButtonClicked(): invoked when the right auxiliary button is clicked.
numberKeyboard.setListener(new NumberKeyboardListener() {
     @Override
     public void onNumberClicked(int number) {...}

     @Override
     public void onLeftAuxButtonClicked() {...}

     @Override
     public void onRightAuxButtonClicked() {...}
});

Take a look at the sample app to see the library working.

Contributing

If you find any issues or you have any questions, ideas... feel free to open an issue. Pull request are very appreciated.

License

Copyright (c) 2018 David Miguel Lozano

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

langchain_dart

Build LLM-powered Dart/Flutter applications.
Dart
385
star
2

drag-to-close

Android library that provides a view group which allows to finish an activity by dragging a view.
Kotlin
70
star
3

go-bees

Android app for monitoring bee hives activity.
Java
37
star
4

multi-state-switch

Android library that provides a multi state switch view.
Kotlin
35
star
5

IDEA-cipher

Software implementation of International Data Encryption Algorithm (IDEA) cipher with 4 ciphering modes (ECB, CBC, CFB, OBF).
Java
18
star
6

youtube-android-player-api-gradle

YouTube Android Player API packaged as Gradle dependency.
9
star
7

3d-engine

Software implementation (based on CPU) of a 3D engine from scratch.
Java
8
star
8

line-chart

A simple Android line chart library.
Kotlin
4
star
9

Twitter-Timeline

Permite mostrar el timeline de un usuario de twitter con la nueva API 1.1, mediante PHP y OAuth. Totalmente configurable. Genera cΓ³digo HTML5 (personalizable).
PHP
4
star
10

photo-editor

Photo editor with a set of filters and drawing capabilities.
Java
4
star
11

go-dentist-android

Freelance dentist management Android app
Kotlin
3
star
12

opencv-android-gradle-repo

OpenCV Android bindings packaged as Gradle dependecy.
Java
2
star
13

cryptocurrencies-course

Programming assignments for Bitcoin and Cryptocurrency Technologies MOOC course from Princeton University.
Java
2
star
14

supermarket-agent-system

Projects for Agent Systems and Applications at Warsaw University of Technology.
Java
2
star
15

relay-race-agents

Testing mobility in the JADE agents platform implementing a "realay race".
Java
2
star
16

cv

My Curriculum Vitae.
TeX
1
star
17

inkchatter

Search and explore your Inkdrop notes through the power of GPT
Python
1
star
18

davidmigloz

This is me!
1
star
19

robotium-testing

Android testing project with Robotium framework.
Java
1
star
20

jclec_maven_repo

Java Class Library for Evolutionary Computation maven repo (unofficial).
1
star
21

spamming-scenario-agents

Implement and test a spamming scenario to test characteristics / boundaries of messaging in JADE agents platform.
Java
1
star
22

cheat-sheets

A place where to save my cheat sheets.
1
star
23

cfmv

Application of clustering for finding missed values in a dataset using k-means.
Java
1
star