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

The following examples show how to use org.greenrobot.eventbus.ThreadMode#BACKGROUND . 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: GoogleDriveClient.java    From financisto with GNU General Public License v2.0 6 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void doBackup(DoDriveBackup event) {
    DatabaseExport export = new DatabaseExport(context, db.db(), true);
    try {
        String targetFolder = getDriveFolderName();
        ConnectionResult connectionResult = connect();
        if (connectionResult.isSuccess()) {
            DriveFolder folder = getDriveFolder(targetFolder);
            String fileName = export.generateFilename();
            byte[] bytes = export.generateBackupBytes();
            Status status = createFile(folder, fileName, bytes);
            if (status.isSuccess()) {
                handleSuccess(fileName);
            } else {
                handleFailure(status);
            }
        } else {
            handleConnectionResult(connectionResult);
        }
    } catch (Exception e) {
        handleError(e);
    }
}
 
Example 2
Source File: PlayService.java    From music_player with Open Software License 3.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(ServiceEvent event) {
    switch (event.action) {
        case MyConstant.playAction:
            play(MyApplication.getPositionNow());
            return;
        case MyConstant.random_playAction:
            play(randomPosition());
            return;
        case MyConstant.previousAction:
            previous();
            return;
        case MyConstant.nextAction:
            next();
            return;
        case MyConstant.pauseAction:
            pause(true);
            return;
        case MyConstant.resumeAction:
            resume();
            return;
        case MyConstant.deleteAction:
            deleteService(event.delay);
            return;
        case MyConstant.resetAction:
            if (mediaPlayer != null) {
                mediaPlayer.reset();
            }
            return;
    }

}
 
Example 3
Source File: MainService.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onChatActEventBeanReceived(ChatActEventBean eventBean)
{
    if (eventBean.isEnterIn())
    {
        if (mHxMessageListener != null)
            mHxMessageListener.addConId(eventBean.getConversatinoId());
    } else
    {
        if (mHxMessageListener != null)
            mHxMessageListener.removeConId(eventBean.getConversatinoId());
    }
}
 
Example 4
Source File: SendingAudio.java    From Alexa-Voice-Service with MIT License 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(MessageEvent event){
    switch (event.event){
        case TokenHandler.SendAudioRequest:
            sendAudioRequest(requestBody,event.message);
            break;
        case TokenHandler.SendSpeechStartedEvent:
            SendSpeechStartedEvent(tokenfrompayload,event.message);
            break;
        case TokenHandler.SendSpeechFinishedEvent:
            SendSpeechFinishedEvent(tokenfrompayload,event.message);
            break;
    }
}
 
Example 5
Source File: SplashActivitiy.java    From Alexa-Voice-Service with MIT License 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(MessageEvent event){
    switch (event.event){
        case TokenHandler.SplashActivity:
                if(event.message.equals("finishSplashActivity")) {
                    Log.d("checkthismethod","splashscreen");
                    finish();
                }
            break;
    }
}
 
Example 6
Source File: MainActivity.java    From Alexa-Voice-Service with MIT License 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(MessageEvent event) {
    switch (event.event){
        case TokenHandler.FinishMainActivity:
            finish();
           break;
    }
}
 
Example 7
Source File: Api17PlusMeasurementParser.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onEvent(Api17PlusMeasurementProcessingEvent event) {
    ParseResult result = parse(event.getLastLocation(), event.getLastCellInfo(),
            System.currentTimeMillis(), event.getMinDistance());
    // when saved different event is published
    if (result != ParseResult.Saved) {
        notifyResult(result);
    }
}
 
Example 8
Source File: LegacyMeasurementParser.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onEvent(LegacyMeasurementProcessingEvent event) {
    ParseResult result = parse(event.getLastLocation(), event.getLastCellLocation(), event.getLastSignalStrength(),
            event.getLastNetworkType(), event.getLastOperatorCode(), event.getLastOperatorName(),
            event.getNeighboringCells(), event.getLastLocationObtainedTime(), event.getMinDistance());
    // when saved different event is published
    if (result != ParseResult.Saved) {
        notifyResult(result);
    }
}
 
Example 9
Source File: MainActivity.java    From VBrowser-Android with GNU General Public License v2.0 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onAddNewDownloadTaskEvent(AddNewDownloadTaskEvent addNewDownloadTaskEvent){
    VideoInfo videoInfo = addNewDownloadTaskEvent.getVideoInfo();
    DownloadTask downloadTask = new DownloadTask(
            UUIDUtil.genUUID(),videoInfo.getFileName(),
            ("m3u8".equals(videoInfo.getVideoFormat().getName())?"m3u8":"normal"),
            videoInfo.getVideoFormat().getName(),
            videoInfo.getUrl(),
            videoInfo.getSourcePageUrl(),
            videoInfo.getSourcePageTitle(),
            videoInfo.getSize());
    MainApplication.downloadManager.addTask(downloadTask);
}
 
Example 10
Source File: HomeFragment.java    From easyweather with MIT License 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onHandleBackground(MessageEvent event){
    if (event.getMessage() == UPDATE_WEATHER){
        ImageUtils.drawImage(MyApplication.getAppContext(),ImageUtils.BRIEF);
    }
}
 
Example 11
Source File: FileStreamerIntentService.java    From grblcontroller with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onGrblOkEvent(GrblOkEvent event){
    try {
        completedCommands.put(1);
    } catch (InterruptedException ignored) {}
}
 
Example 12
Source File: GrblUsbSerialService.java    From grblcontroller with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onGrblRealTimeCommandEvent(GrblRealTimeCommandEvent grblRealTimeCommandEvent){
    serialWriteByte(grblRealTimeCommandEvent.getCommand());
}
 
Example 13
Source File: MediaPlayerHolder.java    From android-simple-mediaplayer with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(LocalEventFromMainActivity.ResetPlayback event) {
    reset();
}
 
Example 14
Source File: GrblBluetoothSerialService.java    From grblcontroller with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onGrblRealTimeCommandEvent(GrblRealTimeCommandEvent grblRealTimeCommandEvent){
    serialWriteByte(grblRealTimeCommandEvent.getCommand());
}
 
Example 15
Source File: GrblBluetoothSerialService.java    From grblcontroller with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onGrblGcodeSendEvent(GcodeCommand event){
    serialWriteString(event.getCommandString());
}
 
Example 16
Source File: MediaPlayerHolder.java    From android-simple-mediaplayer with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(LocalEventFromMainActivity.StartPlayback event) {
    play();
}
 
Example 17
Source File: AbsTrackHandler.java    From Synapse with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public abstract void onTrackEvent(TrackEvent event);
 
Example 18
Source File: MediaPlayerHolder.java    From android-simple-mediaplayer with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(LocalEventFromMainActivity.SeekTo event) {
    seekTo(event.position);
}
 
Example 19
Source File: ExternalBroadcastSender.java    From TowerCollector with Mozilla Public License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onEvent(MeasurementsCollectedEvent event) {
    sendMeasurementsCollectedBroadcast(event.getMeasurement());
}
 
Example 20
Source File: MediaPlayerHolder.java    From android-simple-mediaplayer with Apache License 2.0 4 votes vote down vote up
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(
        LocalEventFromMainActivity.StartUpdatingSeekbarWithPlaybackPosition event) {
    startUpdatingSeekbarWithPlaybackProgress();
}