コード例 #1
0
  /** {@inheritDoc} */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    camScreen = new CameraSurface(this);
    setContentView(camScreen);

    augmentedView = new AugmentedView(this);
    augmentedView.setOnTouchListener(this);
    LayoutParams augLayout = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    addContentView(augmentedView, augLayout);

    zoomLayout = new LinearLayout(this);
    zoomLayout.setVisibility((showZoomBar) ? LinearLayout.VISIBLE : LinearLayout.GONE);
    zoomLayout.setOrientation(LinearLayout.VERTICAL);
    zoomLayout.setPadding(5, 5, 5, 5);
    zoomLayout.setBackgroundColor(ZOOMBAR_BACKGROUND_COLOR);

    endLabel = new VerticalTextView(this);
    endLabel.setText(END_TEXT);
    endLabel.setTextColor(END_TEXT_COLOR);
    LinearLayout.LayoutParams zoomTextParams =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    zoomTextParams.gravity = Gravity.CENTER;
    zoomLayout.addView(endLabel, zoomTextParams);

    myZoomBar = new VerticalSeekBar(this);
    myZoomBar.setMax(100);
    myZoomBar.setProgress(50);
    myZoomBar.setOnSeekBarChangeListener(myZoomBarOnSeekBarChangeListener);
    LinearLayout.LayoutParams zoomBarParams =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
    zoomBarParams.gravity = Gravity.CENTER_HORIZONTAL;
    zoomLayout.addView(myZoomBar, zoomBarParams);

    FrameLayout.LayoutParams frameLayoutParams =
        new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, Gravity.RIGHT);
    addContentView(zoomLayout, frameLayoutParams);

    updateDataOnZoom();

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen");
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_motion);

    preview = (SurfaceView) findViewById(R.id.preview);
    previewHolder = preview.getHolder();
    previewHolder.addCallback(surfaceCallback);
    previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    if (Preferences.USE_RGB) {
      detector = new RgbMotionDetection();
    } else if (Preferences.USE_LUMA) {
      detector = new LumaMotionDetection();
    } else {
      // Using State based (aggregate map)
      detector = new AggregateLumaMotionDetection();
    }
  }