Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
venshine committed May 19, 2016
1 parent 3012996 commit 0f2147c
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 12 deletions.
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# GoodView
Android点赞+1效果,支持文本和图像。

ScreenShot
--
![](https://github.com/venshine/GoodView/blob/master/screenshot/screenshot.gif)

Usage
--
##### Gradle:
```groovy
compile 'com.wx.goodview:goodview:1.0.0'
```

Demo
--

##### Java:
```Java
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main)

final GoodView goodView = new GoodView(this);
Button button = new Button(this);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
goodView.setText("+1");
goodView.show(v);
}
});

}
}
```

##### Methods:
| method 方法 | description 描述 |
|:--- |:---|
| void **setText**(String text) | 设置文本(optional) |
| void **setTextInfo**(String text, int textColor, int textSize) | 设置文本信息(optional) |
| void **setImage**(int resId) | 设置图片(optional) |
| void **setImage**(Drawable drawable) | 设置图片(optional) |
| void **setDistance**(int dis) | 设置移动距离 |
| void **setTranslateY**(int fromY, int toY) | 设置Y轴移动属性 |
| void **setAlpha**(float fromAlpha, float toAlpha) | 设置透明度属性 |
| void **setDuration**(int duration) | 设置动画时长 |
| void **reset**() | 重置属性 |
| void **show**(View v) | 展示 |

About
--
* Email:venshine.cn@gmail.com

License
--
Copyright (C) 2016 venshine.cn@gmail.com

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.

2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
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: 2 additions & 0 deletions goodview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
}

//apply from: 'http://git.oschina.net/venshine/gradle-bintray-upload/raw/master/bintray.gradle'
20 changes: 10 additions & 10 deletions goodview/src/main/java/com/wx/goodview/GoodView.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,6 @@ public void setTextInfo(String text, int textColor, int textSize) {
setText(text);
}

/**
* 设置动画时长
*
* @param duration
*/
public void setDuration(int duration) {
mDuration = duration;
mChanged = true;
}

/**
* 设置图片
*
Expand Down Expand Up @@ -232,6 +222,16 @@ public void setAlpha(float fromAlpha, float toAlpha) {
mChanged = true;
}

/**
* 设置动画时长
*
* @param duration
*/
public void setDuration(int duration) {
mDuration = duration;
mChanged = true;
}

/**
* 重置属性
*/
Expand Down
4 changes: 2 additions & 2 deletions sample/src/main/java/com/wx/goodview/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public void good2(View view) {

public void collection(View view) {
((ImageView) view).setImageResource(R.mipmap.collection_checked);
mGoodView.setTextInfo("收藏成功", Color.parseColor("#f66467"), 14);
mGoodView.setTextInfo("收藏成功", Color.parseColor("#f66467"), 12);
mGoodView.show(view);
}

public void bookmark(View view) {
((ImageView) view).setImageResource(R.mipmap.bookmark_checked);
mGoodView.setTextInfo("收藏成功", Color.parseColor("#ff941A"), 14);
mGoodView.setTextInfo("收藏成功", Color.parseColor("#ff941A"), 12);
mGoodView.show(view);
}

Expand Down
Binary file added screenshot/screenshot.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0f2147c

Please sign in to comment.