All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.leancloud.push.lite.AVCallback Maven / Gradle / Ivy

The newest version!
package cn.leancloud.push.lite;

import android.util.Log;

import cn.leancloud.push.lite.utils.AVUtils;

public abstract class AVCallback {

  public void internalDone(final T t, final AVException avException) {
    if (mustRunOnUIThread() && !AVUtils.isMainThread()) {
      if (!AVOSCloud.handler.post(new Runnable() {
        @Override
        public void run() {
          internalDone0(t, avException);
        }
      })) {
        Log.e("AVCallback","Post runnable to handler failed.");
      }
    } else {
      internalDone0(t, avException);
    }
  }

  protected boolean mustRunOnUIThread() {
    return true;
  }

  public void internalDone(final AVException avException) {
    this.internalDone(null, avException);
  }

  protected abstract void internalDone0(T t, AVException avException);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy