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

Support Tag Gravity #38

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b7be3fa
Update README.md
leonacky Jun 9, 2016
bd16ded
Update README.md
leonacky Jun 9, 2016
f7ecd2a
Update README.md
leonacky Jun 9, 2016
15af372
Add Tag Gravity
leonacky Jun 9, 2016
348c143
Add Tag Gravity
leonacky Jun 9, 2016
b6917e8
Merge branch 'master' of https://github.com/leonacky/AndroidTagGroup
leonacky Jun 9, 2016
7c7b7ae
Update README.md
leonacky Jun 9, 2016
1bd915e
Update README.md
leonacky Jun 9, 2016
bd53260
fix build.gradle
leonacky Jun 9, 2016
edabbdb
Merge branch 'master' of https://github.com/leonacky/AndroidTagGroup
leonacky Jun 9, 2016
a5b6ab2
fix buidl gradle
leonacky Jun 9, 2016
695c414
fix build.gradle
leonacky Jun 9, 2016
b47434b
Add Gitter badge
gitter-badger Jul 8, 2016
304dc7f
Merge pull request #1 from gitter-badger/gitter-badge
leonacky Oct 4, 2016
6abc65e
update selected tag
leonacky Oct 5, 2016
34b54aa
Merge branch 'master' of https://github.com/leonacky/AndroidTagGroup
leonacky Oct 5, 2016
f525815
add TagItem
leonacky Oct 5, 2016
c298feb
update click tag return tag text and tag position
leonacky Oct 5, 2016
179d901
modified project upload to maven
leonacky Oct 7, 2016
4173af2
published to jCenter
leonacky Oct 8, 2016
6404c6a
Update README.md
leonacky Oct 8, 2016
ff905dc
Update README.md
leonacky Oct 8, 2016
1679040
Update README.md
leonacky Oct 8, 2016
c711129
Update README.md
leonacky Oct 8, 2016
f248bb7
Update README.md
leonacky Oct 8, 2016
88ed7dc
Update README.md
leonacky Oct 8, 2016
bdfdcaf
update new build tools
leonacky Oct 8, 2016
261f824
Update README.md
leonacky Oct 8, 2016
9a2d4a6
Update README.md
leonacky Oct 8, 2016
400746b
release v1.6
leonacky Oct 8, 2016
342c26a
Merge branch 'master' of https://github.com/leonacky/AndroidTagGroup
leonacky Oct 8, 2016
182c196
update classpath "com.android.tools.build:gradle:2.1.0"
leonacky Oct 8, 2016
bfb5354
small fix
leonacky Oct 8, 2016
33be85f
remove travis
leonacky Oct 8, 2016
74a13fe
edit travis.yml
leonacky Oct 8, 2016
423ed01
small fix
leonacky Oct 8, 2016
14dfa7b
small fix
leonacky Oct 8, 2016
a7d03a3
small fix
leonacky Oct 8, 2016
8330963
small fix
leonacky Oct 8, 2016
0535058
Update README.md
leonacky Oct 12, 2016
8061b2b
Add text change listener
Mar 6, 2017
e21b92b
Update listener
Mar 6, 2017
639c52b
Merge branch 'master' of https://github.com/leonacky/AndroidTagGroup
leonacky Mar 6, 2017
35e69c9
Add ime action done
leonacky Mar 6, 2017
74abbb7
add on submit listener
leonacky Mar 6, 2017
aef24f1
small fix
leonacky Mar 6, 2017
633bea5
small fix
leonacky Mar 6, 2017
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ build/
*.iml
*.ipr
*.iws
*.asc
*.gpg
.idea/

# Gradle files
.gradle/
.gradle/
library/secring.gpg
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: java
jdk: oraclejdk7
jdk: oraclejdk8
branches:
only:
- master
env:
matrix:
- ANDROID_TARGET=android-21 ANDROID_ABI=armeabi-v7a
- ANDROID_TARGET=android-24 ANDROID_ABI=armeabi-v7a

