コード例 #1
0
  /** This method clears the current account address and launches Login Activity */
  public void logout() {

    // Remove current device on the backend so notifications are not sent to it
    ThreadManager.execute(
        new RemoveCurrentDeviceRunnable(
            (ZeppaApplication) getApplication(), getGoogleAccountCredential()));

    // Restore all singleton instances.
    EventTagSingleton.getInstance().restore();
    NotificationSingleton.getInstance().restore();
    ZeppaEventSingleton.getInstance().restore();
    ZeppaUserSingleton.getInstance().restore();

    // Clear logged in prefs
    getSharedPreferences(Constants.SHARED_PREFS, MODE_PRIVATE)
        .edit()
        .remove(Constants.LOGGED_IN_ACCOUNT)
        .commit();
    getSharedPreferences(Constants.SHARED_PREFS, MODE_PRIVATE)
        .edit()
        .remove(Constants.LOGGED_IN_USER_ID)
        .commit();

    // Return to Login activity
    Intent toLogin = new Intent(this, LoginActivity.class);
    startActivity(toLogin);
    finish();
  }
コード例 #2
0
  public void onNotificationReceived(ZeppaNotification notification) {
    Toast.makeText(
            this,
            NotificationSingleton.getInstance().getNotificationMessage(notification),
            Toast.LENGTH_SHORT)
        .show();

    // Event Canceled
    if (NotificationSingleton.getInstance().getNotificationTypeOrder(notification) == 5) {
      ZeppaEventSingleton.getInstance().removeEventById(notification.getEventId());
      ZeppaEventSingleton.getInstance().notifyObservers();

    } else if (notification.getType().equalsIgnoreCase("EVENT_RECOMMENDATION")
        || notification.getType().equalsIgnoreCase("DIRECT_INVITE")) {
      ZeppaEventSingleton.getInstance().notifyObservers();
    }
  }
コード例 #3
0
  @Override
  public void notifyDataSetChanged() {
    if (isScrolling) {
      this.updateOnScrollStop = true;
    } else {
      this.updateOnScrollStop = false;

      // Make sure the info is stale before updating
      if (ZeppaEventSingleton.getInstance().isInfoStale(lastDataUpdateTime)) {
        super.notifyDataSetChanged();
      }
    }
  }
コード例 #4
0
 @Override
 protected List<AbstractZeppaEventMediator> getCurrentEventMediators() {
   return ZeppaEventSingleton.getInstance().getEventMediators();
 }