OSDN Git Service

画面中央に文字を表示するときに影をつけて読みやすくした。
authorMRSa <mrsa@myad.jp>
Fri, 21 Jul 2017 15:23:25 +0000 (00:23 +0900)
committerMRSa <mrsa@myad.jp>
Fri, 21 Jul 2017 15:23:25 +0000 (00:23 +0900)
ブラケット撮影時に終了するまで操作を禁止するようにした。(ただし、アプリ終了は可能)

wear/src/main/java/jp/sfjp/gokigen/a01c/IShowInformation.java
wear/src/main/java/jp/sfjp/gokigen/a01c/MainActivity.java
wear/src/main/java/jp/sfjp/gokigen/a01c/liveview/CameraLiveImageView.java
wear/src/main/java/jp/sfjp/gokigen/a01c/liveview/OlyCameraLiveViewOnTouchListener.java
wear/src/main/java/jp/sfjp/gokigen/a01c/olycamerawrapper/takepicture/BracketingShotControl.java

index 6bdb10e..d09333a 100644 (file)
@@ -37,4 +37,5 @@ public interface IShowInformation
 
     void vibrate(final int vibratePattern);
 
+    void setEnabledOperation(boolean operation, boolean suppress);
 }
index 8c1fd62..fe3d884 100644 (file)
@@ -426,7 +426,7 @@ public class MainActivity extends WearableActivity implements  IChangeScene, ISh
         // ライブビューの開始 & タッチ/ボタンの操作を可能にする
         coordinator.startLiveView();
         coordinator.setRecViewMode(false);
-        listener.setEnableOperation(true);
+        listener.setEnableOperation(true, false);
         setMessage(IShowInformation.AREA_C, Color.WHITE, "");
         coordinator.updateStatusAll();
     }
@@ -440,7 +440,7 @@ public class MainActivity extends WearableActivity implements  IChangeScene, ISh
     {
         Log.v(TAG, "onCameraDisconnected()");
         setMessage(IShowInformation.AREA_C, Color.YELLOW, getString(R.string.camera_disconnected));
-        listener.setEnableOperation(false);
+        listener.setEnableOperation(false, false);
         cameraDisconnectedHappened = true;
     }
 
@@ -452,7 +452,7 @@ public class MainActivity extends WearableActivity implements  IChangeScene, ISh
     {
         Log.v(TAG, "onCameraOccursException()");
         setMessage(IShowInformation.AREA_C, Color.YELLOW, message);
-        listener.setEnableOperation(false);
+        listener.setEnableOperation(false, false);
         cameraDisconnectedHappened = true;
     }
 
@@ -647,4 +647,13 @@ public class MainActivity extends WearableActivity implements  IChangeScene, ISh
             e.printStackTrace();
         }
     }
+
+    @Override
+    public void setEnabledOperation(boolean operation, boolean suppress)
+    {
+        if (listener != null)
+        {
+            listener.setEnableOperation(operation, suppress);
+        }
+    }
 }
index 8ccc738..aeb2312 100644 (file)
@@ -10,6 +10,7 @@ import android.graphics.Paint;
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.RectF;
+import android.graphics.Typeface;
 import android.media.ExifInterface;
 import android.os.Looper;
 import android.preference.PreferenceManager;
@@ -669,6 +670,7 @@ public class CameraLiveImageView extends View implements CameraLiveViewListenerI
             paint.setColor(messageHolder.getColor(ShowMessageHolder.MessageArea.CENTER));
             paint.setTextSize(messageHolder.getSize(ShowMessageHolder.MessageArea.CENTER));
             paint.setAntiAlias(true);
+            paint.setShadowLayer(5.0f, 3.0f, 3.0f, Color.BLACK);  // これで文字に影をつけたい
             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);
index ffa3a06..50a50d2 100644 (file)
@@ -132,11 +132,12 @@ public class OlyCameraLiveViewOnTouchListener  implements View.OnClickListener,
      *   操作の可否を設定する。
      *
      *    @param operation  true: 操作可能, false: 操作不可
-     *
+     *    @param suppress   true: 操作不可, false: 接続操作実施 (操作不可時のコマンド受付)
      */
-    public void setEnableOperation(boolean operation)
+    public void setEnableOperation(boolean operation, boolean suppress)
     {
         prohibitOperation = !operation;
+        suppressOperation = suppress;
     }
 
     /**
index ad54751..b09f545 100644 (file)
@@ -189,7 +189,7 @@ public class BracketingShotControl implements OLYCamera.TakePictureCallback
             public void run()
             {
                 isBracketingAction = true;
-                updateMessage("INT");
+                updateMessage("BRACKET");
                 try
                 {
                     startBracket();
@@ -238,6 +238,7 @@ public class BracketingShotControl implements OLYCamera.TakePictureCallback
         }
 
         PointF afPoint = camera.getActualAutoFocusPoint();
+        statusDrawer.setEnabledOperation(false, true);  // 画面のタッチ操作を禁止
         for (int index = 0; index < bracketCount; index++)
         {
             // 撮影条件を更新する
@@ -311,6 +312,7 @@ public class BracketingShotControl implements OLYCamera.TakePictureCallback
         {
             e.printStackTrace();
         }
+        statusDrawer.setEnabledOperation(true, false);  // 画面のタッチ操作を有効化する
     }
 
     /**
@@ -326,7 +328,7 @@ public class BracketingShotControl implements OLYCamera.TakePictureCallback
             try
             {
                 // BKT表示(撮影枚数表示と待ち時間)を変える
-                updateMessage("WAIT " + count + "s.");
+                updateMessage("WAIT " + count + "sec.");
                 Thread.sleep(1000);
             }
             catch (Exception e)
@@ -369,7 +371,7 @@ public class BracketingShotControl implements OLYCamera.TakePictureCallback
         retryUpdateBracketingStatus = 0;
 
         // 撮影枚数表示を変える
-        updateMessage("INT " + (index + 1) + "/" + bracketCount);
+        updateMessage("BRACKET " + (index + 1) + "/" + bracketCount);
     }
 
     /**