fix code completion bug

This commit is contained in:
hyb1996
2017-07-22 09:35:51 +08:00
parent 6d62b40b21
commit 11b87d9a51
6 changed files with 24 additions and 27 deletions

View File

@@ -22,14 +22,14 @@ public class Timers {
mBridges = bridges;
}
public int setTimeout(final Object listener, long delay, final Object... args) {
public int setTimeout(final Object callback, long delay, final Object... args) {
prepareLoopIfNeeded();
mCallbackMaxId++;
final int id = mCallbackMaxId;
Runnable r = new Runnable() {
@Override
public void run() {
mBridges.callFunction(listener, null, args);
mBridges.callFunction(callback, null, args);
mHandlerCallbacks.remove(id);
}
};
@@ -98,7 +98,11 @@ public class Timers {
if (Looper.myLooper() != null)
return;
Looper.prepare();
sLoopers.put(Thread.currentThread(), Looper.myLooper());
Looper looper = Looper.myLooper();
if (looper != null) {
// null check is not necessary, just to make Android Studio happy
sLoopers.put(Thread.currentThread(), looper);
}
mHandler = new Handler();
}