Skip to content

Commit 64c73da

Browse files
committed
Release v1.1.3
1 parent 9b1b7f9 commit 64c73da

4 files changed

Lines changed: 29 additions & 9 deletions

File tree

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Add below dependency in your **build.gradle** file.
1616

1717
```groovy
1818
dependencies {
19-
compile 'co.lujun:androidtagview:1.1.2'
19+
compile 'co.lujun:androidtagview:1.1.3'
2020
}
2121
```
2222

@@ -183,14 +183,18 @@ mTagContainerLayout.addTag(String text);
183183
```java
184184
mTagContainerLayout.addTag(String text, int position);
185185
```
186-
* Remove TagView on particular position, require the position of the TagView
186+
* Remove TagView on particular position, require the position of the TagView.
187187
```java
188188
mTagContainerLayout.removeTag(int position);
189189
```
190190
* Remove all TagViews.
191191
```java
192192
mTagContainerLayout.removeAllTags();
193193
```
194+
* Get a TagView in specified position.
195+
```java
196+
mTagContainerLayout.getTagView(int position);
197+
```
194198
* Set color for each TagView.
195199
```java
196200
List<int[]> colors = new ArrayList<int[]>();
@@ -204,6 +208,9 @@ mTagcontainerLayout.setTags(tags, colors);
204208

205209
## Change logs
206210

211+
### 1.1.3(2017-5-17)
212+
- Add ```getTagView(int position)``` method to get TagView in specified position.
213+
207214
### 1.1.2(2017-5-16)
208215
- Fix bugs
209216

androidtagview/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
defaultConfig {
88
minSdkVersion 9
99
targetSdkVersion 25
10-
versionCode 112
11-
versionName "1.1.2"
10+
versionCode 113
11+
versionName "1.1.3"
1212
}
1313
buildTypes {
1414
release {

androidtagview/src/main/java/co/lujun/androidtagview/TagContainerLayout.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class TagContainerLayout extends ViewGroup {
3535
/**
3636
* The list to store the tags color info
3737
*/
38-
private ArrayList<int[]> mColorArrayList;
38+
private List<int[]> mColorArrayList;
3939

4040
/**
4141
* Horizontal interval, default 5(dp)
@@ -720,7 +720,7 @@ public void setTags(List<String> tags) {
720720
* @param tags
721721
* @param colorArrayList
722722
*/
723-
public void setTags(List<String> tags, ArrayList<int[]> colorArrayList) {
723+
public void setTags(List<String> tags, List<int[]> colorArrayList) {
724724
mTags = tags;
725725
mColorArrayList = colorArrayList;
726726
onSetTag();
@@ -1385,11 +1385,24 @@ public boolean isTagSupportLettersRTL() {
13851385
}
13861386

13871387
/**
1388-
* Set whether the 'support letters show with RTL(like: Android to diordnA)' style is enabled
1388+
* Set whether the 'support letters show with RTL(like: Android to diordnA)' style is enabled.
13891389
*
13901390
* @param mTagSupportLettersRTL
13911391
*/
13921392
public void setTagSupportLettersRTL(boolean mTagSupportLettersRTL) {
13931393
this.mTagSupportLettersRTL = mTagSupportLettersRTL;
13941394
}
1395+
1396+
/**
1397+
* Get TagView in specified position.
1398+
*
1399+
* @param position the position of the TagView
1400+
* @return
1401+
*/
1402+
public TagView getTagView(int position){
1403+
if (position < 0 || position >= mChildViews.size()) {
1404+
throw new RuntimeException("Illegal position!");
1405+
}
1406+
return (TagView) mChildViews.get(position);
1407+
}
13951408
}

sample/src/main/java/co/lujun/sample/MainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ public void onTagCrossClick(int position) {
134134
mTagContainerLayout3.setTags(list3);
135135
mTagContainerLayout4.setTags(list4);
136136

137-
ArrayList<int[]> colors = new ArrayList<int[]>();
137+
List<int[]> colors = new ArrayList<int[]>();
138138
//int[]color = {backgroundColor, tagBorderColor, tagTextColor}
139139
int[] col1 = {Color.parseColor("#ff0000"), Color.parseColor("#000000"), Color.parseColor("#ffffff")};
140140
int[] col2 = {Color.parseColor("#0000ff"), Color.parseColor("#000000"), Color.parseColor("#ffffff")};
141141

142142
colors.add(col1);
143143
colors.add(col2);
144144

145-
mTagcontainerLayout5.setTags(list5,colors);
145+
mTagcontainerLayout5.setTags(list5, colors);
146146
final EditText text = (EditText) findViewById(R.id.text_tag);
147147
Button btnAddTag = (Button) findViewById(R.id.btn_add_tag);
148148
btnAddTag.setOnClickListener(new View.OnClickListener() {

0 commit comments

Comments
 (0)