Skip to content

Commit c808311

Browse files
committed
Revert "Revert "1.3.0""
This reverts commit 0a3e819.
1 parent 0a3e819 commit c808311

File tree

9 files changed

+505
-535
lines changed

9 files changed

+505
-535
lines changed

README.md

+96-85
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,15 @@ A new Material Design text field that comes in a box, based on Google Material D
1818

1919
2020
## ***UPDATE NOTICE***
21-
#### 1.2.1 Release
22-
- fix issues #11 #12 #13 #14
2321

24-
#### 1.2.0 Release
25-
- fix the bug of when height (or width) is set to `wrap_content` yet fills up the whole space.
22+
#### 1.3.0 Release
23+
- the "EditText" part is now **seperated** from the TextFieldBoxes. TextFieldBoxes is now a **container** (just like a `TextInputLayout`) that should and should only contain **one** `ExtendedEditText` that inherents the `TextInputEditText`.
2624

27-
- old `hint` attribute is **renamed** to `labelText`.
25+
- `Prefix` and `Suffix` attributes are now belonging to the `ExtendedEditText`.
2826

29-
- current `hint` attribute is for the **placeholder** text that is shown in the field when there is no text and is on focus.
27+
- `Text`, `hint`, `SingleLine` and `MaxLines` attributes are now removed. Instead, one should set them in the `ExtendedEditText` with original `android:` attributes.
3028

31-
- add **Clear Button**, can be activated with `app:hasClearButton` in xml or `setHasClearButton(boolean hasClearButton)` in Java code.
32-
33-
- add **End Icon**, can be activated with `app:endIcon` in xml or `setEndIcon(Int resourceID)` in Java code. Use `getEndIconImageButton()` to do something useful with it.
29+
- the bottom view which contains helper and counter labels will now be hidden when it's empty.
3430

3531
3632
## Requirements
@@ -52,7 +48,7 @@ allprojects {
5248
```
5349
```groovy
5450
dependencies {
55-
   compile 'com.github.HITGIF:TextFieldBoxes:1.2.1'
51+
   compile 'com.github.HITGIF:TextFieldBoxes:1.3.0'
5652
}
5753
```
5854

@@ -69,7 +65,7 @@ dependencies {
6965
<dependency>
7066
<groupId>com.github.HITGIF</groupId>
7167
<artifactId>TextFieldBoxes</artifactId>
72-
   <version>1.2.1</version>
68+
   <version>1.3.0</version>
7369
</dependency>
7470
```
7571

@@ -78,7 +74,7 @@ dependencies {
7874
resolvers += "jitpack" at "https://jitpack.io"
7975
```
8076
```scala
81-
libraryDependencies += "com.github.HITGIF" % "TextFieldBoxes" % "1.2.1"
77+
libraryDependencies += "com.github.HITGIF" % "TextFieldBoxes" % "1.3.0"
8278
```
8379

8480

@@ -87,23 +83,30 @@ libraryDependencies += "com.github.HITGIF" % "TextFieldBoxes" % "1.2.1"
8783
:repositories [["jitpack" "https://jitpack.io"]]
8884
```
8985
```scala
90-
:dependencies [[com.github.hitgif/textfieldboxes "1.2.1"]]
86+
:dependencies [[com.github.hitgif/textfieldboxes "1.3.0"]]
9187
```
9288

9389
9490
## Usage
9591

9692
#### 1. Basic
9793

98-
Add `studio.carbonylgroup.textfieldboxes.TextFieldBoxes` to your layout:
94+
Add `studio.carbonylgroup.textfieldboxes.TextFieldBoxes` that contains a `studio.carbonylgroup.textfieldboxes.ExtendedEditText` to your layout:
9995

10096
```xml
10197
...
10298
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
10399
android:id="@+id/text_field_boxes"
104100
android:layout_width="match_parent"
105101
android:layout_height="wrap_content"
106-
android:labelText="Label" />
102+
app:labelText="Label">
103+
104+
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
105+
android:id="@+id/extended_edit_text"
106+
android:layout_width="wrap_content"
107+
android:layout_height="wrap_content"/>
108+
109+
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
107110
...
108111
```
109112

@@ -114,27 +117,24 @@ Add `studio.carbonylgroup.textfieldboxes.TextFieldBoxes` to your layout:
114117
`app:enabled` in xml or `setEnabled(boolean enabled)` in Java.
115118

116119
```xml
117-
app:enabled="false"
120+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
121+
...
122+
app:enabled="false">
118123
```
119124

120125
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/basic_disabled.png)
121126

122-
#### 3. SingleLine
123-
124-
Use `app:singleLine` in xml or `setSingleLine(boolean singleLine)` in Java to set whether the EditText is single-lined, that scrolls horizontally.
125-
126-
```xml
127-
app:singleLine="true"
128-
```
129-
130-
![Animation](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/singleline.gif)
127+
#### 3. Helper Text and Error Text
131128

132-
#### 4. Helper Text and Error Text
129+
_**NOTE:** setting helper or error text to anything **not empty** will make the bottom view (which contains the helper label) visible and increase the height of the TextFieldBoxes. So if you want to always keep the bottom view visible (height increased), set the helper text to `" "` when there should be nothing._
133130

134131
helper text: `app:helperText` in xml or `setHelperText(String helperText)` in Java.
135132

133+
136134
```xml
137-
app:helperText="Helper is here"
135+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
136+
...
137+
app:helperText="Helper is here">
138138
```
139139

140140
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/helper.png)
@@ -149,87 +149,83 @@ setError("Error message");
149149

150150
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/error.png)
151151

152-
#### 5. Hint (Placeholder)
152+
#### 4. Prefix & Suffix
153153

154-
Use `app:hint` in xml or `setHint(String hint)` in Java to set the placeholder text that is shown in the field when there is no text and is on focus.
155-
156-
```xml
157-
app:hint = "Hint"
158-
```
159-
160-
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/hint.png)
161-
162-
#### 6. Prefix & Suffix
154+
_**! NOTE:** Prifix and Suffix attributes should be set to `ExtendedEditText`._
163155

164156
Use `app:prefix` in xml or `setPrefix(String prefix)` in Java to set the unselectable prefix text at the start of the field.
165157

166158
Use `app:suffix` in xml or `setSuffix(String suffix)` in Java to set the unselectable suffix text at the end of the field.
167159

168160
```xml
169-
app:prefix="$ "
161+
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
162+
...
163+
app:prefix="$ ">
170164
```
171165

172166
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/prefix.png)
173167

174168

175169
```xml
176-
app:suffix="\@gmail.com"
170+
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
171+
...
172+
app:suffix="\@gmail.com">
177173
```
178174

179175
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/suffix.png)
180176

181-
#### 7. Maxlines
177+
#### 5. Max & Min Characters
182178

183-
Use `app:maxLines` in xml or `setMaxLines(Int maxlines)` to set the number of maximum lines allowed in the text field. `Integer.MAX_VALUE` by default.
179+
_**NOTE:** setting max or min character will make the bottom view (which contains the counter label) visible and increase the height of the TextFieldBoxes._
184180

185-
```xml
186-
app:maxLines="3"
187-
```
181+
Use `app:maxCharacters` in xml or `setMaxCharacters(int maxCharacters)` in java code to set the max characters count. Use `removeMaxCharacters()` in java code to remove the limit.
188182

189-
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/maxlines.gif)
183+
Use `app:minCharacters` in xml or `setMinCharacters(int minCharacters)` in java code to set the min characters count. Use `removeMinCharacters()` in java code to remove the limit.
190184

191-
#### 8. Max & Min Characters
192-
193-
Use `app:maxCharacters` in xml or `setMaxCharacters(int maxCharacters)` in java code to set the max characters count.
194-
195-
Use `app:minCharacters` in xml or `setMinCharacters(int minCharacters)` in java code to set the min characters count.
196-
197-
The color of the bottom line will turn to `errorColor` (red by default) when exceeding max or min characters limit. `0`, as default, means no max or min characters.
185+
The color of the bottom line will turn to `errorColor` (red by default) when exceeding max or min characters limit. `0`, as default, means no max or min characters limit.
198186

199187
*NOTE: Space and line feed will NOT count.*
200188

201189
```xml
202-
app:maxCharacters="10"
203-
app:minCharacters="5"
190+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
191+
...
192+
app:maxCharacters="10"
193+
app:minCharacters="5">
204194
```
205195

206196
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/maxMinChar.gif)
207197

208198
```xml
209-
app:maxCharacters="5"
199+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
200+
...
201+
app:maxCharacters="5">
210202
```
211203

