Skip to content

gzeinnumer/EditTextCurrency

Repository files navigation

EditTextCurrency


Simple way to convert 1000000 to 1,000,000 .


Content List


Download

Add maven jitpack.io and dependencies in build.gradle (Project) :

// build.gradle project
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

// build.gradle app/module
dependencies {
  ...
  implementation 'com.github.gzeinnumer:EditTextCurrency:version'
  implementation 'com.google.android.material:material:1.2.0'
}

Feature List


Tech stack and 3rd library


Usage

First Step. Use MaterialComponents in your style :

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <!-- Customize your theme here. -->
</style>

  • Sample 1 -> Simple TextWacher
editText.addTextChangedListener(new CurrencyConverter(editText));

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        String str = editText.getText().toString();
        Log.d(TAG, "onClick: " + StringTools.trimCommaOfString(str));

        textView.setText(StringTools.trimCommaOfString(str));
    }
});

  • Sample 2 -> Simple TextWacher With CallBack
editText.addTextChangedListener(new CurrencyConverter(editText, new CurrencyConverter.StringCallBack() {
    @Override
    public void realString(String value) {
        textView.setText("(Real Value) : " + value + " && (Preview) : " + editText.getText().toString());
    }
}));

Preview For Sample 1-4:

Sample 1 & Sample 2

Example Code/App

FullCode MainActivity & XML

Sample Code And App


Version

  • 4.0.0
    • First Release
  • 4.0.1
    • Take Out Useless Method
  • 5.0.1
    • Support SDK 16
  • 5.0.2
    • Bug Fixing
  • 5.0.3
    • Bug Fixing
  • 5.1.0
    • Take Out CurrencyEditText & CurrencyEditTextFilledBox & CurrencyEditTextOutlinedBox
  • 5.2.0
    • More Simple
  • 5.2.3
    • Bug Fixing
  • 5.2.4
    • Bug Fixing
  • 5.2.6
    • Bug Fixing 0

Contribution

You can sent your constibution to branch open-pull.


Copyright 2020 M. Fadli Zein

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages