Full Code of lopspower/CircleView for AI

master fc3ae3dc46ad cached
26 files
54.1 KB
13.8k tokens
1 requests
Download .txt
Repository: lopspower/CircleView
Branch: master
Commit: fc3ae3dc46ad
Files: 26
Total size: 54.1 KB

Directory structure:
gitextract_utrmu8py/

├── .gitignore
├── LICENSE
├── README.md
├── build.gradle
├── circleview/
│   ├── build.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── mikhaellopez/
│           │           └── circleview/
│           │               └── CircleView.kt
│           └── res/
│               └── values/
│                   └── attrs.xml
├── circleview-example/
│   ├── build.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── mikhaellopez/
│           │           └── circleviewsample/
│           │               └── MainActivity.kt
│           └── res/
│               ├── layout/
│               │   ├── activity_main.xml
│               │   └── layout_demo.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── strings.xml
│               │   └── themes.xml
│               └── values-v21/
│                   └── themes.xml
├── dependencies.gradle
├── gradle/
│   ├── publish-mavencentral.gradle
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── publish.sh
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# GENERATED
*build
.gradle
.DS_Store

# LOCAL
local.properties

# IDEA
*.idea
*.iml


================================================
FILE: LICENSE
================================================
Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2019 LOPEZ MIKHAEL

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
CircleView
=================

<img src="/preview/preview.gif" alt="sample" title="sample" width="300" height="533" align="right" vspace="52" />