212204
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/maxChar.gif)
213205

214-
#### 9. Icon Signifier
206+
#### 6. Icon Signifier
215207

216208
Use `app:iconSignifier` in xml or `setIconSignifier(Int resourceID)` to set the icon that is shown in front of the TextFieldBoxes if you want there to be one.
217209

218210
You can use `setIsResponsiveIconColor(boolean isrResponsiveIconColor)` in Java code to set whether the icon will change its color when gaining or losing focus as the label text and the bottomLine do.
219211
_**NOTE that if `true`, the icon's color will always be `HighlightColor` (the same as the bottomLine) that will turn gray when losing focus. If `false`, the icon will always be in `primaryColor`.**_
220212

221213
```xml
222-
app:iconSignifier="@drawable/ic_vpn_key_black_24dp"
214+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
215+
...
216+
app:iconSignifier="@drawable/ic_vpn_key_black_24dp">
223217
```
224218

225219
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/icon1.png)![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/icon2.png)
226220

227-
#### 10. End Icon
221+
#### 7. End Icon
228222

229223
Use `app:endIcon` in xml or `setEndIcon(Int resourceID)` to set the icon of the ImageButton that is shown at the end of the field if you want there to be one.
230224

231225
```xml
232-
app:endIcon="@drawable/ic_mic_black_24dp"
226+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
227+
...
228+
app:endIcon="@drawable/ic_mic_black_24dp">
233229
```
234230

235231
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/mic.png)
@@ -246,19 +242,21 @@ textFieldBoxes.getEndIconImageButton().setOnClickListener(new View.OnClickListen
246242
});
247243
```
248244

249-
#### 11. Clear Button
245+
#### 8. Clear Button
250246

251247
Use `app:hasClearButton` in xml or `setHasClearButton(boolean hasClearButton)` to set whether to show the clear button.
252248

253249
If `true`, a clear button will be shown at the end when there are characters (**ANY** character) entered in the field.
254250

255251
```xml
256-
app:hasClearButton="true"
252+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
253+
...
254+
app:hasClearButton="true">
257255
```
258256

259257
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/clearButton.png)
260258

261-
#### 12. Custom Colors
259+
#### 9. Custom Colors
262260

263261
*Primary Color* will be used for the color of the underline and the floating label text. You can use `app:primaryColor` in xml or `setPrimaryColor(int colorRes)` in Java. Current theme `Primary Color` by default.
264262

@@ -269,21 +267,24 @@ app:hasClearButton="true"
269267
*Panel Background Color* will be used for the color of panel at the back. You can use `app:panelBackgroundColor` in xml or `setPanelBackgroundColor(int colorRes)` in Java. `6% black` by default. *NOTE that the default color, as in the guideline, is the black (`#000000`) color with the transparency of 6%, so when you're customizing and want it to still be transparent you have to set a color with transparency.*
270268

271269
```xml
272-
app:primaryColor="#1B5E20" <!--Green-->
273-
app:errorColor="#ddaa00" <!--Yellow-->
274-
app:helperTextColor="#795548" <!--Brown-->
275-
app:panelBackgroundColor="#ffe8e8" <!--Pink-->
270+
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
271+
...
272+
app:primaryColor="#1B5E20"
273+
app:errorColor="#ddaa00"
274+
app:helperTextColor="#795548"
275+
app:panelBackgroundColor="#ffe8e8">
276276
```
277277

278278
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/customColor1.png) ![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/customColor2.png)
279279

280-
#### 13. Customize EditText
280+
#### 10. Customize EditText
281281

282-
If you want to customize the `EditText` in the `TextFieldBoxes` (which is a inherited `FrameLayout` that contains a `EditText` for input), use the `getEditText()` methond in Java and do whatever you like (e.g. `setOnKeyListener()`, `addTextChangedListener()`)
282+
**From release 1.3.0**, just do what you want to the `ExtendedEditText` inside the TextFieldBoxes.
283283

