├── .gitattributes ├── .gitignore ├── .idea ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── .travis.yml ├── CircleView.iml ├── README.md ├── Screenshots ├── Screenshot_8.png └── Thumbs.db ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── github │ │ └── pavlospt │ │ └── CircleView.java │ └── res │ └── values │ └── attrs_circle_view.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .DS_Store 4 | build/ 5 | .idea 6 | /gradlew/wrapper 7 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | script: ./gradlew clean build -------------------------------------------------------------------------------- /CircleView.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CircleView 2 | ========== 3 | 4 | A Circle View containing Title and Subtitle 5 | 6 | [ ![Download](https://api.bintray.com/packages/pavlospt/android-libraries/CircleView/images/download.svg) ](https://bintray.com/pavlospt/android-libraries/CircleView/_latestVersion) 7 | 8 | [![Android Arsenal](http://img.shields.io/badge/Android%20Arsenal-CircleView-blue.svg)](http://android-arsenal.com/details/1/796) 9 | 10 | ![CircleView](/Screenshots/Screenshot_8.png) 11 | 12 | Attributes to choose from: 13 | 14 | * `cv_titleText` - The text in the first row. 15 | * `cv_subtitleText` - The text in the second row. 16 | * `cv_titleSize` - The size of the first row text. 17 | * `cv_subtitleSize` - The size of the second row text. 18 | * `cv_strokeWidthSize` - The size of the outter line surrounding the view. 19 | * `cv_fillRadius` - The radius of the inner circle. 20 | * `cv_titleColor` - The color of the first row text. 21 | * `cv_subtitleColor` - The color of the second row text. 22 | * `cv_fillColor` - The color of the inner circle. 23 | * `cv_strokeColorValue` - The color of the outter line circle. 24 | * `cv_backgroundColorValue` - the color between the circle and the stroke. 25 | 26 | Example 27 | ======= 28 | ```xml 29 | 44 | ``` 45 | 46 | How To Use 47 | ========== 48 | 49 | You can search us on *Gradle,please* http://gradleplease.appspot.com/ or just add 50 | 51 | the dependency to your module's `build.gradle` file: 52 | 53 | ```compile 'com.github.pavlospt:circleview:1.3' ``` 54 | 55 | 56 | Credits 57 | ======= 58 | Author : Pavlos-Petros Tournaris (p.tournaris@gmail.com) 59 | 60 | Google+ : [+Pavlos-Petros Tournaris](https://plus.google.com/u/0/+PavlosPetrosTournaris/) 61 | 62 | Facebook : [Pavlos-Petros Tournaris](https://www.facebook.com/pavlospt) 63 | 64 | LinkedIn : [Pavlos-Petros Tournaris](https://www.linkedin.com/pub/pavlos-petros-tournaris/44/abb/218) 65 | 66 | Thanks to [+Filip Puđak](https://plus.google.com/u/0/117550349320705739707/) and his ProgressPieView that helped me think and create this View. 67 | 68 | (In case you use this in your app let me know to make a list of apps that use it! ) 69 | 70 | Apps using this library 71 | ======================= 72 | 73 | Hungry (https://play.google.com/store/apps/details?id=com.hungry) 74 | 75 | License 76 | ======= 77 | 78 | Copyright 2014 Pavlos-Petros Tournaris 79 | 80 | Licensed under the Apache License, Version 2.0 (the "License"); 81 | you may not use this file except in compliance with the License. 82 | You may obtain a copy of the License at 83 | 84 | http://www.apache.org/licenses/LICENSE-2.0 85 | 86 | Unless required by applicable law or agreed to in writing, software 87 | distributed under the License is distributed on an "AS IS" BASIS, 88 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 89 | See the License for the specific language governing permissions and 90 | limitations under the License. 91 | -------------------------------------------------------------------------------- /Screenshots/Screenshot_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pavlospt/CircleView/afd568f6c39f041650a8baeb1cca5bb88e5ec849/Screenshots/Screenshot_8.png -------------------------------------------------------------------------------- /Screenshots/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pavlospt/CircleView/afd568f6c39f041650a8baeb1cca5bb88e5ec849/Screenshots/Thumbs.db -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext { 4 | PUBLISH_GROUP_ID = 'com.github.pavlospt' 5 | PUBLISH_ARTIFACT_ID = 'circleview' 6 | PUBLISH_VERSION = '1.3' 7 | } 8 | 9 | android { 10 | compileSdkVersion 28 11 | 12 | defaultConfig { 13 | minSdkVersion 15 14 | targetSdkVersion 28 15 | versionCode 4 16 | versionName "1.3" 17 | } 18 | } 19 | 20 | //apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' 21 | 22 | //Bintray Push 23 | //apply from: 'https://raw.githubusercontent.com/ArthurHub/release-android-library/master/android-release-aar.gradle' 24 | -------------------------------------------------------------------------------- /app/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=CircleView Library 2 | POM_ARTIFACT_ID=circleview 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /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 C:\Users\Pavlos\AppData\Local\Android\android-studio\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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/pavlospt/CircleView.java: -------------------------------------------------------------------------------- 1 | package com.github.pavlospt; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | import android.graphics.RectF; 9 | import android.graphics.Typeface; 10 | import android.text.TextPaint; 11 | import android.util.AttributeSet; 12 | import android.view.View; 13 | 14 | public class CircleView extends View { 15 | 16 | private static int DEFAULT_TITLE_COLOR = Color.CYAN; 17 | private static int DEFAULT_SUBTITLE_COLOR = Color.WHITE; 18 | 19 | private static String DEFAULT_TITLE = "Title"; 20 | private static String DEFAULT_SUBTITLE = "Subtitle"; 21 | 22 | private static boolean DEFAULT_SHOW_TITLE = true; 23 | private static boolean DEFAULT_SHOW_SUBTITLE = true; 24 | 25 | private static float DEFAULT_TITLE_SIZE = 25f; 26 | private static float DEFAULT_SUBTITLE_SIZE = 20f; 27 | private static float DEFAULT_TITLE_SUBTITLE_SPACE = 0f; 28 | 29 | private static int DEFAULT_STROKE_COLOR = Color.CYAN; 30 | private static int DEFAULT_BACKGROUND_COLOR = Color.WHITE; 31 | private static int DEFAULT_FILL_COLOR = Color.DKGRAY; 32 | 33 | private static float DEFAULT_STROKE_WIDTH = 5f; 34 | private static float DEFAULT_FILL_RADIUS = 0.9f; 35 | 36 | private static final int DEFAULT_VIEW_SIZE = 96; 37 | 38 | private int mTitleColor = DEFAULT_TITLE_COLOR; 39 | private int mSubtitleColor = DEFAULT_SUBTITLE_COLOR; 40 | private int mStrokeColor = DEFAULT_STROKE_COLOR; 41 | private int mBackgroundColor = DEFAULT_BACKGROUND_COLOR; 42 | private int mFillColor = DEFAULT_FILL_COLOR; 43 | 44 | private String mTitleText = DEFAULT_TITLE; 45 | private String mSubtitleText = DEFAULT_SUBTITLE; 46 | 47 | private float mTitleSize = DEFAULT_TITLE_SIZE; 48 | private float mSubtitleSize = DEFAULT_SUBTITLE_SIZE; 49 | private float mStrokeWidth = DEFAULT_STROKE_WIDTH; 50 | private float mFillRadius = DEFAULT_FILL_RADIUS; 51 | private float mTitleSubtitleSpace = DEFAULT_TITLE_SUBTITLE_SPACE; 52 | 53 | private boolean mShowTitle = DEFAULT_SHOW_TITLE; 54 | private boolean mShowSubtitle = DEFAULT_SHOW_SUBTITLE; 55 | 56 | private TextPaint mTitleTextPaint; 57 | private TextPaint mSubTextPaint; 58 | 59 | private Paint mStrokePaint; 60 | private Paint mBackgroundPaint; 61 | private Paint mFillPaint; 62 | 63 | private RectF mInnerRectF; 64 | 65 | private int mViewSize; 66 | 67 | public CircleView(Context context) { 68 | super(context); 69 | init(null, 0); 70 | } 71 | 72 | public CircleView(Context context, AttributeSet attrs) { 73 | super(context, attrs); 74 | init(attrs, 0); 75 | } 76 | 77 | public CircleView(Context context, AttributeSet attrs, int defStyle) { 78 | super(context, attrs, defStyle); 79 | init(attrs, defStyle); 80 | } 81 | 82 | private void init(AttributeSet attrs, int defStyle) { 83 | final TypedArray a = getContext().obtainStyledAttributes( 84 | attrs, R.styleable.CircleView, defStyle, 0); 85 | 86 | if(a.hasValue(R.styleable.CircleView_cv_titleText)){ 87 | mTitleText = a.getString(R.styleable.CircleView_cv_titleText); 88 | } 89 | 90 | if(a.hasValue(R.styleable.CircleView_cv_subtitleText)){ 91 | mSubtitleText = a.getString(R.styleable.CircleView_cv_subtitleText); 92 | } 93 | 94 | mTitleColor = a.getColor(R.styleable.CircleView_cv_titleColor,DEFAULT_TITLE_COLOR); 95 | mSubtitleColor = a.getColor(R.styleable.CircleView_cv_subtitleColor,DEFAULT_SUBTITLE_COLOR); 96 | mBackgroundColor = a.getColor(R.styleable.CircleView_cv_backgroundColorValue,DEFAULT_BACKGROUND_COLOR); 97 | mStrokeColor = a.getColor(R.styleable.CircleView_cv_strokeColorValue,DEFAULT_STROKE_COLOR); 98 | mFillColor = a.getColor(R.styleable.CircleView_cv_fillColor,DEFAULT_FILL_COLOR); 99 | 100 | mTitleSize = a.getDimension(R.styleable.CircleView_cv_titleSize,DEFAULT_TITLE_SIZE); 101 | mSubtitleSize = a.getDimension(R.styleable.CircleView_cv_subtitleSize,DEFAULT_SUBTITLE_SIZE); 102 | 103 | mStrokeWidth = a.getFloat(R.styleable.CircleView_cv_strokeWidthSize,DEFAULT_STROKE_WIDTH); 104 | mFillRadius = a.getFloat(R.styleable.CircleView_cv_fillRadius,DEFAULT_FILL_RADIUS); 105 | 106 | mTitleSubtitleSpace = a.getFloat(R.styleable.CircleView_cv_titleSubtitleSpace, DEFAULT_TITLE_SUBTITLE_SPACE); 107 | 108 | a.recycle(); 109 | 110 | //Title TextPaint 111 | mTitleTextPaint = new TextPaint(); 112 | mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG); 113 | mTitleTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); 114 | mTitleTextPaint.setTextAlign(Paint.Align.CENTER); 115 | mTitleTextPaint.setLinearText(true); 116 | mTitleTextPaint.setColor(mTitleColor); 117 | mTitleTextPaint.setTextSize(mTitleSize); 118 | 119 | //Subtitle TextPaint 120 | mSubTextPaint = new TextPaint(); 121 | mSubTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG); 122 | mSubTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); 123 | mSubTextPaint.setTextAlign(Paint.Align.CENTER); 124 | mSubTextPaint.setLinearText(true); 125 | mSubTextPaint.setColor(mSubtitleColor); 126 | mSubTextPaint.setTextSize(mSubtitleSize); 127 | 128 | //Stroke Paint 129 | mStrokePaint = new Paint(); 130 | mStrokePaint.setFlags(Paint.ANTI_ALIAS_FLAG); 131 | mStrokePaint.setStyle(Paint.Style.STROKE); 132 | mStrokePaint.setColor(mStrokeColor); 133 | mStrokePaint.setStrokeWidth(mStrokeWidth); 134 | 135 | //Background Paint 136 | mBackgroundPaint = new Paint(); 137 | mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG); 138 | mBackgroundPaint.setStyle(Paint.Style.FILL); 139 | mBackgroundPaint.setColor(mBackgroundColor); 140 | 141 | //Fill Paint 142 | mFillPaint = new Paint(); 143 | mFillPaint.setFlags(Paint.ANTI_ALIAS_FLAG); 144 | mFillPaint.setStyle(Paint.Style.FILL); 145 | mFillPaint.setColor(mFillColor); 146 | 147 | mInnerRectF = new RectF(); 148 | 149 | } 150 | 151 | private void invalidateTextPaints(){ 152 | mTitleTextPaint.setColor(mTitleColor); 153 | mSubTextPaint.setColor(mSubtitleColor); 154 | mTitleTextPaint.setTextSize(mTitleSize); 155 | mSubTextPaint.setTextSize(mSubtitleSize); 156 | invalidate(); 157 | } 158 | 159 | private void invalidatePaints(){ 160 | mBackgroundPaint.setColor(mBackgroundColor); 161 | mStrokePaint.setColor(mStrokeColor); 162 | mFillPaint.setColor(mFillColor); 163 | invalidate(); 164 | } 165 | 166 | @Override 167 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 168 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 169 | 170 | int width = resolveSize(DEFAULT_VIEW_SIZE, widthMeasureSpec); 171 | int height = resolveSize(DEFAULT_VIEW_SIZE, heightMeasureSpec); 172 | mViewSize = Math.min(width, height); 173 | 174 | setMeasuredDimension(width, height); 175 | } 176 | 177 | @Override 178 | protected void onDraw(Canvas canvas) { 179 | 180 | mInnerRectF.set(0, 0, mViewSize, mViewSize); 181 | mInnerRectF.offset((getWidth() - mViewSize) / 2, (getHeight() - mViewSize) / 2); 182 | 183 | final int halfBorder = (int) (mStrokePaint.getStrokeWidth() / 2f + 0.5f); 184 | 185 | mInnerRectF.inset(halfBorder, halfBorder); 186 | 187 | float centerX = mInnerRectF.centerX(); 188 | float centerY = mInnerRectF.centerY(); 189 | 190 | canvas.drawArc(mInnerRectF, 0, 360, true, mBackgroundPaint); 191 | 192 | float radius = (mViewSize / 2) * mFillRadius; 193 | 194 | canvas.drawCircle(centerX, centerY, radius + 0.5f - mStrokePaint.getStrokeWidth(), mFillPaint); 195 | 196 | int xPos = (int) centerX; 197 | int yPos = (int) (centerY - (mTitleTextPaint.descent() + mTitleTextPaint.ascent()) / 2); 198 | 199 | canvas.drawOval(mInnerRectF, mStrokePaint); 200 | 201 | if (mShowTitle) { 202 | canvas.drawText(mTitleText, 203 | xPos, 204 | yPos, 205 | mTitleTextPaint); 206 | } 207 | 208 | if (mShowSubtitle) { 209 | canvas.drawText(mSubtitleText, 210 | xPos, 211 | yPos + 20 + mTitleSubtitleSpace, 212 | mSubTextPaint); 213 | } 214 | 215 | } 216 | 217 | /** 218 | * Sets whether the view's title string will be shown. 219 | * @param flag The boolean value. 220 | */ 221 | public void setShowTitle(boolean flag){ 222 | this.mShowTitle = flag; 223 | invalidate(); 224 | } 225 | 226 | /** 227 | * Sets whether the view's subtitle string will be shown. 228 | * @param flag The boolean value. 229 | */ 230 | public void setShowSubtitle(boolean flag){ 231 | this.mShowSubtitle = flag; 232 | invalidate(); 233 | } 234 | 235 | /** 236 | * Gets the title string attribute value. 237 | * @return The title string attribute value. 238 | */ 239 | public String getTitleText() { 240 | return mTitleText; 241 | } 242 | 243 | /** 244 | * Sets the view's title string attribute value. 245 | * @param title The example string attribute value to use. 246 | */ 247 | public void setTitleText(String title) { 248 | mTitleText = title; 249 | invalidate(); 250 | } 251 | 252 | /** 253 | * Gets the subtitle string attribute value. 254 | * @return The subtitle string attribute value. 255 | */ 256 | public String getSubtitleText() { 257 | return mSubtitleText; 258 | } 259 | 260 | /** 261 | * Sets the view's subtitle string attribute value. 262 | * @param subtitle The example string attribute value to use. 263 | */ 264 | public void setSubtitleText(String subtitle) { 265 | mSubtitleText = subtitle; 266 | invalidate(); 267 | } 268 | 269 | /** 270 | * Gets the stroke color attribute value. 271 | * @return The stroke color attribute value. 272 | */ 273 | public int getStrokeColor() { 274 | return mStrokeColor; 275 | } 276 | 277 | /** 278 | * Gets the background color attribute value. 279 | * @return The background color attribute value. 280 | */ 281 | public int getBackgroundColor() { 282 | return mBackgroundColor; 283 | } 284 | 285 | /** 286 | * Gets the fill color attribute value. 287 | * @return The fill color attribute value. 288 | */ 289 | public int getFillColor() { 290 | return mStrokeColor; 291 | } 292 | 293 | /** 294 | * Sets the view's stroke color attribute value. 295 | * @param strokeColor The stroke color attribute value to use. 296 | */ 297 | public void setStrokeColor(int strokeColor) { 298 | mStrokeColor = strokeColor; 299 | invalidatePaints(); 300 | } 301 | 302 | /** 303 | * Sets the view's background color attribute value. 304 | * @param backgroundColor The background color attribute value to use. 305 | */ 306 | public void setBackgroundColor(int backgroundColor) { 307 | mBackgroundColor = backgroundColor; 308 | invalidatePaints(); 309 | } 310 | 311 | /** 312 | * Sets the view's fill color attribute value. 313 | * @param fillColor The fill color attribute value to use. 314 | */ 315 | public void setFillColor(int fillColor) { 316 | mFillColor = fillColor; 317 | invalidatePaints(); 318 | } 319 | 320 | /** 321 | * Gets the stroke width dimension attribute value. 322 | * @return The stroke width dimension attribute value. 323 | */ 324 | public float getStrokeWidth() { 325 | return mStrokeWidth; 326 | } 327 | 328 | /** 329 | * Sets the view's stroke width attribute value. 330 | * @param strokeWidth The stroke width attribute value to use. 331 | */ 332 | public void setBackgroundColor(float strokeWidth) { 333 | mStrokeWidth = strokeWidth; 334 | invalidate(); 335 | } 336 | 337 | /** 338 | * Gets the fill radius dimension attribute value. 339 | * @return The fill radius dimension attribute value. 340 | */ 341 | public float getFillRadius() { 342 | return mFillRadius; 343 | } 344 | 345 | /** 346 | * Sets the view's fill radius attribute value. 347 | * @param fillRadius The fill radius attribute value to use. 348 | */ 349 | public void setFillRadius(float fillRadius) { 350 | mFillRadius = fillRadius; 351 | invalidate(); 352 | } 353 | 354 | /** 355 | * Gets the title size dimension attribute value. 356 | * @return The title size dimension attribute value. 357 | */ 358 | public float getTitleSize() { 359 | return mTitleSize; 360 | } 361 | 362 | /** 363 | * Sets the view's title size dimension attribute value. 364 | * @param titleSize The title size dimension attribute value to use. 365 | */ 366 | public void setTitleSize(float titleSize) { 367 | mTitleSize = titleSize; 368 | invalidateTextPaints(); 369 | } 370 | 371 | /** 372 | * Gets the subtitle size dimension attribute value. 373 | * @return The subtitle size dimension attribute value. 374 | */ 375 | public float getSubtitleSize() { 376 | return mSubtitleSize; 377 | } 378 | 379 | /** 380 | * Sets the view's subtitle size dimension attribute value. 381 | * @param subtitleSize The subtitle size dimension attribute value to use. 382 | */ 383 | public void setSubtitleSize(float subtitleSize) { 384 | mSubtitleSize = subtitleSize; 385 | invalidateTextPaints(); 386 | } 387 | 388 | /** 389 | * Gets the title text color attribute value. 390 | * @return The text color attribute value. 391 | */ 392 | public int getTitleColor() { 393 | return mTitleColor; 394 | } 395 | 396 | /** 397 | * Sets the view's title text color attribute value. 398 | * @param titleColor The title text color attribute value to use. 399 | */ 400 | public void setTitleColor(int titleColor) { 401 | mTitleColor =titleColor; 402 | invalidateTextPaints(); 403 | } 404 | 405 | /** 406 | * Gets the subtitle text color attribute value. 407 | * @return The text color attribute value. 408 | */ 409 | public int getSubtitleColor() { 410 | return mSubtitleColor; 411 | } 412 | 413 | /** 414 | * Sets the view's subtitle text color attribute value. 415 | * @param subtitleColor The subtitle text color attribute value to use. 416 | */ 417 | public void setSubtitleColor(int subtitleColor) { 418 | mSubtitleColor = subtitleColor; 419 | invalidateTextPaints(); 420 | } 421 | 422 | /** 423 | * Gets the title subtitle space attribute value. 424 | * @return The title subtitle space attribute value. 425 | */ 426 | public float getTitleSubtitleSpace() { 427 | return mTitleSubtitleSpace; 428 | } 429 | 430 | /** 431 | * Sets the view's title subtitle space attribute value. 432 | * @param titleSubtitleSpace The space between title and subtitle attribute value to use. 433 | */ 434 | public void setTitleSubtitleSpace(float titleSubtitleSpace) { 435 | this.mTitleSubtitleSpace = titleSubtitleSpace; 436 | invalidateTextPaints(); 437 | } 438 | } 439 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs_circle_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:3.2.0' 8 | } 9 | } 10 | 11 | allprojects { 12 | repositories { 13 | google() 14 | jcenter() 15 | } 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=1.3 2 | VERSION_CODE=4 3 | GROUP=com.github.pavlospt 4 | 5 | POM_DESCRIPTION=A circle View with contained Title and Subtitle 6 | POM_URL=https://github.com/pavlospt/CircleView 7 | POM_SCM_URL=https://github.com/pavlospt/CircleView 8 | POM_SCM_CONNECTION=scm:git@github.com:pavlospt/CircleView.git 9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:pavlospt/CircleView.git 10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 12 | POM_LICENCE_DIST=repo 13 | POM_DEVELOPER_ID=pavlospt 14 | POM_DEVELOPER_NAME=Pavlos-Petros Tournaris 15 | POM_ARTIFACT_ID=circleview 16 | POM_NAME=CircleView 17 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pavlospt/CircleView/afd568f6c39f041650a8baeb1cca5bb88e5ec849/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /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 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 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 Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------