Skip to content

How to use in library module

JingYeoh edited this page Dec 18, 2017 · 1 revision

You can use annotation in application module,but R is not the final variables, so you can not pass parameter in some annotations such as @Puppet and @Animator.

This library operate support api for this.

@Puppet containerViewId

Add below method in your Fragment/Activity:

public int getContainerViewId(){
  return R.id.container;
}

@Animator params

Add below method in your Fragment:

public int[] getPuppetAnimations(){
  return new int[]{
    R.anim.enter,R.anim.exit,R.anim.popEnter,R.anim.popExit
  };
}

Notes: the method getPuppetAnimations return value must be int array with four length, These four values correspond to the four parameters in the annotation, if you do not need the corresponding transition animation, set the value of the corresponding location to 0