[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
[![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=14)
[![Maven Central](https://img.shields.io/maven-central/v/com.mikhaellopez/circleview.svg?label=Maven%20Central)](https://search.maven.org/artifact/com.mikhaellopez/circleview)
[![Twitter](https://img.shields.io/badge/Twitter-@LopezMikhael-blue.svg?style=flat)](http://twitter.com/lopezmikhael)

This is an Android project allowing to realize a circular View in the simplest way possible. Finish the oval shapes of all colors in your projects.

<a href="https://play.google.com/store/apps/details?id=com.mikhaellopez.lopspower">
  <img alt="Android app on Google Play" src="https://developer.android.com/images/brand/en_app_rgb_wo_45.png" />
</a>

USAGE
-----

To make a circular View add CircleView in your layout XML and add CircleView library in your project or you can also grab it via Gradle:

```groovy
implementation 'com.mikhaellopez:circleview:1.4.1'
```

XML
-----

```xml    
<com.mikhaellopez.circleview.CircleView
    android:id="@+id/circleView"
    android:layout_width="300dp"
    android:layout_height="300dp"
    app:cv_border="true"
    app:cv_border_color="#000000"
    app:cv_border_width="8dp"
    app:cv_color="#3f51b5"
    app:cv_shadow="true"
    app:cv_shadow_color="#3f51b5"
    app:cv_shadow_radius="10" />
```

You must use the following properties in your XML to change your CircleView.

| Properties                      | Type                                                         | Default         |
| ------------------------------- | ------------------------------------------------------------ | --------------- |
| `app:cv_color`                  | color                                                        | WHITE           |
| `app:cv_color_start`            | color                                                        | cv_color        |
| `app:cv_color_end`              | color                                                        | cv_color        |
| `app:cv_color_direction`        | left_to_right, right_to_left, top_to_bottom or bottom_to_top | left_to_right   |
| `app:cv_border`                 | boolean                                                      | false           |
| `app:cv_border_width`           | dimension                                                    | 4dp             |
| `app:cv_border_color`           | color                                                        | BLACK           |
| `app:cv_border_color_start`     | color                                                        | cv_border_color |
| `app:cv_border_color_end`       | color                                                        | cv_border_color |
| `app:cv_border_color_direction` | left_to_right, right_to_left, top_to_bottom or bottom_to_top | left_to_right   |
| `app:cv_shadow`                 | boolean                                                      | false           |
| `app:cv_shadow_color`           | color                                                        | BLACK           |
| `app:cv_shadow_radius`          | float                                                        | 8.0f            |
| `app:cv_shadow_gravity`         | center, top, bottom, start or end                            | bottom          |

:information_source: You can also use `android:elevation` instead of `app:cv_shadow` to have default Material Design elevation.

KOTLIN
-----

<img src="/preview/capture.png" alt="sample" title="sample" width="300" height="533" align="right" vspace="200" />

```kotlin
val circleView = findViewById<CircleView>(R.id.circleView)
circleView.apply {
    // Set Color
    circleColor = Color.WHITE
    // or with gradient
    circleColorStart = Color.BLACK
    circleColorEnd = Color.RED
    circleColorDirection = CircleView.GradientDirection.TOP_TO_BOTTOM
    
    // Set Border
    borderWidth = 10f
    borderColor = Color.BLACK
    // or with gradient
    borderColorStart = Color.BLACK
    borderColorEnd = Color.RED
    borderColorDirection = CircleView.GradientDirection.TOP_TO_BOTTOM
    
    // Add Shadow with default param
    shadowEnable = true
    // or with custom param
    shadowRadius = 15f
    shadowColor = Color.RED
    shadowGravity = CircleView.ShadowGravity.CENTER
}
```

JAVA
-----

```java
CircleView circleView = findViewById(R.id.circleView);

// Set Color
circleView.setCircleColor(Color.WHITE);
// or with gradient
circleView.setCircleColorStart(Color.BLACK);
circleView.setCircleColorEnd(Color.RED);
circleView.setCircleColorDirection(CircleView.GradientDirection.TOP_TO_BOTTOM);

// Set Border
circleView.setBorderWidth(10f);
circleView.setBorderColor(Color.BLACK);
// or with gradient
circleView.setBorderColorStart(Color.BLACK);
circleView.setBorderColorEnd(Color.RED);
circleView.setBorderColorDirection(CircleView.GradientDirection.TOP_TO_BOTTOM);

// Add Shadow with default param
circleView.setShadowEnable(true);
// or with custom param
circleView.setShadowRadius(15f);
circleView.setShadowColor(Color.RED);
circleView.setShadowGravity(CircleView.ShadowGravity.CENTER);
```

SUPPORT ❤️
-----

Find this library useful? Support it by joining [**stargazers**](https://github.com/lopspower/CircleView/stargazers) for this repository ⭐️
<br/>
And [**follow me**](https://github.com/lopspower?tab=followers) for my next creations 👍

LICENCE
-----

CircleView by [Lopez Mikhael](http://mikhaellopez.com/) is licensed under a [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).


================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'dependencies.gradle'

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.github.ben-manes:gradle-versions-plugin:0.42.0'
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


================================================
FILE: circleview/build.gradle
================================================
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

apply from: rootProject.file('gradle/publish-mavencentral.gradle')

android {
    compileSdkVersion androidCompileSdkVersion
    defaultConfig {
        minSdkVersion androidMinSdkVersion
        targetSdkVersion androidTargetSdkVersion
        versionCode androidVersionCode
        versionName androidVersionName
    }
    buildTypes {
        release {
            minifyEnabled false
        }
    }
}

dependencies {
    implementation kotlinStdlib
}


================================================
FILE: circleview/src/main/AndroidManifest.xml
================================================
<manifest package="com.mikhaellopez.circleview" />


================================================
FILE: circleview/src/main/java/com/mikhaellopez/circleview/CircleView.kt
================================================
package com.mikhaellopez.circleview

import android.content.Context
import android.graphics.*
import android.os.Build
import android.util.AttributeSet
import android.view.View
import android.view.ViewOutlineProvider
import kotlin.math.min

/**
 * Copyright (C) 2020 Mikhael LOPEZ
 * Licensed under the Apache License Version 2.0
 */
class CircleView(context: Context, attrs: AttributeSet? = null) : View(context, attrs) {

    companion object {
        private const val DEFAULT_BORDER_WIDTH = 4f
        private const val DEFAULT_SHADOW_RADIUS = 8.0f
    }

    // Properties
    private val paint: Paint = Paint().apply { isAntiAlias = true }
    private val paintBorder: Paint = Paint().apply { isAntiAlias = true }
    private val paintShadow: Paint = Paint().apply { isAntiAlias = true }
    private var circleCenter = 0
    private var heightCircle = 0

    //region Attributes
    var circleColor: Int = Color.WHITE
        set(value) {
            field = value
            manageCircleColor()
            invalidate()
        }
    var circleColorStart: Int? = null
        set(value) {
            field = value
            manageCircleColor()
            invalidate()
        }
    var circleColorEnd: Int? = null
        set(value) {
            field = value
            manageCircleColor()
            invalidate()
        }
    var circleColorDirection: GradientDirection = GradientDirection.LEFT_TO_RIGHT
        set(value) {
            field = value
            manageCircleColor()
            invalidate()
        }
    var borderWidth: Float = 0f
        set(value) {
            field = value
            update()
        }
    var borderColor: Int = Color.BLACK
        set(value) {
            field = value
            manageBorderColor()
            invalidate()
        }
    var borderColorStart: Int? = null
        set(value) {
            field = value
            manageBorderColor()
            invalidate()
        }
    var borderColorEnd: Int? = null
        set(value) {
            field = value
            manageBorderColor()
            invalidate()
        }
    var borderColorDirection: GradientDirection = GradientDirection.LEFT_TO_RIGHT
        set(value) {
            field = value
            manageBorderColor()
            invalidate()
        }
    var shadowRadius: Float = 0f
        set(value) {
            field = value
            shadowEnable = shadowRadius > 0f
        }
    var shadowColor = Color.BLACK
        set(value) {
            field = value
            paintShadow.color = field
            invalidate()
        }
    var shadowGravity = ShadowGravity.BOTTOM
        set(value) {
            field = value
            invalidate()
        }
    var shadowEnable = false
        set(value) {
            field = value
            if (field && shadowRadius == 0f)
                shadowRadius = DEFAULT_SHADOW_RADIUS
            update()
        }
    //endregion

    init {
        init(context, attrs)
    }

    private fun init(context: Context, attrs: AttributeSet?) {
        // Load the styled attributes and set their properties
        val attributes = context.obtainStyledAttributes(attrs, R.styleable.CircleView, 0, 0)

        // Init Circle Color
        circleColor = attributes.getColor(R.styleable.CircleView_cv_color, Color.WHITE)
        attributes.getColor(R.styleable.CircleView_cv_color_start, 0)
            .also { if (it != 0) circleColorStart = it }
        attributes.getColor(R.styleable.CircleView_cv_color_end, 0)
            .also { if (it != 0) circleColorEnd = it }
        circleColorDirection = attributes.getInteger(
            R.styleable.CircleView_cv_color_direction,
            circleColorDirection.value
        ).toGradientDirection()

        // Init Border
        if (attributes.getBoolean(R.styleable.CircleView_cv_border, false)) {
            val defaultBorderSize = DEFAULT_BORDER_WIDTH * resources.displayMetrics.density
            borderWidth =
                attributes.getDimension(R.styleable.CircleView_cv_border_width, defaultBorderSize)
            borderColor = attributes.getColor(R.styleable.CircleView_cv_border_color, borderColor)
            attributes.getColor(R.styleable.CircleView_cv_border_color_start, 0)
                .also { if (it != 0) borderColorStart = it }
            attributes.getColor(R.styleable.CircleView_cv_border_color_end, 0)
                .also { if (it != 0) borderColorEnd = it }
            borderColorDirection = attributes.getInteger(
                R.styleable.CircleView_cv_border_color_direction,
                borderColorDirection.value
            ).toGradientDirection()
        }

        // Init Shadow
        shadowEnable = attributes.getBoolean(R.styleable.CircleView_cv_shadow, shadowEnable)
        if (shadowEnable) {
            shadowColor = attributes.getColor(R.styleable.CircleView_cv_shadow_color, shadowColor)
            shadowGravity =
                attributes.getInteger(R.styleable.CircleView_cv_shadow_gravity, shadowGravity.value)
                    .toShadowGravity()
            shadowRadius =
                attributes.getFloat(R.styleable.CircleView_cv_shadow_radius, DEFAULT_SHADOW_RADIUS)
        }

        attributes.recycle()
    }

    override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
        super.onSizeChanged(w, h, oldw, oldh)
        update()
    }

    //region Draw Method
    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)

        val circleCenterWithBorder = circleCenter + borderWidth
        val margeWithShadowRadius = if (shadowEnable) shadowRadius * 2 else 0f

        // Draw Shadow
        if (shadowEnable) {
            drawShadow()
            canvas.drawCircle(
                circleCenterWithBorder,
                circleCenterWithBorder,
                circleCenterWithBorder - margeWithShadowRadius,
                paintShadow
            )
        }

        // Draw Border
        canvas.drawCircle(
            circleCenterWithBorder,
            circleCenterWithBorder,
            circleCenterWithBorder - margeWithShadowRadius,
            paintBorder
        )
        // Draw Circle background
        canvas.drawCircle(
            circleCenterWithBorder,
            circleCenterWithBorder,
            circleCenter - margeWithShadowRadius,
            paint
        )
    }

    private fun update() {
        val usableWidth = width - (paddingLeft + paddingRight)
        val usableHeight = height - (paddingTop + paddingBottom)
        heightCircle = min(usableWidth, usableHeight)

        circleCenter = (heightCircle - borderWidth * 2).toInt() / 2
        manageCircleColor()
        manageBorderColor()
        manageElevation()
        invalidate()
    }

    private fun manageCircleColor() {
        paint.shader = createLinearGradient(
            circleColorStart ?: circleColor,
            circleColorEnd ?: circleColor, circleColorDirection
        )
    }

    private fun manageBorderColor() {
        val borderColor = if (borderWidth == 0f) circleColor else this.borderColor
        paintBorder.shader = createLinearGradient(
            borderColorStart ?: borderColor,
            borderColorEnd ?: borderColor, borderColorDirection
        )
    }

    private fun createLinearGradient(
        startColor: Int,
        endColor: Int,
        gradientDirection: GradientDirection
    ): LinearGradient {
        var x0 = 0f
        var y0 = 0f
        var x1 = 0f
        var y1 = 0f
        when (gradientDirection) {
            GradientDirection.LEFT_TO_RIGHT -> x1 = width.toFloat()
            GradientDirection.RIGHT_TO_LEFT -> x0 = width.toFloat()
            GradientDirection.TOP_TO_BOTTOM -> y1 = height.toFloat()
            GradientDirection.BOTTOM_TO_TOP -> y0 = height.toFloat()
        }
        return LinearGradient(x0, y0, x1, y1, startColor, endColor, Shader.TileMode.CLAMP)
    }

    private fun manageElevation() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            outlineProvider = if (!shadowEnable) object : ViewOutlineProvider() {
                override fun getOutline(view: View?, outline: Outline?) {
                    outline?.setOval(0, 0, heightCircle, heightCircle)
                }
            } else null
        }
    }

    private fun drawShadow() {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
            setLayerType(LAYER_TYPE_SOFTWARE, paintShadow)
        }

        var dx = 0f
        var dy = 0f

        when (shadowGravity) {
            ShadowGravity.CENTER -> {
                /*dx, dy = 0.0f*/
            }
            ShadowGravity.TOP -> dy = -shadowRadius / 2
            ShadowGravity.BOTTOM -> dy = shadowRadius / 2
            ShadowGravity.START -> dx = -shadowRadius / 2
            ShadowGravity.END -> dx = shadowRadius / 2
        }

        paintShadow.setShadowLayer(shadowRadius, dx, dy, shadowColor)
    }
    //endregion

    //region Measure Method
    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        val usableWidth = measure(widthMeasureSpec) - (paddingLeft + paddingRight)
        val usableHeight = measure(heightMeasureSpec) - (paddingTop + paddingBottom)
        heightCircle = min(usableWidth, usableHeight)
        setMeasuredDimension(heightCircle, heightCircle)
    }

    private fun measure(measureSpec: Int): Int {
        val specMode = MeasureSpec.getMode(measureSpec)
        val specSize = MeasureSpec.getSize(measureSpec)
        return when (specMode) {
            MeasureSpec.EXACTLY -> specSize // The parent has determined an exact size for the child.
            MeasureSpec.AT_MOST -> specSize // The child can be as large as it wants up to the specified size.
            else -> heightCircle // The parent has not imposed any constraint on the child.
        }
    }
    //endregion

    private fun Int.toShadowGravity(): ShadowGravity =
        when (this) {
            1 -> ShadowGravity.CENTER
            2 -> ShadowGravity.TOP
            3 -> ShadowGravity.BOTTOM
            4 -> ShadowGravity.START
            5 -> ShadowGravity.END
            else -> throw IllegalArgumentException("This value is not supported for ShadowGravity: $this")
        }

    private fun Int.toGradientDirection(): GradientDirection =
        when (this) {
            1 -> GradientDirection.LEFT_TO_RIGHT
            2 -> GradientDirection.RIGHT_TO_LEFT
            3 -> GradientDirection.TOP_TO_BOTTOM
            4 -> GradientDirection.BOTTOM_TO_TOP
            else -> throw IllegalArgumentException("This value is not supported for GradientDirection: $this")
        }

    /**
     * ShadowGravity enum class to set the gravity of the CircleView shadow
     */
    enum class ShadowGravity(val value: Int) {
        CENTER(1),
        TOP(2),
        BOTTOM(3),
        START(4),
        END(5)
    }

    /**
     * GradientDirection enum class to set the direction of the gradient color
     */
    enum class GradientDirection(val value: Int) {
        LEFT_TO_RIGHT(1),
        RIGHT_TO_LEFT(2),
        TOP_TO_BOTTOM(3),
        BOTTOM_TO_TOP(4)
    }

}


================================================
FILE: circleview/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="CircleView">
        <attr name="cv_color" format="color" />
        <attr name="cv_color_start" format="color" />
        <attr name="cv_color_end" format="color" />
        <attr name="cv_color_direction">
            <flag name="left_to_right" value="1" />
            <flag name="right_to_left" value="2" />
            <flag name="top_to_bottom" value="3" />
            <flag name="bottom_to_top" value="4" />
        </attr>
        <attr name="cv_border" format="boolean" />
        <attr name="cv_border_width" format="dimension" />
        <attr name="cv_border_color" format="color" />
        <attr name="cv_border_color_start" format="color" />
        <attr name="cv_border_color_end" format="color" />
        <attr name="cv_border_color_direction">
            <flag name="left_to_right" value="1" />
            <flag name="right_to_left" value="2" />
            <flag name="top_to_bottom" value="3" />
            <flag name="bottom_to_top" value="4" />
        </attr>
        <attr name="cv_shadow" format="boolean" />
        <attr name="cv_shadow_color" format="color" />
        <attr name="cv_shadow_radius" format="float" />
        <attr name="cv_shadow_gravity">
            <flag name="center" value="1" />
            <flag name="top" value="2" />
            <flag name="bottom" value="3" />
            <flag name="start" value="4" />
            <flag name="end" value="5" />
        </attr>
    </declare-styleable>
</resources>

================================================
FILE: circleview-example/build.gradle
================================================
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.ben-manes.versions'

android {
    compileSdkVersion androidCompileSdkVersion
    defaultConfig {
        applicationId "com.mikhaellopez.circleviewsample"
        minSdkVersion androidMinSdkVersion
        targetSdkVersion androidTargetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
        }
    }
}

dependencies {
    implementation project(':circleview')
    //implementation "com.mikhaellopez:circleview:$androidVersionName"

    // KOTLIN
    implementation kotlinStdlib
    // ANDROID
    implementation androidXAppCompat
    // UI
    implementation lobsterPicker

    // DEPENDENCY CHECK STRATEGY
    dependencyUpdates.resolutionStrategy dependencyUpdatesStrategy
}


================================================
FILE: circleview-example/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.mikhaellopez.circleviewsample">

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Base.Theme"
        tools:ignore="GoogleAppIndexingWarning">
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


================================================
FILE: circleview-example/src/main/java/com/mikhaellopez/circleviewsample/MainActivity.kt
================================================
package com.mikhaellopez.circleviewsample

import android.os.Bundle
import android.widget.SeekBar
import androidx.appcompat.app.AppCompatActivity
import com.larswerkman.lobsterpicker.OnColorListener
import com.larswerkman.lobsterpicker.sliders.LobsterShadeSlider
import com.mikhaellopez.circleview.CircleView

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val circleView = findViewById<CircleView>(R.id.circleView)

        findViewById<SeekBar>(R.id.seekBarBorderWidth).onProgressChanged {
            circleView.borderWidth = it.toFloat()
        }
        findViewById<SeekBar>(R.id.seekBarShadowRadius).onProgressChanged {
            circleView.shadowRadius = it.toFloat()
        }
        findViewById<LobsterShadeSlider>(R.id.shadeSlider).onColorChanged {
            circleView.circleColor = it
            circleView.shadowColor = it
        }
    }

    //region Extensions
    private fun SeekBar.onProgressChanged(onProgressChanged: (Int) -> Unit) {
        setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
                onProgressChanged(progress)
            }

            override fun onStartTrackingTouch(seekBar: SeekBar?) {
                // Nothing
            }

            override fun onStopTrackingTouch(seekBar: SeekBar?) {
                // Nothing
            }
        })
    }

    private fun LobsterShadeSlider.onColorChanged(onColorChanged: (Int) -> Unit) {
        addOnColorListener(object : OnColorListener {
            override fun onColorChanged(color: Int) {
                onColorChanged(color)
            }

            override fun onColorSelected(color: Int) {
                // Nothing
            }
        })
    }
    //endregion

}

