├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── thinkcool
│ │ └── circletextimageviewtest
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── thinkcool
│ │ │ └── circletextimageviewtest
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable
│ │ ├── hugh.png
│ │ └── skye.jpg
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── content_main.xml
│ │ ├── menu
│ │ └── menu_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── thinkcool
│ └── circletextimageviewtest
│ └── ExampleUnitTest.java
├── build.gradle
├── circletextimageview
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── thinkcool
│ │ └── circletextimageview
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── thinkcool
│ │ │ └── circletextimageview
│ │ │ └── CircleTextImageView.java
│ └── res
│ │ └── values
│ │ ├── attrs.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── thinkcool
│ └── circletextimageview
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | CircleTextImageViewTest
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 在项目中我们经常遇到需要显示圆形头像的需求,一般我们都使用hdodenhof/CircleImageView的这个开源控件实现(简洁,没多余的东西)。
2 | 而在的项目中我经常遇到这样的一个需求:如果用户上传了头像就显示圆形头像,如果没有上传头像就在圆形背景上显示文字。或者是直接在圆形头像上添加文字。因此我就在CircleImageView基础上实现了一个CircleTextImageView的组件。
3 | CircleTextImageView是一个什么样的组件呢,直接上图吧
4 |
5 | 1.只显示头像
6 | 
7 |
8 | 2.圆形背景文字
9 | 
10 |
11 | 3.头像+文字
12 | 
13 |
14 | 分别的使用方法:
15 | 1.只显示头像
16 | ```
17 |
25 | ```
26 | 2.圆形背景文字
27 |
28 | ```
29 |
41 | ```
42 | 3.头像+文字
43 |
44 | ```
45 |
58 | ```
59 | 最后在build.gradle中添加组件即可:
60 | ```
61 | compile 'com.github.thinkcool:circletextimageview:1.0.20151218'
62 | ```
63 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.thinkcool.circletextimageviewtest"
9 | minSdkVersion 8
10 | targetSdkVersion 23
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(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.1'
26 | compile 'com.android.support:design:23.1.1'
27 | compile 'com.github.thinkcool:circletextimageview:1.0.20151218'
28 | // compile project(':circletextimageview')
29 | }
30 |
--------------------------------------------------------------------------------
/app/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 D:\Users\thikcool\AppData\Local\Android\sdk1/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 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/thinkcool/circletextimageviewtest/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.thinkcool.circletextimageviewtest;
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 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/thinkcool/circletextimageviewtest/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.thinkcool.circletextimageviewtest;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.Snackbar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.View;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
19 | setSupportActionBar(toolbar);
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/hugh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/app/src/main/res/drawable/hugh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/skye.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/app/src/main/res/drawable/skye.jpg
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
20 |
28 |
29 |
35 |
47 |
48 |
54 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #222222
4 | #222222
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CircleTextImageViewTest
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/test/java/com/thinkcool/circletextimageviewtest/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.thinkcool.circletextimageviewtest;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/circletextimageview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/circletextimageview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 | apply plugin: 'com.jfrog.bintray'
4 | //apply plugin: 'bintray-release'
5 |
6 |
7 | // 这个version是区分library版本的,因此当我们需要更新library时记得修改这个version
8 | // 这个version影响后面的引用
9 | version = "1.0.20151217"
10 |
11 | android {
12 |
13 | resourcePrefix "cc_" //随意填写
14 |
15 | compileSdkVersion 23
16 | buildToolsVersion "23.0.1"
17 |
18 | defaultConfig {
19 | minSdkVersion 8
20 | targetSdkVersion 23
21 | versionCode 2
22 | versionName "1.1"
23 | }
24 | buildTypes {
25 | release {
26 | minifyEnabled false
27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | }
31 |
32 | dependencies {
33 | compile fileTree(dir: 'libs', include: ['*.jar'])
34 | testCompile 'junit:junit:4.12'
35 | compile 'com.android.support:appcompat-v7:23.1.1'
36 |
37 | }
38 |
39 |
40 |
41 | def siteUrl = 'https://github.com/CoolThink/CircleTextImageView' // 项目的主页
42 | def gitUrl = 'https://github.com/CoolThink/CircleTextImageView.git' // Git仓库的url
43 | group = "com.github.thinkcool" // Maven Group ID for the artifact,一般填你唯一的包名
44 | install {
45 | repositories.mavenInstaller {
46 | // This generates POM.xml with proper parameters
47 | pom {
48 | project {
49 | packaging 'aar'
50 | // Add your description here
51 | name 'circletextimageview' //项目的描述 你可以多写一点
52 | url siteUrl
53 | // Set your license
54 | licenses {
55 | license {
56 | name 'The Apache Software License, Version 2.0'
57 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
58 | }
59 | }
60 | developers {
61 | developer {
62 | id 'thinkcool' //填写的一些基本信息
63 | name 'thinkcool'
64 | email 'thinkcoolys@163.com'
65 | }
66 | }
67 | scm {
68 | connection gitUrl
69 | developerConnection gitUrl
70 | url siteUrl
71 | }
72 | }
73 | }
74 | }
75 | }
76 | task sourcesJar(type: Jar) {
77 | from android.sourceSets.main.java.srcDirs
78 | classifier = 'sources'
79 | }
80 | task javadoc(type: Javadoc) {
81 | source = android.sourceSets.main.java.srcDirs
82 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
83 | }
84 | task javadocJar(type: Jar, dependsOn: javadoc) {
85 | classifier = 'javadoc'
86 | from javadoc.destinationDir
87 | }
88 | artifacts {
89 | archives javadocJar
90 | archives sourcesJar
91 | }
92 | Properties properties = new Properties()
93 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
94 | bintray {
95 | user = properties.getProperty("bintray.user")
96 | key = properties.getProperty("bintray.apikey")
97 | configurations = ['archives']
98 | pkg {
99 | repo = "maven"
100 | name = "circletextimageview" //发布到JCenter上的项目名字
101 | websiteUrl = siteUrl
102 | vcsUrl = gitUrl
103 | licenses = ["Apache-2.0"]
104 | publish = true
105 | }
106 | }
--------------------------------------------------------------------------------
/circletextimageview/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 D:\Users\thikcool\AppData\Local\Android\sdk1/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 |
--------------------------------------------------------------------------------
/circletextimageview/src/androidTest/java/com/thinkcool/circletextimageview/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.thinkcool.circletextimageview;
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 | }
--------------------------------------------------------------------------------
/circletextimageview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/circletextimageview/src/main/java/com/thinkcool/circletextimageview/CircleTextImageView.java:
--------------------------------------------------------------------------------
1 |
2 | package com.thinkcool.circletextimageview;
3 |
4 | import android.content.Context;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Bitmap;
7 | import android.graphics.BitmapShader;
8 | import android.graphics.Canvas;
9 | import android.graphics.Color;
10 | import android.graphics.ColorFilter;
11 | import android.graphics.Matrix;
12 | import android.graphics.Paint;
13 | import android.graphics.RectF;
14 | import android.graphics.Shader;
15 | import android.graphics.drawable.BitmapDrawable;
16 | import android.graphics.drawable.ColorDrawable;
17 | import android.graphics.drawable.Drawable;
18 | import android.net.Uri;
19 | import android.support.annotation.ColorInt;
20 | import android.support.annotation.ColorRes;
21 | import android.support.annotation.DrawableRes;
22 | import android.support.annotation.StringRes;
23 | import android.text.TextUtils;
24 | import android.util.AttributeSet;
25 | import android.widget.ImageView;
26 |
27 | public class CircleTextImageView extends ImageView {
28 |
29 | private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;
30 |
31 | private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888;
32 | private static final int COLORDRAWABLE_DIMENSION = 2;
33 |
34 | private static final int DEFAULT_BORDER_WIDTH = 0;
35 | private static final int DEFAULT_BORDER_COLOR = Color.BLACK;
36 | private static final int DEFAULT_FILL_COLOR = Color.TRANSPARENT;
37 | private static final int DEFAULT_TEXT_COLOR = Color.BLACK;
38 | private static final int DEFAULT_TEXT_SIZE = 22;
39 | private static final int DEFAULT_TEXT_PADDING = 4;
40 | private static final boolean DEFAULT_BORDER_OVERLAY = false;
41 |
42 | private final RectF mDrawableRect = new RectF();
43 | private final RectF mBorderRect = new RectF();
44 |
45 | private final Matrix mShaderMatrix = new Matrix();
46 | private final Paint mBitmapPaint = new Paint();
47 | private final Paint mBorderPaint = new Paint();
48 | private final Paint mFillPaint = new Paint();
49 | private final Paint mTextPaint = new Paint();
50 |
51 | private int mBorderColor = DEFAULT_BORDER_COLOR;
52 | private int mBorderWidth = DEFAULT_BORDER_WIDTH;
53 | private int mFillColor = DEFAULT_FILL_COLOR;
54 | private String mTextString;
55 | private int mTextColor = DEFAULT_TEXT_COLOR;
56 | private int mTextSize = DEFAULT_TEXT_SIZE;
57 | private int mTextPadding=DEFAULT_TEXT_PADDING;
58 |
59 | private Bitmap mBitmap;
60 | private BitmapShader mBitmapShader;
61 | private int mBitmapWidth;
62 | private int mBitmapHeight;
63 |
64 | private float mDrawableRadius;
65 | private float mBorderRadius;
66 |
67 | private ColorFilter mColorFilter;
68 |
69 | private boolean mReady;
70 | private boolean mSetupPending;
71 | private boolean mBorderOverlay;
72 |
73 | public CircleTextImageView(Context context) {
74 | super(context);
75 |
76 | init();
77 | }
78 |
79 | public CircleTextImageView(Context context, AttributeSet attrs) {
80 | this(context, attrs, 0);
81 | }
82 |
83 | public CircleTextImageView(Context context, AttributeSet attrs, int defStyle) {
84 | super(context, attrs, defStyle);
85 |
86 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleTextImageView, defStyle, 0);
87 |
88 | mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleTextImageView_citv_border_width, DEFAULT_BORDER_WIDTH);
89 | mBorderColor = a.getColor(R.styleable.CircleTextImageView_citv_border_color, DEFAULT_BORDER_COLOR);
90 | mBorderOverlay = a.getBoolean(R.styleable.CircleTextImageView_citv_border_overlay, DEFAULT_BORDER_OVERLAY);
91 | mFillColor = a.getColor(R.styleable.CircleTextImageView_citv_fill_color, DEFAULT_FILL_COLOR);
92 | mTextString = a.getString(R.styleable.CircleTextImageView_citv_text_text);
93 | mTextColor = a.getColor(R.styleable.CircleTextImageView_citv_border_color, DEFAULT_TEXT_COLOR);
94 | mTextSize = a.getDimensionPixelSize(R.styleable.CircleTextImageView_citv_text_size, DEFAULT_TEXT_SIZE);
95 | mTextPadding=a.getDimensionPixelSize(R.styleable.CircleTextImageView_citv_text_padding, DEFAULT_TEXT_PADDING);
96 | a.recycle();
97 |
98 | init();
99 | }
100 |
101 | private void init() {
102 | super.setScaleType(SCALE_TYPE);
103 | mReady = true;
104 |
105 | if (mSetupPending) {
106 | setup();
107 | mSetupPending = false;
108 | }
109 | }
110 |
111 | @Override
112 | public ScaleType getScaleType() {
113 | return SCALE_TYPE;
114 | }
115 |
116 | @Override
117 | public void setScaleType(ScaleType scaleType) {
118 | if (scaleType != SCALE_TYPE) {
119 | throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType));
120 | }
121 | }
122 |
123 | @Override
124 | public void setAdjustViewBounds(boolean adjustViewBounds) {
125 | if (adjustViewBounds) {
126 | throw new IllegalArgumentException("adjustViewBounds not supported.");
127 | }
128 | }
129 |
130 | @Override
131 | protected void onDraw(Canvas canvas) {
132 | if (mBitmap == null&&TextUtils.isEmpty(mTextString)) {
133 | return;
134 | }
135 |
136 | if (mFillColor != Color.TRANSPARENT) {
137 | canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mFillPaint);
138 | }
139 | if(mBitmap!=null) {
140 | canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mBitmapPaint);
141 | }
142 | if (mBorderWidth != 0) {
143 | canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mBorderRadius, mBorderPaint);
144 | }
145 |
146 | if (!TextUtils.isEmpty(mTextString)) {
147 | Paint.FontMetricsInt fm = mTextPaint.getFontMetricsInt();
148 | canvas.drawText(mTextString,
149 | getWidth() / 2 - mTextPaint.measureText(mTextString) / 2,
150 | getHeight() / 2 - fm.descent + (fm.bottom - fm.top) / 2, mTextPaint);
151 | }
152 | }
153 |
154 | @Override
155 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
156 | super.onSizeChanged(w, h, oldw, oldh);
157 | setup();
158 | }
159 |
160 | public String getTextString() {
161 | return mTextString;
162 | }
163 |
164 |
165 | public void setText(@StringRes int TextResId) {
166 | setText(getResources().getString(TextResId));
167 | }
168 | public void setText(String textString)
169 | {
170 | this.mTextString=textString;
171 | invalidate();
172 |
173 | }
174 |
175 | public int getTextColor() {
176 | return mTextColor;
177 | }
178 |
179 | public void setTextColor(@ColorInt int mTextColor) {
180 | this.mTextColor = mTextColor;
181 | mTextPaint.setColor(mTextColor);
182 | invalidate();
183 | }
184 |
185 | public void setTextColorResource(@ColorRes int colorResource) {
186 | setTextColor(getResources().getColor(colorResource));
187 | }
188 |
189 | public int getTextSize() {
190 | return mTextSize;
191 | }
192 | public void setTextSize(int textSize)
193 | {
194 | this.mTextSize=textSize;
195 | mTextPaint.setTextSize(textSize);
196 | invalidate();
197 | }
198 |
199 | public int getTextPadding() {
200 | return mTextPadding;
201 | }
202 |
203 | public void setTextPadding(int mTextPadding) {
204 | this.mTextPadding = mTextPadding;
205 | invalidate();
206 | }
207 |
208 | public int getBorderColor() {
209 | return mBorderColor;
210 | }
211 |
212 | public void setBorderColor(@ColorInt int borderColor) {
213 | if (borderColor == mBorderColor) {
214 | return;
215 | }
216 |
217 | mBorderColor = borderColor;
218 | mBorderPaint.setColor(mBorderColor);
219 | invalidate();
220 | }
221 |
222 | public void setBorderColorResource(@ColorRes int borderColorRes) {
223 | setBorderColor(getContext().getResources().getColor(borderColorRes));
224 | }
225 |
226 | public int getFillColor() {
227 | return mFillColor;
228 | }
229 |
230 | public void setFillColor(@ColorInt int fillColor) {
231 | if (fillColor == mFillColor) {
232 | return;
233 | }
234 |
235 | mFillColor = fillColor;
236 | mFillPaint.setColor(fillColor);
237 | invalidate();
238 | }
239 |
240 | public void setFillColorResource(@ColorRes int fillColorRes) {
241 | setFillColor(getContext().getResources().getColor(fillColorRes));
242 | }
243 |
244 | public int getBorderWidth() {
245 | return mBorderWidth;
246 | }
247 |
248 | public void setBorderWidth(int borderWidth) {
249 | if (borderWidth == mBorderWidth) {
250 | return;
251 | }
252 |
253 | mBorderWidth = borderWidth;
254 | setup();
255 | }
256 |
257 | public boolean isBorderOverlay() {
258 | return mBorderOverlay;
259 | }
260 |
261 | public void setBorderOverlay(boolean borderOverlay) {
262 | if (borderOverlay == mBorderOverlay) {
263 | return;
264 | }
265 |
266 | mBorderOverlay = borderOverlay;
267 | setup();
268 | }
269 |
270 | @Override
271 | public void setImageBitmap(Bitmap bm) {
272 | super.setImageBitmap(bm);
273 | mBitmap = bm;
274 | setup();
275 | }
276 |
277 | @Override
278 | public void setImageDrawable(Drawable drawable) {
279 | super.setImageDrawable(drawable);
280 | mBitmap = getBitmapFromDrawable(drawable);
281 | setup();
282 | }
283 |
284 | @Override
285 | public void setImageResource(@DrawableRes int resId) {
286 | super.setImageResource(resId);
287 | mBitmap = getBitmapFromDrawable(getDrawable());
288 | setup();
289 | }
290 |
291 | @Override
292 | public void setImageURI(Uri uri) {
293 | super.setImageURI(uri);
294 | mBitmap = uri != null ? getBitmapFromDrawable(getDrawable()) : null;
295 | setup();
296 | }
297 |
298 | @Override
299 | public void setColorFilter(ColorFilter cf) {
300 | if (cf == mColorFilter) {
301 | return;
302 | }
303 |
304 | mColorFilter = cf;
305 | mBitmapPaint.setColorFilter(mColorFilter);
306 | invalidate();
307 | }
308 |
309 | private Bitmap getBitmapFromDrawable(Drawable drawable) {
310 | if (drawable == null) {
311 | return null;
312 | }
313 |
314 | if (drawable instanceof BitmapDrawable) {
315 | return ((BitmapDrawable) drawable).getBitmap();
316 | }
317 |
318 | try {
319 | Bitmap bitmap;
320 |
321 | if (drawable instanceof ColorDrawable) {
322 | bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG);
323 | } else {
324 | bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG);
325 | }
326 |
327 | Canvas canvas = new Canvas(bitmap);
328 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
329 | drawable.draw(canvas);
330 | return bitmap;
331 | } catch (Exception e) {
332 | e.printStackTrace();
333 | return null;
334 | }
335 | }
336 |
337 | private void setup() {
338 | if (!mReady) {
339 | mSetupPending = true;
340 | return;
341 | }
342 |
343 | if (getWidth() == 0 && getHeight() == 0) {
344 | return;
345 | }
346 |
347 |
348 |
349 | if (mBitmap == null&&TextUtils.isEmpty(mTextString)) {
350 | invalidate();
351 | return;
352 | }
353 |
354 |
355 |
356 | mTextPaint.setAntiAlias(true);
357 | mTextPaint.setColor(mTextColor);
358 | mTextPaint.setTextSize(mTextSize);
359 |
360 |
361 | mBorderPaint.setStyle(Paint.Style.STROKE);
362 | mBorderPaint.setAntiAlias(true);
363 | mBorderPaint.setColor(mBorderColor);
364 | mBorderPaint.setStrokeWidth(mBorderWidth);
365 |
366 | mFillPaint.setStyle(Paint.Style.FILL);
367 | mFillPaint.setAntiAlias(true);
368 | mFillPaint.setColor(mFillColor);
369 |
370 |
371 |
372 | mBorderRect.set(0, 0, getWidth(), getHeight());
373 | mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2.0f, (mBorderRect.width() - mBorderWidth) / 2.0f);
374 |
375 | mDrawableRect.set(mBorderRect);
376 | if (!mBorderOverlay) {
377 | mDrawableRect.inset(mBorderWidth, mBorderWidth);
378 | }
379 | mDrawableRadius = Math.min(mDrawableRect.height() / 2.0f, mDrawableRect.width() / 2.0f);
380 |
381 | if(mBitmap!=null)
382 | {
383 | mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
384 | mBitmapHeight = mBitmap.getHeight();
385 | mBitmapWidth = mBitmap.getWidth();
386 | mBitmapPaint.setAntiAlias(true);
387 | mBitmapPaint.setShader(mBitmapShader);
388 | updateShaderMatrix();
389 | }
390 | invalidate();
391 | }
392 |
393 | private void updateShaderMatrix() {
394 | float scale;
395 | float dx = 0;
396 | float dy = 0;
397 |
398 | mShaderMatrix.set(null);
399 |
400 | if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) {
401 | scale = mDrawableRect.height() / (float) mBitmapHeight;
402 | dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f;
403 | } else {
404 | scale = mDrawableRect.width() / (float) mBitmapWidth;
405 | dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f;
406 | }
407 |
408 | mShaderMatrix.setScale(scale, scale);
409 | mShaderMatrix.postTranslate((int) (dx + 0.5f) + mDrawableRect.left, (int) (dy + 0.5f) + mDrawableRect.top);
410 |
411 | mBitmapShader.setLocalMatrix(mShaderMatrix);
412 | }
413 |
414 | @Override
415 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
416 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
417 | int widthMeasureSpecMode=MeasureSpec.getMode(widthMeasureSpec);
418 | int widthMeasureSpecSize=MeasureSpec.getSize(widthMeasureSpec);
419 | int heightMeasureSpecMode=MeasureSpec.getMode(heightMeasureSpec);
420 | int heightMeasureSpecSize=MeasureSpec.getSize(heightMeasureSpec);
421 |
422 | if(!TextUtils.isEmpty(mTextString))
423 | {
424 | int textMeasuredSize= (int) (mTextPaint.measureText(mTextString));
425 | textMeasuredSize+=2*mTextPadding;
426 | if(widthMeasureSpecMode==MeasureSpec.AT_MOST&&heightMeasureSpecMode==MeasureSpec.AT_MOST)
427 | {
428 | if(textMeasuredSize>getMeasuredWidth()||textMeasuredSize>getMeasuredHeight())
429 | {
430 | setMeasuredDimension(textMeasuredSize,textMeasuredSize);
431 | }
432 | }
433 | }
434 |
435 | }
436 | }
437 |
--------------------------------------------------------------------------------
/circletextimageview/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/circletextimageview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CircleTextImageVIew
3 |
4 |
--------------------------------------------------------------------------------
/circletextimageview/src/test/java/com/thinkcool/circletextimageview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.thinkcool.circletextimageview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoolThink/CircleTextImageView/8c7ca3b7e82b957cd219229ded14ada69fd959f8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Dec 17 12:03:07 CST 2015
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.8-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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':circletextimageview'
2 |
--------------------------------------------------------------------------------