#FavorLayout
An Android library implementing praise animation like Periscope.
The animation use ObjectAnimator and the path consists some different Bézier curve.
in emulator:
A custom view animation looks like the Periscope.
These features of the Custom View can be configured:
- Time of the animation
- Floating range
- Initial position
- Custom shapes
android {
...
buildscript{
repositories {
jcenter()
maven { url = 'https://jitpack.io' }
}
}
allprojects {
repositories {
jcenter()
maven { url = 'https://jitpack.io' }
}
}
}
dependencies {
...
compile 'com.github.gaoxuan:FavorLayout:1.1'
}
<com.gx.favorlayout_favorlayout.FavorLayout
android:id="@+id/favor"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:favorHeartWidth="40dp"
app:favorNodeNum="5"
app:favorRangeWidth="40dp"/>
favorDuration
animation durationfavorSpeedMode
speed mode,linear|accelerate|decelerate|acceleratedecelerate
favorIntercurrentHeartNum
set maximum number of concurrentfavorMaxHeartNum
set maximum number of view in screen except the white ImageView and the number TextViewfavorNodeNum
node number in pathfavorHeartWidth
view's width and heightfavorRangeWidth
floating rangefavorMarginRight
view's margin left valuesfavorMarginBottom
view's margin bottom valuesfavorTip
set the white ImageView and the number TextView to show or hidden with the given valuestrue|false
class YourImageView extends AnimImageView {
protected void onDraw(Canvas canvas) {
//custom
}
}
favorlayout.setViewType(YourImageView.class.getName());
- You can set false of favorTip in the xml to hide the white ImageView and the number TextView
- These Heart View can also be customized