before_install:
# Install base Android SDK
Expand All @@ -18,20 +18,23 @@ before_install:
- chmod +x gradlew

# 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
- wget http://services.gradle.org/distributions/gradle-2.14-bin.zip
- unzip gradle-2.14-bin.zip
- export GRADLE_HOME=$PWD/gradle-2.14
- export PATH=$GRADLE_HOME/bin:$PATH

# 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 --all --filter build-tools-24.0.0 --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-24 --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
- mkdir ${ANDROID_HOME}/licenses || true
- echo yes | echo -e "8933bad161af4178b1185d1a37fbf41ea5269c55" > ${ANDROID_HOME}/licenses/android-sdk-license
- echo yes | echo -e "79120722343a6f314e0719f863036c702b0e6b2a" > ${ANDROID_HOME}/licenses/android-sdk-preview-license

install:
- ./gradlew assemble
14 changes: 14 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
Change Log
==========
*** From leonacky/AndroidTagGroup forked from 2dxgujun/AndroidTagGroup

Version 1.5 *(2016-10-07)*
----------------------------

- Add TagGravity
- Change listener for detect tag click event
- Add get/setSelectedTag
- Add get all selected tags




*** From 2dxgujun/AndroidTagGroup

Version 1.4 *(2015-05-23)*
----------------------------
Expand Down
72 changes: 43 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# `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)
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

