├── .gitignore
├── README.md
├── build.gradle
├── extra
├── Screenshot_2015-03-27-16-35-42.png
├── device-2015-05-13-164313.png
├── device-2015-05-13-170211.png
├── sample-debug.apk
└── tagview_screenshot.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── import-summary.txt
├── library
├── .gitignore
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── me
│ │ └── kaede
│ │ └── tagview
│ │ ├── Constants.java
│ │ ├── LogUtil.java
│ │ ├── OnTagClickListener.java
│ │ ├── OnTagDeleteListener.java
│ │ ├── ResolutionUtil.java
│ │ ├── Tag.java
│ │ └── TagView.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── layout
│ └── tagview_item.xml
│ └── values
│ └── tagview_attr.xml
├── sample
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── me
│ │ └── kaede
│ │ └── sample
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── me
│ │ └── kaede
│ │ └── sample
│ │ ├── ListViewActivity.java
│ │ ├── MainActivity.java
│ │ ├── RecyclerViewActivity.java
│ │ └── SubActivity.java
│ └── res
│ ├── drawable-xxhdpi
│ ├── bg_tag_normal.9.png
│ ├── bg_tag_pressed.9.png
│ └── icon_github.png
│ ├── drawable
│ ├── bg_tag.xml
│ └── shape_tagview.xml
│ ├── layout
│ ├── activity_list_view.xml
│ ├── activity_main.xml
│ ├── activity_recycler_view.xml
│ ├── activity_second.xml
│ ├── item_list_tag.xml
│ └── item_list_text.xml
│ ├── menu
│ ├── menu_list_view.xml
│ ├── menu_main.xml
│ └── menu_second.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── arrays.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | .idea
3 | *.iml
4 | build/
5 | local.properties
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Android-Cloud-TagView-Plus
2 | ###Introduction
3 | An Android Cloud Tag Widget. You can edit the tag's style, and set listener of selecting or deleting tag. Used in APP with ten millions of users.
4 |
5 | ###Screenshot
6 | `Sample`
7 |
8 | 
9 |
10 | `used in app with ten millions of users(YY)`
11 |
12 | 
13 |
14 | ###Feature
15 |
16 | - Editable Style of Text, such as Font size and color.
17 | - Editable Style of Tag, Background/Pressed Color, Radius effect, Custom Background, Delete mode.
18 | - Listener of tag selecting and deleting.
19 | - Can be created from XML file or Java code.
20 |
21 | ###Sample Apk
22 | [download apk](raw/sample-debug.apk)
23 |
24 | ###Usage
25 | used in xml file
26 | ```java
27 |
38 |
39 | ```
40 | or used by java code
41 | ```java
42 | TagView tagview2 = new TagView(this);
43 | tagview2.setLineMargin(20f);//dp
44 | tagview2.setTagMargin(20f);
45 | tagview2.setTextPaddingLeft(20f);
46 | tagview2.setTextPaddingTop(20f);
47 | tagview2.setTextPaddingRight(20f);
48 | tagview2.setTexPaddingBottom(20f);
49 | ```
50 | add a lot of tags
51 | ```java
52 | String[] tags = getResources().getStringArray(R.array.continents);
53 | tagView.addTags(tags);
54 | ```
55 | add a tag in details
56 | ```java
57 | Tag tag = new Tag("Tag Text");
58 | tag.tagTextColor = Color.parseColor("#FFFFFF");
59 | tag.layoutColor = Color.parseColor("#DDDDDD");
60 | tag.layoutColorPress = Color.parseColor("#555555");
61 | //or tag.background = this.getResources().getDrawable(R.drawable.custom_bg);
62 | tag.radius = 20f;
63 | tag.tagTextSize = 14f;
64 | tag.layoutBorderSize = 1f;
65 | tag.layoutBorderColor = Color.parseColor("#FFFFFF");
66 | tag.isDeletable = true;
67 | tagView.addTag(tag);
68 | ```
69 |
70 | ###To-Do List
71 |
72 | - Animation Support
73 | - Multi Tag Arrange Type (such as Right-To-Left arrange)
74 | - Improve Performance
75 |
76 | ###Problem
77 | TagView supports to be used as ItemView in ListView/GridView/RecyclerView, but it will remove and re-add its tags very frequently when you are flinging. Therefore the performance of TagView in ItemView maybe not good if you have a lot of ItemViews using TagView. And in this situation it is advised to use `SpannableString` instead of views. I will add `SpannableString` version of TagView to improve the performance in ItemView.
78 |
79 | ###Substitute
80 |
81 | - https://github.com/namito/TagCloudLinkView
82 | - https://github.com/mcharmas/android-tagview
83 |
84 | ##中文
85 | ###简介
86 | Android上的云标签控件,除了能设置标签的样式外,还能监听标签的点击和删除事件。目前已在千万级用户的应用上使用。
87 |
88 | ###特点
89 |
90 | - 支持设置标签内容的样式,如字体大小、颜色
91 | - 支持设置标签的颜色(或者自定义布局)、点击效果、圆角效果、是否可删除
92 | - 能监听标签的点击和删除事件
93 | - 支持从代码或者XML创建TagView
94 |
95 | ###待完成
96 |
97 | - 动画效果
98 |
99 | ###License
100 |
101 | Copyright 2015 Kaede Akatsuki
102 |
103 | Licensed under the Apache License, Version 2.0 (the "License");
104 | you may not use this file except in compliance with the License.
105 | You may obtain a copy of the License at
106 |
107 | http://www.apache.org/licenses/LICENSE-2.0
108 |
109 | Unless required by applicable law or agreed to in writing, software
110 | distributed under the License is distributed on an "AS IS" BASIS,
111 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112 | See the License for the specific language governing permissions and
113 | limitations under the License.
114 |
115 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:1.1.0'
8 | }
9 | }
10 |
11 | allprojects {
12 | repositories {
13 | jcenter()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/extra/Screenshot_2015-03-27-16-35-42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/extra/Screenshot_2015-03-27-16-35-42.png
--------------------------------------------------------------------------------
/extra/device-2015-05-13-164313.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/extra/device-2015-05-13-164313.png
--------------------------------------------------------------------------------
/extra/device-2015-05-13-170211.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/extra/device-2015-05-13-170211.png
--------------------------------------------------------------------------------
/extra/sample-debug.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/extra/sample-debug.apk
--------------------------------------------------------------------------------
/extra/tagview_screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/extra/tagview_screenshot.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Apr 28 20:38:35 CST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/import-summary.txt:
--------------------------------------------------------------------------------
1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY
2 | ======================================
3 |
4 | Ignored Files:
5 | --------------
6 | The following files were *not* copied into the new Gradle project; you
7 | should evaluate whether these are still needed in your project and if
8 | so manually move them:
9 |
10 | * .gitignore
11 | * README.md
12 | * ic_launcher-web.png
13 | * proguard-project.txt
14 | * raw\
15 | * raw\Screenshot_2015-03-27-16-35-42.png
16 | * raw\tagview_screenshot.png
17 |
18 | Moved Files:
19 | ------------
20 | Android Gradle projects use a different directory structure than ADT
21 | Eclipse projects. Here's how the projects were restructured:
22 |
23 | * AndroidManifest.xml => app\src\main\AndroidManifest.xml
24 | * res\ => app\src\main\res\
25 | * src\ => app\src\main\java\
26 |
27 | Next Steps:
28 | -----------
29 | You can now build the project. The Gradle project needs network
30 | connectivity to download dependencies.
31 |
32 | Bugs:
33 | -----
34 | If for some reason your project does not build, and you determine that
35 | it is due to a bug or limitation of the Eclipse to Gradle importer,
36 | please file a bug at http://b.android.com with category
37 | Component-Tools.
38 |
39 | (This import summary is for your information only, and can be deleted
40 | after import once you are satisfied with the results.)
41 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | *.iml
3 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 21
5 | buildToolsVersion "21.1.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 9
9 | targetSdkVersion 23
10 | }
11 |
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
16 | }
17 | }
18 | }
19 | dependencies {
20 | compile 'com.android.support:support-annotations:23.3.0'
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/library/src/main/java/me/kaede/tagview/Constants.java:
--------------------------------------------------------------------------------
1 | package me.kaede.tagview;
2 |
3 | import android.graphics.Color;
4 |
5 | class Constants {
6 | public static boolean DEBUG = true;
7 |
8 | // the dimens unit is dp or sp, not px
9 | public static final float DEFAULT_LINE_MARGIN = 5;
10 | public static final float DEFAULT_TAG_MARGIN = 5;
11 | public static final float DEFAULT_TAG_TEXT_PADDING_LEFT = 8;
12 | public static final float DEFAULT_TAG_TEXT_PADDING_TOP = 5;
13 | public static final float DEFAULT_TAG_TEXT_PADDING_RIGHT = 8;
14 | public static final float DEFAULT_TAG_TEXT_PADDING_BOTTOM = 5;
15 | public static final float LAYOUT_WIDTH_OFFSET = 2;
16 |
17 | public static final float DEFAULT_TAG_TEXT_SIZE = 14f;
18 | public static final float DEFAULT_TAG_DELETE_INDICATOR_SIZE = 14f;
19 | public static final float DEFAULT_TAG_LAYOUT_BORDER_SIZE = 0f;
20 | public static final float DEFAULT_TAG_RADIUS = 100;
21 | public static final int DEFAULT_TAG_LAYOUT_COLOR = Color.parseColor("#00BFFF");
22 | public static final int DEFAULT_TAG_LAYOUT_COLOR_PRESS = Color.parseColor("#88363636");
23 | public static final int DEFAULT_TAG_TEXT_COLOR = Color.parseColor("#ffffff");
24 | public static final int DEFAULT_TAG_DELETE_INDICATOR_COLOR = Color.parseColor("#ffffff");
25 | public static final int DEFAULT_TAG_LAYOUT_BORDER_COLOR = Color.parseColor("#ffffff");
26 | public static final String DEFAULT_TAG_DELETE_ICON = "×";
27 | public static final boolean DEFAULT_TAG_IS_DELETABLE = false;
28 | }
29 |
--------------------------------------------------------------------------------
/library/src/main/java/me/kaede/tagview/LogUtil.java:
--------------------------------------------------------------------------------
1 | package me.kaede.tagview;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created by kaede on 2016/4/11.
7 | */
8 | class LogUtil {
9 |
10 | public static final String PREFIX = "[kaede]";
11 |
12 | public static void v(String TAG, String msg) {
13 | if (!Constants.DEBUG) return;
14 | Log.v(TAG, PREFIX + msg);
15 | }
16 |
17 | public static void d(String TAG, String msg) {
18 | if (!Constants.DEBUG) return;
19 | Log.d(TAG, PREFIX + msg);
20 | }
21 |
22 | public static void i(String TAG, String msg) {
23 | Log.i(TAG, PREFIX + msg);
24 | }
25 |
26 | public static void w(String TAG, String msg) {
27 | Log.w(TAG, PREFIX + msg);
28 | }
29 |
30 | public static void e(String TAG, String msg) {
31 | Log.e(TAG, PREFIX + msg);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/me/kaede/tagview/OnTagClickListener.java:
--------------------------------------------------------------------------------
1 | package me.kaede.tagview;
2 |
3 | /**
4 | * listener for tag delete
5 | */
6 | public interface OnTagClickListener {
7 | void onTagClick(int position, Tag tag);
8 | }
--------------------------------------------------------------------------------
/library/src/main/java/me/kaede/tagview/OnTagDeleteListener.java:
--------------------------------------------------------------------------------
1 | package me.kaede.tagview;
2 |
3 | /**
4 | * listener for tag delete
5 | */
6 | public interface OnTagDeleteListener {
7 | void onTagDeleted(int position, Tag tag);
8 | }
--------------------------------------------------------------------------------
/library/src/main/java/me/kaede/tagview/ResolutionUtil.java:
--------------------------------------------------------------------------------
1 | package me.kaede.tagview;
2 |
3 | import android.content.Context;
4 | import android.util.DisplayMetrics;
5 | import android.util.TypedValue;
6 |
7 | class ResolutionUtil {
8 |
9 | public static int dpToPx(Context c, float dipValue) {
10 | DisplayMetrics metrics = c.getResources().getDisplayMetrics();
11 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics);
12 | }
13 |
14 | public static int spToPx(Context context, float spValue) {
15 | DisplayMetrics metrics = context.getResources().getDisplayMetrics();
16 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue, metrics);
17 | }
18 |
19 | public static int getScreenWidth(Context context) {
20 | return context.getResources().getDisplayMetrics().widthPixels;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/library/src/main/java/me/kaede/tagview/Tag.java:
--------------------------------------------------------------------------------
1 | package me.kaede.tagview;
2 |
3 | import android.graphics.Color;
4 | import android.graphics.drawable.Drawable;
5 |
6 | /**
7 | * Tag Entity
8 | */
9 | public class Tag {
10 |
11 | public int id;
12 | public String text;
13 | public int tagTextColor;
14 | public float tagTextSize;
15 | public int layoutColor;
16 | public int layoutColorPress;
17 | public boolean isDeletable;
18 | public int deleteIndicatorColor;
19 | public float deleteIndicatorSize;
20 | public float radius;
21 | public String deleteIcon;
22 | public float layoutBorderSize;
23 | public int layoutBorderColor;
24 | public Drawable background;
25 |
26 | public Tag(String text) {
27 | init(0, text, Constants.DEFAULT_TAG_TEXT_COLOR, Constants.DEFAULT_TAG_TEXT_SIZE, Constants.DEFAULT_TAG_LAYOUT_COLOR, Constants.DEFAULT_TAG_LAYOUT_COLOR_PRESS,
28 | Constants.DEFAULT_TAG_IS_DELETABLE, Constants.DEFAULT_TAG_DELETE_INDICATOR_COLOR, Constants.DEFAULT_TAG_DELETE_INDICATOR_SIZE, Constants.DEFAULT_TAG_RADIUS, Constants.DEFAULT_TAG_DELETE_ICON, Constants.DEFAULT_TAG_LAYOUT_BORDER_SIZE, Constants.DEFAULT_TAG_LAYOUT_BORDER_COLOR);
29 | }
30 |
31 | public Tag(String text, int color) {
32 | init(0, text, Constants.DEFAULT_TAG_TEXT_COLOR, Constants.DEFAULT_TAG_TEXT_SIZE, color, Constants.DEFAULT_TAG_LAYOUT_COLOR_PRESS, Constants.DEFAULT_TAG_IS_DELETABLE,
33 | Constants.DEFAULT_TAG_DELETE_INDICATOR_COLOR, Constants.DEFAULT_TAG_DELETE_INDICATOR_SIZE, Constants.DEFAULT_TAG_RADIUS, Constants.DEFAULT_TAG_DELETE_ICON, Constants.DEFAULT_TAG_LAYOUT_BORDER_SIZE, Constants.DEFAULT_TAG_LAYOUT_BORDER_COLOR);
34 |
35 | }
36 |
37 | public Tag(String text, String color) {
38 | init(0, text, Constants.DEFAULT_TAG_TEXT_COLOR, Constants.DEFAULT_TAG_TEXT_SIZE, Color.parseColor(color), Constants.DEFAULT_TAG_LAYOUT_COLOR_PRESS,
39 | Constants.DEFAULT_TAG_IS_DELETABLE, Constants.DEFAULT_TAG_DELETE_INDICATOR_COLOR, Constants.DEFAULT_TAG_DELETE_INDICATOR_SIZE, Constants.DEFAULT_TAG_RADIUS, Constants.DEFAULT_TAG_DELETE_ICON, Constants.DEFAULT_TAG_LAYOUT_BORDER_SIZE, Constants.DEFAULT_TAG_LAYOUT_BORDER_COLOR);
40 |
41 | }
42 |
43 | public Tag(int id, String text) {
44 | init(id, text, Constants.DEFAULT_TAG_TEXT_COLOR, Constants.DEFAULT_TAG_TEXT_SIZE, Constants.DEFAULT_TAG_LAYOUT_COLOR, Constants.DEFAULT_TAG_LAYOUT_COLOR_PRESS,
45 | Constants.DEFAULT_TAG_IS_DELETABLE, Constants.DEFAULT_TAG_DELETE_INDICATOR_COLOR, Constants.DEFAULT_TAG_DELETE_INDICATOR_SIZE, Constants.DEFAULT_TAG_RADIUS, Constants.DEFAULT_TAG_DELETE_ICON, Constants.DEFAULT_TAG_LAYOUT_BORDER_SIZE, Constants.DEFAULT_TAG_LAYOUT_BORDER_COLOR);
46 | }
47 |
48 | public Tag(int id, String text, int color) {
49 | init(id, text, Constants.DEFAULT_TAG_TEXT_COLOR, Constants.DEFAULT_TAG_TEXT_SIZE, color, Constants.DEFAULT_TAG_LAYOUT_COLOR_PRESS, Constants.DEFAULT_TAG_IS_DELETABLE,
50 | Constants.DEFAULT_TAG_DELETE_INDICATOR_COLOR, Constants.DEFAULT_TAG_DELETE_INDICATOR_SIZE, Constants.DEFAULT_TAG_RADIUS, Constants.DEFAULT_TAG_DELETE_ICON, Constants.DEFAULT_TAG_LAYOUT_BORDER_SIZE, Constants.DEFAULT_TAG_LAYOUT_BORDER_COLOR);
51 |
52 | }
53 |
54 | public Tag(int id, String text, String color) {
55 | init(id, text, Constants.DEFAULT_TAG_TEXT_COLOR, Constants.DEFAULT_TAG_TEXT_SIZE, Color.parseColor(color), Constants.DEFAULT_TAG_LAYOUT_COLOR_PRESS,
56 | Constants.DEFAULT_TAG_IS_DELETABLE, Constants.DEFAULT_TAG_DELETE_INDICATOR_COLOR, Constants.DEFAULT_TAG_DELETE_INDICATOR_SIZE, Constants.DEFAULT_TAG_RADIUS, Constants.DEFAULT_TAG_DELETE_ICON, Constants.DEFAULT_TAG_LAYOUT_BORDER_SIZE, Constants.DEFAULT_TAG_LAYOUT_BORDER_COLOR);
57 |
58 | }
59 |
60 | private void init(int id, String text, int tagTextColor, float tagTextSize, int layout_color, int layout_color_press, boolean isDeletable, int deleteIndicatorColor,
61 | float deleteIndicatorSize, float radius, String deleteIcon, float layoutBorderSize, int layoutBorderColor) {
62 | this.id = id;
63 | this.text = text;
64 | this.tagTextColor = tagTextColor;
65 | this.tagTextSize = tagTextSize;
66 | this.layoutColor = layout_color;
67 | this.layoutColorPress = layout_color_press;
68 | this.isDeletable = isDeletable;
69 | this.deleteIndicatorColor = deleteIndicatorColor;
70 | this.deleteIndicatorSize = deleteIndicatorSize;
71 | this.radius = radius;
72 | this.deleteIcon = deleteIcon;
73 | this.layoutBorderSize = layoutBorderSize;
74 | this.layoutBorderColor = layoutBorderColor;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/library/src/main/java/me/kaede/tagview/TagView.java:
--------------------------------------------------------------------------------
1 | package me.kaede.tagview;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.content.pm.ApplicationInfo;
6 | import android.content.res.TypedArray;
7 | import android.graphics.Canvas;
8 | import android.graphics.drawable.Drawable;
9 | import android.graphics.drawable.GradientDrawable;
10 | import android.graphics.drawable.StateListDrawable;
11 | import android.os.Build;
12 | import android.support.annotation.NonNull;
13 | import android.util.AttributeSet;
14 | import android.util.TypedValue;
15 | import android.view.LayoutInflater;
16 | import android.view.View;
17 | import android.view.ViewGroup;
18 | import android.widget.LinearLayout;
19 | import android.widget.RelativeLayout;
20 | import android.widget.TextView;
21 | import com.example.demo_cloud_tagview.R;
22 |
23 | import java.util.ArrayList;
24 | import java.util.List;
25 |
26 | /**
27 | * Android TagView Widget
28 | */
29 | public class TagView extends RelativeLayout {
30 | public static final String TAG = "TagView";
31 |
32 | private int mWidth;
33 | private int lineMargin;
34 | private int tagMargin;
35 | private int textPaddingLeft;
36 | private int textPaddingRight;
37 | private int textPaddingTop;
38 | private int texPaddingBottom;
39 | private List mTags = new ArrayList<>();
40 | private LayoutInflater mInflater;
41 | private OnTagClickListener mClickListener;
42 | private OnTagDeleteListener mDeleteListener;
43 |
44 | public TagView(Context context) {
45 | super(context, null);
46 | LogUtil.v(TAG,"[TagView]constructor 1");
47 | init(context, null, 0, 0);
48 | }
49 |
50 | public TagView(Context context, AttributeSet attrs) {
51 | super(context, attrs);
52 | LogUtil.v(TAG,"[TagView]constructor 2");
53 | init(context, attrs, 0, 0);
54 | }
55 |
56 | public TagView(Context ctx, AttributeSet attrs, int defStyle) {
57 | super(ctx, attrs, defStyle);
58 | LogUtil.v(TAG,"[TagView]constructor 3");
59 | init(ctx, attrs, defStyle, defStyle);
60 | }
61 |
62 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
63 | public TagView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
64 | super(context, attrs, defStyleAttr, defStyleRes);
65 | LogUtil.v(TAG,"[TagView]constructor 4");
66 | init(context, attrs, defStyleAttr, defStyleRes);
67 | }
68 |
69 | private void init(Context context, AttributeSet attrs, int defStyle, int defStyleRes) {
70 | LogUtil.v(TAG,"[init]");
71 | Constants.DEBUG = (context.getApplicationContext().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
72 | mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
73 | // get AttributeSet
74 | TypedArray typeArray = context.obtainStyledAttributes(attrs, R.styleable.TagView, defStyle, defStyleRes);
75 | this.lineMargin = (int) typeArray.getDimension(R.styleable.TagView_lineMargin, ResolutionUtil.dpToPx(this.getContext(), Constants.DEFAULT_LINE_MARGIN));
76 | this.tagMargin = (int) typeArray.getDimension(R.styleable.TagView_tagMargin, ResolutionUtil.dpToPx(this.getContext(), Constants.DEFAULT_TAG_MARGIN));
77 | this.textPaddingLeft = (int) typeArray.getDimension(R.styleable.TagView_textPaddingLeft, ResolutionUtil.dpToPx(this.getContext(), Constants.DEFAULT_TAG_TEXT_PADDING_LEFT));
78 | this.textPaddingRight = (int) typeArray.getDimension(R.styleable.TagView_textPaddingRight, ResolutionUtil.dpToPx(this.getContext(), Constants.DEFAULT_TAG_TEXT_PADDING_RIGHT));
79 | this.textPaddingTop = (int) typeArray.getDimension(R.styleable.TagView_textPaddingTop, ResolutionUtil.dpToPx(this.getContext(), Constants.DEFAULT_TAG_TEXT_PADDING_TOP));
80 | this.texPaddingBottom = (int) typeArray.getDimension(R.styleable.TagView_textPaddingBottom, ResolutionUtil.dpToPx(this.getContext(), Constants.DEFAULT_TAG_TEXT_PADDING_BOTTOM));
81 | typeArray.recycle();
82 | mWidth = ResolutionUtil.getScreenWidth(context);
83 | // this.setWillNotDraw(false);
84 | }
85 |
86 | @Override
87 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
88 | super.onSizeChanged(w, h, oldw, oldh);
89 | LogUtil.v(TAG,"[onSizeChanged]w = " + w);
90 | mWidth = w;
91 | // drawTags();
92 | }
93 |
94 | @Override
95 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
96 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
97 | LogUtil.v(TAG,"[onMeasure]getMeasuredWidth = " + getMeasuredWidth());
98 | /*int width = getMeasuredWidth();
99 | if (width <= 0) return;
100 | mWidth = getMeasuredWidth();
101 | drawTags();*/
102 | }
103 |
104 | @Override
105 | protected void onDraw(Canvas canvas) {
106 | super.onDraw(canvas);
107 | // View#onDraw is disabled in view group;
108 | // enable View#onDraw for view group : View#setWillNotDraw(false);
109 | LogUtil.v(TAG,"[onDraw]");
110 | // drawTags();
111 | }
112 |
113 | @Override
114 | protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
115 | LogUtil.v(TAG,"[onVisibilityChanged]");
116 | /*if (changedView == this){
117 | if (visibility == View.VISIBLE){
118 | drawTags();
119 | }
120 | }*/
121 | super.onVisibilityChanged(changedView, visibility);
122 | }
123 |
124 | @Override
125 | protected void onAttachedToWindow() {
126 | super.onAttachedToWindow();
127 | LogUtil.v(TAG,"[onAttachedToWindow]");
128 | }
129 |
130 | private void drawTags() {
131 | LogUtil.v(TAG,"[drawTags]visibility = " + (getVisibility() == View.VISIBLE));
132 | if (getVisibility() != View.VISIBLE) return;
133 | LogUtil.v(TAG,"[drawTags]mWidth = " + mWidth);
134 | LogUtil.d(TAG,"[drawTags]add tags, tag count = " + mTags.size());
135 | // clear all tag
136 | removeAllViews();
137 | // layout padding left & layout padding right
138 | float total = getPaddingLeft() + getPaddingRight();
139 | int listIndex = 1;// List Index
140 | int index_bottom = 1;// The Tag to add below
141 | int index_header = 1;// The header tag of this line
142 | Tag tag_pre = null;
143 | for (Tag item : mTags) {
144 | final int position = listIndex - 1;
145 | final Tag tag = item;
146 | // inflate tag layout
147 | View tagLayout = mInflater.inflate(R.layout.tagview_item, null);
148 | tagLayout.setId(listIndex);
149 | tagLayout.setBackgroundDrawable(getSelector(tag));
150 | // tag text
151 | TextView tagView = (TextView) tagLayout.findViewById(R.id.tv_tag_item_contain);
152 | tagView.setText(tag.text);
153 | //tagView.setPadding(textPaddingLeft, textPaddingTop, textPaddingRight, texPaddingBottom);
154 | LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) tagView.getLayoutParams();
155 | params.setMargins(textPaddingLeft, textPaddingTop, textPaddingRight, texPaddingBottom);
156 | tagView.setLayoutParams(params);
157 | tagView.setTextColor(tag.tagTextColor);
158 | tagView.setTextSize(TypedValue.COMPLEX_UNIT_SP, tag.tagTextSize);
159 | tagLayout.setOnClickListener(new OnClickListener() {
160 | @Override
161 | public void onClick(View v) {
162 | if (mClickListener != null) {
163 | mClickListener.onTagClick(position, tag);
164 | }
165 | }
166 | });
167 | // calculate of tag layout width
168 | float tagWidth = tagView.getPaint().measureText(tag.text) + textPaddingLeft + textPaddingRight;
169 | // tagView padding (left & right)
170 | // deletable text
171 | TextView deletableView = (TextView) tagLayout.findViewById(R.id.tv_tag_item_delete);
172 | if (tag.isDeletable) {
173 | deletableView.setVisibility(View.VISIBLE);
174 | deletableView.setText(tag.deleteIcon);
175 | int offset = ResolutionUtil.dpToPx(getContext(), 2f);
176 | deletableView.setPadding(offset, textPaddingTop, textPaddingRight + offset, texPaddingBottom);
177 | /*params = (LinearLayout.LayoutParams) deletableView.getLayoutParams();
178 | params.setMargins(offset, textPaddingTop, textPaddingRight+offset, texPaddingBottom);
179 | deletableView.setLayoutParams(params);*/
180 | deletableView.setTextColor(tag.deleteIndicatorColor);
181 | deletableView.setTextSize(TypedValue.COMPLEX_UNIT_SP, tag.deleteIndicatorSize);
182 | deletableView.setOnClickListener(new OnClickListener() {
183 | @Override
184 | public void onClick(View v) {
185 | TagView.this.remove(position);
186 | if (mDeleteListener != null) {
187 | mDeleteListener.onTagDeleted(position, tag);
188 | }
189 | }
190 | });
191 | tagWidth += deletableView.getPaint().measureText(tag.deleteIcon) + deletableView.getPaddingLeft() + deletableView.getPaddingRight();
192 | // deletableView Padding (left & right)
193 | } else {
194 | deletableView.setVisibility(View.GONE);
195 | }
196 | LayoutParams tagParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
197 | //tagParams.setMargins(0, 0, 0, 0);
198 | //add margin of each line
199 | tagParams.bottomMargin = lineMargin;
200 | if (mWidth <= total + tagMargin + tagWidth + ResolutionUtil.dpToPx(this.getContext(), Constants.LAYOUT_WIDTH_OFFSET)) {
201 | //need to add in new line
202 | tagParams.addRule(RelativeLayout.BELOW, index_bottom);
203 | // initialize total param (layout padding left & layout padding right)
204 | total = getPaddingLeft() + getPaddingRight();
205 | index_bottom = listIndex;
206 | index_header = listIndex;
207 | } else {
208 | //no need to new line
209 | tagParams.addRule(RelativeLayout.ALIGN_TOP, index_header);
210 | //not header of the line
211 | if (listIndex != index_header) {
212 | tagParams.addRule(RelativeLayout.RIGHT_OF, listIndex - 1);
213 | tagParams.leftMargin = tagMargin;
214 | total += tagMargin;
215 | if (tag_pre.tagTextSize < tag.tagTextSize) {
216 | index_bottom = listIndex;
217 | }
218 | }
219 | }
220 | total += tagWidth;
221 | addView(tagLayout, tagParams);
222 | tag_pre = tag;
223 | listIndex++;
224 | }
225 | }
226 |
227 | private Drawable getSelector(Tag tag) {
228 | if (tag.background != null) return tag.background;
229 | StateListDrawable states = new StateListDrawable();
230 | GradientDrawable gd_normal = new GradientDrawable();
231 | gd_normal.setColor(tag.layoutColor);
232 | gd_normal.setCornerRadius(tag.radius);
233 | if (tag.layoutBorderSize > 0) {
234 | gd_normal.setStroke(ResolutionUtil.dpToPx(getContext(), tag.layoutBorderSize), tag.layoutBorderColor);
235 | }
236 | GradientDrawable gd_press = new GradientDrawable();
237 | gd_press.setColor(tag.layoutColorPress);
238 | gd_press.setCornerRadius(tag.radius);
239 | states.addState(new int[]{android.R.attr.state_pressed}, gd_press);
240 | //must add state_pressed first,or state_pressed will not take effect
241 | states.addState(new int[]{}, gd_normal);
242 | return states;
243 | }
244 |
245 | public void addTag(Tag tag) {
246 | LogUtil.v(TAG,"[addTag]");
247 | mTags.add(tag);
248 | drawTags();
249 | }
250 |
251 | public void addTags(String[] tags) {
252 | LogUtil.v(TAG,"[addTags]");
253 | if (tags == null || tags.length <= 0) return;
254 | for (String item : tags) {
255 | Tag tag = new Tag(item);
256 | mTags.add(tag);
257 | }
258 | drawTags();
259 | }
260 |
261 | public void addTags(List tagList) {
262 | LogUtil.v(TAG,"[addTags]");
263 | if (tagList == null || tagList.size() <= 0) return;
264 | mTags.addAll(tagList);
265 | drawTags();
266 | }
267 |
268 | public List getTags() {
269 | return mTags;
270 | }
271 |
272 | public void remove(int position) {
273 | LogUtil.v(TAG,"[remove]position = " + position);
274 | mTags.remove(position);
275 | drawTags();
276 | }
277 |
278 | public void removeAllTags() {
279 | LogUtil.v(TAG,"[removeAllTags]");
280 | mTags.clear();
281 | drawTags();
282 | }
283 |
284 | public int getLineMargin() {
285 | return lineMargin;
286 | }
287 |
288 | public void setLineMargin(float lineMargin) {
289 | this.lineMargin = ResolutionUtil.dpToPx(getContext(), lineMargin);
290 | }
291 |
292 | public int getTagMargin() {
293 | return tagMargin;
294 | }
295 |
296 | public void setTagMargin(float tagMargin) {
297 | this.tagMargin = ResolutionUtil.dpToPx(getContext(), tagMargin);
298 | }
299 |
300 | public int getTextPaddingLeft() {
301 | return textPaddingLeft;
302 | }
303 |
304 | public void setTextPaddingLeft(float textPaddingLeft) {
305 | this.textPaddingLeft = ResolutionUtil.dpToPx(getContext(), textPaddingLeft);
306 | }
307 |
308 | public int getTextPaddingRight() {
309 | return textPaddingRight;
310 | }
311 |
312 | public void setTextPaddingRight(float textPaddingRight) {
313 | this.textPaddingRight = ResolutionUtil.dpToPx(getContext(), textPaddingRight);
314 | }
315 |
316 | public int getTextPaddingTop() {
317 | return textPaddingTop;
318 | }
319 |
320 | public void setTextPaddingTop(float textPaddingTop) {
321 | this.textPaddingTop = ResolutionUtil.dpToPx(getContext(), textPaddingTop);
322 | }
323 |
324 | public int getTexPaddingBottom() {
325 | return texPaddingBottom;
326 | }
327 |
328 | public void setTexPaddingBottom(float texPaddingBottom) {
329 | this.texPaddingBottom = ResolutionUtil.dpToPx(getContext(), texPaddingBottom);
330 | }
331 |
332 | public void setOnTagClickListener(OnTagClickListener clickListener) {
333 | mClickListener = clickListener;
334 | }
335 |
336 | public void setOnTagDeleteListener(OnTagDeleteListener deleteListener) {
337 | mDeleteListener = deleteListener;
338 | }
339 |
340 | }
341 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/library/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/library/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/library/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/library/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/res/layout/tagview_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/library/src/main/res/values/tagview_attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | *.iml
3 |
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | applicationId "me.kaede.sample"
9 | minSdkVersion 9
10 | targetSdkVersion 21
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | compile 'com.android.support:appcompat-v7:23.3.0'
25 | compile project(':library')
26 | compile 'com.android.support:recyclerview-v7:23.3.0'
27 | }
28 |
--------------------------------------------------------------------------------
/sample/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 C:/ADT/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 |
--------------------------------------------------------------------------------
/sample/src/androidTest/java/me/kaede/sample/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package me.kaede.sample;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/src/main/java/me/kaede/sample/ListViewActivity.java:
--------------------------------------------------------------------------------
1 | package me.kaede.sample;
2 |
3 | import android.graphics.Color;
4 | import android.support.v7.app.ActionBarActivity;
5 | import android.os.Bundle;
6 | import android.view.*;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ListView;
9 | import me.kaede.tagview.Tag;
10 | import me.kaede.tagview.TagView;
11 |
12 | import java.util.ArrayList;
13 | import java.util.Collections;
14 | import java.util.List;
15 |
16 | public class ListViewActivity extends ActionBarActivity {
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_list_view);
22 |
23 | ListView listView = (ListView) this.findViewById(R.id.list);
24 | MyAdapter adapter = new MyAdapter();
25 | listView.setAdapter(adapter);
26 | List datas = new ArrayList<>();
27 | for (int i = 0;i<=50;i++){
28 | datas.add(new ListData("ITEM " + i));
29 | }
30 | adapter.setDatas(datas);
31 | }
32 |
33 | public class ListData {
34 | public String text;
35 |
36 | public ListData(String text) {
37 | this.text = text;
38 | }
39 | }
40 |
41 | public class ViewHolder{
42 | public TagView tagView;
43 | }
44 |
45 | public class MyAdapter extends BaseAdapter{
46 | List datas = new ArrayList<>();
47 |
48 | public void setDatas(List datas){
49 | this.datas = datas;
50 | notifyDataSetChanged();
51 | }
52 |
53 | @Override
54 | public int getCount() {
55 | return datas.size();
56 | }
57 |
58 | @Override
59 | public ListData getItem(int position) {
60 | return datas.get(position);
61 | }
62 |
63 | @Override
64 | public long getItemId(int position) {
65 | return position;
66 | }
67 |
68 | @Override
69 | public View getView(int position, View convertView, ViewGroup parent) {
70 | ViewHolder holder;
71 | if (convertView == null){
72 | convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list_tag, parent, false);
73 | holder = new ViewHolder();
74 | holder.tagView = (TagView) convertView.findViewById(R.id.tagview_item_list);
75 | convertView.setTag(holder);
76 | }
77 | holder = (ViewHolder) convertView.getTag();
78 | if (holder!=null){
79 | holder.tagView.removeAllTags();
80 | List tags = new ArrayList<>();
81 | Tag tag;
82 | tag = new Tag(getItem(position).text);
83 | tag.layoutColor = Color.parseColor("#F06292");
84 | tags.add(tag);
85 | tag = new Tag(getItem(position).text);
86 | tag.layoutColor = Color.parseColor("#90CAF9");
87 | tags.add(tag);
88 | tag = new Tag(getItem(position).text);
89 | tag.layoutColor = Color.parseColor("#80DEEA");
90 | tags.add(tag);
91 | holder.tagView.addTags(tags);
92 | }
93 | return convertView;
94 | }
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/sample/src/main/java/me/kaede/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package me.kaede.sample;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Color;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.v7.app.ActionBarActivity;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.widget.EditText;
12 | import android.widget.Toast;
13 | import me.kaede.tagview.OnTagClickListener;
14 | import me.kaede.tagview.OnTagDeleteListener;
15 | import me.kaede.tagview.Tag;
16 | import me.kaede.tagview.TagView;
17 |
18 | import java.util.Random;
19 |
20 |
21 | public class MainActivity extends ActionBarActivity implements View.OnClickListener{
22 |
23 | private TagView tagView;
24 | private EditText editText;
25 | private Random random;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_main);
31 | findViewById(R.id.tv_add).setOnClickListener(this);
32 | findViewById(R.id.tv_start_activity).setOnClickListener(this);
33 | findViewById(R.id.tv_list_activity).setOnClickListener(this);
34 | findViewById(R.id.tv_recyclerview_activity).setOnClickListener(this);
35 | editText = (EditText) findViewById(R.id.edit_tag);
36 | tagView = (TagView) this.findViewById(R.id.tagview);
37 | //SET LISTENER
38 | tagView.setOnTagClickListener(new OnTagClickListener() {
39 |
40 | @Override
41 | public void onTagClick(int position, Tag tag) {
42 | Toast.makeText(MainActivity.this, "click tag id = " + tag.id + " position = " + position, Toast.LENGTH_SHORT).show();
43 | }
44 | });
45 | tagView.setOnTagDeleteListener(new OnTagDeleteListener() {
46 |
47 | @Override
48 | public void onTagDeleted(int position, Tag tag) {
49 | Toast.makeText(MainActivity.this, "delete tag id = " + tag.id + " position =" + position, Toast.LENGTH_SHORT).show();
50 | }
51 | });
52 | //ADD TAG
53 | String[] tags = getResources().getStringArray(R.array.continents);
54 | tagView.addTags(tags);
55 | random = new Random();
56 | String[] colors = this.getResources().getStringArray(R.array.colors);
57 | for (int i = 1; i < colors.length; i++) {
58 | Tag tag = new Tag("Colorful Text");
59 | tag.tagTextColor = Color.parseColor(colors[i]);
60 | tagView.addTag(tag);
61 | }
62 | for (String item : colors) {
63 | Tag tag = new Tag("Colorful Background");
64 | tag.layoutColor = Color.parseColor(item);
65 | tagView.addTag(tag);
66 | }
67 | Tag tag = new Tag("Border");
68 | tag.layoutBorderSize = 1f;
69 | tagView.addTag(tag);
70 |
71 | tag = new Tag("Border");
72 | tag.layoutBorderSize = 2f;
73 | tag.layoutBorderColor = Color.parseColor(colors[1]);
74 | tagView.addTag(tag);
75 |
76 | tag = new Tag("Border");
77 | tag.layoutBorderSize = 3f;
78 | tag.layoutBorderColor = Color.parseColor(colors[3]);
79 | tagView.addTag(tag);
80 |
81 | tag = new Tag("Round Corner");
82 | tag.radius = 0f;
83 | tagView.addTag(tag);
84 |
85 | tag = new Tag("Round Corner");
86 | tag.radius = 20f;
87 | tagView.addTag(tag);
88 |
89 | tag = new Tag("Round Corner");
90 | tag.radius = 60f;
91 | tagView.addTag(tag);
92 |
93 | tag = new Tag("Deletable");
94 | tag.isDeletable = true;
95 | tagView.addTag(tag);
96 |
97 | tag = new Tag("Custom Background");
98 | tag.tagTextColor = Color.parseColor(colors[0]);
99 | tag.background = this.getResources().getDrawable(R.drawable.bg_tag);
100 | tagView.addTag(tag);
101 |
102 | tag = new Tag("Detail Tag");
103 | tag.tagTextColor = Color.parseColor("#FFFFFF");
104 | tag.layoutColor = Color.parseColor("#DDDDDD");
105 | tag.layoutColorPress = Color.parseColor("#555555");
106 | //or tag.background = this.getResources().getDrawable(R.drawable.custom_bg);
107 | tag.radius = 20f;
108 | tag.tagTextSize = 14f;
109 | tag.layoutBorderSize = 1f;
110 | tag.layoutBorderColor = Color.parseColor("#FFFFFF");
111 | tag.isDeletable = true;
112 | tagView.addTag(tag);
113 | }
114 |
115 | @Override
116 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
117 | super.onActivityResult(requestCode, resultCode, data);
118 | if (resultCode == RESULT_OK) {
119 | Tag tag = new Tag("ADD AFTER ACTIVITY RESULT");
120 | tagView.addTag(tag);
121 | }
122 | }
123 |
124 | @Override
125 | public boolean onCreateOptionsMenu(Menu menu) {
126 | getMenuInflater().inflate(R.menu.menu_main, menu);
127 | return true;
128 | }
129 |
130 | @Override
131 | public boolean onOptionsItemSelected(MenuItem item) {
132 | int id = item.getItemId();
133 | if (id == R.id.action_github) {
134 | Intent intent = new Intent(Intent.ACTION_VIEW);
135 | intent.setData(Uri.parse("https://github.com/kaedea/"));
136 | startActivity(intent);
137 | return true;
138 | }
139 | return super.onOptionsItemSelected(item);
140 | }
141 |
142 | @Override
143 | public void onClick(View v) {
144 | switch (v.getId()) {
145 | case R.id.tv_add:
146 | String string = "ADD A TAG";
147 | if (editText.getText().toString() != null && !editText.getText().toString().equals(""))
148 | string = editText.getText().toString();
149 | Tag tag = new Tag(string);
150 | int r = random.nextInt(2);
151 | if (r == 0) tag.isDeletable = true;
152 | r = random.nextInt(5);
153 | tag.layoutColor = Color.parseColor(MainActivity.this.getResources().getStringArray(R.array.colors)[r]);
154 | tagView.addTag(tag);
155 | break;
156 | case R.id.tv_start_activity:
157 | startActivityForResult(new Intent(MainActivity.this, SubActivity.class), 0);
158 | break;
159 | case R.id.tv_list_activity:
160 | startActivity(new Intent(MainActivity.this, ListViewActivity.class));
161 | break;
162 | case R.id.tv_recyclerview_activity:
163 | startActivity(new Intent(MainActivity.this, RecyclerViewActivity.class));
164 | break;
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/sample/src/main/java/me/kaede/sample/RecyclerViewActivity.java:
--------------------------------------------------------------------------------
1 | package me.kaede.sample;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.ActionBarActivity;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 | import me.kaede.tagview.Tag;
12 | import me.kaede.tagview.TagView;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | public class RecyclerViewActivity extends ActionBarActivity {
18 | private String[] mDataSet = new String[]{"TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT",
19 | "TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT","TEXT"};
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_recycler_view);
25 | RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler);
26 | MyAdapter adapter = new MyAdapter(mDataSet);
27 | assert recyclerView != null;
28 | recyclerView.setLayoutManager(new LinearLayoutManager(this));
29 | recyclerView.setAdapter(adapter);
30 | }
31 |
32 | public static class MyAdapter extends RecyclerView.Adapter {
33 | private String[] mDataSet;
34 |
35 | public MyAdapter(String[] dataSet) {
36 | this.mDataSet = dataSet;
37 | }
38 |
39 | public static class ViewHolder extends RecyclerView.ViewHolder {
40 | public TextView textView;
41 | public TagView tagView;
42 | public ViewHolder(View itemView) {
43 | super(itemView);
44 | }
45 | }
46 |
47 | @Override
48 | public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
49 | ViewHolder vh;
50 | if (viewType == 0) {
51 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list_text, parent, false);
52 | vh = new ViewHolder(v);
53 | vh.textView = (TextView) v.findViewById(R.id.tv);
54 | } else {
55 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list_tag, parent, false);
56 | vh = new ViewHolder(v);
57 | vh.tagView = (TagView) v.findViewById(R.id.tagview_item_list);
58 | }
59 | return vh;
60 | }
61 |
62 | @Override
63 | public void onBindViewHolder(ViewHolder holder, int position) {
64 | if (holder.textView != null){
65 | holder.textView.setText(mDataSet[position]);
66 | } else if (holder.tagView != null){
67 | holder.tagView.removeAllTags();
68 | List tagList = new ArrayList<>();
69 | tagList.add(new Tag("FOOTER 1"));
70 | tagList.add(new Tag("FOOTER 2"));
71 | holder.tagView.addTags(tagList);
72 | }
73 | }
74 |
75 | @Override
76 | public int getItemCount() {
77 | return mDataSet.length + 1;
78 | }
79 |
80 | @Override
81 | public int getItemViewType(int position) {
82 | if (position < mDataSet.length)
83 | return 0;
84 | else {
85 | return 1;
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/sample/src/main/java/me/kaede/sample/SubActivity.java:
--------------------------------------------------------------------------------
1 | package me.kaede.sample;
2 |
3 | import android.support.v7.app.ActionBarActivity;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuItem;
7 | import android.view.View;
8 |
9 |
10 | public class SubActivity extends ActionBarActivity implements View.OnClickListener {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_second);
16 | findViewById(R.id.tv_add).setOnClickListener(this);
17 | }
18 |
19 | public void onclick_tv_add(View view){
20 | this.setResult(RESULT_OK);
21 | finish();
22 | }
23 |
24 | @Override
25 | public boolean onCreateOptionsMenu(Menu menu) {
26 | // Inflate the menu; this adds items to the action bar if it is present.
27 | getMenuInflater().inflate(R.menu.menu_second, menu);
28 | return true;
29 | }
30 |
31 | @Override
32 | public boolean onOptionsItemSelected(MenuItem item) {
33 | // Handle action bar item clicks here. The action bar will
34 | // automatically handle clicks on the Home/Up button, so long
35 | // as you specify a parent activity in AndroidManifest.xml.
36 | int id = item.getItemId();
37 |
38 | //noinspection SimplifiableIfStatement
39 | if (id == R.id.action_settings) {
40 | return true;
41 | }
42 |
43 | return super.onOptionsItemSelected(item);
44 | }
45 |
46 | @Override
47 | public void onClick(View v) {
48 | this.setResult(RESULT_OK);
49 | finish();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxhdpi/bg_tag_normal.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/sample/src/main/res/drawable-xxhdpi/bg_tag_normal.9.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxhdpi/bg_tag_pressed.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/sample/src/main/res/drawable-xxhdpi/bg_tag_pressed.9.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxhdpi/icon_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/sample/src/main/res/drawable-xxhdpi/icon_github.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/bg_tag.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/shape_tagview.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_list_view.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
19 |
20 |
21 |
26 |
27 |
33 |
34 |
38 |
39 |
51 |
63 |
74 |
75 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_recycler_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_second.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/item_list_tag.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/item_list_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/menu/menu_list_view.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/menu/menu_second.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kaedea/android-tagview/b546a5f073ec689a2856a2ef16b6ffccd78af216/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - AFRICA
5 | - EUROPE
6 | - ASIA
7 | - NORTH AMERICA
8 | - SOUTH AMERICA
9 | - ANTARCTICA
10 | - AUSTRALIA
11 |
12 |
13 | - #00BFFF
14 | - #E91E63
15 | - #F44336
16 | - #9C27B0
17 | - #673AB7
18 |
19 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TagView Sample
3 |
4 | Hello world!
5 | Github Project
6 | SecondActivity
7 | ListViewActivity
8 | Settings
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':library', ':sample'
2 |
--------------------------------------------------------------------------------