package com.nilhcem.droidcontn.utils;

/**
 * Preconditions inspired by
 * https://github.com/google/guava/blob/master/guava/src/com/google/common/base/Preconditions.java
 */
public final class Preconditions {

    private Preconditions() {
        throw new UnsupportedOperationException();
    }

    /**
     * Ensures the truth of an expression involving one or more parameters to the calling method.
     *
     * @param expression a boolean expression
     * @throws IllegalArgumentException if {@code expression} is false
     */
    public static void checkArgument(boolean expression) {
        if (!expression) {
            throw new IllegalArgumentException();
        }
    }
}

@@ -32,16 +32,87 @@
 utils;%0A%0A
+import android.os.Looper;%0A%0Aimport com.nilhcem.droidcontn.BuildConfig;%0A%0A
 /**%0A * P
@@ -752,11 +752,639 @@
  %7D%0A    %7D
+%0A%0A    public static void checkOnMainThread() %7B%0A        if (BuildConfig.DEBUG) %7B%0A            if (!isOnMainThread()) %7B%0A                throw new IllegalStateException(%22This method should be called from the main thread%22);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static void checkNotOnMainThread() %7B%0A        if (BuildConfig.DEBUG) %7B%0A            if (isOnMainThread()) %7B%0A                throw new IllegalStateException(%22This method must not be called on the main thread%22);%0A            %7D%0A        %7D%0A    %7D%0A%0A    private static boolean isOnMainThread() %7B%0A        return Thread.currentThread() == Looper.getMainLooper().getThread();%0A    %7D
 %0A%7D%0A

Add thread preconditions to ensure call is/is not on the main thread