Skip to content

gayanvoice/android-layout-transitions-kotlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Layout Transitions in Kotlin

Language grade: Java Build Status Total alerts API GitHub code size in bytes

Android Layout Transitions in Kotlin

Get

Gradle

  1. Add this to build.gradle of project gradle dependency
allprojects {
	repositories {
		...
 		maven { url 'https://jitpack.io' }
	}
}
  1. Add this to build.gradle of app gradle dependency
dependencies {
	implementation 'com.github.gayankuruppu:android-layout-transitions-kotlin:1.0.1'
}

Or

Maven

  1. Add this to build.gradle of project gradle dependency
<repositories>
	<repository>
		<id>jitpack.io</id>
	    	<url>https://jitpack.io</url>
	</repository>
</repositories>
  1. Add this to build.gradle of module gradle dependency
<dependency>
	<groupId>com.github.gayankuruppu</groupId>
	<artifactId>android-layout-transitions-kotlin</artifactId>
	<version>1.0.1</version>
</dependency>

Usage

Import render animations

Kotlin

import layout.transitions.library.*

Java

import layout.transitions.library.*;

Start animation

Kotlin

// declare TextView
val intent = Intent(this, LoadActivity::class.java)
val buttonView: Button = findViewById(R.id.buttonView)

// go to view
buttonView.setOnClickListener {

	// start intent
	startActivity(intent)
	
	// set transition
	val transitions = Transitions(this@MainActivity)
	transitions.setAnimation(Slide().InRight())
	
}

Java

// declare variables
Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class);
Button buttonView = (Button) findViewById(R.id.buttonView);

// go to view
buttonView.setOnClickListener( new OnClickListener() {
	@Override
	public void onClick(View v) {
	
		// start intent
		startActivity(intent);

		// set transition
		Transitions transitions = Transitions(MainActivity.this);
		transitions.setAnimation(Slide().InRight());
		
	}
});	

Transitions

To animate the layout, create Transitions class and set the method name and specific transition method name to setAnimation method. The following classes are the transitions support by the library

Class Name
Slide Fade Flip Rotate Zoom

Slide

Slide
InLeft Slide In Left InRight Slide In Right
InUp Slide In Left InDown Slide In Right

Fade

Fade
InLeft Slide In Left InRight Slide In Right
InUp Slide In Left InDown Slide In Right
In Slide In Left

Flip

Flip
InLeft Slide In Left

Rotate

Flip
InLeft Slide In Left

Zoom

Flip
InLeft Slide In Left

Develop the library

  1. Select Git from Check out project from Version Control in your Android Studio
  2. Paste the repository url and click Clone button
  3. Click Yes to open the repository
  4. Build using the latest Gradle version

Go to https://github.com/gayankuruppu/android-vpn-client-ics-openvpn#develop see the steps