Skip to content

imanodaysoffdotcom/FavorLayout

 
 

Repository files navigation

#FavorLayout

An Android library implementing praise animation like Periscope.
The animation use ObjectAnimator and the path consists some different Bézier curve.

in emulator:

Add One

addOne

Add More

addMore

Use Custom View

addMore

Features


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

Gradle

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'
}

Usage

<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"/>
Attributes:
  • favorDuration animation duration
  • favorSpeedMode speed mode, linear|accelerate|decelerate|acceleratedecelerate
  • favorIntercurrentHeartNum set maximum number of concurrent
  • favorMaxHeartNum set maximum number of view in screen except the white ImageView and the number TextView
  • favorNodeNum node number in path
  • favorHeartWidth view's width and height
  • favorRangeWidth floating range
  • favorMarginRight view's margin left values
  • favorMarginBottom view's margin bottom values
  • favorTip set the white ImageView and the number TextView to show or hidden with the given values true|false
If you want to use custom view
class YourImageView extends AnimImageView {
    protected void onDraw(Canvas canvas) {
        //custom
    }
}

favorlayout.setViewType(YourImageView.class.getName());

Update

  • 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

About

An Android library implementing praise animation like Periscope.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%