Ejemplo n.º 1
0
  private void processIntent(Intent intent) {
    // get either session instance or create one from a bookmark
    Bundle bundle = intent.getExtras();
    if (bundle.containsKey(PARAM_INSTANCE)) {
      int inst = bundle.getInt(PARAM_INSTANCE);
      session = GlobalApp.getSession(inst);
      bitmap = session.getSurface().getBitmap();
      bindSession();
    } else if (bundle.containsKey(PARAM_CONNECTION_REFERENCE)) {
      BookmarkBase bookmark = null;
      String refStr = bundle.getString(PARAM_CONNECTION_REFERENCE);
      if (ConnectionReference.isHostnameReference(refStr)) {
        bookmark = new ManualBookmark();
        bookmark.<ManualBookmark>get().setHostname(ConnectionReference.getHostname(refStr));
      } else if (ConnectionReference.isBookmarkReference(refStr)) {
        if (ConnectionReference.isManualBookmarkReference(refStr))
          bookmark =
              GlobalApp.getManualBookmarkGateway()
                  .findById(ConnectionReference.getManualBookmarkId(refStr));
        else assert false;
      }

      if (bookmark != null) connect(bookmark);
      else closeSessionActivity(RESULT_CANCELED);
    } else {
      // no session found - exit
      closeSessionActivity(RESULT_CANCELED);
    }
  }