├── .directory ├── .gitignore ├── .idea ├── compiler.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── CHANGES.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── marcinorlowski │ │ └── bettertextinputlayout │ │ └── demo │ │ └── MainActivity.java │ └── res │ ├── layout │ └── activity_main.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── marcinorlowski │ └── bettertextinputlayout │ └── BetterTextInputLayout.java └── settings.gradle /.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2017,6,4,13,31,30 3 | Version=3 4 | ViewMode=1 5 | 6 | [Settings] 7 | HiddenFilesShown=true 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | *~ 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | v2.0.0 (2019.02.18) 2 | =================== 3 | * Updated to use Jetpack (androidx.*) libraries. 4 | 5 | v1.1.0 (2017-06-04) 6 | =================== 7 | * Password visibility toggle is now updated when changed pass visibility from code. 8 | * Added `togglePassword()` method. 9 | 10 | v1.0.0 (2016-08-14) 11 | =================== 12 | * Initial release. 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BetterTextInputLayout 2 | ===================== 3 | `BetterTextInputLayout` is Android's Jetpack library's `TextInputLayout` subclass 4 | providing following extensions: 5 | 6 | * adds methods to manipulate password visibility from code, 7 | * comes with `passwordToggleEnabled` enabled by default. 8 | 9 | Methods 10 | ======= 11 | * `showPassword()` 12 | * `hidePassword()` 13 | * `togglePassword()` 14 | 15 | Names should be pretty self-explanatory :) See demo app for usage example though. 16 | 17 | Installation 18 | ============ 19 | 20 | Edit your master `gradle.build` file and **add** `maven { url 'https://jitpack.io' }` to your current 21 | `repositories` block content (if you use other jitpack hosted libraries, then this step can be skipped): 22 | 23 | allprojects { 24 | repositories { 25 | maven { url 'https://jitpack.io' } 26 | } 27 | } 28 | 29 | Next, edit your **module**'s `build.gradle` and the following dependency: 30 | 31 | compile 'com.github.MarcinOrlowski:bettertextinputlayout:' 32 | 33 | For recent value of `` consult [library releases](https://github.com/MarcinOrlowski/bettertextinputlayout/releases) 34 | or jitpack badge: [![Release](https://jitpack.io/v/MarcinOrlowski/bettertextinputlayout.svg)](https://jitpack.io/#MarcinOrlowski/bettertextinputlayout) 35 | 36 | 37 | Author 38 | ====== 39 | * Marcin Orlowski 40 | 41 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "28.0.3" 6 | defaultConfig { 7 | applicationId 'com.marcinorlowski.bettertextinputlayout.demo' 8 | minSdkVersion 16 9 | targetSdkVersion 28 10 | versionCode 20180218 11 | versionName "2.0.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | productFlavors { 20 | } 21 | } 22 | 23 | dependencies { 24 | implementation "androidx.appcompat:appcompat:1.0.0" 25 | implementation "com.google.android.material:material:1.0.0-rc01" 26 | 27 | implementation 'androidx.constraintlayout:constraintlayout:1.1.2' 28 | 29 | implementation project(':lib') 30 | } 31 | -------------------------------------------------------------------------------- /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 /home/carlos/dev/android/sdk/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/marcinorlowski/bettertextinputlayout/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.marcinorlowski.bettertextinputlayout.demo; 2 | 3 | /** 4 | * BetterTextInputLayout Demo app 5 | * 6 | * BetterTextInputLayout is subclass of TextInputLayout that adds public methods to manipulate 7 | * password visibility of underlying EditText directly from code 8 | * 9 | * Marcin Orlowski 10 | */ 11 | 12 | import android.os.Bundle; 13 | import android.view.View; 14 | 15 | import com.marcinorlowski.bettertextinputlayout.BetterTextInputLayout; 16 | 17 | import androidx.appcompat.app.AppCompatActivity; 18 | 19 | public class MainActivity extends AppCompatActivity { 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_main); 25 | 26 | findViewById(R.id.show).setOnClickListener(clickListener); 27 | findViewById(R.id.hide).setOnClickListener(clickListener); 28 | findViewById(R.id.toggle).setOnClickListener(clickListener); 29 | } 30 | 31 | protected View.OnClickListener clickListener = new View.OnClickListener() { 32 | @Override 33 | public void onClick(View v) { 34 | switch (v.getId()) { 35 | case R.id.show: 36 | View til = findViewById(R.id.til); 37 | ((BetterTextInputLayout)findViewById(R.id.til)).showPassword(); 38 | break; 39 | 40 | case R.id.hide: 41 | ((BetterTextInputLayout)findViewById(R.id.til)).hidePassword(); 42 | break; 43 | 44 | case R.id.toggle: 45 | ((BetterTextInputLayout)findViewById(R.id.til)).togglePassword(); 46 | break; 47 | } 48 | } 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 18 | 19 | 26 | 27 | 28 | 29 | 32 | 33 |