Skip to content

Commit

Permalink
Update: to v0.2.0 (≖ ‿ ≖)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangqi92 committed Feb 17, 2016
1 parent 6866607 commit f9acde9
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 48 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Include the library as a local library project or add the dependency in your bui

```groovy
dependencies {
compile 'me.itangqi.waveloadingview:library:0.1.5'
// I have uploaded v0.1.5 on 2016-01-14, if it doesn't take effect or your
// gradle cannot find it in maven central, you may try v0.1.4.
compile 'me.itangqi.waveloadingview:library:2.0.0'
// I have uploaded v2.0.0 on 2016-02-17, if it doesn't take effect or your
// gradle cannot find it in maven central, you may try v0.1.5.
}
```
Or
Expand All @@ -41,21 +41,21 @@ Include the WaveLoadingView widget in your layout. And you can customize it like
android:id="@+id/waveLoadingView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:mlv_borderColor="@color/colorAccent"
app:mlv_borderWidth="3dp"
app:mlv_progressValue="40"
app:mlv_shapeType="square"
app:mlv_titleBottom="Bottom Title"
app:mlv_titleBottomColor="@color/colorPrimaryText"
app:mlv_titleBottomSize="20sp"
app:mlv_titleCenter="Center Title"
app:mlv_titleCenterColor="@color/colorPrimaryText"
app:mlv_titleCenterSize="24sp"
app:mlv_titleTop="Top Title"
app:mlv_titleTopColor="@color/colorPrimaryText"
app:mlv_titleTopSize="20sp"
app:mlv_waveAmplitude="60"
app:mlv_waveColor="@color/colorAccent"/>
app:wlv_borderColor="@color/colorAccent"
app:wlv_borderWidth="3dp"
app:wlv_progressValue="40"
app:wlv_shapeType="circle"
app:wlv_titleBottom="Bottom Title"
app:wlv_titleBottomColor="@color/colorPrimaryText"
app:wlv_titleBottomSize="20sp"
app:wlv_titleCenter="Center Title"
app:wlv_titleCenterColor="@color/colorPrimaryText"
app:wlv_titleCenterSize="24sp"
app:wlv_titleTop="Top Title"
app:wlv_titleTopColor="@color/colorPrimaryText"
app:wlv_titleTopSize="20sp"
app:wlv_waveAmplitude="70"
app:wlv_waveColor="@color/colorAccent"/>
```

### Step 3
Expand All @@ -82,27 +82,42 @@ Do what you what :)

|name|format|description|
|:---:|:---:|:---:|
| mlv_borderWidth | dimension |set border width, default is 0
| mlv_borderColor | color |set border color
| mlv_progressValue | integer |set progress value, default is 50
| mlv_shapeType | enum |set shape type, default is circle
| mlv_waveColor | color |set wave color
| mlv_waveAmplitude | float |set wave amplitude
| mlv_titleTopSize | dimension |set top title size, default is 18
| mlv_titleCenterSize | dimension |set center title size, default is 22
| mlv_titleBottomSize | dimension |set bottom size, default is 18
| mlv_titleTopColor| color |set top title color
| mlv_titleCenterColor | color |set center title color
| mlv_titleBottomColor | color |set bottom title color
| mlv_titleTop | string |set top title content, default is null
| mlv_titleCenter | string |set center title content, default is null
| mlv_titleBottom | string |set bottom title content, default is null
| wlv_borderWidth | dimension |set border width, default is 0
| wlv_borderColor | color |set border color
| wlv_progressValue | integer |set progress value, default is 50
| wlv_shapeType | enum |set shape type, default is circle
| wlv_waveColor | color |set wave color
| wlv_waveAmplitude | float |set wave amplitude
| wlv_titleTopSize | dimension |set top title size, default is 18
| wlv_titleCenterSize | dimension |set center title size, default is 22
| wlv_titleBottomSize | dimension |set bottom size, default is 18
| wlv_titleTopColor| color |set top title color
| wlv_titleCenterColor | color |set center title color
| wlv_titleBottomColor | color |set bottom title color
| wlv_titleTop | string |set top title content, default is null
| wlv_titleCenter | string |set center title content, default is null
| wlv_titleBottom | string |set bottom title content, default is null

**All attributes have their respective getters and setters to change them at runtime.**


## Change Log

### 0.1.6 (2016-02-17)

#### Implemented enhancements:

- Prefix the attributes with "wlv"

#### Fixed bugs:

- setProgressValue() increase doesn't conform to logic [#8](https://github.com/tangqi92/WaveLoadingView/issues/8)

#### Update:

- Update `build.gradle`
- Update Sample

### 0.1.5 (2016-01-14)

#### Fixed bugs:
Expand All @@ -120,14 +135,8 @@ Do what you what :)

#### Fixed bugs:


- Attribute "borderWidth" has already been defined [#2](https://github.com/tangqi92/WaveLoadingView/issues/2)

#### Implemented enhancements:

- Prefix the attributes with "wlv"



## Demo

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

// This is the library version used when deploying the artifact.
version = "0.1.5"
version = "0.2.0"

android {
compileSdkVersion 23
Expand All @@ -12,8 +12,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
versionCode 2
versionName "2.0"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,47 +120,47 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr) {
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.WaveLoadingView, defStyleAttr, 0);

// Init ShapeType
mShapeType = attributes.getInteger(R.styleable.WaveLoadingView_mlv_shapeType, DEFAULT_WAVE_SHAPE);
mShapeType = attributes.getInteger(R.styleable.WaveLoadingView_wlv_shapeType, DEFAULT_WAVE_SHAPE);

// Init Wave
mWaveColor = attributes.getColor(R.styleable.WaveLoadingView_mlv_waveColor, DEFAULT_WAVE_COLOR);
mWaveColor = attributes.getColor(R.styleable.WaveLoadingView_wlv_waveColor, DEFAULT_WAVE_COLOR);

// Init AmplitudeRatio
float amplitudeRatioAttr = attributes.getFloat(R.styleable.WaveLoadingView_mlv_waveAmplitude, DEFAULT_AMPLITUDE_RATIO) / 1000;
float amplitudeRatioAttr = attributes.getFloat(R.styleable.WaveLoadingView_wlv_waveAmplitude, DEFAULT_AMPLITUDE_RATIO) / 1000;
mAmplitudeRatio = (amplitudeRatioAttr > DEFAULT_AMPLITUDE_RATIO) ? DEFAULT_AMPLITUDE_RATIO : amplitudeRatioAttr;

// Init Progress
mProgressValue = attributes.getInteger(R.styleable.WaveLoadingView_mlv_progressValue, DEFAULT_WAVE_PROGRESS_VALUE);
mProgressValue = attributes.getInteger(R.styleable.WaveLoadingView_wlv_progressValue, DEFAULT_WAVE_PROGRESS_VALUE);
setProgressValue(mProgressValue);

// Init Border
mBorderPaint = new Paint();
mBorderPaint.setAntiAlias(true);
mBorderPaint.setStyle(Paint.Style.STROKE);
mBorderPaint.setStrokeWidth(attributes.getDimension(R.styleable.WaveLoadingView_mlv_borderWidth, dp2px(DEFAULT_BORDER_WIDTH)));
mBorderPaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_mlv_borderColor, DEFAULT_WAVE_COLOR));
mBorderPaint.setStrokeWidth(attributes.getDimension(R.styleable.WaveLoadingView_wlv_borderWidth, dp2px(DEFAULT_BORDER_WIDTH)));
mBorderPaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_wlv_borderColor, DEFAULT_WAVE_COLOR));

// Init Title
mTopTitlePaint = new Paint();
mTopTitlePaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_mlv_titleTopColor, DEFAULT_TITLE_COLOR));
mTopTitlePaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_wlv_titleTopColor, DEFAULT_TITLE_COLOR));
mTopTitlePaint.setStyle(Paint.Style.FILL);
mTopTitlePaint.setAntiAlias(true);
mTopTitlePaint.setTextSize(attributes.getDimension(R.styleable.WaveLoadingView_mlv_titleTopSize, sp2px(DEFAULT_TITLE_TOP_SIZE)));
mTopTitle = attributes.getString(R.styleable.WaveLoadingView_mlv_titleTop);
mTopTitlePaint.setTextSize(attributes.getDimension(R.styleable.WaveLoadingView_wlv_titleTopSize, sp2px(DEFAULT_TITLE_TOP_SIZE)));
mTopTitle = attributes.getString(R.styleable.WaveLoadingView_wlv_titleTop);

mCenterTitlePaint = new Paint();
mCenterTitlePaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_mlv_titleCenterColor, DEFAULT_TITLE_COLOR));
mCenterTitlePaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_wlv_titleCenterColor, DEFAULT_TITLE_COLOR));
mCenterTitlePaint.setStyle(Paint.Style.FILL);
mCenterTitlePaint.setAntiAlias(true);
mCenterTitlePaint.setTextSize(attributes.getDimension(R.styleable.WaveLoadingView_mlv_titleCenterSize, sp2px(DEFAULT_TITLE_CENTER_SIZE)));
mCenterTitle = attributes.getString(R.styleable.WaveLoadingView_mlv_titleCenter);
mCenterTitlePaint.setTextSize(attributes.getDimension(R.styleable.WaveLoadingView_wlv_titleCenterSize, sp2px(DEFAULT_TITLE_CENTER_SIZE)));
mCenterTitle = attributes.getString(R.styleable.WaveLoadingView_wlv_titleCenter);

mBottomTitlePaint = new Paint();
mBottomTitlePaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_mlv_titleBottomColor, DEFAULT_TITLE_COLOR));
mBottomTitlePaint.setColor(attributes.getColor(R.styleable.WaveLoadingView_wlv_titleBottomColor, DEFAULT_TITLE_COLOR));
mBottomTitlePaint.setStyle(Paint.Style.FILL);
mBottomTitlePaint.setAntiAlias(true);
mBottomTitlePaint.setTextSize(attributes.getDimension(R.styleable.WaveLoadingView_mlv_titleBottomSize, sp2px(DEFAULT_TITLE_BOTTOM_SIZE)));
mBottomTitle = attributes.getString(R.styleable.WaveLoadingView_mlv_titleBottom);
mBottomTitlePaint.setTextSize(attributes.getDimension(R.styleable.WaveLoadingView_wlv_titleBottomSize, sp2px(DEFAULT_TITLE_BOTTOM_SIZE)));
mBottomTitle = attributes.getString(R.styleable.WaveLoadingView_wlv_titleBottom);
}

@Override
Expand Down Expand Up @@ -409,7 +409,7 @@ public float getAmplitudeRatio() {
*/
public void setProgressValue(int progress) {
mProgressValue = progress;
ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(this, "waterLevelRatio", mWaterLevelRatio, 1f - ((float) progress / 100));
ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(this, "waterLevelRatio", mWaterLevelRatio, ((float) mProgressValue / 100));
waterLevelAnim.setDuration(1000);
waterLevelAnim.setInterpolator(new DecelerateInterpolator());
AnimatorSet animatorSetProgress = new AnimatorSet();
Expand Down
30 changes: 15 additions & 15 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<resources>

<declare-styleable name="WaveLoadingView">
<attr name="mlv_borderWidth" format="dimension"/>
<attr name="mlv_borderColor" format="color"/>
<attr name="mlv_progressValue" format="integer"/>
<attr name="mlv_shapeType" format="enum">
<attr name="wlv_borderWidth" format="dimension"/>
<attr name="wlv_borderColor" format="color"/>
<attr name="wlv_progressValue" format="integer"/>
<attr name="wlv_shapeType" format="enum">
<enum name="circle" value="0" />
<enum name="square" value="1" />
</attr>
<attr name="mlv_waveColor" format="color"/>
<attr name="mlv_waveAmplitude" format="float"/>
<attr name="mlv_titleTopSize" format="dimension"/>
<attr name="mlv_titleCenterSize" format="dimension"/>
<attr name="mlv_titleBottomSize" format="dimension"/>
<attr name="mlv_titleTopColor" format="color"/>
<attr name="mlv_titleCenterColor" format="color"/>
<attr name="mlv_titleBottomColor" format="color"/>
<attr name="mlv_titleTop" format="string"/>
<attr name="mlv_titleCenter" format="string"/>
<attr name="mlv_titleBottom" format="string"/>
<attr name="wlv_waveColor" format="color"/>
<attr name="wlv_waveAmplitude" format="float"/>
<attr name="wlv_titleTopSize" format="dimension"/>
<attr name="wlv_titleCenterSize" format="dimension"/>
<attr name="wlv_titleBottomSize" format="dimension"/>
<attr name="wlv_titleTopColor" format="color"/>
<attr name="wlv_titleCenterColor" format="color"/>
<attr name="wlv_titleBottomColor" format="color"/>
<attr name="wlv_titleTop" format="string"/>
<attr name="wlv_titleCenter" format="string"/>
<attr name="wlv_titleBottom" format="string"/>
</declare-styleable>

</resources>
30 changes: 15 additions & 15 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
android:id="@+id/waveLoadingView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:mlv_borderColor="@color/colorAccent"
app:mlv_borderWidth="3dp"
app:mlv_progressValue="40"
app:mlv_shapeType="square"
app:mlv_titleBottom="Bottom Title"
app:mlv_titleBottomColor="@color/colorPrimaryText"
app:mlv_titleBottomSize="20sp"
app:mlv_titleCenter="Center Title"
app:mlv_titleCenterColor="@color/colorPrimaryText"
app:mlv_titleCenterSize="24sp"
app:mlv_titleTop="Top Title"
app:mlv_titleTopColor="@color/colorPrimaryText"
app:mlv_titleTopSize="20sp"
app:mlv_waveAmplitude="70"
app:mlv_waveColor="@color/colorAccent"/>
app:wlv_borderColor="@color/colorAccent"
app:wlv_borderWidth="3dp"
app:wlv_progressValue="40"
app:wlv_shapeType="circle"
app:wlv_titleBottom="Bottom Title"
app:wlv_titleBottomColor="@color/colorPrimaryText"
app:wlv_titleBottomSize="20sp"
app:wlv_titleCenter="Center Title"
app:wlv_titleCenterColor="@color/colorPrimaryText"
app:wlv_titleCenterSize="24sp"
app:wlv_titleTop="Top Title"
app:wlv_titleTopColor="@color/colorPrimaryText"
app:wlv_titleTopSize="20sp"
app:wlv_waveAmplitude="70"
app:wlv_waveColor="@color/colorAccent"/>

</LinearLayout>

Expand Down

0 comments on commit f9acde9

Please sign in to comment.