MCPcopy Index your code
hub / github.com/Lauzy/LBehavior

github.com/Lauzy/LBehavior @1.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.3 ↗ · + Follow
126 symbols 318 edges 27 files 12 documented · 10% updated 7y ago1.0.3 · 2018-09-17★ 603
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

LBehavior: Simple implementation of sliding animation of title bar, bottom bar and floatingActionButton.

中文文档

Screenshots

screenshot screenshot screenshot

Blog Introduce

JianShu: http://www.jianshu.com/p/2974d8ffc3a5

Download

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

    dependencies {
        implementation 'com.github.Lauzy:LBehavior:VERSION_CODE'
    }

The version code of the latest release can be found here

Usage

Xml file:

The root layout must be CoordinatorLayout,which is similar to FrameLayout

    <android.support.design.widget.CoordinatorLayout
        ...>
        <FloatingActionButton
            ...
            app:layout_behavior="@string/fab_vertical_behavior/>
    </android.support.design.widget.CoordinatorLayout>

Set different layout_behavior in xml file according to different view.

Param Explanation
@string/title_view_behavior TitleBar
@string/bottom_view_behavior BottomBar
@string/fab_scale_behavior FloatingActionButton(scale anim)
@string/fab_vertical_behavior FloatingActionButton(slide anim)

Custom properties(All have default values):

Function Param Explanation
setMinScrollY int y Sets the minimum sliding distance for triggering the animation. The default value is 5 pixels.
setScrollYDistance int y Sets the sliding distance for triggering the animation. The animation can be triggered when the total sliding distance is greater than this property, even if the single sliding distance is less than the minimum distance. The default value is 40 pixels.
setDuration int duration Sets the length of the animation. The default value is 400 milliseconds.
setInterpolator Interpolator interpolator Sets the interpolator to be used by this animation.The default interpolator is LinearOutSlowInInterpolator. Interpolator official documentation

    CommonBehavior behavior = CommonBehavior.from(mFloatingActionButton);

    behavior.show();//show the view
    behavior.hide();//hide

    behavior.setMinScrollY(20)
    behavior.setScrollYDistance(100)
    behavior.setDuration(1000)
    behavior.setInterpolator(new LinearOutSlowInInterpolator());

Tips

1、Because the root layout is CoordinatorLayout, the toolbar may cover the item at the top of the recyclerView when used, and the bottom bar may also cover the bottom item. You can add a placeholder such as itemDecoration to the recyclerView, or a placeholder view at the top. If the situation is relatively simple, you can simply set padding, margin and so on. I have dealt with this kind of situation in the demo simply.

2、If the elevation of the floatingActionButton is greater than that of the bottomBar, the animation of the floatingActionButton will cover the top of the bottomBar, and vice versa.

Apk and More Info

For more usage, you can download or clone the demo. You can also download the demo apk.

License

Copyright 2017 Lauzy

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.

Extension points exported contracts — how you extend this code

IBehavior (Interface)
Desc : behavior 接口 Author : lauzy Date : 2018/9/17 Email : freedompaladin@gmail.com [5 implementers]
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehavior.java
IBehaviorAnim (Interface)
(no doc) [6 implementers]
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehaviorAnim.java

Core symbols most depended-on inside this repo

hide
called by 20
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehavior.java
show
called by 16
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehavior.java
setInterpolator
called by 15
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehaviorAnim.java
setDuration
called by 13
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehaviorAnim.java
from
called by 13
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/behavior/CommonBehavior.java
getInterpolator
called by 8
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehaviorAnim.java
getDuration
called by 8
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehaviorAnim.java
isEnableScroll
called by 4
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/behavior/CommonBehavior.java

Shape

Method 98
Class 26
Interface 2

Languages

Java100%

Modules by API surface

lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/behavior/CommonBehavior.java13 symbols
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/anim/FabScaleBehaviorAnim.java7 symbols
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/anim/AbsBehaviorAnim.java7 symbols
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/IBehaviorAnim.java7 symbols
app/src/main/java/com/lauzy/freedom/lbehavior/fragment/Demo1Fragment.java7 symbols
app/src/main/java/com/lauzy/freedom/lbehavior/adapter/DemoAdapter.java7 symbols
app/src/main/java/com/lauzy/freedom/lbehavior/fragment/Demo3Fragment.java6 symbols
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/anim/TitleBehaviorAnim.java5 symbols
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/anim/FabVerticalBehaviorAnim.java5 symbols
lbehaviorlib/src/main/java/com/lauzy/freedom/lbehaviorlib/anim/BottomBehaviorAnim.java5 symbols
app/src/main/java/com/lauzy/freedom/lbehavior/widget/DemoItemDecoration.java5 symbols
app/src/main/java/com/lauzy/freedom/lbehavior/fragment/Demo4Fragment.java5 symbols

For agents

$ claude mcp add LBehavior \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact