dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(path: ':wear')
- provided 'com.google.android.wearable:wearable:2.1.0'
- compile 'com.google.android.support:wearable:2.1.0'
- compile 'com.google.android.gms:play-services-wearable:11.4.2'
+ provided 'com.google.android.wearable:wearable:2.2.0'
+ compile 'com.google.android.support:wearable:2.2.0'
+ compile 'com.google.android.gms:play-services-wearable:11.8.0'
- compile 'com.android.support:animated-vector-drawable:27.0.0'
- compile 'com.android.support:percent:27.0.0'
- compile 'com.android.support:support-vector-drawable:27.0.0'
- compile 'com.android.support:appcompat-v7:27.0.0'
- compile 'com.android.support:preference-v7:27.0.0'
- compile 'com.android.support:exifinterface:27.0.0'
- compile 'com.android.support:support-v4:27.0.0'
+ compile 'com.android.support:animated-vector-drawable:27.0.2'
+ compile 'com.android.support:percent:27.0.2'
+ compile 'com.android.support:support-vector-drawable:27.0.2'
+ compile 'com.android.support:appcompat-v7:27.0.2'
+ compile 'com.android.support:preference-v7:27.0.2'
+ compile 'com.android.support:exifinterface:27.0.2'
+ compile 'com.android.support:support-v4:27.0.2'
}
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.0'
+ classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
- provided 'com.google.android.wearable:wearable:2.1.0'
- compile 'com.google.android.support:wearable:2.1.0'
- compile 'com.google.android.gms:play-services-wearable:11.4.2'
+ provided 'com.google.android.wearable:wearable:2.2.0'
+ compile 'com.google.android.support:wearable:2.2.0'
+ compile 'com.google.android.gms:play-services-wearable:11.8.0'
//compile 'com.android.support:wear:26.0.0'
- compile 'com.android.support:animated-vector-drawable:27.0.0'
- compile 'com.android.support:percent:27.0.0'
- compile 'com.android.support:support-vector-drawable:27.0.0'
- compile 'com.android.support:appcompat-v7:27.0.0'
- compile 'com.android.support:preference-v7:27.0.0'
- compile 'com.android.support:exifinterface:27.0.0'
- compile 'com.android.support:support-v4:27.0.0'
+ compile 'com.android.support:animated-vector-drawable:27.0.2'
+ compile 'com.android.support:percent:27.0.2'
+ compile 'com.android.support:support-vector-drawable:27.0.2'
+ compile 'com.android.support:appcompat-v7:27.0.2'
+ compile 'com.android.support:preference-v7:27.0.2'
+ compile 'com.android.support:exifinterface:27.0.2'
+ compile 'com.android.support:support-v4:27.0.2'
compile files('libs/olycamerakit.jar')
}
Log.v(TAG, "onTouch() : prohibit operation");
return ((operationMode == IShowInformation.operation.ONLY_CONNECT)&&(changeScene.showConnectionStatus()));
}
- // 現在のところ、タッチエリアの場合はオートフォーカス実行で固定
+
+ // 画面下部のエリア(オートフォーカスエリア外)をタッチした場合には、ボタン押下アクションに切り替える
+ int hookId = checkHookTouchedPosition(v, event);
+ if (hookId != 0)
+ {
+ boolean ret = false;
+ if (hookId == R.id.liveview)
+ {
+ // 何もしないパターン。。。
+ return (true);
+ }
+ try
+ {
+ IPushedButton button = buttonDispatcher.get(hookId);
+ if (button != null)
+ {
+ // ボタンを押したことにする
+ ret = button.pushedButton(false);
+ //v.performClick(); // 本来はこっちで動かしたい。
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (ret);
+ }
+
+ // オートフォーカスエリアに含まれていた場合には、オートフォーカスを実行する
return ((id == R.id.liveview)&&(dispatcher.dispatchAreaAction(event, ICameraFeatureDispatcher.FEATURE_AREA_ACTION_DRIVE_AUTOFOCUS)));
}
/**
+ * タッチエリアを確認しフックするかどうか確認する (0なら hook しない)
+ *
+ */
+ private int checkHookTouchedPosition(View v, MotionEvent event)
+ {
+ int hookId = 0;
+ try
+ {
+ // オートフォーカスエリア内かどうかチェックする
+ if (dispatcher.dispatchAreaAction(event, ICameraFeatureDispatcher.FEATURE_AREA_ACTION_CHECK_CONTAINS_AUTOFOCUS_AREA))
+ {
+ if (event.getAction() != MotionEvent.ACTION_DOWN)
+ {
+ // オートフォーカスエリア内のときには、ACTION_DOWN のみを拾う
+ return (R.id.liveview);
+ }
+ // オートフォーカスエリアに含まれているのでオートフォーカスする
+ return (0);
+ }
+ if (event.getAction() != MotionEvent.ACTION_UP)
+ {
+ // オートフォーカスエリア外のときには、 ACTION_UP のみを拾う
+ return (R.id.liveview);
+ }
+
+ // オートフォーカスエリア外なので、イベントをフックしてボタン操作に変える(当面は右下のみ)
+ float areaY = event.getY() / v.getHeight();
+ float areaX = event.getX() / v.getWidth();
+ Log.v(TAG, "HOOKED POSITION (areaX : " + areaX + " areaY : " + areaY + ")");
+ if (areaY > 0.66f)
+ {
+ if (areaX > 0.8333f)
+ {
+ // 画面右下のオートフォーカスエリア外のときのみ、撮影ボタンを押したことにする
+ // (0.66f ... 画面タッチエリアの下 1/3、0.8333f ... 画面タッチエリアの右側 1/6)
+ return (R.id.btn_6);
+ }
+ else if (areaX < 0.1666f)
+ {
+ return (R.id.btn_1);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // ちゃんとポジションが取れなかった...
+ e.printStackTrace();
+ hookId = 0;
+ }
+ return (hookId);
+ }
+
+ /**
* 操作の可否を設定する。
*
*/
boolean driveAutoFocus(MotionEvent event);
void unlockAutoFocus();
+ /** ポイントがオートフォーカス可能なエリアかどうかチェックする **/
+ boolean isContainsAutoFocusPoint(MotionEvent event); // trueならオートフォーカス可能
+
/** シングル撮影機能の実行 **/
void singleShot();
if (!isWatchingLevelGauge)
{
// レベルゲージの監視はしない
- Log.v(TAG, "checkLevelGauge() : not watch");
+ // Log.v(TAG, "checkLevelGauge() : not watch"); // 結構ログが出るので消す
return;
}
try
import android.app.Activity;
import android.graphics.PointF;
+import android.graphics.RectF;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.Toast;
}
/**
+ * オートフォーカスのポイントに含まれているか確認する (trueだったら含まれる)
+ *
+ */
+ @Override
+ public boolean isContainsAutoFocusPoint(MotionEvent event)
+ {
+ //// 以下の機能は、タッチイベントの受信時のみ動作させる
+ //if (event.getAction() != MotionEvent.ACTION_DOWN)
+ //{
+ // return (false);
+ //}
+ try
+ {
+ // タッチした位置を取得する
+ PointF point = focusFrameDisplay.getPointWithEvent(event);
+
+ // AFの有効座標を取得する
+ RectF rect = camera.getAutoFocusEffectiveArea();
+ //Log.v(TAG, "AF POINT (" + point.x + "," + point.y + ")");
+ //Log.v(TAG, "AF EFFECTIVE AREA (" + rect.left + "," + rect.left + ") - (" + rect.right + "," + rect.bottom + ")");
+ return (rect.contains(point.x, point.y));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ /**
* フォーカスロックの解除
*/
public void unlockAutoFocus()
*/
break;
+ case ICameraFeatureDispatcher.FEATURE_AREA_ACTION_CHECK_CONTAINS_AUTOFOCUS_AREA:
+ // AUTOFOCUS エリアに含まれているかどうかチェックする
+ ret = camera.isContainsAutoFocusPoint(event);
+ break;
+
case FEATURE_AREA_ACTION_NONE:
default:
// 何もしない
int FEATURE_AREA_ACTION_NONE = 100;
int FEATURE_AREA_ACTION_NOT_CONNECTED = 101;
int FEATURE_AREA_ACTION_DRIVE_AUTOFOCUS = 102;
+ int FEATURE_AREA_ACTION_CHECK_CONTAINS_AUTOFOCUS_AREA = 103;
+
+
// アクションインタフェース
String getTakeMode(); // 撮影モードの取得