================================================
FILE: circleview-example/src/main/res/layout/activity_main.xml
================================================
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="vertical">

        <com.mikhaellopez.circleview.CircleView
            android:id="@+id/circleView"
            android:layout_width="300dp"
            android:layout_height="300dp"
            app:cv_border="true"
            app:cv_border_color="#000000"
            app:cv_border_width="8dp"
            app:cv_color="#3f51b5"
            app:cv_shadow="true"
            app:cv_shadow_color="#3f51b5"
            app:cv_shadow_radius="10" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="240dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="40dp"
        android:gravity="center"
        android:orientation="vertical">

        <SeekBar
            android:id="@+id/seekBarBorderWidth"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:max="200"
            android:progress="8" />

        <SeekBar
            android:id="@+id/seekBarShadowRadius"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:max="40"
            android:progress="8" />

        <com.larswerkman.lobsterpicker.sliders.LobsterShadeSlider
            android:id="@+id/shadeSlider"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp" />

    </LinearLayout>

</LinearLayout>

================================================
FILE: circleview-example/src/main/res/layout/layout_demo.xml
================================================
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical">

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="30dp"
        app:cv_border="true"
        app:cv_border_color="#ba6b6c"
        app:cv_border_width="8dp"
        app:cv_color="#ef9a9a"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="280dp"
        android:layout_height="280dp"
        android:layout_marginLeft="80dp"
        android:layout_marginTop="100dp"
        app:cv_border="true"
        app:cv_border_color="#bf5f82"
        app:cv_border_width="8dp"
        app:cv_color="#f48fb1"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="240dp"
        android:layout_height="240dp"
        android:layout_marginLeft="130dp"
        android:layout_marginTop="170dp"
        app:cv_border="true"
        app:cv_border_color="#9c64a6"
        app:cv_border_width="7dp"
        app:cv_color="#ce93d8"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="240dp"
        app:cv_border="true"
        app:cv_border_color="#836fa9"
        app:cv_border_width="7dp"
        app:cv_color="#b39ddb"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="240dp"
        app:cv_border="true"
        app:cv_border_color="#6f79a8"
        app:cv_border_width="7dp"
        app:cv_color="#9fa8da"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="160dp"
        android:layout_height="160dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="300dp"
        app:cv_border="true"
        app:cv_border_color="#5d99c6"
        app:cv_border_width="6dp"
        app:cv_color="#90caf9"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="360dp"
        app:cv_border="true"
        app:cv_border_color="#4bacb8"
        app:cv_border_width="6dp"
        app:cv_color="#80deea"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="90dp"
        android:layout_height="90dp"
        android:layout_marginLeft="130dp"
        android:layout_marginTop="400dp"
        app:cv_border="true"
        app:cv_border_color="#4f9a94"
        app:cv_border_width="6dp"
        app:cv_color="#80cbc4"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_marginLeft="110dp"
        android:layout_marginTop="430dp"
        app:cv_border="true"
        app:cv_border_color="#75a478"
        app:cv_border_width="5dp"
        app:cv_color="#a5d6a7"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_marginLeft="100dp"
        android:layout_marginTop="460dp"
        app:cv_border="true"
        app:cv_border_color="#94af76"
        app:cv_border_width="5dp"
        app:cv_color="#c5e1a5"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_marginLeft="90dp"
        android:layout_marginTop="485dp"
        app:cv_border="true"
        app:cv_border_color="#b3bc6d"
        app:cv_border_width="4dp"
        app:cv_color="#e6ee9c"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_marginLeft="95dp"
        android:layout_marginTop="505dp"
        app:cv_border="true"
        app:cv_border_color="#cbc26d"
        app:cv_border_width="3dp"
        app:cv_color="#fff59d"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:layout_marginLeft="110dp"
        android:layout_marginTop="515dp"
        app:cv_border="true"
        app:cv_border_color="#caae53"
        app:cv_border_width="3dp"
        app:cv_color="#ffe082"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_marginLeft="125dp"
        android:layout_marginTop="525dp"
        app:cv_border="true"
        app:cv_border_color="#ca9b52"
        app:cv_border_width="2dp"
        app:cv_color="#ffcc80"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="15dp"
        android:layout_height="15dp"
        android:layout_marginLeft="135dp"
        android:layout_marginTop="532dp"
        app:cv_border="true"
        app:cv_border_color="#c97b63"
        app:cv_border_width="2dp"
        app:cv_color="#ffab91"
        tools:ignore="RtlHardcoded" />

    <com.mikhaellopez.circleview.CircleView
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_gravity="bottom|end"
        android:layout_marginRight="14dp"
        android:layout_marginBottom="14dp"
        app:cv_border="true"
        app:cv_border_color="#000000"
        app:cv_border_width="4dp"
        app:cv_color="@color/primary"
        app:cv_shadow="true"
        tools:ignore="RtlHardcoded" />

