Skip to content

Commit

Permalink
added fake-android module with fake android.os.Handler and Looper
Browse files Browse the repository at this point in the history
  • Loading branch information
Miha-x64 committed Mar 24, 2018
1 parent 40937ba commit 9bd1d24
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fake-android/build.gradle
@@ -0,0 +1,12 @@

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
27 changes: 27 additions & 0 deletions fake-android/src/main/java/android/os/Handler.java
@@ -0,0 +1,27 @@
package android.os;

/**
* Pretends to be {@link android.os.Handler}.
* Used as a {@code compileOnly} dependency to avoid reflection.
*/
public class Handler {

static {
if (true) {
throw new NoClassDefFoundError("this class in for compile-time only");
}
}

public Handler(Looper looper) {
throw null;
}

public final boolean post(Runnable r) {
throw null;
}

public final boolean postDelayed(Runnable r, long delayMillis) {
throw null;
}

}
19 changes: 19 additions & 0 deletions fake-android/src/main/java/android/os/Looper.java
@@ -0,0 +1,19 @@
package android.os;

/**
* Pretends to be {@link android.os.Looper}.
* Used as a {@code compileOnly} dependency to avoid reflection.
*/
public final class Looper {

static {
if (true) {
throw new NoClassDefFoundError("this class in for compile-time only");
}
}

public static Looper myLooper() {
throw null;
}

}

0 comments on commit 9bd1d24

Please sign in to comment.