├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── gregacucnik │ │ └── edittextviewdemo │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── gregacucnik │ │ │ └── edittextviewdemo │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-xxxhdpi │ │ ├── ic_camera_black_24dp.png │ │ ├── ic_camera_blue_24dp.png │ │ ├── ic_camera_grey600_24dp.png │ │ ├── ic_clock_black_24dp.png │ │ ├── ic_clock_blue_24dp.png │ │ ├── ic_clock_grey600_24dp.png │ │ ├── ic_file_document_box_black_24dp.png │ │ ├── ic_file_document_box_blue_24dp.png │ │ ├── ic_file_document_box_grey600_24dp.png │ │ ├── ic_information_outline_black_24dp.png │ │ ├── ic_information_outline_blue_24dp.png │ │ └── ic_information_outline_grey600_24dp.png │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── gregacucnik │ └── edittextviewdemo │ └── ExampleUnitTest.java ├── build.gradle ├── edittextview.gif ├── edittextview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── gregacucnik │ │ └── edittextview │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── gregacucnik │ │ │ ├── ETT_EditText.java │ │ │ └── EditTextView.java │ └── res │ │ ├── layout │ │ └── layout_edittextview.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── gregacucnik │ └── edittextview │ └── 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/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | EditTextViewDemo -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Grega Čučnik 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 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EditTextView 2 | Android widget combination of ImageView, EditText and TextView based on Material Design guidelines. 3 | 4 | ![Sample Screenshot](https://raw.githubusercontent.com/gregacucnik/EditTextView/master/edittextview.gif) 5 | 6 | # Usage 7 | *For a working implementation in the sample app, see the `app/` folder.* 8 | 9 | 1. Add the dependency in your build.gradle 10 | 11 | compile 'com.gregacucnik:edittextview:1.6' 12 | 13 | 2. Include EditTextView widget in your layout 14 | 15 | ``` 16 | 26 | ``` 27 | 28 | 3. (Optional - if you want to exit EditMode when you click outside of EditTextView) Implement OnClickListener for EditTextView parent layout and requestFocus. 29 | 30 | ``` 31 | final LinearLayout llContainer = (LinearLayout)findViewById(R.id.llContainer); 32 | 33 | llContainer.setClickable(true); 34 | llContainer.setFocusable(true); 35 | 36 | llContainer.setOnClickListener(new View.OnClickListener() { 37 | @Override 38 | public void onClick(View v) { 39 | llContainer.requestFocus(); 40 | } 41 | }); 42 | ``` 43 | 44 | 4. (Optional) Implement `EditTextViewListener` to get callbacks for `onEditTextViewEditModeStart()` and `onEditTextViewEditModeFinish(String text)`. 45 | 46 | 47 | # Customization 48 | Add `xmlns:app="http://schemas.android.com/apk/res-auto"` to (root) layout 49 | 50 | * `app:ettIcon` Icon when EditTextView has text 51 | * `app:ettIconEmpty` Icon when EditTextView is empty (if not set, ettIcon is used, if set) 52 | * `app:ettIconInEditMode` Optional icon when EditTextView is in EditMode (if not set, ettIcon is used, if set) 53 | * `app:ettText` EditTextView text 54 | * `app:ettEmptyText` Optional hint text to show when ettText is empty 55 | * `app:ettEmptyTexStyle` Custom text style for ettEmptyText 56 | * `app:ettTextColor` Custom text color when not empty 57 | * `app:ettEmptyColor` Custom text color for ettEmptyText 58 | * `app:ettSelectAllOnEditMode` Auto-select text when in EditMode (default: true) 59 | * `app:ettShowHint` Show empty hint text when in EditMode (default: true) 60 | * `app:ettMarginTopBottom` Custom top and bottom margin for the whole view 61 | * `app:ettIconMarginLeft` Custom left margin for icon 62 | * `app:ettIconMarginRight` Custom right margin for icon 63 | * `app:ettTextMarginLeft` Custom left margin for text 64 | * `app:ettTextMarginRight` Custom right margin for text 65 | * `app:ettTextSize` Custom text size (min: 12sp) 66 | * `app:ettLocked` Lock or unlock EditTextView (default: false) 67 | * `app:ettMaxLines` Max lines for EditText, if input type textMultiLine (default: 1) 68 | * `android:inputType` Input type for EditText (default: textCapSentences) 69 | 70 | 71 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-EditTextView-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2889) 72 | 73 | License 74 | ======= 75 | The MIT License (MIT) 76 | 77 | Copyright (c) 2016 Grega Čučnik 78 | 79 | Permission is hereby granted, free of charge, to any person obtaining a copy 80 | of this software and associated documentation files (the "Software"), to deal 81 | in the Software without restriction, including without limitation the rights 82 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 83 | copies of the Software, and to permit persons to whom the Software is 84 | furnished to do so, subject to the following conditions: 85 | 86 | The above copyright notice and this permission notice shall be included in all 87 | copies or substantial portions of the Software. 88 | 89 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 90 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 91 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 92 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 93 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 94 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 95 | SOFTWARE. 96 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.gregacucnik.edittextviewdemo" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.1.1' 26 | compile 'com.gregacucnik:edittextview:1.6' 27 | // compile project(':edittextview') 28 | } 29 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Grega/android-sdks/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/gregacucnik/edittextviewdemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.gregacucnik.edittextviewdemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/gregacucnik/edittextviewdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.gregacucnik.edittextviewdemo; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | import android.widget.LinearLayout; 7 | 8 | public class MainActivity extends AppCompatActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_main); 14 | 15 | final LinearLayout llContainer = (LinearLayout)findViewById(R.id.llContainer); 16 | 17 | llContainer.setOnClickListener(new View.OnClickListener() { 18 | @Override 19 | public void onClick(View v) { 20 | llContainer.requestFocus(); 21 | } 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_camera_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_camera_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_camera_blue_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_camera_blue_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_camera_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_camera_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_clock_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_clock_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_clock_blue_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_clock_blue_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_clock_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_clock_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_file_document_box_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_file_document_box_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_file_document_box_blue_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_file_document_box_blue_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_file_document_box_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_file_document_box_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_information_outline_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_information_outline_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_information_outline_blue_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_information_outline_blue_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_information_outline_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/drawable-xxxhdpi/ic_information_outline_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 25 | 26 | 38 | 39 | 51 | 52 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #1A65BD 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | EditTextViewDemo 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/gregacucnik/edittextviewdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.gregacucnik.edittextviewdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.5.0' 9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } 25 | -------------------------------------------------------------------------------- /edittextview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/edittextview.gif -------------------------------------------------------------------------------- /edittextview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /edittextview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext { 4 | bintrayRepo = 'maven' 5 | bintrayName = 'edittextview' 6 | 7 | publishedGroupId = 'com.gregacucnik' 8 | libraryName = 'EditTextView' 9 | artifact = 'edittextview' 10 | 11 | libraryDescription = 'Android widget combination of ImageView, EditText and TextView based on Material Design guidelines.' 12 | 13 | libraryVersion = '1.6' 14 | 15 | developerId = 'gregacucnik' 16 | developerName = 'Grega Čučnik' 17 | developerEmail = '' 18 | } 19 | 20 | android { 21 | compileSdkVersion 23 22 | buildToolsVersion "23.0.2" 23 | 24 | defaultConfig { 25 | minSdkVersion 15 26 | targetSdkVersion 23 27 | versionCode 7 28 | versionName "1.6" 29 | } 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | } 37 | 38 | dependencies { 39 | compile fileTree(dir: 'libs', include: ['*.jar']) 40 | testCompile 'junit:junit:4.12' 41 | compile 'com.android.support:appcompat-v7:23.1.1' 42 | } 43 | 44 | apply from: 'https://raw.githubusercontent.com/attwellBrian/JCenter/master/installv1.gradle' 45 | apply from: 'https://raw.githubusercontent.com/attwellBrian/JCenter/master/bintrayv1.gradle' -------------------------------------------------------------------------------- /edittextview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Grega/android-sdks/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /edittextview/src/androidTest/java/com/gregacucnik/edittextview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.gregacucnik.edittextview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /edittextview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /edittextview/src/main/java/com/gregacucnik/ETT_EditText.java: -------------------------------------------------------------------------------- 1 | package com.gregacucnik; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.KeyEvent; 6 | import android.view.inputmethod.EditorInfo; 7 | import android.widget.EditText; 8 | import android.widget.TextView; 9 | 10 | /** 11 | * Created by Grega on 23/11/15. 12 | */ 13 | public class ETT_EditText extends EditText { 14 | 15 | private OnEditTextListener mListener; 16 | 17 | public interface OnEditTextListener{ 18 | void onEditTextKeyboardDismissed(); 19 | void onEditTextKeyboardDone(); 20 | } 21 | 22 | public ETT_EditText(Context context) { 23 | super(context); 24 | 25 | init(); 26 | } 27 | 28 | public ETT_EditText(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | 31 | init(); 32 | } 33 | 34 | public ETT_EditText(Context context, AttributeSet attrs, int defStyleAttr) { 35 | super(context, attrs, defStyleAttr); 36 | 37 | init(); 38 | } 39 | 40 | private void init(){ 41 | setOnEditorActionListener(new EditText.OnEditorActionListener() { 42 | @Override 43 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 44 | if (actionId == EditorInfo.IME_ACTION_DONE) { 45 | 46 | if(mListener != null) 47 | mListener.onEditTextKeyboardDone(); 48 | 49 | return true; 50 | } 51 | return false; 52 | } 53 | }); 54 | } 55 | 56 | public void setOnKeyboardDismissedListener(OnEditTextListener listener){ 57 | this.mListener = listener; 58 | } 59 | 60 | @Override 61 | public boolean onKeyPreIme(int keyCode, KeyEvent event) { 62 | if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { 63 | 64 | if(mListener != null) 65 | mListener.onEditTextKeyboardDismissed(); 66 | 67 | return false; 68 | } 69 | 70 | return super.dispatchKeyEvent(event); 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /edittextview/src/main/java/com/gregacucnik/EditTextView.java: -------------------------------------------------------------------------------- 1 | package com.gregacucnik; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.content.res.TypedArray; 6 | import android.graphics.Color; 7 | import android.os.Build; 8 | import android.os.Parcel; 9 | import android.os.Parcelable; 10 | import android.util.AttributeSet; 11 | import android.util.SparseArray; 12 | import android.util.TypedValue; 13 | import android.view.View; 14 | import android.view.inputmethod.EditorInfo; 15 | import android.view.inputmethod.InputMethodManager; 16 | import android.widget.EditText; 17 | import android.widget.ImageView; 18 | import android.widget.RelativeLayout; 19 | import android.widget.TextView; 20 | 21 | import com.gregacucnik.edittextview.R; 22 | 23 | /** 24 | * Created by Grega on 23/11/15. 25 | */ 26 | public class EditTextView extends RelativeLayout implements ETT_EditText.OnEditTextListener, View.OnFocusChangeListener{ 27 | 28 | private RelativeLayout rlContainer; 29 | private ImageView ettImageView; 30 | private TextView ettTextView; 31 | private ETT_EditText ettEditText; 32 | 33 | private boolean isInEditMode = false; 34 | private String emptyText; 35 | private int emptyStyle = 0; 36 | private int emptyColor = Color.BLACK; 37 | private int textColor = Color.BLACK; 38 | private int icon = 0; 39 | private int iconEmpty = 0; 40 | private int iconInEditMode = 0; 41 | 42 | private boolean selectOnFocus; 43 | private boolean showHint; 44 | private boolean locked; 45 | 46 | private EditTextViewListener mListener; 47 | 48 | public interface EditTextViewListener{ 49 | void onEditTextViewEditModeStart(); 50 | void onEditTextViewEditModeFinish(String text); 51 | } 52 | 53 | public EditTextView(Context context) { 54 | super(context); 55 | } 56 | 57 | public EditTextView(Context context, AttributeSet attrs) { 58 | super(context, attrs); 59 | 60 | View container = inflate(getContext(), R.layout.layout_edittextview, this); 61 | 62 | setSaveEnabled(true); 63 | 64 | ettImageView = (ImageView)findViewById(R.id.ettImageView); 65 | ettTextView = (TextView)findViewById(R.id.ettTextView); 66 | ettEditText = (ETT_EditText)findViewById(R.id.ettEditText); 67 | ettEditText.setOnKeyboardDismissedListener(this); 68 | ettEditText.setOnFocusChangeListener(this); 69 | 70 | rlContainer = (RelativeLayout)findViewById(R.id.ettContainer); 71 | 72 | Resources res = getResources(); 73 | 74 | textColor = res.getColor(R.color.default_text_color); 75 | emptyColor = res.getColor(R.color.default_empty_color); 76 | 77 | TypedArray a = context.getTheme().obtainStyledAttributes( 78 | attrs, 79 | R.styleable.EditTextView, 80 | 0, 0); 81 | 82 | try { 83 | emptyStyle = a.getInt(R.styleable.EditTextView_ettEmptyTexStyle, 2); 84 | emptyColor = a.getColor(R.styleable.EditTextView_ettEmptyColor, emptyColor); 85 | textColor = a.getColor(R.styleable.EditTextView_ettTextColor, textColor); 86 | selectOnFocus = a.getBoolean(R.styleable.EditTextView_ettSelectAllOnEditMode, true); 87 | showHint = a.getBoolean(R.styleable.EditTextView_ettShowHint, true); 88 | icon = a.getResourceId(R.styleable.EditTextView_ettIcon, 0); 89 | iconEmpty = a.getResourceId(R.styleable.EditTextView_ettIconEmpty, icon); 90 | iconInEditMode = a.getResourceId(R.styleable.EditTextView_ettIconInEditMode, icon); 91 | locked = a.getBoolean(R.styleable.EditTextView_ettLocked, false); 92 | 93 | /* Text Size */ 94 | int textSize = a.getDimensionPixelSize(R.styleable.EditTextView_ettTextSize, getScaledPixels(16)); 95 | if(textSize < getScaledPixels(12)) 96 | textSize = getScaledPixels(12); 97 | 98 | ettTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); 99 | ettEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); 100 | 101 | /* Input Type */ 102 | int inputType = a.getInt(R.styleable.EditTextView_android_inputType, EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES); 103 | ettEditText.setInputType(inputType); 104 | 105 | int maxLines = a.getInt(R.styleable.EditTextView_ettMaxLines, 1); 106 | ettEditText.setMaxLines(maxLines); 107 | 108 | setEmptyText(a.getString(R.styleable.EditTextView_ettEmptyText)); 109 | setText(a.getString(R.styleable.EditTextView_ettText)); 110 | 111 | /* Margins */ 112 | int marginTopBottom = a.getDimensionPixelSize(R.styleable.EditTextView_ettMarginTopBottom, getPixels(8) + (textSize - getPixels(12))); 113 | 114 | if(marginTopBottom < 0) 115 | marginTopBottom = getPixels(8) + (textSize - getPixels(12)); 116 | 117 | int iconMarginLeft = a.getDimensionPixelSize(R.styleable.EditTextView_ettIconMarginLeft, getPixels(16)); 118 | int iconMarginRight = a.getDimensionPixelSize(R.styleable.EditTextView_ettIconMarginRight, getPixels(32)); 119 | 120 | setMargins(ettImageView, marginTopBottom, marginTopBottom, iconMarginLeft, iconMarginRight); 121 | 122 | int textMarginTopBottom = marginTopBottom - (getPixels(8) + textSize - getPixels(12)) + (int) ((textSize - getPixels(12))*0.5f); 123 | int textMarginLeft = a.getDimensionPixelSize(R.styleable.EditTextView_ettTextMarginLeft, getPixels(0)); 124 | int textMarginRight = a.getDimensionPixelSize(R.styleable.EditTextView_ettTextMarginLeft, getPixels(8)); 125 | 126 | setMargins(findViewById(R.id.rlText), textMarginTopBottom, textMarginTopBottom, textMarginLeft, textMarginRight); 127 | 128 | } finally { 129 | a.recycle(); 130 | } 131 | 132 | setClickable(true); 133 | setFocusable(true); 134 | setFocusableInTouchMode(true); 135 | 136 | rlContainer.setOnClickListener(new OnClickListener() { 137 | @Override 138 | public void onClick(View v) { 139 | toggleLayout(true); 140 | } 141 | }); 142 | 143 | checkLocked(); 144 | } 145 | 146 | /** 147 | * Set callback listener for EditTextView changes 148 | * @param listener EditTextViewListener 149 | */ 150 | public void setEditTextViewListener(EditTextViewListener listener){ 151 | this.mListener= listener; 152 | } 153 | 154 | 155 | private static void setMargins(final View view, final int marginTop, final int marginBottom, final int marginLeft, final int marginRight) { 156 | final RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams)view.getLayoutParams(); 157 | lp.setMargins(marginLeft, marginTop == -1 ? lp.topMargin : marginTop, marginRight, marginBottom == -1 ? lp.bottomMargin : marginBottom); 158 | view.setLayoutParams(lp); 159 | 160 | // Fix for older Android version (<4.3) because of a bug in RelativeLayout margins 161 | if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) 162 | view.setPadding(0, 0, 0, marginBottom == -1 ? lp.bottomMargin : marginBottom); 163 | } 164 | 165 | private int getPixels(float dp){ 166 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics()); 167 | } 168 | 169 | private int getScaledPixels(float dp){ 170 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, dp, getResources().getDisplayMetrics()); 171 | } 172 | 173 | @Override 174 | public void onFocusChange(View v, boolean hasFocus) { 175 | if(v instanceof EditText){ 176 | if(isInEditMode && !hasFocus) 177 | toggleLayout(true); 178 | } 179 | } 180 | 181 | private void hideKeyboard(){ 182 | if(ettEditText != null && !isInEditMode()) { 183 | InputMethodManager imm = (InputMethodManager) getContext().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); 184 | imm.hideSoftInputFromWindow(ettEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); 185 | } 186 | } 187 | 188 | private void showKeyboard(){ 189 | if(ettEditText != null && !isInEditMode()) { 190 | InputMethodManager imm = (InputMethodManager) getContext().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); 191 | imm.showSoftInput(ettEditText, InputMethodManager.SHOW_IMPLICIT); 192 | } 193 | } 194 | 195 | @Override 196 | public void onEditTextKeyboardDismissed() { 197 | toggleLayout(false); 198 | } 199 | 200 | @Override 201 | public void onEditTextKeyboardDone() { 202 | toggleLayout(false); 203 | } 204 | 205 | /** SAVED INSTANCE **/ 206 | 207 | private static class SavedState extends BaseSavedState { 208 | String text; 209 | String empty; 210 | 211 | boolean editmode; 212 | boolean select; 213 | boolean hint; 214 | boolean locked; 215 | 216 | SavedState(Parcelable superState) { 217 | super(superState); 218 | } 219 | 220 | private SavedState(Parcel in) { 221 | super(in); 222 | text = in.readString(); 223 | empty = in.readString(); 224 | 225 | select = in.readInt() == 1; 226 | hint = in.readInt() == 1; 227 | editmode = in.readInt() == 1; 228 | locked = in.readInt() == 1; 229 | } 230 | 231 | @Override 232 | public void writeToParcel(Parcel out, int flags) { 233 | super.writeToParcel(out, flags); 234 | out.writeString(text); 235 | out.writeString(empty); 236 | 237 | out.writeInt(select ? 1 : 0); 238 | out.writeInt(hint ? 1 : 0); 239 | out.writeInt(editmode ? 1 : 0); 240 | out.writeInt(locked ? 1 : 0); 241 | } 242 | 243 | public static final Creator CREATOR = new Creator() { 244 | public SavedState createFromParcel(Parcel in) { 245 | return new SavedState(in); 246 | } 247 | 248 | public SavedState[] newArray(int size) { 249 | return new SavedState[size]; 250 | } 251 | }; 252 | } 253 | 254 | @Override 255 | public Parcelable onSaveInstanceState() { 256 | Parcelable superState = super.onSaveInstanceState(); 257 | SavedState ss = new SavedState(superState); 258 | 259 | ss.text = ettEditText.getText().toString(); 260 | ss.empty = this.emptyText; 261 | 262 | ss.select = selectOnFocus; 263 | ss.hint = showHint; 264 | 265 | ss.editmode = isInEditMode; 266 | ss.locked = locked; 267 | 268 | if(isInEditMode) { 269 | InputMethodManager imm = (InputMethodManager) getContext().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); 270 | imm.hideSoftInputFromWindow(ettEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); 271 | } 272 | 273 | return ss; 274 | } 275 | 276 | 277 | @Override 278 | public void onRestoreInstanceState(Parcelable state) { 279 | SavedState ss = (SavedState) state; 280 | super.onRestoreInstanceState(ss.getSuperState()); 281 | 282 | setText(ss.text); 283 | setEmptyText(ss.empty); 284 | 285 | selectOnFocus = ss.select; 286 | showHint = ss.hint; 287 | isInEditMode = ss.editmode; 288 | locked = ss.locked; 289 | 290 | if(isInEditMode) { 291 | showEditText(false); // false - prevent notifying callback listener because state restored 292 | }else 293 | showTextView(false); // false - prevent notifying callback listener because state restored 294 | 295 | checkLocked(); 296 | } 297 | 298 | @Override 299 | protected void dispatchSaveInstanceState(SparseArray container) { 300 | super.dispatchFreezeSelfOnly(container); 301 | } 302 | 303 | @Override 304 | protected void dispatchRestoreInstanceState(SparseArray container) { 305 | super.dispatchThawSelfOnly(container); 306 | } 307 | 308 | /****/ 309 | 310 | private void toggleLayout(boolean notifyListener){ 311 | if(isInEditMode) { 312 | showTextView(notifyListener); // TextView will be visible 313 | }else{ 314 | showEditText(notifyListener); // EditText will be visible 315 | } 316 | } 317 | 318 | private void checkLocked() { 319 | rlContainer.setEnabled(!locked); 320 | } 321 | 322 | private void showTextView(){ 323 | showTextView(true); 324 | } 325 | 326 | private void showTextView(boolean notifyListener){ 327 | setTextViewText(ettEditText.getText().toString()); 328 | ettTextView.setVisibility(View.VISIBLE); 329 | ettEditText.setVisibility(View.INVISIBLE); 330 | 331 | hideKeyboard(); 332 | 333 | isInEditMode = false; 334 | 335 | if(mListener != null && notifyListener) { 336 | mListener.onEditTextViewEditModeFinish(ettEditText.getText().toString()); 337 | } 338 | } 339 | 340 | private void showEditText(){ 341 | showEditText(true); 342 | } 343 | 344 | private void showEditText(boolean notifyListener){ 345 | ettTextView.setVisibility(View.INVISIBLE); 346 | ettEditText.setVisibility(View.VISIBLE); 347 | 348 | setIcon(iconInEditMode); 349 | 350 | ettEditText.requestFocus(); 351 | 352 | if(selectOnFocus) 353 | ettEditText.selectAll(); 354 | else 355 | ettEditText.setSelection(getText().length()); 356 | 357 | showKeyboard(); 358 | 359 | isInEditMode = true; 360 | 361 | if(mListener != null && notifyListener) 362 | mListener.onEditTextViewEditModeStart(); 363 | } 364 | 365 | /** 366 | * Switch back to normal mode from edit mode. 367 | */ 368 | public void leaveEditMode(){ 369 | if(isInEditMode) 370 | showTextView(); 371 | } 372 | 373 | /** 374 | * Set text 375 | * @param text String 376 | */ 377 | public void setText(String text){ 378 | if(text == null){ 379 | text = ""; 380 | } 381 | 382 | ettEditText.setText(text); 383 | setTextViewText(text); 384 | } 385 | 386 | private void setTextViewText(String text){ 387 | if(text.isEmpty()){ 388 | ettTextView.setText(emptyText); 389 | ettTextView.setTypeface(null, emptyStyle); 390 | ettTextView.setTextColor(emptyColor); 391 | 392 | setIcon(iconEmpty); 393 | }else{ 394 | ettTextView.setText(text); 395 | ettTextView.setTypeface(null, 0); 396 | ettTextView.setTextColor(textColor); 397 | 398 | setIcon(icon); 399 | } 400 | } 401 | 402 | /** 403 | * Get text 404 | * @return String 405 | */ 406 | public String getText(){ 407 | return ettEditText.getText().toString(); 408 | } 409 | 410 | /** 411 | * Change text when empty or for hint (if enabled). 412 | * @param emptyText String 413 | */ 414 | public void setEmptyText(String emptyText){ 415 | if(emptyText == null || emptyText.isEmpty()) 416 | emptyText = getResources().getString(R.string.default_empty_text); 417 | 418 | this.emptyText = emptyText; 419 | 420 | if(showHint) { 421 | ettEditText.setHint(emptyText); 422 | ettEditText.setHintTextColor(emptyColor); 423 | }else 424 | ettEditText.setHint(""); 425 | } 426 | 427 | private void setIcon(int res){ 428 | if(res == 0 || icon == 0) 429 | ettImageView.setVisibility(View.GONE); 430 | else 431 | ettImageView.setVisibility(View.VISIBLE); 432 | 433 | ettImageView.setImageResource(res); 434 | } 435 | 436 | /** 437 | * Check if EditTextView is locked. 438 | * @return boolean 439 | */ 440 | public boolean isLocked(){ 441 | return locked; 442 | } 443 | 444 | /** 445 | * Lock or unlock EditTextView. 446 | * @param locked boolean 447 | */ 448 | public void setLocked(boolean locked){ 449 | this.locked = locked; 450 | 451 | leaveEditMode(); 452 | 453 | checkLocked(); 454 | } 455 | 456 | /** 457 | * Check if EditTextView is in EditMode 458 | * @return boolean 459 | */ 460 | public boolean isInEditMode(){ 461 | return isInEditMode; 462 | } 463 | 464 | } 465 | -------------------------------------------------------------------------------- /edittextview/src/main/res/layout/layout_edittextview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | 26 | 27 | 41 | 42 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /edittextview/src/main/res/values/attrs.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 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /edittextview/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #B5B5B5 4 | #000 5 | -------------------------------------------------------------------------------- /edittextview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | EditTextView 3 | Add text… 4 | 5 | -------------------------------------------------------------------------------- /edittextview/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /edittextview/src/test/java/com/gregacucnik/edittextview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.gregacucnik.edittextview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregacucnik/EditTextView/15eb00a1745d438917878f759162ebd8c6b7a7c3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 2015 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-2.8-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':edittextview' 2 | --------------------------------------------------------------------------------