</FrameLayout>

================================================
FILE: circleview-example/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="primary">#424242</color>
    <color name="primary_dark">#212121</color>
    <color name="accent">@color/primary</color>
</resources>


================================================
FILE: circleview-example/src/main/res/values/strings.xml
================================================
<resources>
    <string name="app_name">CircleView</string>
</resources>


================================================
FILE: circleview-example/src/main/res/values/themes.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="Base.Theme" parent="Base.V1.Theme" />

    <style name="Base.V1.Theme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
    </style>

</resources>



================================================
FILE: circleview-example/src/main/res/values-v21/themes.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="Base.Theme" parent="Base.V21.Theme" />

    <style name="Base.V21.Theme" parent="Base.V1.Theme">
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:navigationBarColor">@color/primary</item>
    </style>

</resources>

================================================
FILE: dependencies.gradle
================================================
allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

ext {
    // APP VERSION
    androidVersionCode          = 14
    androidVersionName          = '1.4.1'
    libraryGroupId              = 'com.mikhaellopez'
    libraryArtifactId           = 'circleview'
    libraryVersion              = androidVersionName

    // ANDROID VERSION
    androidCompileSdkVersion    = 32
    androidMinSdkVersion        = 14
    androidTargetSdkVersion     = androidCompileSdkVersion

    // KOTLIN
    kotlinStdlib                = "org.jetbrains.kotlin:kotlin-stdlib:$ext.kotlin_version"

    // ANDROID LIB
    androidXAppCompat           = "androidx.appcompat:appcompat:1.5.0"

    // UI
    lobsterPicker               = "com.larswerkman:lobsterpicker:1.0.1"

    // DEPENDENCY CHECK STRATEGY
    dependencyUpdatesStrategy = {
        def isNonStable = { String version ->
            def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { keyword ->
                version.toUpperCase().contains(keyword)
            }
            def regex = /^[0-9,.v-]+(-r)?$/
            return !stableKeyword && !(version ==~ regex)
        }
        componentSelection {
            all {
                if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
                    reject('Release candidate')
                }
            }
        }
    }
}


================================================
FILE: gradle/publish-mavencentral.gradle
================================================
apply plugin: 'maven-publish'
apply plugin: 'signing'

task androidSourcesJar(type: Jar) {
    archiveClassifier.set('sources')
    from android.sourceSets.main.java.sourceFiles
}

afterEvaluate {
    publishing {
        publications {
            release(MavenPublication) {
                groupId = libraryGroupId
                artifactId = libraryArtifactId
                version = libraryVersion

                from components.release
                artifact androidSourcesJar

                pom {
                    name = 'CircleView'
                    packaging = 'aar'
                    description = 'This is an Android project allowing to realize a circular View in the simplest way possible.'
                    url = 'https://github.com/lopspower/CircleView'

                    groupId = libraryGroupId
                    artifactId = libraryArtifactId
                    version = libraryVersion

                    scm {
                        connection = 'scm:git:https://github.com/lopspower/CircleView'
                        developerConnection = 'scm:git:https://github.com/lopspower/CircleView'
                        url = 'https://github.com/lopspower/CircleView'
                    }
                    licenses {
                        license {
                            name = 'The Apache License, Version 2.0'
                            url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                        }
                    }
                    developers {
                        developer {
                            id = 'mikhael.lopez'
                            name = 'Mikhael LOPEZ'
                            email = 'lopez.mikhael@gmail.com'
                        }
                    }
                }
            }
        }
        repositories {
            maven {
                name = "ossrh"
                url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
                credentials {
                    username = ossrhUsername
                    password = ossrhPassword
                }
            }
        }
    }
}

