├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── adityarathi │ │ └── viewwrappertext │ │ └── MainActivity.java │ └── res │ ├── drawable │ └── sample.jpg │ ├── layout │ ├── activity_main.xml │ ├── content_main.xml │ └── custom_edit_text.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-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── art └── demo.gif ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── adityarathi │ │ │ └── viewwrapperedittext │ │ │ ├── CustomEditText.java │ │ │ └── ViewTextWrapperLayout.java │ └── res │ │ └── values │ │ ├── image_text_wrapper_attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── adityarathi │ └── viewwrapper │ └── ExampleUnitTest.java └── 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 | ImageWrapperEditText -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 26 | 27 | -------------------------------------------------------------------------------- /.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 | 47 | 48 | 49 | 50 | 1.8 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /.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 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ViewWrapperEditText 2 | A View wrapper for EditTexts in Android. Add Views inside/outside EditTexts using this library 3 | 4 | ![alt text](https://raw.githubusercontent.com/aditya2705/ViewWrapperEditText/master/art/demo.gif) 5 | 6 | ##Setup 7 | ```groovy 8 | repositories { 9 | maven { 10 | url "http://dl.bintray.com/aditya2705/maven" 11 | } 12 | } 13 | dependencies { 14 | compile 'com.adityarathi.viewwrapperedittext:view-wrapper-edittext:1.0' 15 | } 16 | ``` 17 | 18 | ###Usage 19 | ####Method 1: Add Views with auto generated Edit Texts 20 | You may add Views within EditTexts using **addViewWithinText(View v)** 21 | 22 | Similarly delete Views using **deleteViewWithinText(View v)** 23 | 24 | In sample case, **View v** taken is a ImageView 25 | ```java 26 | imageTextWrapperLayout = (ViewTextWrapperLayout) findViewById(R.id.imageTextWrapperLayout); 27 | Button button = (Button)findViewById(R.id.add_image); 28 | button.setOnClickListener(new View.OnClickListener() { 29 | @Override 30 | public void onClick(View v) { 31 | ImageView imageView = new ImageView(MainActivity.this); 32 | imageView.setImageResource(R.drawable.sample); 33 | imageView.setAdjustViewBounds(true); 34 | imageView.setOnClickListener(new View.OnClickListener() { 35 | @Override 36 | public void onClick(View v) { 37 | imageTextWrapperLayout.deleteViewWithinText(v); 38 | } 39 | }); 40 | imageTextWrapperLayout.addViewWithinText(imageView); 41 | } 42 | }); 43 | 44 | ``` 45 | ####Method 2: Add views with your own customized Edit Texts 46 | You may now add Views with your own customized EditTexts using **addViewWithinText(View v, CustomEditText editText)** 47 | 48 | The class **CustomEditText** extends the **EditText** class. 49 | 50 | You can do this -- 51 | 52 | a. Either programmatically: 53 | ```java 54 | CustomEditText customEditText = new CustomEditText(MainActivity.this); 55 | customEditText.setTextColor(//set Color); 56 | customEditText.setText(//set Text); 57 | ......... 58 | ........ 59 | ..... 60 | imageTextWrapperLayout.addViewWithinText(imageView,customEditText); 61 | 62 | ``` 63 | b. Or by defining it in an **XML layout** and **Inflating** 64 | ```xml 65 | 66 | 73 | ``` 74 | Do not use it other than as the parent root when inflating. Should not reside as a child. 75 | ```java 76 | CustomEditText customEditText = (CustomEditText) View.inflate(MainActivity.this,R.layout.custom_edit_text,null); 77 | imageTextWrapperLayout.addViewWithinText(imageView,customEditText); 78 | ``` 79 | 80 | c. You can also make your own **EditText** class by extending the **CustomEditText** class. 81 | 82 | 83 | **Will be updating with newer features and functionalities soon. Please do report issues if you come across any.** 84 | 85 | **Cheers!** 86 | 87 | ###Developed By 88 | Aditya Rathi 89 | 90 | Company: [Alpha Labz](http://www.alphalabz.com) 91 | 92 | ###License 93 | 94 | ``` 95 | Copyright 2015 Aditya Rathi 96 | 97 | Licensed under the Apache License, Version 2.0 (the "License"); 98 | you may not use this file except in compliance with the License. 99 | You may obtain a copy of the License at 100 | 101 | http://www.apache.org/licenses/LICENSE-2.0 102 | 103 | Unless required by applicable law or agreed to in writing, software 104 | distributed under the License is distributed on an "AS IS" BASIS, 105 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 106 | See the License for the specific language governing permissions and 107 | limitations under the License. 108 | ``` 109 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | 4 | android { 5 | compileSdkVersion 23 6 | buildToolsVersion "23.0.2" 7 | 8 | defaultConfig { 9 | applicationId "com.adityarathi.viewwrappertext" 10 | minSdkVersion 8 11 | targetSdkVersion 23 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(include: ['*.jar'], dir: 'libs') 25 | testCompile 'junit:junit:4.12' 26 | compile 'com.android.support:appcompat-v7:23.1.1' 27 | compile 'com.android.support:design:23.1.1' 28 | compile project(':library') 29 | } 30 | -------------------------------------------------------------------------------- /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 G:\AndroidSDK/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/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/adityarathi/viewwrappertext/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.adityarathi.viewwrappertext; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.EditText; 10 | import android.widget.ImageView; 11 | 12 | import com.adityarathi.viewwrapperedittext.CustomEditText; 13 | import com.adityarathi.viewwrapperedittext.ViewTextWrapperLayout; 14 | 15 | public class MainActivity extends AppCompatActivity { 16 | 17 | private ViewTextWrapperLayout imageTextWrapperLayout; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_main); 23 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 24 | setSupportActionBar(toolbar); 25 | 26 | imageTextWrapperLayout = (ViewTextWrapperLayout) findViewById(R.id.imageTextWrapperLayout); 27 | 28 | Button button = (Button)findViewById(R.id.add_image); 29 | button.setOnClickListener(new View.OnClickListener() { 30 | @Override 31 | public void onClick(View v) { 32 | ImageView imageView = new ImageView(MainActivity.this); 33 | imageView.setImageResource(R.drawable.sample); 34 | imageView.setAdjustViewBounds(true); 35 | imageView.setOnClickListener(new View.OnClickListener() { 36 | @Override 37 | public void onClick(View v) { 38 | imageTextWrapperLayout.deleteViewWithinText(v); 39 | } 40 | }); 41 | CustomEditText customEditText = (CustomEditText) View.inflate(MainActivity.this,R.layout.custom_edit_text,null); 42 | imageTextWrapperLayout.addViewWithinText(imageView,customEditText); 43 | } 44 | }); 45 | 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aditya2705/ViewWrapperEditText/c44d8bbc54cddea6b95c98694585ed91ce7e2dfe/app/src/main/res/drawable/sample.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 15 | 16 | 20 | 21 | 27 | 28 | 29 | 30 |