package com.codepath.socialshopper.socialshopper.Activities;

import android.app.ActivityOptions;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.transition.Transition;
import android.transition.TransitionInflater;

import com.codepath.socialshopper.socialshopper.R;
import com.codepath.socialshopper.socialshopper.Utils.FacebookUtils;
import com.daimajia.androidanimations.library.Techniques;
import com.viksaa.sssplash.lib.activity.AwesomeSplash;
import com.viksaa.sssplash.lib.cnst.Flags;
import com.viksaa.sssplash.lib.model.ConfigSplash;

public class SplashScreenActivity extends AwesomeSplash {

    // Implemented https://github.com/ViksaaSkool/AwesomeSplash

    @Override
    public void initSplash(ConfigSplash configSplash) {

        //Customize Circular Reveal
        configSplash.setBackgroundColor(R.color.colorGreen); //any color you want form colors.xml
        configSplash.setAnimCircularRevealDuration(1000); //int ms
        configSplash.setRevealFlagX(Flags.REVEAL_RIGHT);  //or Flags.REVEAL_LEFT
        configSplash.setRevealFlagY(Flags.REVEAL_BOTTOM); //or Flags.REVEAL_TOP

        //Customize Logo
        configSplash.setLogoSplash(R.drawable.splash); //or any other drawable
        configSplash.setAnimLogoSplashDuration(1000); //int ms
        configSplash.setAnimLogoSplashTechnique(Techniques.Bounce); //choose one form Techniques (ref: https://github.com/daimajia/AndroidViewAnimations)

        //Customize Title
        configSplash.setTitleSplash("");
        configSplash.setTitleTextColor(R.color.colorWhite);
        configSplash.setTitleTextSize(30f); //float value
        configSplash.setAnimTitleDuration(30);
        configSplash.setAnimTitleTechnique(Techniques.FadeIn);
        setupTransitions();

    }

    @Override
    public void animationsFinished() {
        Intent intent;
        if (!FacebookUtils.isLoggedIn()) {
            intent = new Intent(this, LoginActivity.class);
        }else{
            intent = new Intent(this, MainActivity.class);
        }
        startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
        //finish();
    }

    private void setupTransitions() {
        Transition exitSlide =
                TransitionInflater.from(this).
                        inflateTransition(R.transition.transition_slide_left);

        getWindow().setExitTransition(exitSlide);
    }
}

@@ -350,16 +350,45 @@
 nflater;
+%0Aimport android.widget.Toast;
 %0A%0Aimport
@@ -432,16 +432,81 @@
 pper.R;%0A
+import com.codepath.socialshopper.socialshopper.Utils.Constants;%0A
 import c
@@ -624,16 +624,274 @@
 niques;%0A
+import com.google.android.gms.wallet.Cart;%0Aimport com.stripe.wrap.pay.AndroidPayConfiguration;%0Aimport com.stripe.wrap.pay.activity.StripeAndroidPayActivity;%0Aimport com.stripe.wrap.pay.utils.CartContentException;%0Aimport com.stripe.wrap.pay.utils.CartManager;%0A
 import c
@@ -2319,16 +2319,17 @@
 intent;%0A
+%0A
         
@@ -2601,16 +2601,48 @@
 dle());%0A
+        //initializePayments();%0A
         
@@ -2864,16 +2864,18 @@
         
+//
 getWindo
@@ -2913,11 +2913,672 @@
 );%0A    %7D
+%0A%0A    private void initializePayments() %7B%0A        Intent intent;%0A        AndroidPayConfiguration payConfiguration = AndroidPayConfiguration.init(Constants.PUBLISHABLE_KEY, Constants.CURRENCY_CODE_USD);%0A        CartManager cartManager = new CartManager();%0A        cartManager.setTotalPrice(1L);%0A        try %7B%0A            Cart cart = cartManager.buildCart();%0A            intent = new Intent(this, PaymentActivity.class).putExtra(StripeAndroidPayActivity.EXTRA_CART, cart);%0A            startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this).toBundle());%0A        %7D catch (CartContentException e) %7B%0A%0A            e.printStackTrace();%0A        %7D%0A    %7D
 %0A%7D%0A

Exit transition added