/** @param context */
      public CameraButtonView(Context context) {
        super(context);

        setOnItemClickListener(CameraView.this);

        // Layout:
        setBackgroundColor(Color.TRANSPARENT);
        setGravity(Gravity.CENTER);
        setPadding(0, collectorUI.getSpacingPx(), 0, 0);

        // Columns
        setNumColumns(getNumberOfColumns());

        // Images/buttons:

        // Button size, padding & background colour:
        this.setItemDimensionsPx(
            LayoutParams.MATCH_PARENT,
            ScreenMetrics.ConvertDipToPx(context, AndroidControlsUI.CONTROL_HEIGHT_DIP));
        this.buttonBackColor =
            ColourHelpers.ParseColour(
                controller.getCurrentForm().getControlBackgroundColor(),
                Form.DEFAULT_CONTROL_BACKGROUND_COLOR /*light gray*/);

        // The addButtons() should be called after the button parameters (size, padding etc.) have
        // been setup
        addButtons();

        // And finally:
        setAdapter(getAdapter()); // this is supposedly needed on Android v2.3.x (TODO test it)
      }
Example #2
0
  public void applyProperties(View view) {
    // Set padding (same all round):
    int paddingPx = ScreenMetrics.ConvertDipToPx(view.getContext(), paddingDip);
    view.setPadding(paddingPx, paddingPx, paddingPx, paddingPx);

    // Set background color:
    view.setBackgroundColor(backgroundColor);

    // Set the description used for accessibility support:
    if (description != null) view.setContentDescription(description);

    // Set view visibility:
    view.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
  }