All Projects → CottaCush → Currencyedittext

CottaCush / Currencyedittext

Licence: apache-2.0
💰 A library to dynamically format your EditTexts to take currency inputs

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Currencyedittext

RotatableAutofitEditText
Extended EditText which allows to move, rotate and resize text at the same time
Stars: ✭ 51 (-31.08%)
Mutual labels:  edittext
Pinview
A PIN view library for Android. Use to enter PIN/OTP/password etc.
Stars: ✭ 387 (+422.97%)
Mutual labels:  edittext
Rxmarkdown
📠Markdown for Android, supports TextView && EditText (Live Preview), supports code high light.
Stars: ✭ 714 (+864.86%)
Mutual labels:  edittext
Text-Length-Bar
No description or website provided.
Stars: ✭ 31 (-58.11%)
Mutual labels:  edittext
Spedittool
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
Stars: ✭ 292 (+294.59%)
Mutual labels:  edittext
Androidedit
Android EditText的撤销和恢复(反撤销)
Stars: ✭ 449 (+506.76%)
Mutual labels:  edittext
textmatcher
A simple text watcher that matches specific targets like mention or hashtag in a string by defining rules
Stars: ✭ 67 (-9.46%)
Mutual labels:  edittext
Splitedittext
🔢 SplitEditText 是一个灵活的分割编辑框。常常应用于验证码输入 、密码输入等场景。
Stars: ✭ 33 (-55.41%)
Mutual labels:  edittext
Autocomplete
Simple yet powerful autocomplete behavior for EditTexts, to avoid working with MultiAutoCompleteTextView APIs.
Stars: ✭ 307 (+314.86%)
Mutual labels:  edittext
Gsyricktext
类似微博的emoji表情、@人、话题等的EdiText,优化了编辑框中的光标点击和删除处理。TextView支持emoji表情、话题、链接、电话和@某人特殊显示的文本。
Stars: ✭ 651 (+779.73%)
Mutual labels:  edittext
currency edittext
Simple currency formatter for Android EditText
Stars: ✭ 64 (-13.51%)
Mutual labels:  edittext
Editdrawabletext
EditDrawableText - An EditText which makes your Drawable Clickable
Stars: ✭ 288 (+289.19%)
Mutual labels:  edittext
Xedittext
XEditText: clear contents easily; show/hide password; separeta contents automatically, such as credit card number; disable Emoji inputs; 带删除功能的EditText;显示或者隐藏密码;可设置自动添加分隔符分割电话号码、银行卡号等;支持禁止Emoji表情符号输入。
Stars: ✭ 474 (+540.54%)
Mutual labels:  edittext
CustomEditText
Simple Custom EditText for Android like Instagram
Stars: ✭ 23 (-68.92%)
Mutual labels:  edittext
Textfieldboxes
Material Design text field that comes in a box, based on (OLD) Google Material Design guidelines.
Stars: ✭ 760 (+927.03%)
Mutual labels:  edittext
CustomFontView
Custom View classes for TextView, EditText & Buttons - to set custom fonts
Stars: ✭ 26 (-64.86%)
Mutual labels:  edittext
Edittext Mask
The custom masks for EditText. The solution for input phone numbers, SSN, and so on for Android
Stars: ✭ 413 (+458.11%)
Mutual labels:  edittext
Viewtooltip
A fluent tooltip for Android
Stars: ✭ 1,029 (+1290.54%)
Mutual labels:  edittext
Textinputview
Permanent hint for EditText
Stars: ✭ 26 (-64.86%)
Mutual labels:  edittext
Maskara
A simple way to format text fields without getting affected by input filters
Stars: ✭ 515 (+595.95%)
Mutual labels:  edittext

CurrencyEditText

A library to dynamically format your EditTexts to take currency inputs.

Build Status Download

Gradle Dependency

Add the dependency to your app's build.gradle:

implementation 'com.cottacush:CurrencyEditText:0.0.7'

Usage

Add the CurrencyEditText to your layout.

   <com.cottacush.android.currencyedittext.CurrencyEditText
            ...
            android:layout_width="wrap_content"
            android:layout_height="60dp"
            android:ems="10"
            android:id="@+id/editText"/>

That's all for basic setup. Your editText should automatically format currency inputs.

Customisation

Currency Symbol

You can specify the currency symbol using the currencySymbol and useCurrencySymbolAsHint attributes in xml. The formatted currency value will be prepended with the currencySymbol value. The currencySymbol value can also be used as hint, as described by the useCurrencySymbolAsHint attribute.

   <com.cottacush.android.currencyedittext.CurrencyEditText
            ...
            app:currencySymbol="₦"
            app:useCurrencySymbolAsHint="true"/>

or programmatically:

   currencyEditText.setCurrencySymbol("₦", useCurrencySymbolAsHint = true)

Locale

The CurrencyEditText uses the default Locale if no locale is specified. Locale can be specified programmatically via

   currencyEditText.setLocale(locale)

Locales can also be specified using locale-tags. The locale tag method requires API 21 and above. Instructions on how to construct valid Locale and locale-tags can be found here.

   <com.cottacush.android.currencyedittext.CurrencyEditText
            ...
            app:localeTag="en-NG"/>

or programmatically via

   currencyEditText.setLocale("en-NG") //Requires API level 21 and above.

Getting the input value

Numeric values for the editText can be gotten as shown below.

   currencyEditText.getNumericValue()

If you need a BigDecimal to continue your monetary calculations right away, you can get it by

   currencyEditText.getNumericValueBigDecimal()

Using the formatter directly

If you'd like to use the library with any EditText widget, you can attach your EditText with the CurrencyInputWatcher class:

   editText.addTextChangedListener(CurrencyInputWatcher(editText,"₦", Locale.getDefault()))

License

Copyright (c) 2019 Cotta & Cush Limited.

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].