├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── Preview.gif
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── yigitserin
│ │ └── currencyedittextsample
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-web.png
│ ├── java
│ │ └── com
│ │ │ └── yigitserin
│ │ │ └── currencyedittextsample
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── yigitserin
│ └── currencyedittextsample
│ └── ExampleUnitTest.java
├── build.gradle
├── currencyedittext
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── yigitserin
│ │ └── currencyedittext
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── yigitserin
│ │ │ └── currencyedittext
│ │ │ └── CurrencyEditText.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── yigitserin
│ └── currencyedittext
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
12 | # Created by https://www.gitignore.io/api/android
13 |
14 | ### Android ###
15 | # Built application files
16 | *.apk
17 | *.ap_
18 |
19 | # Files for the ART/Dalvik VM
20 | *.dex
21 |
22 | # Java class files
23 | *.class
24 |
25 | # Generated files
26 | bin/
27 | gen/
28 | out/
29 |
30 | # Gradle files
31 | .gradle/
32 | build/
33 |
34 | # Local configuration file (sdk path, etc)
35 | local.properties
36 |
37 | # Proguard folder generated by Eclipse
38 | proguard/
39 |
40 | # Log Files
41 | *.log
42 |
43 | # Android Studio Navigation editor temp files
44 | .navigation/
45 |
46 | # Android Studio captures folder
47 | captures/
48 |
49 | # IntelliJ
50 | *.iml
51 | .idea/workspace.xml
52 | .idea/tasks.xml
53 | .idea/gradle.xml
54 | .idea/assetWizardSettings.xml
55 | .idea/dictionaries
56 | .idea/libraries
57 | .idea/caches
58 |
59 | # Keystore files
60 | # Uncomment the following line if you do not want to check your keystore files in.
61 | #*.jks
62 |
63 | # External native build folder generated in Android Studio 2.2 and later
64 | .externalNativeBuild
65 |
66 | # Google Services (e.g. APIs or Firebase)
67 | google-services.json
68 |
69 | # Freeline
70 | freeline.py
71 | freeline/
72 | freeline_project_description.json
73 |
74 | # fastlane
75 | fastlane/report.xml
76 | fastlane/Preview.html
77 | fastlane/screenshots
78 | fastlane/test_output
79 | fastlane/readme.md
80 |
81 | ### Android Patch ###
82 | gen-external-apklibs
83 |
84 |
85 | # End of https://www.gitignore.io/api/android
86 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
19 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Yigit Serin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Preview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/Preview.gif
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CurrencyEditText [  ](https://bintray.com/yigitserin/CurrencyEditText/CurrencyEditText/_latestVersion)
2 |
3 |
4 |
5 | CurrencyEditText is an EditText library for inputting currency values. It supports grouping and decimal seperators.
6 |
7 | ##### Step 1. Add the dependency
8 |
9 | ```gradle
10 | repositories {
11 | mavenCentral()
12 | google()
13 | }
14 |
15 | dependencies {
16 | implementation 'com.yigitserin.currencyedittext:CurrencyEditText:0.3'
17 | }
18 | ```
19 |
20 | ##### Step 2. Configure
21 | ```java
22 | CurrencyEditText etCurrency = findViewById(R.id.etCurrency);
23 | etCurrency.setLocale(new Locale("tr","TR"));
24 | etCurrency.setDecimalDigits(2);
25 | ```
26 |
27 | ##### Step 3. Enjoy
28 |
29 |
30 | ### Licence
31 |
32 | MIT License
33 |
34 | Copyright (c) 2018 Yigit Serin
35 |
36 | Permission is hereby granted, free of charge, to any person obtaining a copy
37 | of this software and associated documentation files (the "Software"), to deal
38 | in the Software without restriction, including without limitation the rights
39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40 | copies of the Software, and to permit persons to whom the Software is
41 | furnished to do so, subject to the following conditions:
42 |
43 | The above copyright notice and this permission notice shall be included in all
44 | copies or substantial portions of the Software.
45 |
46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52 | SOFTWARE.
53 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.yigitserin.currencyedittextsample"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:28.0.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25 | implementation project(':currencyedittext')
26 | testImplementation 'junit:junit:4.12'
27 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
28 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
29 | }
30 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/yigitserin/currencyedittextsample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.yigitserin.currencyedittextsample;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.yigitserin.currencyedittextsample", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/com/yigitserin/currencyedittextsample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.yigitserin.currencyedittextsample;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.yigitserin.currencyedittext.CurrencyEditText;
7 |
8 | import java.util.Locale;
9 |
10 | public class MainActivity extends AppCompatActivity {
11 |
12 | private CurrencyEditText cetPayment;
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 |
19 | cetPayment = findViewById(R.id.cetPayment);
20 | cetPayment.setLocale(new Locale("tr", "TR"));
21 | cetPayment.setDecimalDigits(2);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #14BB0A
4 | #13990A
5 | #D81B60
6 | #FFFFFF
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #14BB0A
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CurrencyEditText Sample
3 | Pay!
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/yigitserin/currencyedittextsample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.yigitserin.currencyedittextsample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.0'
11 | classpath 'com.novoda:bintray-release:0.8.1'
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | }
22 | }
23 |
24 | task clean(type: Delete) {
25 | delete rootProject.buildDir
26 | }
27 |
--------------------------------------------------------------------------------
/currencyedittext/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/currencyedittext/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.novoda.bintray-release'
3 |
4 | publish {
5 |
6 | def groupProjectID = 'com.yigitserin.currencyedittext'
7 | def artifactProjectID = 'CurrencyEditText'
8 | def publishVersionID = '0.3'
9 |
10 | userOrg = 'yigitserin'
11 | repoName = 'CurrencyEditText'
12 | groupId = groupProjectID
13 | artifactId = artifactProjectID
14 | publishVersion = publishVersionID
15 | desc = 'EditText input for currency values.'
16 | website = 'https://github.com/yigitserin/CurrencyEditText'
17 |
18 | }
19 |
20 | android {
21 | compileSdkVersion 28
22 |
23 |
24 |
25 | defaultConfig {
26 | minSdkVersion 17
27 | targetSdkVersion 28
28 | versionCode 1
29 | versionName "1.0"
30 |
31 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
32 |
33 | }
34 |
35 | buildTypes {
36 | release {
37 | minifyEnabled false
38 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
39 | }
40 | }
41 |
42 | }
43 |
44 | dependencies {
45 | implementation fileTree(dir: 'libs', include: ['*.jar'])
46 |
47 | implementation 'com.android.support:appcompat-v7:28.0.0'
48 | testImplementation 'junit:junit:4.12'
49 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
50 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
51 | }
52 |
--------------------------------------------------------------------------------
/currencyedittext/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/currencyedittext/src/androidTest/java/com/yigitserin/currencyedittext/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.yigitserin.currencyedittext;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.yigitserin.currencyedittext.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/currencyedittext/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/currencyedittext/src/main/java/com/yigitserin/currencyedittext/CurrencyEditText.java:
--------------------------------------------------------------------------------
1 | package com.yigitserin.currencyedittext;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.AppCompatEditText;
5 | import android.text.Editable;
6 | import android.text.InputType;
7 | import android.text.TextUtils;
8 | import android.text.TextWatcher;
9 | import android.util.AttributeSet;
10 | import android.util.Log;
11 | import android.view.View;
12 |
13 | import java.text.DecimalFormatSymbols;
14 | import java.text.NumberFormat;
15 | import java.text.ParseException;
16 | import java.util.ArrayList;
17 | import java.util.List;
18 | import java.util.Locale;
19 |
20 | public class CurrencyEditText extends AppCompatEditText {
21 |
22 | public interface NumericValueWatcher {
23 | void onChanged(double newValue);
24 | void onCleared();
25 | }
26 |
27 | public Locale locale = new Locale("en","US");
28 | public int decimalDigits = 2;
29 |
30 | private char GROUPING_SEPARATOR;
31 | private char DECIMAL_SEPARATOR;
32 | private String LEADING_ZERO_FILTER_REGEX;
33 |
34 | private String mDefaultText = null;
35 | private String mPreviousText = "";
36 | private String mNumberFilterRegex;
37 | private List mNumericListeners = new ArrayList<>();
38 |
39 | //region TextWatcher
40 |
41 | private final TextWatcher mTextWatcher = new TextWatcher() {
42 | private boolean validateLock = false;
43 |
44 | @Override
45 | public void afterTextChanged(Editable s) {
46 |
47 | String text = s.toString();
48 |
49 | if (validateLock) {
50 | return;
51 | }
52 |
53 | // If user presses GROUPING_SEPARATOR, convert it to DECIMAL_SEPARATOR
54 | if (text.endsWith(GROUPING_SEPARATOR+"")){
55 | text = text.substring(0,text.length()-1) + DECIMAL_SEPARATOR;
56 | }
57 |
58 | // Limit decimal digits
59 | if (decimalDigitLimitReached(text)){
60 | validateLock = true;
61 | setText(mPreviousText); // cancel change and revert to previous input
62 | setSelection(mPreviousText.length());
63 | validateLock = false;
64 | return;
65 | }
66 |
67 | // valid decimal number should not have thousand separators after a decimal separators
68 | if (hasGroupingSeperatorAfterDecimalSeperator(text)){
69 | validateLock = true;
70 | setText(mPreviousText); // cancel change and revert to previous input
71 | setSelection(mPreviousText.length());
72 | validateLock = false;
73 | return;
74 | }
75 |
76 |
77 | // valid decimal number should not have more than 2 decimal separators
78 | if (countMatches(text, String.valueOf(DECIMAL_SEPARATOR)) > 1) {
79 | validateLock = true;
80 | setText(mPreviousText); // cancel change and revert to previous input
81 | setSelection(mPreviousText.length());
82 | validateLock = false;
83 | return;
84 | }
85 |
86 | if (text.length() == 0) {
87 | handleNumericValueCleared();
88 | return;
89 | }
90 |
91 | // If only decimal separator is inputted, add a zero to the left of it
92 | if (text.equals(String.valueOf(DECIMAL_SEPARATOR))) {
93 | text = '0' + text;
94 | }
95 |
96 | setTextInternal(format(text));
97 | setSelection(getText().length());
98 | handleNumericValueChanged();
99 | }
100 |
101 | @Override
102 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
103 | // do nothing
104 | }
105 |
106 | @Override
107 | public void onTextChanged(CharSequence s, int start, int before, int count) {
108 | // do nothing
109 | }
110 | };
111 |
112 | //endregion
113 |
114 | public CurrencyEditText(Context context, AttributeSet attrs) {
115 | super(context, attrs);
116 |
117 | setInputType(InputType.TYPE_CLASS_PHONE);
118 | setTextAlignment(TEXT_ALIGNMENT_TEXT_END);
119 |
120 | reload();
121 |
122 | addTextChangedListener(mTextWatcher);
123 | setOnClickListener(new View.OnClickListener() {
124 | @Override
125 | public void onClick(View v) {
126 | // disable moving cursor
127 | setSelection(getText().length());
128 | }
129 | });
130 | }
131 |
132 | public void setLocale(Locale locale) {
133 | this.locale = locale;
134 | reload();
135 | }
136 |
137 | public void setDecimalDigits(int decimalDigits) {
138 | this.decimalDigits = decimalDigits;
139 | reload();
140 | }
141 |
142 | private void reload(){
143 | DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
144 |
145 | GROUPING_SEPARATOR = symbols.getGroupingSeparator();
146 | DECIMAL_SEPARATOR = symbols.getDecimalSeparator();
147 | LEADING_ZERO_FILTER_REGEX = "^0+(?!$)";
148 | mNumberFilterRegex = "[^\\d\\" + this.DECIMAL_SEPARATOR + "]";
149 | }
150 |
151 | //region Utils
152 |
153 | private void handleNumericValueCleared() {
154 | mPreviousText = "";
155 | for (NumericValueWatcher listener : mNumericListeners) {
156 | listener.onCleared();
157 | }
158 | }
159 |
160 | private void handleNumericValueChanged() {
161 | mPreviousText = getText().toString();
162 | for (NumericValueWatcher listener : mNumericListeners) {
163 | listener.onChanged(getNumericValue());
164 | }
165 | }
166 |
167 | public void addNumericValueChangedListener(NumericValueWatcher watcher) {
168 | mNumericListeners.add(watcher);
169 | }
170 |
171 | public void removeAllNumericValueChangedListeners() {
172 | while (!mNumericListeners.isEmpty()) {
173 | mNumericListeners.remove(0);
174 | }
175 | }
176 |
177 | public void setDefaultNumericValue(double defaultNumericValue, final String defaultNumericFormat) {
178 | mDefaultText = String.format(defaultNumericFormat, defaultNumericValue);
179 | setTextInternal(mDefaultText);
180 | }
181 |
182 | public void clear() {
183 | setTextInternal(mDefaultText != null ? mDefaultText : "");
184 | if (mDefaultText != null) {
185 | handleNumericValueChanged();
186 | }
187 | }
188 |
189 | public double getNumericValue() {
190 | String original = getText().toString().replaceAll(mNumberFilterRegex, "");
191 | try {
192 | return NumberFormat.getInstance().parse(original).doubleValue();
193 | } catch (ParseException e) {
194 | return Double.NaN;
195 | }
196 | }
197 |
198 | private String format(final String original) {
199 | String[] parts = splitOriginalText(original);
200 | String number = parts[0].replaceAll(mNumberFilterRegex, "").replaceFirst(LEADING_ZERO_FILTER_REGEX, "");
201 |
202 | number = reverse(reverse(number).replaceAll("(.{3})", "$1" + GROUPING_SEPARATOR));
203 | number = removeStart(number, String.valueOf(GROUPING_SEPARATOR));
204 |
205 | if (parts.length > 1) {
206 | parts[1] = parts[1].replaceAll(mNumberFilterRegex, "");
207 | number += DECIMAL_SEPARATOR + parts[1];
208 | }
209 |
210 | return number;
211 | }
212 |
213 | private String[] splitOriginalText(String original) {
214 | //Dot is special character in regex, so we have to treat it specially.
215 | final String[] parts;
216 | if (DECIMAL_SEPARATOR == '.') {
217 | parts = original.split("\\.", -1);
218 | } else {
219 | parts = original.split(DECIMAL_SEPARATOR + "", -1);
220 | }
221 | return parts;
222 | }
223 |
224 | private void setTextInternal(String text) {
225 | removeTextChangedListener(mTextWatcher);
226 | setText(text);
227 | addTextChangedListener(mTextWatcher);
228 | }
229 |
230 | private String reverse(String original) {
231 | if (original == null || original.length() <= 1) {
232 | return original;
233 | }
234 | return TextUtils.getReverse(original, 0, original.length()).toString();
235 | }
236 |
237 | private String removeStart(String str, String remove) {
238 | if (TextUtils.isEmpty(str)) {
239 | return str;
240 | }
241 | if (str.startsWith(remove)){
242 | return str.substring(remove.length());
243 | }
244 | return str;
245 | }
246 |
247 | private int countMatches(String str, String sub) {
248 | if (TextUtils.isEmpty(str)) {
249 | return 0;
250 | }
251 | int lastIndex = str.lastIndexOf(sub);
252 | if (lastIndex < 0) {
253 | return 0;
254 | } else {
255 | return 1 + countMatches(str.substring(0, lastIndex), sub);
256 | }
257 | }
258 |
259 | private boolean hasGroupingSeperatorAfterDecimalSeperator(String text){
260 | //Return true if thousand seperator (.) comes after a decimal seperator. (,)
261 |
262 | if (text.contains(GROUPING_SEPARATOR+"") && text.contains(DECIMAL_SEPARATOR+"")){
263 | int firstIndexOfDecimal = text.indexOf(DECIMAL_SEPARATOR);
264 | int lastIndexOfGrouping = text.lastIndexOf(GROUPING_SEPARATOR);
265 |
266 | if (firstIndexOfDecimal < lastIndexOfGrouping){
267 | return true;
268 | }
269 | }
270 |
271 | return false;
272 | }
273 |
274 | private boolean decimalDigitLimitReached(String text){
275 | //Return true if decimal digit limit is reached
276 | if (text.contains(DECIMAL_SEPARATOR+"")){
277 |
278 | if (DECIMAL_SEPARATOR == '.'){
279 | //Dot is special character in regex, so we have to treat it specially.
280 | String[] parts = text.split("\\.");
281 | if (parts.length>0){
282 | String lastPart = parts[parts.length-1];
283 |
284 | if (lastPart.length() == decimalDigits + 1){
285 | return true;
286 | }
287 | }
288 | }else{
289 | //If decimal seperator is not a dot, we can safely split.
290 | String[] parts = text.split(DECIMAL_SEPARATOR+"");
291 | if (parts.length>1){
292 | String lastPart = parts[parts.length-1];
293 |
294 | if (lastPart.length() == decimalDigits + 1){
295 | return true;
296 | }
297 | }
298 | }
299 | }
300 |
301 | return false;
302 | }
303 |
304 | //endregion
305 | }
306 |
--------------------------------------------------------------------------------
/currencyedittext/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CurrencyEditText
3 |
4 |
--------------------------------------------------------------------------------
/currencyedittext/src/test/java/com/yigitserin/currencyedittext/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.yigitserin.currencyedittext;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yigitserin/CurrencyEditText/746b383cc9c9e8246f4b20ddfdd3f700a35622d8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Oct 09 13:14:48 EET 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':currencyedittext'
2 |
--------------------------------------------------------------------------------