// Path: app/src/main/java/com/nasageek/utexasutilities/MyBus.java
// public class MyBus {
// 
//     private static final Bus BUS = new Bus();
// 
//     public static Bus getInstance() {
//         return BUS;
//     }
// }


import android.app.Dialog;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import com.nasageek.utexasutilities.MyBus;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import okio.Buffer;
import okio.Okio;
                        Buffer htmlBuffer = new Buffer();
                        try {
                            String[] files = assets.list(filePath);
                            htmlBuffer.writeAll(Okio.source(assets
                                    .open(filePath + "/" + files[which - 1])));
                            new Thread(() -> {
                                mockServer.enqueue(new MockResponse().setBody(htmlBuffer));
                                // Anything else the client tries to load from us should just fail.
                                // 20 chosen arbitrarily.
                                MockResponse badResponse = new MockResponse().setResponseCode(404);
                                for (int i = 0; i < 20; i++) {
                                    mockServer.enqueue(badResponse);
                                }
                                try {
                                    mockServer.start();
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                                cdl.countDown();
                            }).start();
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                        try {
                            cdl.await();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        reqUrl = mockServer.url("").toString();
                    }
// Path: app/src/main/java/com/nasageek/utexasutilities/MyBus.java
// public class MyBus {
// 
//     private static final Bus BUS = new Bus();
// 
//     public static Bus getInstance() {
//         return BUS;
//     }
// }


// Path: app/src/debug/java/com/nasageek/utexasutilities/fragments/DataSourceSelectionFragment.java
import android.app.Dialog;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import com.nasageek.utexasutilities.MyBus;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import okio.Buffer;
import okio.Okio;

                        Buffer htmlBuffer = new Buffer();
                        try {
                            String[] files = assets.list(filePath);
                            htmlBuffer.writeAll(Okio.source(assets
                                    .open(filePath + "/" + files[which - 1])));
                            new Thread(() -> {
                                mockServer.enqueue(new MockResponse().setBody(htmlBuffer));
                                // Anything else the client tries to load from us should just fail.
                                // 20 chosen arbitrarily.
                                MockResponse badResponse = new MockResponse().setResponseCode(404);
                                for (int i = 0; i < 20; i++) {
                                    mockServer.enqueue(badResponse);
                                }
                                try {
                                    mockServer.start();
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                                cdl.countDown();
                            }).start();
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                        try {
                            cdl.await();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        reqUrl = mockServer.url("").toString();
                    }
                    MyBus.getInstance().post(new DataSourceSelectedEvent(reqUrl));