Java Code Examples for org.greenrobot.eventbus.ThreadMode#ASYNC

The following examples show how to use org.greenrobot.eventbus.ThreadMode#ASYNC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From landlord_client with Apache License 2.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPictureCompressEvent(PictureCompressEvent pictureCompressEvent) {
    //压缩后的图片不大于1MB
    Uri compressUri = AvatarChangeUtil.compress(this, pictureCompressEvent.getPictureUri(), 1024);
    if(compressUri != null) {
        SharedPreferencesUtil.saveUserAvatar(compressUri);
        userAvatar.setImageURI(compressUri);
    }
}
 
Example 2
Source File: PreviewFragment.java    From CameraCompat with MIT License 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.ASYNC)
public synchronized void onSwitchCamera(SwitchCameraEvent event) {
    if (isResumed() && CheckUtil.nonNull(mProcessorChain, mCameraHelper)) {
        mProcessorChain.pause();
        mCameraHelper.switchCamera();
        mProcessorChain.cameraSwitched();
    }
}
 
Example 3
Source File: AudioView.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe(sticky = true, threadMode = ThreadMode.ASYNC)
public void onEventAsync(final PartProgressEvent event) {
  if (audioSlidePlayer != null && event.attachment.equals(this.audioSlidePlayer.getAudioSlide().asAttachment())) {
    Util.runOnMain(new Runnable() {
      @Override
      public void run() {
        downloadProgress.setInstantProgress(((float) event.progress) / event.total);
      }
    });
  }
}
 
Example 4
Source File: TransferControlView.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe(sticky = true, threadMode = ThreadMode.ASYNC)
public void onEventAsync(final PartProgressEvent event) {
  if (this.slide != null && event.attachment.equals(this.slide.asAttachment())) {
    Util.runOnMain(new Runnable() {
      @Override
      public void run() {
        progressWheel.setInstantProgress(((float)event.progress) / event.total);
      }
    });
  }
}
 
Example 5
Source File: AsyncFunction.java    From PrivacyStreams with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onEvent(Object obj) {
    this.applyInBackground(this.uqi, this.input);
}
 
Example 6
Source File: PreviewFragment.java    From CameraCompat with MIT License 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.ASYNC)
public synchronized void onSwitchBeautify(SwitchBeautifyEvent event) {
    if (isResumed() && mProcessorChain instanceof GPUImageChain) {
        ((GPUImageChain) mProcessorChain).switchBeautify();
    }
}
 
Example 7
Source File: PreviewFragment.java    From CameraCompat with MIT License 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.ASYNC)
public synchronized void onSwitchFlash(SwitchFlashEvent event) {
    if (isResumed() && CheckUtil.nonNull(mCameraHelper)) {
        mCameraHelper.switchFlash();
    }
}
 
Example 8
Source File: PreviewFragment.java    From CameraCompat with MIT License 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.ASYNC)
public synchronized void onSwitchMirror(SwitchMirrorEvent event) {
    if (isResumed() && CheckUtil.nonNull(mProcessorChain)) {
        mProcessorChain.switchMirror();
    }
}
 
Example 9
Source File: RightFragment.java    From Study_Android_Demo with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.ASYNC)
public void getMsg(String msg){
    tv.setText(msg);
    Log.d("Tag", "getMsg: "+Thread.currentThread().getName());

}
 
Example 10
Source File: AutoScheduleMainFragment.java    From BetterWay with Apache License 2.0 2 votes vote down vote up
/**
 * 获得选择的城市并记录
 *
 * @param location 选择的城市
 */
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onLocationEvent(String location) {
    searchLocation = location;
}