├── .gitignore
├── README.md
├── arts
└── preview.jpg
├── build.gradle
├── compoundicontextview
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── github
│ │ └── aakira
│ │ └── compoundicontextview
│ │ └── CompoundIconTextView.java
│ └── res
│ └── values
│ └── attrs.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── sample
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── github
│ │ └── aakira
│ │ └── compoundicontextview
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── aakira
│ │ │ └── compoundicontextview
│ │ │ └── sample
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable
│ │ ├── ic_android_black_24dp.xml
│ │ ├── ic_call_end_black_24px.xml
│ │ ├── ic_cloud_download_black_24px.xml
│ │ ├── ic_language_black_24px.xml
│ │ ├── ic_train_black_24px.xml
│ │ └── ic_volume_up_black_24px.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values-ar
│ │ └── strings.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimen.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── github
│ └── aakira
│ └── compoundicontextview
│ └── ExampleUnitTest.java
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | .idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CompoundIconTextView
2 |
3 | An android library that is able to set a vector drawable at text view pre-Lollipop.
4 |
5 | [](http://developer.android.com/index.html)
6 | [](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
7 | [](http://www.apache.org/licenses/LICENSE-2.0)
8 | [](https://bintray.com/aakira/maven/compound-icon-textview/_latestVersion)
9 |
10 | ## Preview
11 |
12 | ![PREVIEW][preview]
13 |
14 | ## Features
15 |
16 | * Set a vector drawable at text view pre-Lollipop
17 |
18 | ## Usage
19 |
20 | ### Gradle
21 |
22 | You should set this line in your gradle file if you set colors to vector drawable pre-Lollipop.
23 |
24 | ```gradle
25 | android {
26 | defaultConfig {
27 | vectorDrawables.useSupportLibrary = true
28 | }
29 | }
30 | ```
31 |
32 | ### Code
33 |
34 | ```Java
35 |
36 | CompoundIconTextView tv = (CompoundIconTextView) findViewById(R.id.compoundIconTextView);
37 |
38 | // set icon drawable
39 | tv.setVectorDrawableTop(R.drawable.ic_android_black_24dp);
40 | tv.setVectorDrawableLeft(R.drawable.ic_android_black_24dp);
41 |
42 | // set icon color
43 | tv.setIconColorResource(R.color.colorPrimary);
44 |
45 | // set icon size
46 | tv.setIconSizeResource(R.dimen.icon_size, R.dimen.icon_size);
47 | tv.setIconSize(32, 32);
48 |
49 | // clear icon
50 | tv.setVectorDrawableRight(CompoundIconTextView.UNDEFINED_RESOURCE);
51 |
52 | ```
53 |
54 | ### Xml
55 |
56 | ```xml
57 |
58 |
59 |
72 | ```
73 |
74 | ### Attributes
75 |
76 | |attribute name|description|
77 | |:-:|:-:|
78 | |cit_drawableLeft|Sets a drawable or vector drawable to left of TextView|
79 | |cit_drawableTop|Sets a drawable or vector drawable to top of TextView|
80 | |cit_drawableBottom|Sets a drawable or vector drawable to bottom of TextView|
81 | |cit_drawableRight|Sets a drawable or vector drawable to right of TextView|
82 | |cit_drawableStart|Sets a drawable or vector drawable to start of TextView (for RTL)|
83 | |cit_drawableEnd|Sets a drawable or vector drawable to end of TextView (for RTL)|
84 | |cit_iconWidth|Sets a width of icon|
85 | |cit_iconHeight|Sets a width of icon|
86 | |cit_iconColor|Sets a icon color|
87 |
88 | ## Setup
89 |
90 | ### Gradle
91 |
92 | Add the dependency in your `build.gradle`
93 |
94 | ```groovy
95 | buildscript {
96 | repositories {
97 | jcenter()
98 | }
99 | }
100 |
101 | dependencies {
102 | compile 'com.github.aakira:compound-icon-textview:1.2.1@aar'
103 | }
104 | ```
105 | ## Using libraries
106 |
107 | * [Material icons](https://material.io/icons/#ic_cloud_download)
108 |
109 | ## Author
110 |
111 | ### Akira Aratani
112 |
113 | * Twitter
114 | - [@_a_akira](https://twitter.com/_a_akira)
115 | * Mail
116 | - developer.a.akira@gmail.com
117 |
118 | ## License
119 |
120 | ```
121 | Copyright (C) 2017 A.Akira
122 |
123 | Licensed under the Apache License, Version 2.0 (the "License");
124 | you may not use this file except in compliance with the License.
125 | You may obtain a copy of the License at
126 |
127 | http://www.apache.org/licenses/LICENSE-2.0
128 |
129 | Unless required by applicable law or agreed to in writing, software
130 | distributed under the License is distributed on an "AS IS" BASIS,
131 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132 | See the License for the specific language governing permissions and
133 | limitations under the License.
134 | ```
135 |
136 | [preview]: /arts/preview.jpg
137 |
--------------------------------------------------------------------------------
/arts/preview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/arts/preview.jpg
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:2.3.1'
8 | classpath 'com.novoda:bintray-release:0.5.0'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | jcenter()
15 | }
16 | }
17 |
18 | task clean(type: Delete) {
19 | delete rootProject.buildDir
20 | }
--------------------------------------------------------------------------------
/compoundicontextview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/compoundicontextview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.novoda.bintray-release'
3 |
4 | android {
5 | compileSdkVersion COMPILE_SDK_VERSION as int
6 | buildToolsVersion BUILD_TOOLS_VERSION
7 |
8 | defaultConfig {
9 | minSdkVersion MIN_SDK_VERSION as int
10 | targetSdkVersion TARGET_SDK_VERSION as int
11 | versionCode LIBRARY_VERSION_CODE as int
12 | versionName LIBRARY_VERSION_NAME
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 | }
16 | }
17 |
18 | dependencies {
19 | compile "com.android.support:appcompat-v7:$APP_COMPAT_VERSION"
20 | }
21 |
22 | def getBintrayUserProperty() {
23 | return hasProperty('bintrayUser') ? bintrayUser : ""
24 | }
25 |
26 | def getBintrayApiKeyProperty() {
27 | return hasProperty('bintrayApiKey') ? bintrayApiKey : ""
28 | }
29 |
30 | publish {
31 | userOrg = POM_DEVELOPER_ID
32 | groupId = GROUP
33 | artifactId = ARTIFACT_ID
34 | publishVersion = LIBRARY_VERSION_NAME
35 | licences = ['Apache-2.0']
36 | desc = POM_DESCRIPTION
37 | website = POM_URL
38 | issueTracker = ISSUE_URL
39 | repository = POM_SCM_URL
40 | autoPublish = false
41 | bintrayUser = bintrayUserProperty
42 | bintrayKey = bintrayApiKeyProperty
43 | dryRun = false
44 | }
--------------------------------------------------------------------------------
/compoundicontextview/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 /Applications/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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/compoundicontextview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/compoundicontextview/src/main/java/com/github/aakira/compoundicontextview/CompoundIconTextView.java:
--------------------------------------------------------------------------------
1 | package com.github.aakira.compoundicontextview;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Bitmap;
7 | import android.graphics.Canvas;
8 | import android.graphics.PorterDuff;
9 | import android.graphics.drawable.BitmapDrawable;
10 | import android.graphics.drawable.Drawable;
11 | import android.os.Build;
12 | import android.support.annotation.ColorInt;
13 | import android.support.annotation.ColorRes;
14 | import android.support.annotation.DimenRes;
15 | import android.support.annotation.Dimension;
16 | import android.support.annotation.DrawableRes;
17 | import android.support.annotation.NonNull;
18 | import android.support.annotation.Nullable;
19 | import android.support.v4.content.ContextCompat;
20 | import android.support.v4.graphics.drawable.DrawableCompat;
21 | import android.support.v4.text.TextUtilsCompat;
22 | import android.support.v4.view.ViewCompat;
23 | import android.support.v7.content.res.AppCompatResources;
24 | import android.support.v7.widget.AppCompatTextView;
25 | import android.util.AttributeSet;
26 |
27 | import java.util.Locale;
28 |
29 | /**
30 | * You can use a vector drawable in TextView instead of drawableLeft, drawableTop, drawableRight and
31 | * drawableBottom.
32 | *
33 | * You must set this line in your gradle.
34 | *
35 | * ```
36 | * default config { "vectorDrawables.useSupportLibrary = true" }
37 | * ```
38 | */
39 | public class CompoundIconTextView extends AppCompatTextView {
40 |
41 | public static final int UNDEFINED_RESOURCE = 0xABCD;
42 |
43 | private static final int INDEX_LEFT = 0;
44 | private static final int INDEX_TOP = 1;
45 | private static final int INDEX_RIGHT = 2;
46 | private static final int INDEX_BOTTOM = 3;
47 |
48 | /**
49 | * @see android.support.v7.widget.DrawableUtils#VECTOR_DRAWABLE_CLAZZ_NAME
50 | */
51 | private static final String VECTOR_DRAWABLE_CLAZZ_NAME = "android.graphics.drawable.VectorDrawable";
52 |
53 | /**
54 | * @see android.support.v7.widget.ThemeUtils#CHECKED_STATE_SET
55 | */
56 | private static final int[] CHECKED_STATE_SET = new int[]{android.R.attr.state_checked};
57 |
58 | /**
59 | * @see android.support.v7.widget.ThemeUtils#EMPTY_STATE_SET
60 | */
61 | private static final int[] EMPTY_STATE_SET = new int[0];
62 |
63 | private int iconWidth = UNDEFINED_RESOURCE;
64 | private int iconHeight = UNDEFINED_RESOURCE;
65 | private int iconColor = UNDEFINED_RESOURCE;
66 | private Drawable[] drawables = new Drawable[4];
67 | private int[] drawableResIds = new int[4]; // cache drawable resource ids
68 |
69 | public CompoundIconTextView(Context context) {
70 | this(context, null);
71 | }
72 |
73 | public CompoundIconTextView(Context context, @Nullable AttributeSet attrs) {
74 | this(context, attrs, 0);
75 | }
76 |
77 | public CompoundIconTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
78 | super(context, attrs, defStyleAttr);
79 |
80 | TypedArray a = null;
81 | try {
82 | a = context.obtainStyledAttributes(attrs, R.styleable.CompoundIconTextView, defStyleAttr, 0);
83 | drawableResIds[INDEX_LEFT] = a.getResourceId(R.styleable.CompoundIconTextView_cit_drawableLeft, UNDEFINED_RESOURCE);
84 | drawableResIds[INDEX_TOP] = a.getResourceId(R.styleable.CompoundIconTextView_cit_drawableTop, UNDEFINED_RESOURCE);
85 | drawableResIds[INDEX_RIGHT] = a.getResourceId(R.styleable.CompoundIconTextView_cit_drawableRight, UNDEFINED_RESOURCE);
86 | drawableResIds[INDEX_BOTTOM] = a.getResourceId(R.styleable.CompoundIconTextView_cit_drawableBottom, UNDEFINED_RESOURCE);
87 | if (a.hasValue(R.styleable.CompoundIconTextView_cit_drawableStart)) {
88 | drawableResIds[isRtl() ? INDEX_RIGHT : INDEX_LEFT] = a.getResourceId(R.styleable.CompoundIconTextView_cit_drawableStart, UNDEFINED_RESOURCE);
89 | }
90 | if (a.hasValue(R.styleable.CompoundIconTextView_cit_drawableEnd)) {
91 | drawableResIds[isRtl() ? INDEX_LEFT : INDEX_RIGHT] = a.getResourceId(R.styleable.CompoundIconTextView_cit_drawableEnd, UNDEFINED_RESOURCE);
92 | }
93 | iconWidth = a.getDimensionPixelSize(R.styleable.CompoundIconTextView_cit_iconWidth, UNDEFINED_RESOURCE);
94 | iconHeight = a.getDimensionPixelSize(R.styleable.CompoundIconTextView_cit_iconHeight, UNDEFINED_RESOURCE);
95 | iconColor = a.getColor(R.styleable.CompoundIconTextView_cit_iconColor, UNDEFINED_RESOURCE);
96 | } finally {
97 | if (a != null) {
98 | a.recycle();
99 | }
100 | }
101 |
102 | if (drawableResIds[INDEX_LEFT] == UNDEFINED_RESOURCE && drawableResIds[INDEX_TOP] == UNDEFINED_RESOURCE
103 | && drawableResIds[INDEX_RIGHT] == UNDEFINED_RESOURCE && drawableResIds[INDEX_BOTTOM] == UNDEFINED_RESOURCE) {
104 | return;
105 | }
106 |
107 | checkHasIconSize();
108 | makeDrawableIcons();
109 | updateIcons();
110 | }
111 |
112 | /**
113 | * @param resourceId Set the {@link CompoundIconTextView#UNDEFINED_RESOURCE} if you want clear icon.
114 | */
115 | public void setVectorDrawableLeft(@DrawableRes final int resourceId) {
116 | setVectorDrawable(INDEX_LEFT, resourceId);
117 | }
118 |
119 | /**
120 | * @param resourceId Set the {@link CompoundIconTextView#UNDEFINED_RESOURCE} if you want clear icon.
121 | */
122 | public void setVectorDrawableTop(@DrawableRes final int resourceId) {
123 | setVectorDrawable(INDEX_TOP, resourceId);
124 | }
125 |
126 | /**
127 | * @param resourceId Set the {@link CompoundIconTextView#UNDEFINED_RESOURCE} if you want clear icon.
128 | */
129 | public void setVectorDrawableRight(@DrawableRes final int resourceId) {
130 | setVectorDrawable(INDEX_RIGHT, resourceId);
131 | }
132 |
133 | /**
134 | * @param resourceId Set the {@link CompoundIconTextView#UNDEFINED_RESOURCE} if you want clear icon.
135 | */
136 | public void setVectorDrawableBottom(@DrawableRes final int resourceId) {
137 | setVectorDrawable(INDEX_BOTTOM, resourceId);
138 | }
139 |
140 | /**
141 | * @param resourceId Set the {@link CompoundIconTextView#UNDEFINED_RESOURCE} if you want clear icon.
142 | */
143 | public void setVectorDrawableStart(@DrawableRes final int resourceId) {
144 | setVectorDrawable(isRtl() ? INDEX_RIGHT : INDEX_LEFT, resourceId);
145 | }
146 |
147 | /**
148 | * @param resourceId Set the {@link CompoundIconTextView#UNDEFINED_RESOURCE} if you want clear icon.
149 | */
150 | public void setVectorDrawableEnd(@DrawableRes final int resourceId) {
151 | setVectorDrawable(isRtl() ? INDEX_LEFT : INDEX_RIGHT, resourceId);
152 | }
153 |
154 | /**
155 | * Change drawable icon color
156 | *
157 | * @param resId Set color resource id
158 | */
159 | public void setIconColorResource(@ColorRes final int resId) {
160 | setIconColor(ContextCompat.getColor(getContext(), resId));
161 | }
162 |
163 | /**
164 | * Change drawable icon color
165 | *
166 | * @param color Set color integer
167 | */
168 | public void setIconColor(@ColorInt final int color) {
169 | for (int i = 0; i < drawables.length; i++) {
170 | setColorFilter(i, color);
171 | }
172 | iconColor = color;
173 | updateIcons();
174 | }
175 |
176 | /**
177 | * Change drawable icon size
178 | *
179 | * @param widthRes Set width resource id
180 | * @param heightRes Set height resource id
181 | */
182 | public void setIconSizeResource(@DimenRes final int widthRes, @DimenRes final int heightRes) {
183 | setIconSize(getContext().getResources().getDimensionPixelSize(widthRes),
184 | getContext().getResources().getDimensionPixelSize(heightRes));
185 | }
186 |
187 | /**
188 | * Change drawable icon size
189 | *
190 | * @param width Set width size
191 | * @param height Set height size
192 | */
193 | public void setIconSize(@Dimension final int width, @Dimension final int height) {
194 | iconWidth = width;
195 | iconHeight = height;
196 | makeDrawableIcons();
197 | updateIcons();
198 | }
199 |
200 | private void checkHasIconSize() {
201 | if (iconWidth == UNDEFINED_RESOURCE || iconHeight == UNDEFINED_RESOURCE) {
202 | throw new IllegalStateException("You must set the 'iconSize'");
203 | }
204 | }
205 |
206 | private void makeDrawableIcons() {
207 | for (int i = 0; i < drawables.length; i++) {
208 | if (drawableResIds[i] != UNDEFINED_RESOURCE) {
209 | setDrawable(i, drawableResIds[i]);
210 | }
211 | }
212 | }
213 |
214 | private void setColorFilter(final int index, @ColorInt final int color) {
215 | if (drawables[index] != null) {
216 | drawables[index].setColorFilter(color, PorterDuff.Mode.SRC_IN);
217 | }
218 | }
219 |
220 | private void setVectorDrawable(final int index, @DrawableRes final int resourceId) {
221 | if (resourceId == UNDEFINED_RESOURCE) {
222 | drawables[index] = null;
223 | drawableResIds[index] = UNDEFINED_RESOURCE;
224 | updateIcons();
225 | } else {
226 | checkHasIconSize();
227 | setDrawable(index, resourceId);
228 | drawableResIds[index] = resourceId;
229 | updateIcons();
230 | }
231 | }
232 |
233 | private void updateIcons() {
234 | setCompoundDrawablesWithIntrinsicBounds(drawables[INDEX_LEFT], drawables[INDEX_TOP],
235 | drawables[INDEX_RIGHT], drawables[INDEX_BOTTOM]);
236 | }
237 |
238 | private void setDrawable(final int index, @DrawableRes final int resourceId) {
239 | drawables[index] = resource2VectorDrawable(resourceId, iconColor, iconWidth, iconHeight);
240 | }
241 |
242 | /**
243 | * @param resourceId drawable resourceId
244 | * @param iconColor color integer
245 | * @param iconWidth pixel size
246 | * @param iconHeight pixel size
247 | * @return Resized bitmap
248 | */
249 | private Drawable resource2VectorDrawable(@DrawableRes final int resourceId, @ColorInt final int iconColor,
250 | final int iconWidth, final int iconHeight) {
251 | final Context context = getContext();
252 | final Drawable drawable = AppCompatResources.getDrawable(context, resourceId);
253 |
254 | if (drawable == null) {
255 | throw new Resources.NotFoundException("Resource not found : %s." + resourceId);
256 | }
257 |
258 | // See if we need to 'fix' the drawableLeft
259 | fixDrawable(drawable);
260 | // Set color
261 | if(iconColor != UNDEFINED_RESOURCE) {
262 | DrawableCompat.setTint(drawable, iconColor);
263 | DrawableCompat.setTintMode(drawable, PorterDuff.Mode.SRC_IN);
264 | }
265 | // Resize Bitmap
266 | return new BitmapDrawable(context.getResources(),
267 | Bitmap.createScaledBitmap(drawable2Bitmap(drawable, iconWidth, iconHeight), iconWidth, iconHeight, true));
268 | }
269 |
270 | /**
271 | * Convert to bitmap from drawable
272 | */
273 | private static Bitmap drawable2Bitmap(final Drawable drawable, final int iconWidth, final int iconHeight) {
274 | final Bitmap bitmap = Bitmap.createBitmap(iconWidth, iconHeight, Bitmap.Config.ARGB_8888);
275 | final Canvas canvas = new Canvas(bitmap);
276 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
277 | drawable.draw(canvas);
278 | return bitmap;
279 | }
280 |
281 | /**
282 | * @see android.support.v7.widget.DrawableUtils#fixDrawable(Drawable)
283 | *
284 | * Attempt the fix any issues in the given drawable, usually caused by platform bugs in the
285 | * implementation. This method should be call after retrieval from
286 | * {@link android.content.res.Resources} or a {@link android.content.res.TypedArray}.
287 | */
288 | private static void fixDrawable(@NonNull final Drawable drawable) {
289 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP
290 | && VECTOR_DRAWABLE_CLAZZ_NAME.equals(drawable.getClass().getName())) {
291 | fixVectorDrawableTinting(drawable);
292 | }
293 | }
294 |
295 | /**
296 | * @see android.support.v7.widget.DrawableUtils#fixVectorDrawableTinting(Drawable)
297 | *
298 | * VectorDrawable has an issue on API 21 where it sometimes doesn't create its tint filter.
299 | * Fixed by toggling it's state to force a filter creation.
300 | */
301 | private static void fixVectorDrawableTinting(final Drawable drawable) {
302 | final int[] originalState = drawable.getState();
303 | if (originalState.length == 0) {
304 | // The drawable doesn't have a state, so set it to be checked
305 | drawable.setState(CHECKED_STATE_SET);
306 | } else {
307 | // Else the drawable does have a state, so clear it
308 | drawable.setState(EMPTY_STATE_SET);
309 | }
310 | // Now set the original state
311 | drawable.setState(originalState);
312 | }
313 |
314 | private boolean isRtl() {
315 | Resources resources = getContext().getResources();
316 | Locale locale = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
317 | ? resources.getConfiguration().getLocales().getFirstMatch(resources.getAssets().getLocales())
318 | : resources.getConfiguration().locale;
319 | return TextUtilsCompat.getLayoutDirectionFromLocale(locale) == ViewCompat.LAYOUT_DIRECTION_RTL;
320 | }
321 | }
--------------------------------------------------------------------------------
/compoundicontextview/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 |
20 | # This library version
21 |
22 | LIBRARY_VERSION_CODE=4
23 | LIBRARY_VERSION_NAME=1.2.1
24 |
25 | # App information
26 |
27 | COMPILE_SDK_VERSION=25
28 | BUILD_TOOLS_VERSION=25.0.0
29 | MIN_SDK_VERSION=16
30 | TARGET_SDK_VERSION=23
31 |
32 | # Using libraries
33 |
34 | ## Others
35 | APP_COMPAT_VERSION=25.3.1
36 | PLAY_SERVICE_VERSION=10.2.0
37 |
38 | # Bintray
39 |
40 | GROUP=com.github.aakira
41 | ARTIFACT_ID=compound-icon-textview
42 |
43 | POM_DESCRIPTION=An android library that is able to set a vector drawable at text view pre-Lollipop.
44 |
45 | POM_URL=https://github.com/aakira/CompoundIconTextView
46 | POM_SCM_URL=git@github.com:aakira/CompoundIconTextView.git
47 | POM_SCM_CONNECTION=scm:git@github.com:aakira/CompoundIconTextView.git
48 | POM_SCM_DEV_CONNECTION=scm:git@github.com:aakira/CompoundIconTextView.git
49 | POM_LICENSE_NAME=The Apache Software License, Version 2.0
50 | POM_LICENSE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
51 | POM_LICENSE_DIST=repo
52 | POM_DEVELOPER_ID=aakira
53 | POM_DEVELOPER_NAME=aakira
54 | POM_DEVELOPER_EMAIL=developer.a.akira@gmail.com
55 | ISSUE_URL=https://github.com/aakira/CompoundIconTextView/issues
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jun 03 23:16:48 JST 2017
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-3.5-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 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion COMPILE_SDK_VERSION as int
5 | buildToolsVersion BUILD_TOOLS_VERSION
6 |
7 | defaultConfig {
8 | applicationId "com.github.aakira.compoundicontextview"
9 |
10 | minSdkVersion MIN_SDK_VERSION as int
11 | targetSdkVersion TARGET_SDK_VERSION as int
12 | versionCode LIBRARY_VERSION_CODE as int
13 | versionName LIBRARY_VERSION_NAME
14 |
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 |
17 | // Use a vector drawable under Lollipop
18 | vectorDrawables.useSupportLibrary = true
19 | }
20 |
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | }
26 | }
27 | }
28 |
29 | dependencies {
30 | compile project(':compoundicontextview')
31 | compile "com.android.support:appcompat-v7:$APP_COMPAT_VERSION"
32 | }
--------------------------------------------------------------------------------
/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 /Applications/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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/sample/src/androidTest/java/com/github/aakira/compoundicontextview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.github.aakira.compoundicontextview;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.github.aakira.compoundicontextview", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/github/aakira/compoundicontextview/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.github.aakira.compoundicontextview.sample;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.github.aakira.compoundicontextview.CompoundIconTextView;
7 |
8 | public class MainActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 |
15 | CompoundIconTextView tv1 = (CompoundIconTextView) findViewById(R.id.compoundIconTextView1);
16 | CompoundIconTextView tv2 = (CompoundIconTextView) findViewById(R.id.compoundIconTextView2);
17 |
18 | // set icon
19 | tv1.setVectorDrawableTop(R.drawable.ic_android_black_24dp);
20 | tv1.setIconColorResource(R.color.colorPrimary);
21 | tv1.setIconSizeResource(R.dimen.icon_size, R.dimen.icon_size);
22 |
23 | // clear icon
24 | tv2.setVectorDrawableRight(CompoundIconTextView.UNDEFINED_RESOURCE);
25 | }
26 | }
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_android_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_call_end_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_cloud_download_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_language_black_24px.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_train_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_volume_up_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
30 |
31 |
47 |
48 |
62 |
63 |
77 |
78 |
92 |
93 |
106 |
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AAkira/CompoundIconTextView/55b71cef1f61014f83bee96848933197c8feabf6/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/values-ar/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | من اليمين الى اليسار
3 |
4 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/dimen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 12sp
4 | 14sp
5 |
6 | 24dp
7 |
8 | 4dp
9 | 8dp
10 | 16dp
11 | 32dp
12 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CompoundIconTextView
3 | Right to Left (in Arabic)
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/test/java/com/github/aakira/compoundicontextview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.github.aakira.compoundicontextview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':sample', ':compoundicontextview'
--------------------------------------------------------------------------------