com.squareup.otto.Subscribe.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中com.squareup.otto.Subscribe.<init>()方法的一些代码示例,展示了Subscribe.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subscribe.<init>()方法的具体详情如下:
包路径:com.squareup.otto.Subscribe
类名称:Subscribe
方法名:<init>

Subscribe.<init>介绍

暂无

代码示例

代码示例来源:origin: androidannotations/androidannotations

@Subscribe
public void onEvent(Event event) {
  lastEvent = event;
}

代码示例来源:origin: greenrobot/EventBus

@Subscribe
public void onEvent(TestEvent event) {
  eventsReceivedCount.incrementAndGet();
}

代码示例来源:origin: square/otto

@Subscribe public void onImageAvailable(ImageAvailableEvent event) {
 if (imageView != null) {
  imageView.setImageDrawable(event.image);
 }
}

代码示例来源:origin: square/otto

@Subscribe public void onLocationCleared(LocationClearEvent event) {
  locationEvents.clear();
  if (adapter != null) {
   adapter.notifyDataSetChanged();
  }
 }
}

代码示例来源:origin: square/otto

@Subscribe public void onLocationChanged(LocationChangedEvent event) {
 locationEvents.add(0, event.toString());
 if (adapter != null) {
  adapter.notifyDataSetChanged();
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Subscribe
public void onRandomEvent(final RandomEvent event) {
 if (getActivity() != null) {
  getActivity().runOnUiThread(new Runnable() {
   @Override
   public void run() {
    adapter.add(event);
   }
  });
 }
}

代码示例来源:origin: square/otto

@Subscribe public void onLocationChanged(LocationChangedEvent event) {
 // Stop existing download, if it exists.
 if (downloadTask != null) {
  downloadTask.cancel(true);
 }
 // Trigger a background download of an image for the new location.
 downloadTask = new DownloadTask();
 downloadTask.execute(String.format(URL, event.lat, event.lon));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Subscribe
 public void onDeadEvent(DeadEvent braiiiiiiinz) {
  RandomEvent original=(RandomEvent)braiiiiiiinz.event;
  NotificationCompat.Builder b=new NotificationCompat.Builder(this);
  Intent ui=new Intent(this, EventDemoActivity.class);

  b.setAutoCancel(true).setDefaults(Notification.DEFAULT_SOUND)
   .setContentTitle(getString(R.string.notif_title))
   .setContentText(Integer.toHexString(original.value))
   .setSmallIcon(android.R.drawable.stat_notify_more)
   .setTicker(getString(R.string.notif_title))
   .setContentIntent(PendingIntent.getActivity(this, 0, ui, 0));

  NotificationManager mgr=
    (NotificationManager)getSystemService(NOTIFICATION_SERVICE);

  mgr.notify(NOTIFY_ID, b.build());
 }
}

代码示例来源:origin: ribot/ribot-app-android

@Subscribe
public void onAuthenticationError(BusEvent.AuthenticationError event) {
  mDataManager.signOut()
      .observeOn(AndroidSchedulers.mainThread())
      .subscribeOn(Schedulers.io())
      .subscribe(new Action1<Void>() {
        @Override
        public void call(Void aVoid) {
          startSignInActivity();
        }
      });
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe
public void onBrowserAuthResult(RedirectReceiverActivity.BrowserAuthResult event) {
  if (!TextUtils.isEmpty(event.code)) {
    setResult(RESULT_OK, new Intent().putExtra(EXTRA_CODE, event.code));
  } else {
    setResult(RESULT_OK, new Intent().putExtra(EXTRA_ERROR, event.error));
  }
  finish();
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void onConnect(AccountConnectionChangedEvent event) {
  if (event.connected) {
    startActivityForResult(new Intent(this,
        AccountManagerAuthActivity.class), REQUEST_PICK_ACCOUNT);
  } else {
    showDialog(DISCONNECT);
  }
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void canceled(CancelEvent cancelEvent) {
  if (LOCAL_LOGV) {
    Log.v(TAG, "canceled("+cancelEvent+")");
  }
  cancel(cancelEvent.mayInterruptIfRunning());
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void backupStateChanged(final BackupState newState) {
  if ((newState.backupType == MANUAL || newState.backupType == SKIP) && newState.isPermissionException()) {
    ActivityCompat.requestPermissions(this,
      newState.getMissingPermissions(),
      newState.backupType == SKIP ? REQUEST_PERMISSIONS_BACKUP_MANUAL_SKIP : REQUEST_PERMISSIONS_BACKUP_MANUAL
    );
  }
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void handleFallbackAuth(FallbackAuthEvent event) {
  if (event.showDialog) {
    showDialog(WEB_CONNECT);
  } else {
    startActivityForResult(fallbackAuthIntent, REQUEST_WEB_AUTH);
  }
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void doPerform(Actions action) {
  switch (action) {
    case Backup:
    case BackupSkip:
      startBackup(action == Backup ? MANUAL : SKIP);
      break;
    case Restore:
      startRestore();
      break;
  }
}

代码示例来源:origin: ribot/ribot-app-android

@Subscribe
public void onBeaconsSyncCompleted(BusEvent.BeaconsSyncCompleted event) {
  Timber.i("Beacons sync completed, refreshing monitoring regions...");
  // Connect will trigger a call to startMonitoringRegisteredBeaconUuids() that will
  // start monitoring any new beacon saved after the sync.
  mBeaconManager.connect(this);
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void autoBackupSettingsChanged(final AutoBackupSettingsChangedEvent event) {
  if (LOCAL_LOGV) {
    Log.v(TAG, "autoBackupSettingsChanged("+event+")");
  }
  setBroadcastReceiversEnabled(preferences.isUseOldScheduler() && preferences.isAutoBackupEnabled());
  rescheduleJobs();
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void onOAuth2Callback(OAuth2CallbackTask.OAuth2CallbackEvent event) {
  if (event.valid()) {
    authPreferences.setOauth2Token(event.token.userName, event.token.accessToken, event.token.refreshToken);
    onAuthenticated();
  } else {
    showDialog(OAUTH2_ACCESS_TOKEN_ERROR);
  }
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void onSettingsReset(SettingsResetEvent event) {
  preferences.getDataTypePreferences().clearLastSyncData();
  preferences.reset();
  updateConnected();
}

代码示例来源:origin: jberkel/sms-backup-plus

@Subscribe public void restoreStateChanged(final RestoreState newState) {
  if (newState.isFinished() && isSmsBackupDefaultSmsApp(this)) {
     restoreDefaultSmsProvider(preferences.getSmsDefaultPackage());
  }
}

相关文章