Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.23 添加了一个评论图形的GraphAdapter,修改了README
- Loading branch information
Showing
10 changed files
with
173 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
likeview/src/main/java/cn/izouxiang/likeview/CommentPathAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package cn.izouxiang.likeview; | ||
|
||
import android.graphics.Path; | ||
|
||
/** | ||
* Created by zouxiang on 2016/12/5. | ||
*/ | ||
|
||
public class CommentPathAdapter implements LikeView.GraphAdapter { | ||
private static CommentPathAdapter instance; | ||
private static final float xOffsetScale = 0.06f; | ||
private static final float yOffsetScale = 0.2f; | ||
//可用单例模式 | ||
public static CommentPathAdapter getInstance() { | ||
synchronized (CommentPathAdapter.class) { | ||
if (null == instance) { | ||
instance = new CommentPathAdapter(); | ||
} | ||
} | ||
return instance; | ||
} | ||
//这里绘制你想要的图形 | ||
@Override | ||
public Path getGraphPath(LikeView view, int length) { | ||
Path path = new Path(); | ||
int dx = (int) (length * xOffsetScale); | ||
int dy = (int) (length * yOffsetScale); | ||
int w = (int) (length * (1 - xOffsetScale * 2)); | ||
int h = (int) (length * (1 - yOffsetScale * 2)); | ||
path.moveTo(dx, dy); | ||
path.lineTo(dx + w, dy); | ||
path.lineTo(dx + w, dy + h); | ||
path.lineTo(dx + (w * 0.35f), dy + h); | ||
path.lineTo(dx + (w * 0.1f), dy + (h * 1.4f)); | ||
path.lineTo(dx + (w * 0.1f), dy + h); | ||
path.lineTo(dx, dy + h); | ||
path.lineTo(dx, dy); | ||
return path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters