TransformationLayout

๐ŸŒ  Transform between two Views, Activities, and Fragments, or a View to a Fragment with container transform animations for Android.

APACHE-2.0 License

Stars
2.4K

Bot releases are hidden (Show)

TransformationLayout - 1.1.4 Latest Release

Published by skydoves 4 months ago

What's Changed

Full Changelog: https://github.com/skydoves/TransformationLayout/compare/1.1.3...1.1.4

TransformationLayout - 1.1.3

Published by skydoves about 1 year ago

What's Changed

Full Changelog: https://github.com/skydoves/TransformationLayout/compare/1.1.2...1.1.3

TransformationLayout - 1.1.2

Published by skydoves over 1 year ago

What's Changed

Full Changelog: https://github.com/skydoves/TransformationLayout/compare/1.1.1...1.1.2

TransformationLayout - 1.1.1

Published by skydoves almost 3 years ago

๐ŸŽ‰ Released a new stable 1.1.1! ๐ŸŽ‰

What's new?

  • Migrated material version to 1.5.0-alpha05.
  • Removed buildConfig option on the transformationlayout module.
TransformationLayout - 1.1.0

Published by skydoves over 3 years ago

๐ŸŽ‰ Released a new version 1.1.0! ๐ŸŽ‰

What's New?

  • Migrated to material version 1.4.0 stable.
TransformationLayout - 1.0.9

Published by skydoves over 3 years ago

๐ŸŽ‰ Released a new version 1.0.9! ๐ŸŽ‰

What's new?

  • Updated material version to 1.4.0-beta01.
  • Concealed internal functionalities for Java APIs.
TransformationLayout - 1.0.8

Published by skydoves over 3 years ago

๐ŸŽ‰ Released a new version 1.0.8!

What's New?

  • Updated to use material 1.4.0-alpha.
TransformationLayout - 1.0.7

Published by skydoves almost 4 years ago

๐ŸŽ‰ Released a new version 1.0.7! ๐ŸŽ‰

What's new?

  • Updated material version to 1.3.0-beta01.
  • Migrated to kotlin-parcelize plugin internally.
  • Updated kotlin version to 1.4.20 internally.
TransformationLayout - 1.0.6

Published by skydoves about 4 years ago

๐ŸŽ‰ Released a new version 1.0.6! ๐ŸŽ‰

What's New?

  • Added extensions related functionalities to TransformationCompat for supporting Java.
TransformationCompat.startActivity(transformationLayout, intent)
TransformationCompat.startActivityForResult(transformationLayout, intent)
TransformationCompat.onTransformationStartContainer(activity)
TransformationCompat.onTransformationEndContainer(activity, transformationParams)
TransformationCompat.onTransformationStartContainer(fragment)
TransformationCompat.onTransformationEndContainer(fragment, transformationParams)
TransformationCompat.addTransformation(fragmentTransaction, transformationLayout, transitionName)
  • Added onTransformationEndContainerApplyParams functionality in TransformationCompat.
    After starts a new activity by using startActivity or startActivityForResult in TransformationCompat, apply the TransformationLayout.Params on an Activity.

Activiy A

TransformationCompat.startActivity(transformationLayout, intent)

Activity B

TransformationCompat,onTransformationEndContainerApplyParams(activity)

onTransformationEndContainerApplyParams() // kotlin extension
  • Used compile SDK version 30 and kotlin version 1.4.0 stable
  • Used single abstract method conversions to listener interfaces.
  • Used JvmSynthetic for hiding kotlin lambda functions in Java for using without adding a kotlin dependency.
TransformationLayout - 1.0.5

Published by skydoves about 4 years ago

๐ŸŽ‰ Released a new version 1.0.5! ๐ŸŽ‰

What's New?

  • Migrated Google-Material version to 1.3.0-alpha02.
  • Added allContainerColors, startElevation, endElevation, elevationShadowEnabled, holdAtEndEnabled to the params, and attributes.
