public void showZoomer(boolean force) {
   if (force || zoomer.getVisibility() != View.VISIBLE) {
     zoomer.show();
     hideZoomAfterMs = SystemClock.uptimeMillis() + ZOOM_HIDE_DELAY_MS;
     canvas.handler.postAtTime(hideZoomInstance, hideZoomAfterMs + 10);
   }
 }
  void continueConnecting() {
    // TODO: Implement left-icon
    // requestWindowFeature(Window.FEATURE_LEFT_ICON);
    // setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icon);

    setContentView(R.layout.canvas);
    canvas = (RemoteCanvas) findViewById(R.id.vnc_canvas);
    zoomer = (ZoomControls) findViewById(R.id.zoomer);

    // Initialize and define actions for on-screen keys.
    initializeOnScreenKeys();

    canvas.initializeCanvas(
        connection,
        database,
        new Runnable() {
          public void run() {
            try {
              setModes();
            } catch (NullPointerException e) {
            }
          }
        });

    canvas.setOnKeyListener(this);
    canvas.setFocusableInTouchMode(true);
    canvas.setDrawingCacheEnabled(false);

    // This code detects when the soft keyboard is up and sets an appropriate visibleHeight in
    // vncCanvas.
    // When the keyboard is gone, it resets visibleHeight and pans zero distance to prevent us from
    // being
    // below the desktop image (if we scrolled all the way down when the keyboard was up).
    // TODO: Move this into a separate thread, and post the visibility changes to the handler.
    //       to avoid occupying the UI thread with this.
    final View rootView = ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);
    rootView
        .getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {
              @Override
              public void onGlobalLayout() {
                Rect r = new Rect();

                rootView.getWindowVisibleDisplayFrame(r);

                // To avoid setting the visible height to a wrong value after an screen unlock event
                // (when r.bottom holds the width of the screen rather than the height due to a
                // rotation)
                // we make sure r.top is zero (i.e. there is no notification bar and we are in
                // full-screen mode)
                // It's a bit of a hack.
                if (r.top == 0) {
                  if (canvas.bitmapData != null) {
                    canvas.setVisibleHeight(r.bottom);
                    canvas.pan(0, 0);
                  }
                }

                // Enable/show the zoomer if the keyboard is gone, and disable/hide otherwise.
                // We detect the keyboard if more than 19% of the screen is covered.
                int offset = 0;
                int rootViewHeight = rootView.getHeight();
                if (r.bottom > rootViewHeight * 0.81) {
                  offset = rootViewHeight - r.bottom;
                  // Soft Kbd gone, shift the meta keys and arrows down.
                  if (layoutKeys != null) {
                    layoutKeys.offsetTopAndBottom(offset);
                    keyStow.offsetTopAndBottom(offset);
                    if (prevBottomOffset != offset) {
                      setExtraKeysVisibility(View.GONE, false);
                      canvas.invalidate();
                      zoomer.enable();
                    }
                  }
                } else {
                  offset = r.bottom - rootViewHeight;
                  //  Soft Kbd up, shift the meta keys and arrows up.
                  if (layoutKeys != null) {
                    layoutKeys.offsetTopAndBottom(offset);
                    keyStow.offsetTopAndBottom(offset);
                    if (prevBottomOffset != offset) {
                      setExtraKeysVisibility(View.VISIBLE, true);
                      canvas.invalidate();
                      zoomer.hide();
                      zoomer.disable();
                    }
                  }
                }
                setKeyStowDrawableAndVisibility();
                prevBottomOffset = offset;
              }
            });

    zoomer.hide();

    zoomer.setOnZoomKeyboardClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            InputMethodManager inputMgr =
                (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMgr.toggleSoftInput(0, 0);
          }
        });

    zoomer.setOnShowMenuClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            RemoteCanvasActivity.this.openOptionsMenu();
          }
        });
    panner = new Panner(this, canvas.handler);

    inputHandler = getInputHandlerById(R.id.itemInputTouchPanZoomMouse);
  }