A simplistic and easy to use number pad for Android.
Add this in your root build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add this to your module's build.gradle file:
dependencies {
...
implementation 'com.github.wRorsjakz:Android-NumPad:1.0.1'
}
Include the widget in your xml
layout file:
<com.example.numpad.NumPad
android:id="@+id/numpad_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Instantiate the numpad widget:
NumPad numPad = findViewById(R.id.my_numpad);
numPad.setOnNumPadClickListener(new NumPadClick(new numPadClickListener() {
@Override
public void onNumpadClicked(ArrayList<Integer> nums) {
Log.d("MYTAG", "onNumpadClicked: " + nums);
}
}));
onNumpadClicked(ArrayList<Integer> nums)
returns a ArrayList<Integer>
of numbers that the user has entered till then. If the user presses delete when the arraylist is already empty, then it returns an empty arraylist.
Change the color of the button text:
numpad.setButtonTextColor(@NonNull Context context, @NonNull int colorId);
Change color of numpad background
<com.example.numpad.NumPad
...
android:background="..."
/>
- 1.0.1
- Initial Release
Copyright 2019 Nicholas Gan
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.