TransformationLayout - 1.0.4

Published by skydoves over 4 years ago

Released version 1.0.4.

What's the difference?

We can transform a view or fragment into a fragment.

How to use?

Here is some example of transformation RecyclerView item in Fragment A into Fragment B.

FragmentA

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    // [Step1]: apply onTransformationStartContainer.
    onTransformationStartContainer()
}
  /** This function will be called from the [PosterSingleAdapter.PosterDelegate]'s onBindViewHolder. */
  override fun onItemClick(poster: Poster, itemView: TransformationLayout) {
    val fragment = MainSingleDetailFragment()
    // [Step2]: getBundle from the TransformationLayout.
    val bundle = itemView.getBundle(MainSingleDetailFragment.paramsKey)
    bundle.putParcelable(MainSingleDetailFragment.posterKey, poster)
    fragment.arguments = bundle

    requireFragmentManager()
      .beginTransaction()
      // [Step3]: addTransformation using the TransformationLayout.
      .addTransformation(itemView)
      .replace(R.id.main_container, fragment, MainSingleDetailFragment.TAG)
      .addToBackStack(MainSingleDetailFragment.TAG)
      .commit()
  }

RecyclerView.Adapter

transformationLayout.transitionName = item.name

If you want to transform view (not a recyclerView's item), set transiton name in on onViewCreated.

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    transformationLayout.transitionName = item.name
}

FragmentB

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // [Step1]: apply onTransformationEndContainer using TransformationLayout.Params.
    val params = arguments?.getParcelable<TransformationLayout.Params>(paramsKey)
    onTransformationEndContainer(params)
  }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
   
    // [Step2]: sets a transition name to the target view.
    detail_container.transitionName = poster.name
}
TransformationLayout - 1.0.3

Published by skydoves over 4 years ago

Released version 1.0.3.

What's the difference?

Added TransformationCompat, TransformationActivity and TransformationAppCompatActivity.
We can transform into an Activity easier using them.

How to use?

onTransformationStartContainer

Here is the same as before.
We should add onTransformationStartContainer() to the Activity that has the floating action button.

override fun onCreate(savedInstanceState: Bundle?) {
    onTransformationStartContainer() // should be called before super.onCreate().
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
}

TransformationAppCompatActivity

Extends TransformationAppCompatActivity or TransformationActivity to your activity that will be transformed.

class DetailActivity : TransformationAppCompatActivity()

Here is the Java way.

public class DetailActivity extends TransformationAppCompatActivity 

TransformationCompat

And start the DetailActivity using the TransformationCompat.startActivity method.

val intent = Intent(context, DetailActivity::class.java)
TransformationCompat.startActivity(transformationLayout, intent)

Here is the Java way.

Intent intent = new Intent(context, DetailActivity.class);
TransformationCompat.INSTANCE.startActivity(transformationLayout, intent);
TransformationLayout - 1.0.2

Published by skydoves over 4 years ago

Released version 1.0.2.

What's difference?

startTransform(), startTransformWithDelay(delay: Long), finishTransform(), finishTransformWithDelay(delay: Long) functionalites are added.

startTransform and finishTransform

So we don't need to put container parameter to startTransform() and finishTransform methods.

// start transformation when touching the fab.
fab.setOnClickListener {
  transformationLayout.startTransform()
}

startTransformWithDelay and finishTransformWithDelay

We can start transformation with delaying.

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_detail)

    // starts transformation automatically 200ms later.
    transformationLayout.startTransformWithDelay(200)
}
TransformationLayout - 1.0.1

Published by skydoves over 4 years ago

Released version 1.0.1.

What is difference?

  • withView, withContext functionalities are added.

We can use it instead of withActivity in non-activity class like what RecyclerView.Adapter.

TransformationLayout - 1.0.0

Published by skydoves over 4 years ago

Released the first version 1.0.0.

Badges
Extracted from project README
Maven Central
Related Projects