예제 #1
0
  public void toggleMarkerDisplay(View view) {
    if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.off) {
      detector.setMarkerDrawMode(MarkerDetector.MarkerDrawMode.outline);
    } else if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.outline) {
      detector.setMarkerDrawMode(MarkerDetector.MarkerDrawMode.regions);
    } else {
      detector.setMarkerDrawMode(MarkerDetector.MarkerDrawMode.off);
    }

    updateMenu();
  }
예제 #2
0
  protected void updateMenu() {
    Button flipCameraButton = (Button) findViewById(R.id.flipCameraButton);
    if (camera.getCameraCount() > 1) {
      flipCameraButton.setVisibility(View.VISIBLE);
      if (camera.isFront()) {
        flipCameraButton.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.ic_camera_front_white_24dp, 0, 0, 0);
        flipCameraButton.setText(getString(R.string.camera_front));
      } else {
        flipCameraButton.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.ic_camera_rear_white_24dp, 0, 0, 0);
        flipCameraButton.setText(getString(R.string.camera_rear));
      }
    } else {
      flipCameraButton.setVisibility(View.GONE);
    }

    Button thresholdDisplayButton = (Button) findViewById(R.id.thresholdDisplayButton);
    if (detector.shouldDrawThreshold()) {
      thresholdDisplayButton.setText(getString(R.string.threshold_on));
      thresholdDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_filter_b_and_w_white_24dp, 0, 0, 0);
    } else {
      thresholdDisplayButton.setText(getString(R.string.threshold_off));
      thresholdDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_filter_b_and_w_off_white_24dp, 0, 0, 0);
    }

    Button markerDisplayButton = (Button) findViewById(R.id.markerDisplayButton);
    if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.off) {
      markerDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_border_clear_white_24dp, 0, 0, 0);
      markerDisplayButton.setText(getString(R.string.marker_off));
    } else if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.outline) {
      markerDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_border_outer_white_24dp, 0, 0, 0);
      markerDisplayButton.setText(getString(R.string.marker_outline));
    } else {
      markerDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_border_all_white_24dp, 0, 0, 0);
      markerDisplayButton.setText(getString(R.string.marker_on));
    }

    // private ImageView autoOpenIcon;
    // private TextView autoOpenLabel;
  }