All Projects → mikepenz → Crossfader

mikepenz / Crossfader

Licence: Apache-2.0 license
Crossfader is a small library to provide an easy to use and fast helper class for the great CrossFadeSlidingPaneLayout

Programming Languages

java
68154 projects - #9 most used programming language

Crossfader Maven Central

Join the chat at https://gitter.im/mikepenz/crossfader

Crossfader is a small library to provide an easy to use and fast helper class for the great CrossFadeSlidingPaneLayout by @chiuki.

It comes with following features:

  • Easy to use API
  • Lightweight
  • No additional dependencies
  • No need to modify your layouts

Preview

Screenshots

Image Image

Image

#Include in your project ##Using Maven The Crossfader Library is pushed to Maven Central, so you just need to add the following dependency to your build.gradle.

implementation "com.mikepenz:crossfader:1.6.0"
implementation "androidx.appcompat:appcompat:${androidX}"

To use appcompat please use a version smaller than 1.6.0. (See the releases on GitHub)

How to use

Initialize and create the Crossfader

crossFader = new Crossfader()
	    //provide the view which should be the main content
        .withContent(findViewById(R.id.crossfade_content))
        //provide the view and it's width (in pixels) which should be displayed first
        .withFirst(result.getSlider(), firstWidth)
        //provide the view and it's width (in pixels) which should be displayed after fading
        .withSecond(miniResult.build(this), secondWidth)
        //provde the saved instance state to store the previous state of the crossfade view
        .withSavedInstance(savedInstanceState)
        //build and inflate everything
        .build();
        //Awesome everything is set and working

Programmatically crossFade the view

//check if the view is crossFaded
if (crossFader.isCrossFaded()) {
	//crossFade the view
	crossFader.crossFade();
}

Save the instance state

@Override
protected void onSaveInstanceState(Bundle outState) {
	//add the values which need to be saved from the crossFader to the bundle
	outState = crossFader.saveInstanceState(outState);
	super.onSaveInstanceState(outState);
}

Developed By

License

Copyright 2018 Mike Penz

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].