*
*/
@Override
- public void pushedButton(String code)
+ public boolean pushedButton(String code, boolean isLongPress)
{
- pushButton(code);
+ return (pushButton(code, isLongPress));
}
/**
*
*
*/
- private void pushButton(@NonNull final String keyName)
+ private boolean pushButton(@NonNull final String keyName, final boolean isLongPress)
{
Log.v(TAG, "pushButton()");
if (keyName.equals(ICameraButtonControl.SPECIAL_GREEN_BUTTON))
{
// Greenボタンの処理を入れる
- processGreenButton();
- return;
+ return (processGreenButton(isLongPress));
}
try
{
try
{
String cmd = "cmd=" + keyName;
+ if (isLongPress)
+ {
+ // ボタン長押しの場合...
+ cmd = cmd + " 1";
+ }
String result = SimpleHttpClient.httpPost(buttonControlUrl, cmd, timeoutMs);
if ((result == null)||(result.length() < 1)) {
Log.v(TAG, "pushButton() reply is null. " + cmd);
{
e.printStackTrace();
}
+ return (true);
}
- private void processGreenButton()
+ private boolean processGreenButton(boolean isLongPress)
{
Log.v(TAG, "processGreenButton()");
try
{
e.printStackTrace();
}
+ return (true);
}
}
*
*
*/
-class LiveViewKeyPanelClickListener implements View.OnClickListener
+class LiveViewKeyPanelClickListener implements View.OnClickListener, View.OnLongClickListener
{
private final String TAG = toString();
private final IInterfaceProvider interfaceProvider;
void updateToggleButton(boolean isOn);
void updateLcdOnOff(boolean isOn);
void updateAFLlever(boolean isCaf);
- };
+ }
LiveViewKeyPanelClickListener(@NonNull IInterfaceProvider interfaceProvider, @Nullable KeyPanelFeedback feedback, @Nullable Vibrator vibrator)
{
@Override
public void onClick(View view)
{
+ onButtonClick(view, false);
+ }
+
+
+ private boolean onButtonClick(View view, boolean isLongPress)
+ {
+ boolean ret = true;
try
{
String keyId = "";
keyId = decideLCDOnOff();
break;
default:
- Log.v(TAG, "onClick() : " + id);
+ Log.v(TAG, "onClick() : " + id + " [long:" + isLongPress + "]");
+ ret = false;
break;
}
if (keyId.length() > 1)
ICameraButtonControl buttonControl = interfaceProvider.getButtonControl();
if (buttonControl != null)
{
- buttonControl.pushedButton(keyId);
+ ret = buttonControl.pushedButton(keyId, isLongPress);
if (vibrator != null)
{
vibrator.vibrate(30);
catch (Exception e)
{
e.printStackTrace();
+ ret = false;
+ }
+ return (ret);
+ }
+
+ /**
+ * ボタンの長押し処理
+ *
+ */
+ @Override
+ public boolean onLongClick(View view)
+ {
+ try
+ {
+ int id = view.getId();
+ if ((id == R.id.button_function_1)||(id == R.id.button_function_3))
+ {
+ return (onButtonClick(view, true));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
}
+ return (false);
}
private String decideAccLock()