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;
74 Paint framePaint = new Paint();
75 framePaint.setStyle(Paint.Style.STROKE);
76 framePaint.setColor(Color.WHITE);
77 framePaint.setTextSize(24);
79 String message = shooting_mode + " REMAIN : " + sd_remain_size + " ISO : " + iso + " BATT: ";
80 if (battery_level < 0)
82 message = message + "???";
86 message = message + battery_level + "% ";
88 message = message + " " + shutter_speed + " " + aperture + " " + expRev + " : cnt:" + f_ss_Control;
89 canvas.drawText(message, startX, centerY - 50, framePaint);
93 message = "WB: " + whiteBalance + " ";
94 if (focusPoint != null)
96 message = message + "FOCUS : [" + focusPoint.x + "," + focusPoint.y + "] ";
100 message = message + " (LOCKED)";
104 message = message + " ERROR";
106 message = message + " [" + focusControlMode + "] ";
107 canvas.drawText(message, startX, centerY, framePaint);
111 message = imageAspect + " " + imageFormat + " " + "[" + filmSimulation + "]" + " ";
112 canvas.drawText(message, startX, centerY + 50, framePaint);
127 public void drawInformation(IFujiStatus cameraStatus)
129 focusPoint = cameraStatus.getFocusPoint();
130 sd_remain_size = cameraStatus.getRemainImageSpace();
131 shooting_mode = cameraStatus.getShootingMode();
132 focus_lock = cameraStatus.isFocusLocked();
133 battery_level = cameraStatus.getBatteryLevel();
134 isDeviceError = cameraStatus.isDeviceError();
135 iso = cameraStatus.getIsoSensitivity();
136 shutter_speed = cameraStatus.getShutterSpeed();
137 aperture = cameraStatus.getAperture();
138 expRev = cameraStatus.getExpRev();
139 whiteBalance = cameraStatus.getWhiteBalance();
140 f_ss_Control = cameraStatus.getF_SS_Control();
141 focusControlMode = cameraStatus.getFocusControlMode();
142 imageAspect = cameraStatus.getImageAspect();
143 imageFormat = cameraStatus.getImageFormat();
144 filmSimulation = cameraStatus.getFilmSimulation();