private OlyCameraLiveViewOnTouchListener listener = null;
private Vibrator vibrator = null;
private boolean cameraDisconnectedHappened = false;
+ private boolean ambientMode = false;
/**
*
{
super.onEnterAmbient(ambientDetails);
Log.v(TAG, "onEnterAmbient()");
+ ambientMode =true;
}
/**
{
super.onExitAmbient();
Log.v(TAG, "onExitAmbient()");
+ ambientMode = false;
}
/**
public void exitApplication()
{
Log.v(TAG, "exitApplication()");
+ if (ambientMode)
+ {
+ // アンビエントモードの時(≒自分でアプリを終了しなかったとき)は、何もしない
+ // (接続したままとする)
+ Log.v(TAG, "keep liveview.");
+ return;
+ }
// ライブビューを停止させる
coordinator.stopLiveView();
*
*/
@Override
- public void vibrate(int vibratePattern)
+ public void vibrate(final int vibratePattern)
{
try
{
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_SHORT_DOUBLE:
- long[] pattern = { 10, 25, 20, 25, 0 };
- vibrator.vibrate(pattern, -1);
- break;
- case IShowInformation.VIBRATE_PATTERN_NONE:
- default:
- // ぶるぶるしない
- break;
- }
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ 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_SHORT_DOUBLE:
+ long[] pattern = { 10, 25, 20, 25, 0 };
+ vibrator.vibrate(pattern, -1);
+ break;
+ case IShowInformation.VIBRATE_PATTERN_NONE:
+ default:
+ // ぶるぶるしない
+ break;
+ }
+ }
+ });
+ thread.start();
}
catch (Exception e)
{
e.printStackTrace();
}
}
-
}