Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

PreLollipopTransition

> 编程语言
Open source

Simple tool which help you to implement activity and fragment transition for pre-Lollipop devices.

1.3K stars0 likes0 views
WebsiteGitHub

About

Simple tool which help you to implement activity and fragment transition for pre-Lollipop devices.

PreLollipopTransition

Simple tool which help you to implement activity and fragment transition for pre-Lollipop devices.

Download

In your app build.gradle add

groovy
dependencies {
    compile 'com.kogitune:pre-lollipop-activity-transition:1.x.x'
}

Code

Activity

Start Activity in first activity.

java
findViewById(R.id.imageView).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        final Intent intent = new Intent(MainActivity.this, SubActivity.class);
        ActivityTransitionLauncher.with(MainActivity.this).from(v).launch(intent);
    }
});

Receive intent in second activity.

java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sub);
    ActivityTransition.with(getIntent()).to(findViewById(R.id.sub_imageView)).start(savedInstanceState);
}

If you want the exit animation, you can do like this.

java
private ExitActivityTransition exitTransition;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sub2);
    exitTransition = ActivityTransition.with(getIntent()).to(findViewById(R.id.sub_imageView)).start(savedInstanceState);
}
@Override
public void onBackPressed() {
    exitTransition.exit(this);
}

If you want to use startActivityForResult, you should do below.

  1. Use createBundle().
  2. Put Extra to intent.
  3. Call overridePendingTransition after startActivityForResult.
java
Bundle transitionBundle = ActivityTransitionLauncher.with(MainActivity.this).from(v).createBundle();
intent.putExtras(transitionBundle);
startActivityForResult(intent, REQUEST_CODE);
// you should prevent default activity transition animation
overridePendingTransition(0, 0);

Fragment

Start fragment transition in first fragment.

…

Start animation in second fragment.

java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.support_fragment_end, container, false);
    final ExitFragmentTransition exitFragmentTransition = FragmentTransition.with(this).to(v.findViewById(R.id.fragment_imageView)).start(savedInstanceState);
    exitFragmentTransition.startExitListening();
    return v;
}

If you want to pass argument to second fragment, you should use Fragment#getArguments() after call prepare().

java
final EndFragment toFragment = new EndFragment();
FragmentTransitionLauncher
        .with(view.getContext())
        .image(BitmapFactory.decodeResource(getResources(), R.drawable.photo))
        .from(view.findViewById(R.id.imageView)).prepare(toFragment);
toFragment.getArguments().putString("stringArgKey", "this is value");
getFragmentManager().beginTransaction().replace(R.id.content, toFragment).addToBackStack(null).commit();

Sample

Contributors

  • shiraji
  • lovejjfg

Thanks

Sample Photo Luke Ma https://www.flickr.com/photos/lukema/12499338274/in/photostream/

DevBytes: Custom Activity Animations https://www.youtube.com/watch?v=CPxkoe2MraA

License

This project is released under the Apache License, Version 2.0.

  • The Apache License, Version 2.0

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言