Skip to content
This repository has been archived by the owner on Nov 28, 2021. It is now read-only.

Commit

Permalink
0.1.1 - removed custom attributes to resolve possible attribute name …
Browse files Browse the repository at this point in the history
…conflicts
  • Loading branch information
ntoskrnl committed Oct 29, 2014
1 parent b8f3f97 commit e63762d
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 107 deletions.
28 changes: 3 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ The labrary is available in maven repository.
You can include your library in your **build.gradle**:

```
compile 'com.cardiomood.android:android-widgets:0.1'
compile 'com.cardiomood.android:android-widgets:0.1.1'
```

If you are using Maven, add the following dependency to **pom.xml**:
```xml
<dependency>
<groupId>com.cardiomood.android</groupId>
<artifactId>android-widgets</artifactId>
<version>0.1</version>
<version>0.1.1</version>
<type>aar</type>
</dependency>
```
Expand Down Expand Up @@ -81,26 +81,4 @@ Configure SpeedometerGuge:
speedometer.addColoredRange(140, 180, Color.YELLOW);
speedometer.addColoredRange(180, 400, Color.RED);

```

### Version History

**SpeedometerView 1.0.1**

- added attribute labelTextSize
- text is drawn in dp (looks the same on all screens now)
- fixed needle artifact

Download: [SpeedometerView-v1.0.1](https://github.com/ntoskrnl/SpeedometerView/releases/tag/SpeedometerView-v1.0.1)

**SpeedometerView 1.0**

Minimal Android SDK version: 9 (Android 2.3)

**Supported features**:
- Major and minor tick marks
- Custom labels
- Colored value ranges
- Animation of arrow (*requires Android API level 11+*)

Download: [SpeedometerView-v1.0](https://github.com/ntoskrnl/SpeedometerView/releases/tag/SpeedometerView-v1.0)
```
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=0.1
VERSION_NAME=0.1.1
VERSION_CODE=1
GROUP=com.cardiomood.android