signing {
    sign publishing.publications
}

================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Fri Sep 13 10:50:05 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip


================================================
FILE: gradle.properties
================================================
android.useAndroidX=true
android.enableJetifier=true

================================================
FILE: gradlew
================================================
#!/usr/bin/env sh

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
    echo "$*"
}

die () {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
  NONSTOP* )
    nonstop=true
    ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
    JAVACMD=`cygpath --unix "$JAVACMD"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Escape application args
save () {
    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
    echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
  cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"


================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: publish.sh
================================================
#!/usr/bin/env bash
./gradlew clean
./gradlew publish

================================================
FILE: settings.gradle
================================================
include ':circleview-example', ':circleview'
Download .txt
gitextract_utrmu8py/

├── .gitignore
├── LICENSE
├── README.md
├── build.gradle
├── circleview/
│   ├── build.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── mikhaellopez/
│           │           └── circleview/
│           │               └── CircleView.kt
│           └── res/
│               └── values/
│                   └── attrs.xml
├── circleview-example/
│   ├── build.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── mikhaellopez/
│           │           └── circleviewsample/
│           │               └── MainActivity.kt
│           └── res/
│               ├── layout/
│               │   ├── activity_main.xml
│               │   └── layout_demo.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── strings.xml
│               │   └── themes.xml
│               └── values-v21/
│                   └── themes.xml
├── dependencies.gradle
├── gradle/
│   ├── publish-mavencentral.gradle
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── publish.sh
└── settings.gradle
Condensed preview — 26 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (59K chars).
[
  {
    "path": ".gitignore",
    "chars": 84,
    "preview": "# GENERATED\n*build\n.gradle\n.DS_Store\n\n# LOCAL\nlocal.properties\n\n# IDEA\n*.idea\n*.iml\n"
  },
  {
    "path": "LICENSE",
    "chars": 11310,
    "preview": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licens"
  },
  {
    "path": "README.md",
    "chars": 5786,
    "preview": "CircleView\n=================\n\n<img src=\"/preview/preview.gif\" alt=\"sample\" title=\"sample\" width=\"300\" height=\"533\" align"
  },
  {
    "path": "build.gradle",
    "chars": 572,
    "preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\napply from: 'depende"
  },
  {
    "path": "circleview/build.gradle",
    "chars": 524,
    "preview": "apply plugin: 'com.android.library'\napply plugin: 'kotlin-android'\n\napply from: rootProject.file('gradle/publish-mavence"
  },
  {
    "path": "circleview/src/main/AndroidManifest.xml",
    "chars": 51,
    "preview": "<manifest package=\"com.mikhaellopez.circleview\" />\n"
  },
  {
    "path": "circleview/src/main/java/com/mikhaellopez/circleview/CircleView.kt",
    "chars": 11149,
    "preview": "package com.mikhaellopez.circleview\n\nimport android.content.Context\nimport android.graphics.*\nimport android.os.Build\nim"
  },
  {
    "path": "circleview/src/main/res/values/attrs.xml",
    "chars": 1542,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <declare-styleable name=\"CircleView\">\n        <attr name=\"cv_colo"
  },
  {
    "path": "circleview-example/build.gradle",
    "chars": 858,
    "preview": "apply plugin: 'com.android.application'\napply plugin: 'kotlin-android'\napply plugin: 'com.github.ben-manes.versions'\n\nan"
  },
  {
    "path": "circleview-example/src/main/AndroidManifest.xml",
    "chars": 749,
    "preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n"
  },
  {
    "path": "circleview-example/src/main/java/com/mikhaellopez/circleviewsample/MainActivity.kt",
    "chars": 1961,
    "preview": "package com.mikhaellopez.circleviewsample\n\nimport android.os.Bundle\nimport android.widget.SeekBar\nimport androidx.appcom"
  },
  {
    "path": "circleview-example/src/main/res/layout/activity_main.xml",
    "chars": 1950,
    "preview": "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/r"
  },
  {
    "path": "circleview-example/src/main/res/layout/layout_demo.xml",
    "chars": 6383,
    "preview": "<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/re"
  },
  {
    "path": "circleview-example/src/main/res/values/colors.xml",
    "chars": 201,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"primary\">#424242</color>\n    <color name=\"primary_da"
  },
  {
    "path": "circleview-example/src/main/res/values/strings.xml",
    "chars": 73,
    "preview": "<resources>\n    <string name=\"app_name\">CircleView</string>\n</resources>\n"
  },
  {
    "path": "circleview-example/src/main/res/values/themes.xml",
    "chars": 389,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"Base.Theme\" parent=\"Base.V1.Theme\" />\n\n    <style n"
  },
  {
    "path": "circleview-example/src/main/res/values-v21/themes.xml",
    "chars": 335,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"Base.Theme\" parent=\"Base.V21.Theme\" />\n\n    <style "
  },
  {
    "path": "dependencies.gradle",
    "chars": 1385,
    "preview": "allprojects {\n    repositories {\n        google()\n        mavenCentral()\n    }\n}\n\next {\n    // APP VERSION\n    androidVe"
  },
  {
    "path": "gradle/publish-mavencentral.gradle",
    "chars": 2195,
    "preview": "apply plugin: 'maven-publish'\napply plugin: 'signing'\n\ntask androidSourcesJar(type: Jar) {\n    archiveClassifier.set('so"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 233,
    "preview": "#Fri Sep 13 10:50:05 CEST 2019\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER"
  },
  {
    "path": "gradle.properties",
    "chars": 52,
    "preview": "android.useAndroidX=true\nandroid.enableJetifier=true"
  },
  {
    "path": "gradlew",
    "chars": 5296,
    "preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n##  Gradle start up"
  },
  {
    "path": "gradlew.bat",
    "chars": 2176,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
  },
  {
    "path": "publish.sh",
    "chars": 53,
    "preview": "#!/usr/bin/env bash\n./gradlew clean\n./gradlew publish"
  },
  {
    "path": "settings.gradle",
    "chars": 45,
    "preview": "include ':circleview-example', ':circleview'\n"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the lopspower/CircleView GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 26 files (54.1 KB), approximately 13.8k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!