Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
AAkira committed Jun 4, 2017
0 parents commit df7b8ba
Show file tree
Hide file tree
Showing 43 changed files with 1,163 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
.idea
.DS_Store
/build
/captures
.externalNativeBuild
122 changes: 122 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# CompoundIconTextView

An android library that is able to set a vector drawable at text view pre-Lollipop.

[![Platform](http://img.shields.io/badge/platform-android-brightgreen.svg?style=flat)](http://developer.android.com/index.html)
[![Language](http://img.shields.io/badge/language-java-orange.svg?style=flat)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
[![License](http://img.shields.io/badge/license-apache2.0-lightgrey.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
[![Download CompoundIconTextView](https://api.bintray.com/packages/aakira/maven/compound-icon-textview/images/download.svg)](https://bintray.com/aakira/maven/compound-icon-textview/_latestVersion)

## Preview

![PREVIEW][preview]

## Features

* Set a vector drawable at text view pre-Lollipop

## Usage

### Code

```Java

CompoundIconTextView tv = (CompoundIconTextView) findViewById(R.id.compoundIconTextView);

// set icon drawable
tv.setVectorDrawableTop(R.drawable.ic_android_black_24dp);
tv.setVectorDrawableLeft(R.drawable.ic_android_black_24dp);

// set icon color
tv.setIconColorResource(R.color.colorPrimary);

// set icon size
tv.setIconSizeResource(R.dimen.icon_size, R.dimen.icon_size);
tv.setIconSize(32, 32);

// clear icon
tv.setVectorDrawableRight(CompoundIconTextView.UNDEFINED_RESOURCE);

```

### Xml

```xml

<?xml version="1.0" encoding="UTF-8"?>
<com.github.aakira.compoundicontextview.CompoundIconTextView
android:id="@+id/compoundIconTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="4dp"
android:gravity="center"
android:text="Hello World!"
android:textColor="#3F51B5"
android:textSize="16sp"
app:cit_drawableLeft="@drawable/ic_android_black_24dp"
app:cit_iconColor="#000"
app:cit_iconHeight="16dp"
app:cit_iconWidth="16dp" />
```

### Attributes

|attribute name|description|
|:-:|:-:|
|cit_drawableLeft|Sets a drawable or vector drawable to left of TextView|
|cit_drawableTop|Sets a drawable or vector drawable to top of TextView|
|cit_drawableBottom|Sets a drawable or vector drawable to bottom of TextView|
|cit_drawableRight|Sets a drawable or vector drawable to right of TextView|
|cit_iconWidth|Sets a width of icon|
|cit_iconHeight|Sets a width of icon|
|cit_iconColor|Sets a icon color|

## Setup

### Gradle

Add the dependency in your `build.gradle`

```groovy
buildscript {
repositories {
jcenter()
}
}
dependencies {
compile 'com.github.aakira:compound-text-view:1.0.0@aar'
}
```
## Using libraries

* [Material icons](https://material.io/icons/#ic_cloud_download)

## Author

### Akira Aratani

* Twitter
- [@_a_akira](https://twitter.com/_a_akira)
* Mail
- developer.a.akira@gmail.com

## License

```
Copyright (C) 2017 A.Akira
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

[preview]: /arts/preview.png
Binary file added arts/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.novoda:bintray-release:0.5.0'
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions compoundicontextview/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
44 changes: 44 additions & 0 deletions compoundicontextview/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION

defaultConfig {
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode LIBRARY_VERSION_CODE as int
versionName LIBRARY_VERSION_NAME

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

dependencies {
compile "com.android.support:appcompat-v7:$APP_COMPAT_VERSION"
}

def getBintrayUserProperty() {
return hasProperty('bintrayUser') ? bintrayUser : ""
}

def getBintrayApiKeyProperty() {
return hasProperty('bintrayApiKey') ? bintrayApiKey : ""
}

publish {
userOrg = POM_DEVELOPER_ID
groupId = GROUP
artifactId = ARTIFACT_ID
publishVersion = LIBRARY_VERSION_NAME
licences = ['Apache-2.0']
desc = POM_DESCRIPTION
website = POM_URL
issueTracker = ISSUE_URL
repository = POM_SCM_URL
autoPublish = false
bintrayUser = bintrayUserProperty
bintrayKey = bintrayApiKeyProperty
dryRun = false
}
25 changes: 25 additions & 0 deletions compoundicontextview/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Applications/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
4 changes: 4 additions & 0 deletions compoundicontextview/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<manifest package="com.github.aakira.compoundicontextview">

<application />
</manifest>
Loading

0 comments on commit df7b8ba

Please sign in to comment.