Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limitation feature added #22

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ee041c2
Limitation feature added
meness Sep 23, 2015
06ce155
Add limitation attribute to the table
meness Sep 23, 2015
bc056e1
minor fix
meness Sep 23, 2015
e354cbd
Update gradle and fix Google Keyboard issue (by tajchert)
meness Sep 23, 2015
f6abaaa
change demo app name to `app` and update libs and the Gradle
meness Dec 18, 2015
12261dc
Reformat, XML attr `limitation` to `tagsLimitation`, new `charsLimita…
meness Dec 18, 2015
575e72c
remove unnecessary files from base repo, fix minor bugs, more complex…
meness Dec 18, 2015
44f1dbf
v1.7
meness Dec 18, 2015
4fda69c
fix style
meness Dec 18, 2015
99dc1cb
travis
meness Dec 18, 2015
50ccd41
fix travis
meness Dec 18, 2015
bbdd75b
fix travis
meness Dec 18, 2015
c4fb34f
fix travis
meness Dec 18, 2015
fdf23d4
fix travis
meness Dec 18, 2015
9f2ff35
fix travis
meness Dec 18, 2015
1818836
disable abortOnError
meness Dec 18, 2015
ab05244
disable abortOnError
meness Dec 18, 2015
5e8c8e7
fix travis
meness Dec 18, 2015
8603d43
fix travis
meness Dec 18, 2015
ea5c42a
fix travis
meness Dec 18, 2015
d25eb85
fix travis
meness Dec 18, 2015
adc1595
update readme
meness Dec 18, 2015
433cca9
fix travis
meness Dec 19, 2015
b686fa2
fix
meness Dec 19, 2015
d760bb2
v1.7
alirezaaa Dec 21, 2015
edacf32
fix
alirezaaa Dec 21, 2015
fef6a48
nothing special
meness Dec 22, 2015
d397806
chars limitation setter
meness Dec 22, 2015
e2e25d3
cleaning
meness Dec 22, 2015
dfd2ec9
separate utils
meness Dec 22, 2015
4e65458
create setters for properties + cleaning
meness Dec 22, 2015
38098b6
Remove unnecessary LayoutParams class
meness Dec 22, 2015
7b8c3b0
Remove non-English strings
meness Dec 22, 2015
ae94263
fix minor bug
meness Dec 22, 2015
587ed93
add ColorInt annotation to properties
meness Dec 22, 2015
0edd9c4
v1.7.3
meness Dec 22, 2015
00616bd
cleaned up + move demo to 'app' package
meness Mar 15, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
48 changes: 20 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
language: java
language: android
jdk: oraclejdk7
branches:
only:
- master
env:
matrix:
- ANDROID_TARGET=android-21 ANDROID_ABI=armeabi-v7a
global:
- ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
android:
components:
- tools
- build-tools-23.0.2
- android-23

before_install:
# Install base Android SDK
- sudo apt-get update -qq
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
- wget http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
- tar xzf android-sdk_r24.0.2-linux.tgz
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
- chmod +x gradlew
- extra-android-m2repository

- sys-img-armeabi-v7a-android-23

# Gradle
- wget http://services.gradle.org/distributions/gradle-1.12-bin.zip
- unzip gradle-1.12-bin.zip
- export GRADLE_HOME=$PWD/gradle-1.12
- export PATH=$GRADLE_HOME/bin:$PATH
licenses:
- 'android-sdk-license-.+'

# Install required components
# For a full list, run `android list sdk -a --extended`
# Note that sysimg-19 downloads only ARM, because only the first license query is accepted.
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --all --filter build-tools-21.1.1 --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-21 --no-ui --force > /dev/null
- echo yes | android update sdk --filter sys-img-x86-android-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
before_install:
- chmod +x gradlew

install:
- ./gradlew assemble
before_script:
- echo no | android create avd --force -n test -t android-23 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
35 changes: 0 additions & 35 deletions CHANGELOG

This file was deleted.

152 changes: 46 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,132 +1,72 @@
# `AndroidTagGroup`
# AndroidTagGroup

[![Release 1.4](https://img.shields.io/badge/Release-1.4.1-green.svg)](https://github.com/2dxgujun/AndroidTagGroup/releases)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.gujun.android.taggroup/library/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/me.gujun.android.taggroup/library)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndroidTagGroup-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1539)
[![Build Status](https://travis-ci.org/2dxgujun/AndroidTagGroup.png?branch=master)](https://travis-ci.org/2dxgujun/AndroidTagGroup)

The TagGroup is a special layout with a set of tags. You can use it to tag people, books or anything you want.

Also you can contribute new idea to me.

# Demo
AndroidTagGroup is a special layout with a set of tags. You can use it to tag people, books or anything you want.

### Screenshot
![screenshot1](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsby9v5fj20u00w8jxx.jpg)

### Edit Tags
![screenshot2](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbngv8fj20u005w75v.jpg)
![screenshot3](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbmoagij20u005sabl.jpg)

[Download Demo](https://github.com/2dxgujun/AndroidTagGroup/releases/download/v1.4/AndroidTagGroup-Demo-v1.4.apk)

# Usage

## Step 1

#### Gradle
```groovy
dependencies {
compile 'me.gujun.android.taggroup:library:1.4@aar'
}
```

#### Maven
```xml
<dependency>
<groupId>me.gujun.android.taggroup</groupId>
<artifactId>library</artifactId>
<version>1.4</version>
<type>apklib</type>
</dependency>
```

## Step 2
## Usage
### Step 1
Follow [these steps](https://jitpack.io/#alirezaaa/AndroidTagGroup/v1.7.3).

### Step 2
Use it in your own code:
```xml
<me.gujun.android.taggroup.TagGroup
android:id="@+id/tag_group"
style="@style/TagGroup" />
<me.gujun.android.taggroup.AndroidTagGroup
android:id="@+id/androidTagGroup"
style="@style/AndroidTagGroup" />
```

```java
TagGroup mTagGroup = (TagGroup) findViewById(R.id.tag_group);
mTagGroup.setTags(new String[]{"Tag1", "Tag2", "Tag3"});
AndroidTagGroup mTagGroup = (AndroidTagGroup) findViewById(R.id.androidTagGroup);
mTagGroup.setTags(new String[]{"Tag 1", "Tag 2", "Tag 3"});
```
Use `setTags(...)` to set the initial tags in the group.

#### How to submit a new tag?

To "submit" a new tag as user press "Enter" or tap the blank area of the tag group, also you can "submit" a new tag via `submitTag()`.

**Note**: Google keyboard (a few soft keyboard not honour the key event) currently not supported "Enter" key to "submit" a new tag.

#### How to delete a tag?

To delete a tag as user press "Backspace" key or double-tap the tag which you want to delete.

#### How to detect tag click event?

Implement a callback interface: `TagGroup.OnTagClickListener`, and set the listener via `setOnTagClickListener()`.


# Build

run `./gradlew assembleDebug` (Mac/Linux)

or

run `gradlew.bat assembleDebug` (Windows)
### Notes
- Use `setTags(...)` to set the initial tags in the group.
- To submit a new tag as user press "Enter" key or tap the blank area of the tag group, use `submitTag()`.
- To delete a tag as user press "Backspace", double-tap the tag which you want to delete.
- There are following interfaces to implement; `OnTagLimitationExceedListener`, `OnTagChangeListener`, and `OnTagClickListener`.

# Attributes

There are several attributes you can set:

![Dimension illustrate](http://ww2.sinaimg.cn/large/bce2dea9gw1epov0i8x6kj20rk054q4g.jpg)

| attr | default | mean |
|:------------------------- |:---------------- |:------------------------------------------------------- |
| atg_isAppendMode | false | Determine the TagGroup mode, APPEND or single DISPLAY. |
| atg_inputHint | Add Tag/添加标签 | The hint of the INPUT tag. |
| atg_borderColor | #49C120 | The tag outline border color. |
| atg_textColor | #49C120 | The tag text color. |
| atg_backgroundColor | #FFFFFF | The tag background color. |
| atg_dashBorderColor | #AAAAAA | The tag dash outline border color. |
| atg_inputHintColor | #80000000 | The input tag hint text color. |
| atg_inputTextColor | #DE000000 | The input tag type text color.. |
| atg_checkedBorderColor | #49C120 | The checked tag outline border color. |
| atg_checkedTextColor | #FFFFFF | The checked text color. |
| atg_checkedMarkerColor | #FFFFFF | The checked marker color. |
| atg_checkedBackgroundColor| #49C120 | The checked tag background color. |
| atg_pressedBackgroundColor| #EDEDED | The tag background color when the tag is being pressed. |
| atg_borderStrokeWidth | 0.5dp | The tag outline border stroke width. |
| atg_textSize | 13sp | The tag text size. |
| atg_horizontalSpacing | 8dp | The horizontal tag spacing.(Mark1) |
| atg_verticalSpacing | 4dp | The vertical tag spacing.(Mark2) |
| atg_horizontalPadding | 12dp | The horizontal tag padding.(Mark3) |
| atg_verticalPadding | 3dp | The vertical tag padding.(Mark4) |

# Developed By

Jun Gu - <[email protected]>

<a href="http://weibo.com/2dxgujun">
<img alt="Follow me on Weibo" src="http://ww4.sinaimg.cn/large/bce2dea9gw1epjhk9h9m6j20230233yb.jpg"/>
</a>
<a href="https://plus.google.com/u/0/113657331852211913645">
<img alt="Follow me on Google Plus" src="http://ww1.sinaimg.cn/large/bce2dea9gw1epjhbx0ouij2023023jr6.jpg"/>
</a>

# License

| Attribute | Default Value | Description |
|:------------------------------|:-----------------------|:--------------------------------------------------------|
| atg_isAppendMode | false | Determine the mode. |
| atg_inputHint | Add Tag | The hint of the INPUT tag. |
| atg_borderColor | #49C120 | The tag outline border color. |
| atg_textColor | #49C120 | The tag text color. |
| atg_backgroundColor | #FFFFFF | The tag background color. |
| atg_dashBorderColor | #AAAAAA | The tag dash outline border color. |
| atg_inputHintColor | #80000000 | The input tag hint text color. |
| atg_inputTextColor | #DE000000 | The input tag type text color.. |
| atg_checkedBorderColor | #49C120 | The checked tag outline border color. |
| atg_checkedTextColor | #FFFFFF | The checked text color. |
| atg_checkedMarkerColor | #FFFFFF | The checked marker color. |
| atg_checkedBackgroundColor | #49C120 | The checked tag background color. |
| atg_pressedBackgroundColor | #EDEDED | The tag background color when the tag is being pressed. |
| atg_borderStrokeWidth | 0.5dp | The tag outline border stroke width. |
| atg_textSize | 13sp | The tag text size. |
| atg_horizontalSpacing | 8dp | The horizontal tag spacing. |
| atg_verticalSpacing | 4dp | The vertical tag spacing. |
| atg_horizontalPadding | 12dp | The horizontal tag padding. |
| atg_verticalPadding | 3dp | The vertical tag padding. |
| atg_tagsLimitation | no limitation | Adding tags limitation |
| atg_charsLimitation | no limitation | Characters limitation |

## Developed By
- Jun Gu - <[email protected]>
- Alireza Eskandarpour Shoferi - <[email protected]>

## License
Copyright 2015 Jun Gu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
File renamed without changes.
14 changes: 9 additions & 5 deletions demo/build.gradle → app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId 'me.gujun.android.taggroup.demo'
applicationId 'me.gujun.android.taggroup.app'
minSdkVersion 8
targetSdkVersion 21
targetSdkVersion 23
versionName project.VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)
}
Expand All @@ -18,9 +18,13 @@ android {
}
productFlavors {
}
// Travis CI needing
lintOptions {
abortOnError false
}
}

dependencies {
compile project(':library')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:23.2.1'
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.gujun.android.taggroup.demo" >
<manifest package="me.gujun.android.taggroup.app"
xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" >
android:theme="@style/AppTheme">
<activity android:name="me.gujun.android.taggroup.app.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".TagEditorActivity"
android:name="me.gujun.android.taggroup.app.TagEditorActivity"
android:label="@string/title_activity_tag_editor"
android:parentActivityName=".MainActivity" >
android:parentActivityName="me.gujun.android.taggroup.app.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="me.gujun.android.taggroup.demo.MainActivity" />
android:value="me.gujun.android.taggroup.app.MainActivity"/>
</activity>
</application>

Expand Down
Loading