package io.futurestud.tutorials.glide.ui.activities;

import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.view.View;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.FutureTarget;
import com.bumptech.glide.request.animation.ViewPropertyAnimation;

import java.io.File;
import java.util.concurrent.ExecutionException;

public class UsageExampleDownload extends GlideExampleActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );

        loadImageAnimateResource();
        loadImageAnimateCode();
    }

    private void loadImageAnimateResource() {
        FutureTarget<File> fileFutureTarget = Glide
                .with( context )
                .load( eatFoodyImages[0] )
                .downloadOnly( 500, 500 );

        try {
            File file = fileFutureTarget.get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }

    private void loadImageAnimateCode() {
        ViewPropertyAnimation.Animator animationObject = new ViewPropertyAnimation.Animator() {
            @Override
            public void animate(View view) {
                view.setAlpha( 0f );

                ObjectAnimator fadeAnim = ObjectAnimator.ofFloat( view, "alpha", 0f, 1f );
                fadeAnim.setDuration( 2500 );
                fadeAnim.start();
            }
        };

        Glide
                .with( context )
                .load( eatFoodyImages[1] )
                .animate( animationObject )
                .into( imageView2 );
    }
}

@@ -51,49 +51,8 @@
 s;%0A%0A
-import android.animation.ObjectAnimator;%0A
 impo
@@ -92,17 +92,20 @@
 oid.
-view.View
+widget.Toast
 ;%0A%0Ai
@@ -187,75 +187,8 @@
 get;
-%0Aimport com.bumptech.glide.request.animation.ViewPropertyAnimation;
 %0A%0Aim
@@ -451,44 +451,130 @@
     
-loadImageAnimateResource
+Toast.makeText(UsageExampleDownload.this, %22No visual demo, check the source code :)%22, Toast.LENGTH_LONG).show
 ();%0A
+%0A
         
 load
@@ -569,16 +569,22 @@
         
+//down
 loadImag
@@ -584,27 +584,16 @@
 oadImage
-AnimateCode
 ();%0A    
@@ -604,32 +604,36 @@
    private void 
+down
 loadImageAnimate
@@ -629,23 +629,8 @@
 mage
-AnimateResource
 () %7B
@@ -1035,623 +1035,6 @@
  %7D%0A%0A
-    private void loadImageAnimateCode() %7B%0A        ViewPropertyAnimation.Animator animationObject = new ViewPropertyAnimation.Animator() %7B%0A            @Override%0A            public void animate(View view) %7B%0A                view.setAlpha( 0f );%0A%0A                ObjectAnimator fadeAnim = ObjectAnimator.ofFloat( view, %22alpha%22, 0f, 1f );%0A                fadeAnim.setDuration( 2500 );%0A                fadeAnim.start();%0A            %7D%0A        %7D;%0A%0A        Glide%0A                .with( context )%0A                .load( eatFoodyImages%5B1%5D )%0A                .animate( animationObject )%0A                .into( imageView2 );%0A    %7D%0A
 %7D%0A

fix download image code sample