284284
```java
285285
final TextFieldBoxes textFieldBoxes = findViewById(R.id.text_field_boxes);
286-
textFieldBoxes.getEditText().addTextChangedListener(new TextWatcher() {
286+
final ExtendedEditText extendedEditText = findViewById(R.id.extended_edit_text);
287+
extendedEditText.addTextChangedListener(new TextWatcher() {
287288
@Override
288289
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
289290
}
@@ -294,15 +295,15 @@ textFieldBoxes.getEditText().addTextChangedListener(new TextWatcher() {
294295

295296
@Override
296297
public void afterTextChanged(Editable editable) {
297-
if (editable.toString().equals("wrong"))
298-
textFieldBoxes.setError("It's wrong");
298+
if (editable.toString().equals("wrong"))
299+
textFieldBoxes.setError("It's wrong");
299300
}
300301
});
301302
```
302303

303304
![](https://raw.githubusercontent.com/HITGIF/TextFieldBoxes/master/images/edittext.gif)
304305

305-
#### 14. Dark Theme
306+
#### 11. Dark Theme
306307

307308
TextFieldBoxes use the color attributes within the current theme and will automatically change its color to fit the dark theme without additional settings.
308309

@@ -313,47 +314,56 @@ TextFieldBoxes use the color attributes within the current theme and will automa
313314
314315
## All Attributes
315316

316-
#### Texts
317+
### ExtendedEditText
318+
319+
##### Texts
317320

318321
| Attribute | Description |
319322
| --- | --- |
320-
| `app:text` | EditText text |
321-
| `app:labelText` | Floating label text at the top |
322-
| `app:helperText` | Helper text at the bottom |
323-
| `app:hint` | Placeholder text that is shown in the EditText when there is no text and is on focus |
324323
| `app:prefix` | Prefix Text |
325324
| `app:suffix` | Suffix Text |
326325

327-
#### Colors
326+
##### Colors
327+
328+
| Attribute | Description | Default |
329+
| --- | --- | --- |
330+
| `app:prefixTextColor` | Prefix text color | Current theme `textColorTertiary` |
331+
| `app:suffixTextColor` | Suffix text color | Current theme `textColorTertiary` |
332+
333+
### TextFieldBoxes
334+
335+
##### Texts
336+
337+
| Attribute | Description |
338+
| --- | --- |
339+
| `app:labelText` | Floating label text at the top |
340+
| `app:helperText` | Helper text at the bottom |
341+
342+
##### Colors
328343

329344
| Attribute | Description | Default |
330345
| --- | --- | --- |
331346
| `app:helperTextColor` | Helper text color | Current theme `textColorTertiary` |
332347
| `app:errorColor` | The color that is used to indicate error (e.g. exceeding max characters, `setError()`) | `A400 red` |
333348
| `app:primaryColor` | The color for the underline and the floating label text | Current theme `colorPrimary` |
334-
| `app:prefixTextColor` | Prefix text color | Current theme `textColorTertiary` |
335-
| `app:suffixTextColor` | Suffix text color | Current theme `textColorTertiary` |
336349
| `app:panelBackgroundColor` | The color for the panel at the back | 6% Current theme `colorForeground` |
337350

338-
#### Characters counter
351+
##### Characters counter
339352

340353
| Attribute | Description | Default |
341354
| --- | --- | --- |
342355
| `app:maxCharacters` | Max characters count limit. `0` means no limit | `0` |
343356
| `app:minCharacters` | Min characters count limit. `0` means no limit | `0` |
344357

345-
#### Others
358+
##### Others
346359

347360
| Attribute | Description | Default |
348361
| --- | --- | --- |
349362
| `app:enabled` | Whether the text field is enabled | `True` |
350-
| `app:singleLine` | Whether the EditText is single-lined | `False` |
351-
| `app:maxLines` | The number of maximum lines allowed in the text field | `Integer.MAX_VALUE` |
352363
| `app:iconSignifier` | The resource ID of the icon before the TextFieldBoxes | `0` |
353364
| `app:endIcon` | The resource ID of the icon at the end of the field | `0` |
354365
| `app:hasClearButton` | Whether to show the clear button at the end of the EditText | `False` |
355366
| `app:hasFocus` | Whether the EditText is having the focus | `False` |
356-
357367
358368
## TODO
359369
+ [X] Prefix & Suffix
@@ -362,6 +372,7 @@ TextFieldBoxes use the color attributes within the current theme and will automa
362372
+ [X] Delete Button
363373
+ [X] End Icon
364374
+ [X] Placeholder (real "hint")
375+
+ [X] Move the EditText out
365376

366377
367378
## License

0 commit comments

Comments
 (0)