Skip to content

Commit

Permalink
Updated gradle, upgraded version to v.1.0.3
Browse files Browse the repository at this point in the history
Fixed mispelled variable.
  • Loading branch information
pkleczko committed Aug 1, 2016
1 parent a209f74 commit bd17569
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions CustomGauge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "1.0.2"
versionCode 3
versionName "1.0.3"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ public class CustomGauge extends View {
private int mStrokeColor;
private RectF mRect;
private String mStrokeCap;
private int mStartAngel;
private int mSweepAngel;
private int mStartAngle;
private int mSweepAngle;
private int mStartValue;
private int mEndValue;
private int mValue;
private double mPointAngel;
private double mPointAngle;
private int mPoint;
private int mPointSize;
private int mPointStartColor;
private int mPointEndColor;
private int mDividerColor;
private int mDividerSize;
private int mDividerStepAngel;
private int mDividerStepAngle;
private int mDividersCount;
private boolean mDividerDrawFirst;
private boolean mDividerDrawLast;
Expand All @@ -51,9 +51,9 @@ public CustomGauge(Context context, AttributeSet attrs) {
setStrokeColor(a.getColor(R.styleable.CustomGauge_gaugeStrokeColor, ContextCompat.getColor(context, android.R.color.darker_gray)));
setStrokeCap(a.getString(R.styleable.CustomGauge_gaugeStrokeCap));

// angel start and sweep (opposite direction 0, 270, 180, 90)
setStartAngel(a.getInt(R.styleable.CustomGauge_gaugeStartAngel, 0));
setSweepAngel(a.getInt(R.styleable.CustomGauge_gaugeSweepAngel, 360));
// angle start and sweep (opposite direction 0, 270, 180, 90)
setStartAngle(a.getInt(R.styleable.CustomGauge_gaugeStartAngle, 0));
setSweepAngle(a.getInt(R.styleable.CustomGauge_gaugeSweepAngle, 360));

// scale (from mStartValue to mEndValue)
setStartValue(a.getInt(R.styleable.CustomGauge_gaugeStartValue, 0));
Expand All @@ -72,13 +72,13 @@ public CustomGauge(Context context, AttributeSet attrs) {
setDividerDrawLast(a.getBoolean(R.styleable.CustomGauge_gaugeDividerDrawLast, true));

// calculating one point sweep
mPointAngel = ((double) Math.abs(mSweepAngel) / (mEndValue - mStartValue));
mPointAngle = ((double) Math.abs(mSweepAngle) / (mEndValue - mStartValue));

// calculating divider step
if (dividerSize > 0) {
mDividerSize = mSweepAngel / (Math.abs(mEndValue - mStartValue) / dividerSize);
mDividerSize = mSweepAngle / (Math.abs(mEndValue - mStartValue) / dividerSize);
mDividersCount = 100 / dividerStep;
mDividerStepAngel = mSweepAngel / mDividersCount;
mDividerStepAngle = mSweepAngle / mDividersCount;
}
a.recycle();
init();
Expand All @@ -101,7 +101,7 @@ else if (mStrokeCap.equals("ROUND"))
mRect = new RectF();

mValue = mStartValue;
mPoint = mStartAngel;
mPoint = mStartAngle;
}

@Override
Expand All @@ -124,11 +124,11 @@ protected void onDraw(Canvas canvas) {

mPaint.setColor(mStrokeColor);
mPaint.setShader(null);
canvas.drawArc(mRect, mStartAngel, mSweepAngel, false, mPaint);
canvas.drawArc(mRect, mStartAngle, mSweepAngle, false, mPaint);
mPaint.setColor(mPointStartColor);
mPaint.setShader(new LinearGradient(getWidth(), getHeight(), 0, 0, mPointEndColor, mPointStartColor, Shader.TileMode.CLAMP));
if (mPointSize>0) {//if size of pointer is defined
if (mPoint > mStartAngel + mPointSize/2) {
if (mPoint > mStartAngle + mPointSize/2) {
canvas.drawArc(mRect, mPoint - mPointSize/2, mPointSize, false, mPaint);
}
else { //to avoid excedding start/zero point
Expand All @@ -137,9 +137,9 @@ protected void onDraw(Canvas canvas) {
}
else { //draw from start point to value point (long pointer)
if (mValue==mStartValue) //use non-zero default value for start point (to avoid lack of pointer for start/zero value)
canvas.drawArc(mRect, mStartAngel, DEFAULT_LONG_POINTER_SIZE, false, mPaint);
canvas.drawArc(mRect, mStartAngle, DEFAULT_LONG_POINTER_SIZE, false, mPaint);
else
canvas.drawArc(mRect, mStartAngel, mPoint - mStartAngel, false, mPaint);
canvas.drawArc(mRect, mStartAngle, mPoint - mStartAngle, false, mPaint);
}

if (mDividerSize > 0) {
Expand All @@ -148,15 +148,15 @@ protected void onDraw(Canvas canvas) {
int i = mDividerDrawFirst ? 0 : 1;
int max = mDividerDrawLast ? mDividersCount + 1 : mDividersCount;
for (; i < max; i++) {
canvas.drawArc(mRect, mStartAngel + i*mDividerStepAngel, mDividerSize, false, mPaint);
canvas.drawArc(mRect, mStartAngle + i* mDividerStepAngle, mDividerSize, false, mPaint);
}
}

}

public void setValue(int value) {
mValue = value;
mPoint = (int) (mStartAngel + (mValue-mStartValue) * mPointAngel);
mPoint = (int) (mStartAngle + (mValue-mStartValue) * mPointAngle);
invalidate();
}

Expand Down Expand Up @@ -192,21 +192,21 @@ public void setStrokeCap(String strokeCap) {
}

@SuppressWarnings("unused")
public int getStartAngel() {
return mStartAngel;
public int getStartAngle() {
return mStartAngle;
}

public void setStartAngel(int startAngel) {
mStartAngel = startAngel;
public void setStartAngle(int startAngle) {
mStartAngle = startAngle;
}

@SuppressWarnings("unused")
public int getSweepAngel() {
return mSweepAngel;
public int getSweepAngle() {
return mSweepAngle;
}

public void setSweepAngel(int sweepAngel) {
mSweepAngel = sweepAngel;
public void setSweepAngle(int sweepAngle) {
mSweepAngle = sweepAngle;
}

@SuppressWarnings("unused")
Expand Down
4 changes: 2 additions & 2 deletions CustomGauge/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<attr name="gaugeStrokeColor" format="color" />
<attr name="gaugeStrokeWidth" format="dimension" />
<attr name="gaugeStrokeCap" format="string" />
<attr name="gaugeStartAngel" format="integer" />
<attr name="gaugeSweepAngel" format="integer" />
<attr name="gaugeStartAngle" format="integer" />
<attr name="gaugeSweepAngle" format="integer" />
<attr name="gaugeStartValue" format="integer" />
<attr name="gaugeEndValue" format="integer" />
<attr name="gaugeDividerSize" format="integer" />
Expand Down
12 changes: 6 additions & 6 deletions CustomGaugeExample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
app:gaugePointStartColor="@color/md_red_500"
app:gaugePointEndColor="@color/md_red_500"
app:gaugePointSize="6"
app:gaugeStartAngel="135"
app:gaugeStartAngle="135"
app:gaugeStrokeCap="ROUND"
app:gaugeStrokeColor="@color/md_grey_400"
app:gaugeStrokeWidth="10dp"
app:gaugeStartValue="0"
app:gaugeEndValue="1000"
app:gaugeSweepAngel="270" />
app:gaugeSweepAngle="270" />

<TextView
android:id="@+id/textView1"
Expand All @@ -64,12 +64,12 @@
app:gaugeEndValue="800"
app:gaugePointEndColor="@color/md_blue_800"
app:gaugePointStartColor="@color/md_blue_300"
app:gaugeStartAngel="135"
app:gaugeStartAngle="135"
app:gaugeStartValue="200"
app:gaugeStrokeCap="ROUND"
app:gaugeStrokeColor="@color/md_grey_400"
app:gaugeStrokeWidth="10dp"
app:gaugeSweepAngel="270" />
app:gaugeSweepAngle="270" />

<pl.pawelkleczkowski.customgauge.CustomGauge
android:id="@+id/gauge3"
Expand All @@ -86,12 +86,12 @@
app:gaugeEndValue="100"
app:gaugePointEndColor="@color/md_green_500"
app:gaugePointStartColor="@color/md_red_500"
app:gaugeStartAngel="180"
app:gaugeStartAngle="180"
app:gaugeStartValue="0"
app:gaugeStrokeCap="BUTT"
app:gaugeStrokeColor="@color/md_grey_400"
app:gaugeStrokeWidth="20dp"
app:gaugeSweepAngel="180"
app:gaugeSweepAngle="180"
app:gaugeDividerSize="1"
app:gaugeDividerColor="@color/md_yellow_500"
app:gaugeDividerStep="10"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Oct 21 11:34:03 PDT 2015
#Tue Aug 02 00:19:13 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

0 comments on commit bd17569

Please sign in to comment.