您当前的位置: 首页 >  android

android-pulse-indicator

发布时间:2016-10-20 09:32:23 ,浏览量:0

android-pulse-indicator
项目地址: jackpocket/android-pulse-indicator
简介:An Android View system for indicating Views using fading pulses

Download

An Android View system for indicating Views using fading pulses

pulse-indicator Sample

Installation
repositories {
        jcenter()
    }

    dependencies {
        compile('com.jackpocket:pulse-indicator:1.0.4')
    }
Usage Layout Approach

Make the root of your Activity's layout one of the base PulseLayouts included in this library: thePulsingLinearLayout or the PulsingRelativeLayout. e.g.


			

Then find it in your Activity and simply call PulseLayout.attachTo(Activity, View). Done. e.g.

((PulseLayout) findViewById(R.id.my_pulsing_layout))
    .attachTo(this, findViewById(R.id.some_view_I_want_to_indicate);
PulseView Approach

Just add a PulseView to your layout (make sure you're using a ViewGroup that allows overlapping children (e.g. RelativeLayout)).


			

You could then use it the same way you would going the Layout Approach mentioned above.

Custom Approach

If you want to add pulsing to your own custom layouts, just checkout one of the supplied layout class files for detailed information on how to implemented the PulsingController manually.

Changing the values at runtime can also be configured by working with the PulseController:

((PulseLayout) findViewById(R.id.my_pulsing_layout))
    .attachTo(this, findViewById(R.id.some_view_I_want_to_indicate)
        .setCirclePathOverride(false) // Set it to use the rectangular boundaries instead of circle pulsing
        .setPulsingColor(0xFF22FF22) // Set the pulse starting color
        .setPulsingStrokeWidth(10) // Override the dynamic stroke width with a custom one
        .setDurationMs(1500) // Set the overall duration of the pulsing (will continue until no pulses exist)
        .setPulseLifespanMs(900) // The length of time a pulse is visible
        .setRespawnRateMs(300) // The rate at which a new pulse should be added
        .setAlphaInterpolator(new AccelerateInterpolator()) // Set the Interpolator for the alpha animation
        .setScaleInterpolator(new LinearInterpolator()) // Set the Interpolator for the scaling animation
        .setFinishedListener(view -> doSomethingOnFinished()); // Set a callback to be triggered when the pulsing finished for a View. Calling attach() before it completes will prevent it from being triggered
Configs

The default configs for pulsing color, duration, individual lifespan, respawn rates can be overwritten via the following, respectively:

R.color.pulse__color
R.integer.pulse__duration_default
R.integer.pulse__lifespan_default
R.integer.pulse__respawn_rate_default
关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    111043博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0502s