Skip to content

Commit

Permalink
Release v1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
whilu committed May 16, 2017
1 parent 9b1b7f9 commit 64c73da
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add below dependency in your **build.gradle** file.

```groovy
dependencies {
compile 'co.lujun:androidtagview:1.1.2'
compile 'co.lujun:androidtagview:1.1.3'
}
```

Expand Down Expand Up @@ -183,14 +183,18 @@ mTagContainerLayout.addTag(String text);
```java
mTagContainerLayout.addTag(String text, int position);
```
* Remove TagView on particular position, require the position of the TagView
* Remove TagView on particular position, require the position of the TagView.
```java
mTagContainerLayout.removeTag(int position);
```
* Remove all TagViews.
```java
mTagContainerLayout.removeAllTags();
```
* Get a TagView in specified position.
```java
mTagContainerLayout.getTagView(int position);
```
* Set color for each TagView.
```java
List<int[]> colors = new ArrayList<int[]>();
Expand All @@ -204,6 +208,9 @@ mTagcontainerLayout.setTags(tags, colors);

## Change logs

### 1.1.3(2017-5-17)
- Add ```getTagView(int position)``` method to get TagView in specified position.

### 1.1.2(2017-5-16)
- Fix bugs

Expand Down
4 changes: 2 additions & 2 deletions androidtagview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 112
versionName "1.1.2"
versionCode 113
versionName "1.1.3"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TagContainerLayout extends ViewGroup {
/**
* The list to store the tags color info
*/
private ArrayList<int[]> mColorArrayList;
private List<int[]> mColorArrayList;

/**
* Horizontal interval, default 5(dp)
Expand Down Expand Up @@ -720,7 +720,7 @@ public void setTags(List<String> tags) {
* @param tags
* @param colorArrayList
*/
public void setTags(List<String> tags, ArrayList<int[]> colorArrayList) {
public void setTags(List<String> tags, List<int[]> colorArrayList) {
mTags = tags;
mColorArrayList = colorArrayList;
onSetTag();
Expand Down Expand Up @@ -1385,11 +1385,24 @@ public boolean isTagSupportLettersRTL() {
}

/**
* Set whether the 'support letters show with RTL(like: Android to diordnA)' style is enabled
* Set whether the 'support letters show with RTL(like: Android to diordnA)' style is enabled.
*
* @param mTagSupportLettersRTL
*/
public void setTagSupportLettersRTL(boolean mTagSupportLettersRTL) {
this.mTagSupportLettersRTL = mTagSupportLettersRTL;
}

/**
* Get TagView in specified position.
*
* @param position the position of the TagView
* @return
*/
public TagView getTagView(int position){
if (position < 0 || position >= mChildViews.size()) {
throw new RuntimeException("Illegal position!");
}
return (TagView) mChildViews.get(position);
}
}
4 changes: 2 additions & 2 deletions sample/src/main/java/co/lujun/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ public void onTagCrossClick(int position) {
mTagContainerLayout3.setTags(list3);
mTagContainerLayout4.setTags(list4);

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

colors.add(col1);
colors.add(col2);

mTagcontainerLayout5.setTags(list5,colors);
mTagcontainerLayout5.setTags(list5, colors);
final EditText text = (EditText) findViewById(R.id.text_tag);
Button btnAddTag = (Button) findViewById(R.id.btn_add_tag);
btnAddTag.setOnClickListener(new View.OnClickListener() {
Expand Down

0 comments on commit 64c73da

Please sign in to comment.