1 package net.osdn.gokigen.cameratest.camtest;
3 import android.content.Context;
4 import android.graphics.Canvas;
5 import android.graphics.Color;
6 import android.graphics.Paint;
7 import android.graphics.Point;
8 import android.util.AttributeSet;
9 import android.util.Log;
11 import androidx.appcompat.widget.AppCompatImageView;
13 import net.osdn.gokigen.cameratest.fuji.statuses.IFujiStatus;
15 public class InformationView extends AppCompatImageView
17 private final String TAG = toString();
18 private Point focusPoint;
19 private int sd_remain_size;
20 private String shooting_mode;
21 private boolean focus_lock;
22 private boolean isDeviceError;
23 private int battery_level;
25 private String shutter_speed = "";
26 private String aperture = "";
27 private String expRev = "";
28 private String whiteBalance = "";
29 private String focusControlMode = "";
30 private String imageAspect = "";
31 private String imageFormat = "";
32 private String filmSimulation = "";
33 private int f_ss_Control = -1;
36 public InformationView(Context context) {
38 initComponent(context);
41 public InformationView(Context context, AttributeSet attrs) {
42 super(context, attrs);
43 initComponent(context);
46 public InformationView(Context context, AttributeSet attrs, int defStyleAttr) {
47 super(context, attrs, defStyleAttr);
48 initComponent(context);
51 private void initComponent(Context context) {
56 protected void onDraw(Canvas canvas)
62 private void drawCanvas(Canvas canvas)
67 canvas.drawARGB(255, 0, 0, 0);
70 int centerX = canvas.getWidth() / 2;
71 int centerY = canvas.getHeight() / 2;
73 Paint framePaint = new Paint();
74 framePaint.setStyle(Paint.Style.STROKE);
75 framePaint.setColor(Color.WHITE);
77 String message = shooting_mode + " REMAIN : " + sd_remain_size + " ISO : " + iso + " BATT: ";
78 if (battery_level < 0)
80 message = message + "???";
84 message = message + battery_level + "% ";
86 message = message + " " + shutter_speed + " " + aperture + " " + expRev + " : cnt:" + f_ss_Control;
87 canvas.drawText(message, centerX, centerY - 50, framePaint);
91 message = "WB: " + whiteBalance + " ";
92 if (focusPoint != null)
94 message = message + "FOCUS : [" + focusPoint.x + "," + focusPoint.y + "] ";
98 message = message + " (LOCKED)";
102 message = message + " ERROR";
104 message = message + " [" + focusControlMode + "] ";
105 canvas.drawText(message, centerX, centerY, framePaint);
109 message = imageAspect + " " + imageFormat + " " + "[" + filmSimulation + "]" + " ";
110 canvas.drawText(message, centerX, centerY + 50, framePaint);
125 public void drawInformation(IFujiStatus cameraStatus)
127 focusPoint = cameraStatus.getFocusPoint();
128 sd_remain_size = cameraStatus.getRemainImageSpace();
129 shooting_mode = cameraStatus.getShootingMode();
130 focus_lock = cameraStatus.isFocusLocked();
131 battery_level = cameraStatus.getBatteryLevel();
132 isDeviceError = cameraStatus.isDeviceError();
133 iso = cameraStatus.getIsoSensitivity();
134 shutter_speed = cameraStatus.getShutterSpeed();
135 aperture = cameraStatus.getAperture();
136 expRev = cameraStatus.getExpRev();
137 whiteBalance = cameraStatus.getWhiteBalance();
138 f_ss_Control = cameraStatus.getF_SS_Control();
139 focusControlMode = cameraStatus.getFocusControlMode();
140 imageAspect = cameraStatus.getImageAspect();
141 imageFormat = cameraStatus.getImageFormat();
142 filmSimulation = cameraStatus.getFilmSimulation();