Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Hustling

Damanpreet Singh damanpreetsb

💪
Hustling
View GitHub Profile
@damanpreetsb
damanpreetsb / MainActivity.java
Created Dec 8, 2016
Viewpager by using ArrayList
View MainActivity.java
package com.example.daman.swipefragmentdemo;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
View styles.xml
<item name="android:windowContentTransitions">true</item>
View SharedElementTransition.kt
customiseButton.setOnClickListener {
val intent = Intent(this, CustomiseActivity::class.java)
val options = ActivityOptionsCompat
.makeSceneTransitionAnimation(
this,
pizzaImageView as View,
"pizza")
startActivity(intent, options.toBundle())
}
View PlayAnimationsTogether.kt
AnimatorSet().apply {
play(fadeCheese).with(fadeCrust).with(fadeInPizza).with(scaleUpPizzaX).with(scaleUpPizzaY).with(translatePizzaY)
}
View TranslatePizzaYAnimation.kt
val translatePizzaY = ObjectAnimator.ofFloat(pizzaImageView, "translationY", 0f, -360f)
View ScaleUpPizzaYAnimation.kt
val scaleUpPizzaY = ObjectAnimator.ofFloat(pizzaImageView, "scaleY", 0f, 14f)
View ScaleUpPizzaXAnimation.kt
val scaleUpPizzaX = ObjectAnimator.ofFloat(pizzaImageView, "scaleX", 0f, 0.8f)
View FadeInPizzaAnimation.kt
val fadeInPizza = ObjectAnimator.ofFloat(pizzaImageView, "alpha", 0f, 1f)
View FadeCrustAnimation.kt
val fadeCrust = ObjectAnimator.ofFloat(pizzaCrustImageView, "alpha", 1f, 0f)
View FadeCheeseAnimation.kt
val fadeCheese = ObjectAnimator.ofFloat(pizzaCheeseImageView, "alpha", 1f, 0f)