// Path: app/src/main/java/de/lukasniemeier/gamecenterlivesender/model/publishpoint/PublishPointResult.java
// public class PublishPointResult extends Entity {
// 
//     @XML(tag = "result" + XML.SUB + "path")
//     public String path;
// 
//     public static PublishPointResult parse(String body, Context ctx) throws Exception {
//         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//         DocumentBuilder builder = factory.newDocumentBuilder();
//         Document xml = builder.parse(new InputSource(new StringReader(body)));
// 
//         XMLSerializer<PublishPointResult> serializer =
//                 new XMLSerializer<PublishPointResult>(PublishPointResult.class, ctx);
// 
//         return serializer.deserialize(xml);
//     }
// }
// 
// Path: app/src/main/java/de/lukasniemeier/gamecenterlivesender/utils/Functional.java
// public class Functional {
// 
//     public interface Procedure {
//         void execute();
//     }
// 
//     public interface Consumer<T> {
//         void accept(T t);
//     }
// 
//     public interface BiConsumer<R, S> {
//         void accept(R r, S s);
//     }
// 
//     public interface Supplier<T> {
//         T get();
//     }
// 
//     public interface Function<T, R> {
//         R apply(T t);
//     }
// 
//     public interface Predicate<T> {
//         boolean test(T t);
//     }
// }


import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.TextView;
import android.widget.Toast;
import org.droidparts.contract.HTTP;
import org.droidparts.net.http.HTTPException;
import org.droidparts.net.http.RESTClient2;
import java.util.HashMap;
import java.util.Map;
import de.lukasniemeier.gamecenterlivesender.R;
import de.lukasniemeier.gamecenterlivesender.model.publishpoint.PublishPointResult;
import de.lukasniemeier.gamecenterlivesender.utils.Functional;

package de.lukasniemeier.gamecenterlivesender.http;





public class TaskFactory {

    private static final String TAG = TaskFactory.class.getSimpleName();

    private final Context context;

    private final RESTClient2 restClient;

    private final TextView statusView;

    private final Animation fadeOutAnimation;

    public TaskFactory(Context context, RESTClient2 restClient, TextView statusView) {
        this.context = context;
        this.restClient = restClient;
        this.statusView = statusView;
        this.fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
        fadeOutAnimation.setDuration(2000);
        fadeOutAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationEnd(Animation animation) {
                statusView.setVisibility(View.GONE);
            }

            @Override
            public void onAnimationStart(Animation animation) { }

            @Override
            public void onAnimationRepeat(Animation animation) { }
        });
    }


// Path: app/src/main/java/de/lukasniemeier/gamecenterlivesender/model/publishpoint/PublishPointResult.java
// public class PublishPointResult extends Entity {
// 
//     @XML(tag = "result" + XML.SUB + "path")
//     public String path;
// 
//     public static PublishPointResult parse(String body, Context ctx) throws Exception {
//         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//         DocumentBuilder builder = factory.newDocumentBuilder();
//         Document xml = builder.parse(new InputSource(new StringReader(body)));
// 
//         XMLSerializer<PublishPointResult> serializer =
//                 new XMLSerializer<PublishPointResult>(PublishPointResult.class, ctx);
// 
//         return serializer.deserialize(xml);
//     }
// }
// 
// Path: app/src/main/java/de/lukasniemeier/gamecenterlivesender/utils/Functional.java
// public class Functional {
// 
//     public interface Procedure {
//         void execute();
//     }
// 
//     public interface Consumer<T> {
//         void accept(T t);
//     }
// 
//     public interface BiConsumer<R, S> {
//         void accept(R r, S s);
//     }
// 
//     public interface Supplier<T> {
//         T get();
//     }
// 
//     public interface Function<T, R> {
//         R apply(T t);
//     }
// 
//     public interface Predicate<T> {
//         boolean test(T t);
//     }
// }


// Path: app/src/main/java/de/lukasniemeier/gamecenterlivesender/http/TaskFactory.java
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.TextView;
import android.widget.Toast;
import org.droidparts.contract.HTTP;
import org.droidparts.net.http.HTTPException;
import org.droidparts.net.http.RESTClient2;
import java.util.HashMap;
import java.util.Map;
import de.lukasniemeier.gamecenterlivesender.R;
import de.lukasniemeier.gamecenterlivesender.model.publishpoint.PublishPointResult;
import de.lukasniemeier.gamecenterlivesender.utils.Functional;

package de.lukasniemeier.gamecenterlivesender.http;





public class TaskFactory {

    private static final String TAG = TaskFactory.class.getSimpleName();

    private final Context context;

    private final RESTClient2 restClient;

    private final TextView statusView;

    private final Animation fadeOutAnimation;

    public TaskFactory(Context context, RESTClient2 restClient, TextView statusView) {
        this.context = context;
        this.restClient = restClient;
        this.statusView = statusView;
        this.fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
        fadeOutAnimation.setDuration(2000);
        fadeOutAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationEnd(Animation animation) {
                statusView.setVisibility(View.GONE);
            }

            @Override
            public void onAnimationStart(Animation animation) { }

            @Override
            public void onAnimationRepeat(Animation animation) { }
        });
    }


    public HttpTask createPublishTask(String url, Functional.Consumer<String> castConsumer) {
