package com.neoranga55.androidconfchangeloaders.presenters;

import android.os.AsyncTask;

/**
 * Created by neoranga on 28/03/2016.
 */
public class DemoPresenter implements DemoContract.UserActions<DemoContract.ViewActions> {

    private DemoContract.ViewActions mViewActions;

    @Override
    public void onViewAttached(DemoContract.ViewActions viewActions) {
        mViewActions = viewActions;
    }

    @Override
    public void onViewDetached() {
        mViewActions = null;
    }

    @Override
    public void onDestroyed() {
        // Nothing to clean up
    }

    @Override
    public void loadButtonPressed() {
        mViewActions.showLoading();
        AsyncTask.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(30000);
                    mViewActions.showContentLoaded();
                } catch (InterruptedException ignored) {
                }
            }
        });
    }

    @Override
    public void cancelButtonPressed() {
        mViewActions.showCancelledRequest();
    }
}

@@ -272,16 +272,46 @@
 Actions;
+%0A    private Thread mSlowTask;
 %0A%0A    @O
@@ -701,25 +701,30 @@
     
-AsyncTask.execute
+mSlowTask = new Thread
 (new
@@ -1009,16 +1009,43 @@
     %7D);%0A
+        mSlowTask.start();%0A
     %7D%0A%0A 
@@ -1089,32 +1089,110 @@
 ttonPressed() %7B%0A
+        if (mSlowTask != null) %7B%0A            mSlowTask.interrupt();%0A        %7D%0A
         mViewAct

Fix thread cancelling