Expand Down
6 changes: 3 additions & 3 deletions main/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 19
compileSdkVersion 21
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.cardiomood.android.controls"
minSdkVersion 9
targetSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "0.1"
versionName "0.1.1"
}
buildTypes {
release {
Expand Down
2 changes: 1 addition & 1 deletion main/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package="com.cardiomood.android.controls">

<application android:allowBackup="true">

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BlurMaskFilter;
Expand Down Expand Up @@ -75,20 +74,20 @@ public BatteryIndicatorGauge(Context context, AttributeSet attrs) {
super(context, attrs);
density = getResources().getDisplayMetrics().density;

TypedArray attributes = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.BatteryIndicatorGauge,
0, 0);

try {
// read attributes
setMax(attributes.getFloat(R.styleable.BatteryIndicatorGauge_max, (float) DEFAULT_MAX));
setMin(attributes.getFloat(R.styleable.BatteryIndicatorGauge_min, (float) DEFAULT_MIN));
setValue(attributes.getFloat(R.styleable.BatteryIndicatorGauge_value, DEFAULT_VALUE));
setOrientation(attributes.getInt(R.styleable.BatteryIndicatorGauge_orientation, DEFAULT_ORIENTATION));
} finally {
attributes.recycle();
}
// TypedArray attributes = context.getTheme().obtainStyledAttributes(
// attrs,
// R.styleable.BatteryIndicatorGauge,
// 0, 0);
//
// try {
// // read attributes
// setMax(attributes.getFloat(R.styleable.BatteryIndicatorGauge_max, (float) DEFAULT_MAX));
// setMin(attributes.getFloat(R.styleable.BatteryIndicatorGauge_min, (float) DEFAULT_MIN));
// setValue(attributes.getFloat(R.styleable.BatteryIndicatorGauge_value, DEFAULT_VALUE));
// setOrientation(attributes.getInt(R.styleable.BatteryIndicatorGauge_orientation, DEFAULT_ORIENTATION));
// } finally {
// attributes.recycle();
// }

init();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
Expand Down Expand Up @@ -67,20 +66,20 @@ public SpeedometerGauge(Context context) {
public SpeedometerGauge(Context context, AttributeSet attrs) {
super(context, attrs);

float density = getResources().getDisplayMetrics().density;
TypedArray attributes = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.SpeedometerGauge,
0, 0);

try {
// read attributes
setMaxSpeed(attributes.getFloat(R.styleable.SpeedometerGauge_maxSpeed, (float) DEFAULT_MAX_SPEED));
setSpeed(attributes.getFloat(R.styleable.SpeedometerGauge_speed, 0));
setLabelTextSize(attributes.getDimensionPixelSize(R.styleable.SpeedometerGauge_labelTextSize, Math.round(DEFAULT_LABEL_TEXT_SIZE_DP * density)));
} finally {
attributes.recycle();
}
// float density = getResources().getDisplayMetrics().density;
// TypedArray attributes = context.getTheme().obtainStyledAttributes(
// attrs,
// R.styleable.SpeedometerGauge,
// 0, 0);
//
// try {
// // read attributes
// setMaxSpeed(attributes.getFloat(R.styleable.SpeedometerGauge_maxSpeed, (float) DEFAULT_MAX_SPEED));
// setSpeed(attributes.getFloat(R.styleable.SpeedometerGauge_speed, 0));
// setLabelTextSize(attributes.getDimensionPixelSize(R.styleable.SpeedometerGauge_labelTextSize, Math.round(DEFAULT_LABEL_TEXT_SIZE_DP * density)));
// } finally {
// attributes.recycle();
// }
init();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

import com.cardiomood.android.controls.R;

/**
* Created by danon on 01.03.14.
*/
Expand Down Expand Up @@ -50,22 +47,34 @@ public CircularProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);

density = getResources().getDisplayMetrics().density;
TypedArray attributes = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.CircularProgressBar,
0, 0);

try {
// read attributes
setMax(attributes.getFloat(R.styleable.CircularProgressBar_max, (float) DEFAULT_MAX));
setMin(attributes.getFloat(R.styleable.CircularProgressBar_min, (float) DEFAULT_MIN));
setProgress(attributes.getFloat(R.styleable.CircularProgressBar_progress, 0));
setLineWidth(attributes.getDimensionPixelSize(R.styleable.CircularProgressBar_lineWidth, DEFAULT_LINE_WIDTH));
setColor(attributes.getColor(R.styleable.CircularProgressBar_color, DEFAULT_COLOR));
setTextSize(attributes.getDimensionPixelSize(R.styleable.CircularProgressBar_textSize, Math.round(DEFAULT_TEXT_SIZE * density)));
} finally {
attributes.recycle();
}
textSize = DEFAULT_TEXT_SIZE*density;

// density = getResources().getDisplayMetrics().density;
// TypedArray attributes = context.getTheme().obtainStyledAttributes(
// attrs,
// R.styleable.CircularProgressBar,
// 0, 0);
//
// try {
// // read attributes
// setMax(attributes.getFloat(R.styleable.CircularProgressBar_max, (float) DEFAULT_MAX));
// setMin(attributes.getFloat(R.styleable.CircularProgressBar_min, (float) DEFAULT_MIN));
// setProgress(attributes.getFloat(R.styleable.CircularProgressBar_progress, 0));
// setLineWidth(attributes.getDimensionPixelSize(R.styleable.CircularProgressBar_lineWidth, DEFAULT_LINE_WIDTH));
// setColor(attributes.getColor(R.styleable.CircularProgressBar_color, DEFAULT_COLOR));
// setTextSize(attributes.getDimensionPixelSize(R.styleable.CircularProgressBar_textSize, Math.round(DEFAULT_TEXT_SIZE * density)));
// } finally {
// attributes.recycle();
// }

init();
}

public CircularProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);

density = getResources().getDisplayMetrics().density;
textSize = DEFAULT_TEXT_SIZE*density;

init();
}
Expand Down
28 changes: 0 additions & 28 deletions main/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<attr name="min" format="float" />
<attr name="max" format="float" />

<declare-styleable name="CircularProgressBar">
<attr name="max"/>
<attr name="progress" format="float" />
<attr name="min" />
<attr name="color" format="color" />
<attr name="lineWidth" format="dimension" />
<attr name="textSize" format="dimension" />
</declare-styleable>

<declare-styleable name="BatteryIndicatorGauge">
<attr name="value" format="float" />
<attr name="max"/>
<attr name="min"/>
<attr name="orientation" format="integer">
<enum name="horizontal" value="0"/>
<enum name="vertical" value="1"/>
</attr>
</declare-styleable>

<declare-styleable name="SpeedometerGauge">
<attr name="maxSpeed" format="float" />
<attr name="speed" format="float"/>
<attr name="labelTextSize" format="dimension" />
</declare-styleable>

</resources>

0 comments on commit e63762d

Please sign in to comment.