The TagGroup is a special layout with a set of tags. You can use it to tag people, books or anything you want.
[![Release 1.6](https://img.shields.io/badge/Release-1.6-green.svg)](https://github.com/leonacky/AndroidTagGroup/releases)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library)
[![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)

Also you can contribute new idea to me.
The TagGroup is a special layout with a set of tags. I have developed from 2dxgujun/AndroidTagGroup
with new features:

1. TagGravity

2. Tag Selected

3. Get all tags is selected

4. New implement for detect tag click event

# Demo

Expand All @@ -18,34 +26,37 @@ Also you can contribute new idea to me.
![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)
### Tag Gravity
![screenshot4](https://dl.dropboxusercontent.com/u/25101600/tag_gravity.png)

[Download Demo](https://dl.dropboxusercontent.com/u/25101600/TagGroup-demo-release.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>
<groupId>com.aotasoft.taggroup</groupId>
<artifactId>library</artifactId>
<version>1.4</version>
<type>apklib</type>
<version>1.6</version>
<type>aar</type>
</dependency>
```

#### Gradle
```groovy
dependencies {
compile 'com.aotasoft.taggroup:library:1.6'
}
```

## Step 2

Use it in your own code:
```xml
<me.gujun.android.taggroup.TagGroup
<com.aotasoft.taggroup.TagGroup
android:id="@+id/tag_group"
style="@style/TagGroup" />
```
Expand All @@ -70,6 +81,17 @@ To delete a tag as user press "Backspace" key or double-tap the tag which you wa

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

#### How to set a tag is selected?

To set tag is sellected for TagGroup: use `tagroup.setSelectedTag(...)`

#### How to get all tags is selected?

To get all tags is sellected for TagGroup: use `tagroup.getSelectedTags(...)` will return all position of tag is selected

#### Gravity for TagGroup

To set gravity for TagGroup: use `setGravity(...)` supported `TagGroup.Gravity.LEFT`, `TagGroup.Gravity.MIDDLE` and `TagGroup.Gravity.RIGHT`

# Build

Expand All @@ -88,7 +110,7 @@ There are several attributes you can set:
| 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_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. |
Expand All @@ -108,19 +130,11 @@ There are several attributes you can set:
| 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>
Tuan Dinh - <[email protected]> from origin project 2dxgujun/AndroidTagGroup

# License

Copyright 2015 Jun Gu
Copyright 2015 Tuan Dinh

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath('com.android.tools.build:gradle:2.2.0') {
force = true
}
}
}

Expand Down
15 changes: 9 additions & 6 deletions demo/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 24
buildToolsVersion '24.0.0'
defaultConfig {
applicationId 'me.gujun.android.taggroup.demo'
minSdkVersion 8
targetSdkVersion 21
applicationId 'com.aotasoft.taggroup.demo'
minSdkVersion 9
targetSdkVersion 24
versionName project.VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)
}
Expand All @@ -18,9 +18,12 @@ android {
}
productFlavors {
}
lintOptions {
abortOnError false
}
}

dependencies {
compile project(':library')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:24.2.1'
}
10 changes: 5 additions & 5 deletions demo/src/main/AndroidManifest.xml
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" >
package="com.aotasoft.taggroup.demo" >

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.gujun.android.taggroup.demo;
package com.aotasoft.taggroup.demo;

import android.content.Intent;
import android.os.Bundle;
Expand All @@ -9,8 +9,8 @@
import android.widget.TextView;
import android.widget.Toast;

import me.gujun.android.taggroup.TagGroup;
import me.gujun.android.taggroup.demo.db.TagsManager;
import com.aotasoft.taggroup.TagGroup;
import com.aotasoft.taggroup.demo.db.TagsManager;


public class MainActivity extends ActionBarActivity {
Expand All @@ -19,15 +19,18 @@ public class MainActivity extends ActionBarActivity {
private TagGroup mDefaultTagGroup;
private TagGroup mSmallTagGroup;
private TagGroup mLargeTagGroup;
private TagGroup mLargeMiddleTagGroup;
private TagGroup mLargeRightTagGroup;
private TagGroup mBeautyTagGroup;
private TagGroup mBeautyInverseTagGroup;

private TagsManager mTagsManager;

private TagGroup.OnTagClickListener mTagClickListener = new TagGroup.OnTagClickListener() {
@Override
public void onTagClick(String tag) {
public void onTagClick(TagGroup tagGroup, String tag, int position) {
Toast.makeText(MainActivity.this, tag, Toast.LENGTH_SHORT).show();
tagGroup.setSelectedTag(position, !tagGroup.isSelectedTag(position));
}
};

Expand All @@ -50,6 +53,8 @@ public void onClick(View v) {
mDefaultTagGroup = (TagGroup) findViewById(R.id.tag_group);
mSmallTagGroup = (TagGroup) findViewById(R.id.tag_group_small);
mLargeTagGroup = (TagGroup) findViewById(R.id.tag_group_large);
mLargeMiddleTagGroup = (TagGroup) findViewById(R.id.tag_group_large_middle);
mLargeRightTagGroup = (TagGroup) findViewById(R.id.tag_group_large_right);
mBeautyTagGroup = (TagGroup) findViewById(R.id.tag_group_beauty);
mBeautyInverseTagGroup = (TagGroup) findViewById(R.id.tag_group_beauty_inverse);
if (tags != null && tags.length > 0) {
Expand All @@ -58,6 +63,11 @@ public void onClick(View v) {
mLargeTagGroup.setTags(tags);
mBeautyTagGroup.setTags(tags);
mBeautyInverseTagGroup.setTags(tags);

mLargeMiddleTagGroup.setTags(tags);
mLargeMiddleTagGroup.setGravity(TagGroup.TagGravity.MIDDLE);
mLargeRightTagGroup.setTags(tags);
mLargeRightTagGroup.setGravity(TagGroup.TagGravity.RIGHT);
}

MyTagGroupOnClickListener tgClickListener = new MyTagGroupOnClickListener();
Expand Down Expand Up @@ -85,6 +95,10 @@ protected void onResume() {
mLargeTagGroup.setTags(tags);
mBeautyTagGroup.setTags(tags);
mBeautyInverseTagGroup.setTags(tags);
mLargeMiddleTagGroup.setTags(tags);
mLargeMiddleTagGroup.setGravity(TagGroup.TagGravity.MIDDLE);
mLargeRightTagGroup.setTags(tags);
mLargeRightTagGroup.setGravity(TagGroup.TagGravity.RIGHT);
}

@Override
Expand Down
Loading