import android.graphics.Color;
import android.os.Bundle;
+import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.support.wearable.activity.WearableActivity;
import android.util.Log;
private IOlyCameraCoordinator coordinator = null;
private IMessageDrawer messageDrawer = null;
private OlyCameraLiveViewOnTouchListener listener = null;
+ private Vibrator vibrator = null;
/**
*
*/
(ContextCompat.checkSelfPermission(this, Manifest.permission.CHANGE_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED)||
(ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_SETTINGS) != PackageManager.PERMISSION_GRANTED)||
(ContextCompat.checkSelfPermission(this, Manifest.permission.WAKE_LOCK) != PackageManager.PERMISSION_GRANTED)||
+ (ContextCompat.checkSelfPermission(this, Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED)||
(ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED))
{
ActivityCompat.requestPermissions(this,
// warn the user that location function is not available.
}
+ // バイブレータをつかまえる
+ vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
+
listener = new OlyCameraLiveViewOnTouchListener(this);
setupCameraCoordinator();
coordinator.setRecViewMode(false);
listener.setEnableOperation(true);
setMessage(IShowInformation.AREA_C, Color.WHITE, "");
+ coordinator.updateStatusAll();
}
/**
{
return (getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS));
}
+
+ /**
+ *
+ *
+ */
+ @Override
+ public void vibrate(int vibratePattern)
+ {
+ try
+ {
+ if ((vibrator == null)||(!vibrator.hasVibrator()))
+ {
+ return;
+ }
+
+ switch (vibratePattern)
+ {
+ case IShowInformation.VIBRATE_PATTERN_SIMPLE_LONGLONG:
+ vibrator.vibrate(300);
+ break;
+ case IShowInformation.VIBRATE_PATTERN_SIMPLE_LONG:
+ vibrator.vibrate(150);
+ break;
+ case IShowInformation.VIBRATE_PATTERN_SIMPLE_MIDDLE:
+ vibrator.vibrate(75);
+ break;
+ case IShowInformation.VIBRATE_PATTERN_SIMPLE_SHORT:
+ vibrator.vibrate(20);
+ break;
+ case IShowInformation.VIBRATE_PATTERN_NONE:
+ default:
+ // ぶるぶるしない
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+
}
Paint paint = new Paint();
paint.setColor(messageHolder.getColor(ShowMessageHolder.MessageArea.CENTER));
paint.setTextSize(messageHolder.getSize(ShowMessageHolder.MessageArea.CENTER));
+ paint.setAntiAlias(true);
Paint.FontMetrics fontMetrics = paint.getFontMetrics();
float cx = (canvas.getWidth() / 2.0f) - (paint.measureText(message) / 2.0f);
float cy = (canvas.getHeight() / 2.0f) - ((fontMetrics.ascent + fontMetrics.descent) / 2.0f);
canvas.drawText(message, cx, cy, paint);
}
- // ç\94»é\9d¢ä¸\8aé\83¨å\8f³側に表示する
+ // ç\94»é\9d¢ä¸\8aé\83¨å·¦側に表示する
message = messageHolder.getMessage(ShowMessageHolder.MessageArea.UPLEFT);
if ((message != null)&&(message.length() > 0))
{
Paint paintUp = new Paint();
paintUp.setColor(messageHolder.getColor(ShowMessageHolder.MessageArea.UPLEFT));
paintUp.setTextSize(messageHolder.getSize(ShowMessageHolder.MessageArea.UPLEFT));
- canvas.drawText(message, viewRect.left, viewRect.top, paintUp);
+ paintUp.setAntiAlias(true);
+ Paint.FontMetrics fontMetrics = paintUp.getFontMetrics();
+ canvas.drawText(message, viewRect.left + 3.0f, viewRect.top + (fontMetrics.descent - fontMetrics.ascent), paintUp);
}
- // 画面下部右側に表示する
+ // 画面上部右側に表示する
+ message = messageHolder.getMessage(ShowMessageHolder.MessageArea.UPRIGHT);
+ if ((message != null)&&(message.length() > 0))
+ {
+ Paint paintUp = new Paint();
+ paintUp.setColor(messageHolder.getColor(ShowMessageHolder.MessageArea.UPRIGHT));
+ paintUp.setTextSize(messageHolder.getSize(ShowMessageHolder.MessageArea.UPRIGHT));
+ paintUp.setAntiAlias(true);
+ float width = paintUp.measureText(message);
+ Paint.FontMetrics fontMetrics = paintUp.getFontMetrics();
+ canvas.drawText(message, (viewRect.right - 3.0f) - width, viewRect.top + (fontMetrics.descent - fontMetrics.ascent), paintUp);
+ }
+
+ // 画面下部左側に表示する
message = messageHolder.getMessage(ShowMessageHolder.MessageArea.LOWLEFT);
if ((message != null)&&(message.length() > 0))
{
Paint paint = new Paint();
paint.setColor(messageHolder.getColor(ShowMessageHolder.MessageArea.LOWLEFT));
paint.setTextSize(messageHolder.getSize(ShowMessageHolder.MessageArea.LOWLEFT));
+ paint.setAntiAlias(true);
Paint.FontMetrics fontMetrics = paint.getFontMetrics();
canvas.drawText(message, viewRect.left + 3.0f, viewRect.bottom - fontMetrics.bottom, paint);
}
+
+ // 画面下部右側に表示する
+ message = messageHolder.getMessage(ShowMessageHolder.MessageArea.LOWRIGHT);
+ if ((message != null)&&(message.length() > 0))
+ {
+ Paint paint = new Paint();
+ paint.setColor(messageHolder.getColor(ShowMessageHolder.MessageArea.LOWRIGHT));
+ paint.setTextSize(messageHolder.getSize(ShowMessageHolder.MessageArea.LOWRIGHT));
+ paint.setAntiAlias(true);
+ float width = paint.measureText(message);
+ Paint.FontMetrics fontMetrics = paint.getFontMetrics();
+ canvas.drawText(message, (viewRect.right - 3.0f) - width, viewRect.bottom - fontMetrics.bottom, paint);
+ }
+
}
/**
private int apertureArea = IShowInformation.AREA_3; // 絞り値の表示エリア指定
private int isoSensitivityArea = IShowInformation.AREA_4; // ISO感度の表示エリア指定
private int focalLengthArea = 0; // 焦点距離の表示エリア指定
- private int exposureCompensationArea = IShowInformation.AREA_6; // 露出補正値の表示エリア指定
- private int warningArea = IShowInformation.AREA_5; // 警告の表示エリア指定
- private int batteryLevelArea = 0; // バッテリの残量表示エリア指定
- private int whiteBalanceArea = 0; // ホワイトバランスの表示エリア指定
- private int driveModeArea = 0; // ドライブモードの表示エリア指定
- private int aeModeArea = 0; // 測光モードの表示エリア指定
- private int aeLockStateArea = 0; // AEロック状態の表示エリア指定
+ private int exposureCompensationArea = IShowInformation.AREA_6; // 露出補正値の表示エリア指定
+ private int warningArea = IShowInformation.AREA_7; // 警告の表示エリア指定
+ private int batteryLevelArea = 0; // バッテリの残量表示エリア指定
+ private int whiteBalanceArea = 0; // ホワイトバランスの表示エリア指定
+ private int driveModeArea = 0; // ドライブモードの表示エリア指定
+ private int aeModeArea = 0; // 測光モードの表示エリア指定
+ private int aeLockStateArea = IShowInformation.AREA_6; // AEロック状態の表示エリア指定
+ private int colorToneArea = IShowInformation.AREA_8; // 仕上がり・ピクチャーモードの表示エリア指定
+ private int artFilterArea = 0; // アートフィルターの表示エリア指定
/**
*
@Override
public void updateTakeMode()
{
+ if (takeModeArea == 0)
+ {
+ return;
+ }
+ Log.v(TAG, "updateTakeMode()");
String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.TAKE_MODE));
- if ((propetyValue != null)&&(takeModeArea != 0))
+ if (propetyValue != null)
{
informationObject.setMessage(takeModeArea, Color.WHITE, propetyValue);
+ updateDisplayArea(propetyValue);
}
}
@Override
public void updateDriveMode()
{
+ if (driveModeArea == 0)
+ {
+ return;
+ }
String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.DRIVE_MODE));
- if ((propetyValue != null)&&(driveModeArea != 0))
+ if (propetyValue != null)
{
informationObject.setMessage(driveModeArea, Color.WHITE, propetyValue);
}
@Override
public void updateWhiteBalance()
{
+ if (whiteBalanceArea == 0)
+ {
+ return;
+ }
String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.WB_MODE));
- if ((propetyValue != null)&&(whiteBalanceArea != 0))
+ if (propetyValue != null)
{
informationObject.setMessage(whiteBalanceArea, Color.WHITE, propetyValue);
}
@Override
public void updateBatteryLevel()
{
+ if (batteryLevelArea == 0)
+ {
+ return;
+ }
String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.BATTERY_LEVEL));
- if ((propetyValue != null)&&(batteryLevelArea != 0))
+ if (propetyValue != null)
{
informationObject.setMessage(batteryLevelArea, Color.WHITE, propetyValue);
}
@Override
public void updateAeMode()
{
+ if (aeModeArea == 0)
+ {
+ return;
+ }
String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.AE_MODE));
- if ((propetyValue != null)&&(aeModeArea != 0))
+ if (propetyValue != null)
{
informationObject.setMessage(aeModeArea, Color.WHITE, propetyValue);
}
@Override
public void updateAeLockState()
{
+ if (aeLockStateArea == 0)
+ {
+ return;
+ }
+ String message = "";
String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.AE_LOCK_STATE));
- if ((propetyValue != null)&&(aeLockStateArea != 0))
+ if (propetyValue != null)
{
if (propetyValue.equals("LOCK"))
{
- informationObject.setMessage(aeLockStateArea, Color.WHITE, "AE-L");
+ message = "AE-L";
}
}
+ if (message.length() > 0)
+ {
+ informationObject.setMessage(aeLockStateArea, Color.WHITE, message);
+ }
}
/**
@Override
public void updateWarning(String value)
{
- if((value != null)&&(warningArea != 0))
+ if (warningArea == 0)
+ {
+ return;
+ }
+ if(value != null)
{
{
- informationObject.setMessage(warningArea, Color.argb(0, 255,204,0), value);
+ informationObject.setMessage(warningArea, Color.argb(255, 255,204,0), value);
}
}
}
+ @Override
+ public void updateColorTone()
+ {
+ if (colorToneArea == 0)
+ {
+ return;
+ }
+ String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.COLOR_TONE));
+ if (propetyValue != null)
+ {
+ informationObject.setMessage(colorToneArea, Color.WHITE, propetyValue);
+ }
+ }
+
+
+ @Override
+ public void updateArtFilter()
+ {
+ if (artFilterArea == 0)
+ {
+ return;
+ }
+ String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.ART_FILTER));
+ if (propetyValue != null)
+ {
+ informationObject.setMessage(artFilterArea, Color.WHITE, /*Color.argb(255, 0x72, 0x39, 0x34),*/ propetyValue);
+ }
+ }
+
/**
*
*
@Override
public void updateExposureCompensation(String value)
{
- if((value != null)&&(exposureCompensationArea != 0))
+ if (exposureCompensationArea == 0)
+ {
+ return;
+ }
+ if (value != null)
{
if ("0.0".equals(value))
{
@Override
public void updateFocalLength(String value)
{
- if((value != null)&&(focalLengthArea != 0))
+ if (focalLengthArea == 0)
+ {
+ return;
+ }
+ if (value != null)
{
informationObject.setMessage(focalLengthArea, Color.WHITE, value);
}
@Override
public void updateIsoSensitivity(String value)
{
+ if (isoSensitivityArea == 0)
+ {
+ return;
+ }
String prefix = "ISO";
String propetyValue = propertyProxy.getCameraPropertyValueTitle(propertyProxy.getCameraPropertyValue(IOlyCameraProperty.ISO_SENSITIVITY));
if ("Auto".equals(propetyValue))
{
prefix = "iso";
}
- if((value != null)&&(isoSensitivityArea != 0))
+ if (value != null)
{
informationObject.setMessage(isoSensitivityArea, Color.WHITE, prefix + value);
}
@Override
public void updateShutterSpeed(String value)
{
- if((value != null)&&(shutterSpeedArea != 0))
+ if (shutterSpeedArea == 0)
+ {
+ return;
+ }
+ if (value != null)
{
informationObject.setMessage(shutterSpeedArea, Color.WHITE, value);
}
@Override
public void updateAperture(String value)
{
- if((value != null)&&(apertureArea != 0))
+ if (apertureArea == 0)
+ {
+ return;
+ }
+ if (value != null)
{
informationObject.setMessage(apertureArea, Color.WHITE, "F" + value);
}
}
+
+ /**
+ * 撮影モードに合わせて、表示内容を変化させる...
+ *
+ */
+ private void updateDisplayArea(String takeMode)
+ {
+ switch (takeMode)
+ {
+ case "P":
+ colorToneArea = IShowInformation.AREA_8;
+ artFilterArea = 0;
+ updateColorTone();
+ break;
+
+ case "A":
+ colorToneArea = 0;
+ artFilterArea = 0;
+ informationObject.setMessage(IShowInformation.AREA_8, Color.WHITE, "");
+ break;
+
+ case "S":
+ colorToneArea = 0;
+ artFilterArea = 0;
+ informationObject.setMessage(IShowInformation.AREA_8, Color.WHITE, "");
+ break;
+
+ case "M":
+ colorToneArea = 0;
+ artFilterArea = 0;
+ informationObject.setMessage(IShowInformation.AREA_8, Color.WHITE, "");
+ break;
+
+ case "ART":
+ colorToneArea = 0;
+ artFilterArea = IShowInformation.AREA_8;
+ updateArtFilter();
+ break;
+
+ case "iAuto":
+ colorToneArea = 0;
+ artFilterArea = 0;
+ informationObject.setMessage(IShowInformation.AREA_8, Color.WHITE, "");
+ break;
+
+ case "movie":
+ colorToneArea = 0;
+ artFilterArea = 0;
+ informationObject.setMessage(IShowInformation.AREA_8, Color.WHITE, "");
+ break;
+
+ default:
+ takeModeArea = IShowInformation.AREA_1; // 撮影モードの表示エリア指定
+ shutterSpeedArea = IShowInformation.AREA_2; // シャッタースピードの表示エリア指定
+ apertureArea = IShowInformation.AREA_3; // 絞り値の表示エリア指定
+ isoSensitivityArea = IShowInformation.AREA_4; // ISO感度の表示エリア指定
+ focalLengthArea = 0; // 焦点距離の表示エリア指定
+ exposureCompensationArea = IShowInformation.AREA_6; // 露出補正値の表示エリア指定
+ warningArea = IShowInformation.AREA_7; // 警告の表示エリア指定
+ batteryLevelArea = 0; // バッテリの残量表示エリア指定
+ whiteBalanceArea = 0; // ホワイトバランスの表示エリア指定
+ driveModeArea = 0; // ドライブモードの表示エリア指定
+ aeModeArea = 0; // 測光モードの表示エリア指定
+ aeLockStateArea = IShowInformation.AREA_6; // AEロック状態の表示エリア指定
+ colorToneArea = IShowInformation.AREA_8; // 仕上がり・ピクチャーモードの表示エリア指定
+ artFilterArea = 0; // アートフィルターの表示エリア指定
+ informationObject.setMessage(IShowInformation.AREA_8, Color.WHITE, "");
+ break;
+ }
+ }
+
/**
*
*
{
//informationObject.setMessage(IShowInformation.AREA_4, Color.argb(0, 255,204,0), message);
}
+
+ /**
+ * すべてのステータスをまとめて更新する
+ *
+ */
+ @Override
+ public void updateCameraStatusAll()
+ {
+ updateTakeMode();
+
+ updateColorTone();
+ updateDriveMode();
+ updateWhiteBalance();
+ updateBatteryLevel();
+ updateAeMode();
+ updateAeLockState();
+ updateArtFilter();
+ }
}