OSDN Git Service

切り替えたときに接続方式を右上に表示するようにした。
authorMRSa <mrsa@myad.jp>
Sat, 9 Jan 2021 15:54:36 +0000 (00:54 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 9 Jan 2021 15:54:36 +0000 (00:54 +0900)
wear/src/main/java/jp/sfjp/gokigen/a01c/MainActivity.java
wear/src/main/java/jp/sfjp/gokigen/a01c/liveview/CameraLiveImageView.java

index 14d7f9c..5b7e694 100644 (file)
@@ -835,7 +835,13 @@ public class MainActivity extends AppCompatActivity implements  IChangeScene, IS
         {
             String connectionMethod = preferences.getString(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD, IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
             int methodId = (connectionMethod.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA)) ? R.string.connection_method_theta : R.string.connection_method_opc;
-            setMessage(IShowInformation.AREA_5, Color.MAGENTA, getString(methodId));
+            setMessage(IShowInformation.AREA_7, Color.MAGENTA, getString(methodId));
+            if (liveView == null)
+            {
+                liveView = findViewById(R.id.liveview);
+            }
+            liveView.setupInitialBackgroundImage(this);
+            liveView.invalidate();
         }
         catch (Exception e)
         {
index 3f0b13f..5c15d9a 100644 (file)
@@ -9,6 +9,8 @@ import android.graphics.Paint;
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.RectF;
+
+import androidx.annotation.NonNull;
 import androidx.exifinterface.media.ExifInterface;
 import androidx.preference.PreferenceDataStore;
 
@@ -118,28 +120,7 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
         gridFrameDrawer = GridFrameFactory.getGridFrameDrawer(framingGridStatus);
 
         // ダミーのビットマップデータ読み込み...画面表示のテスト用ロジック
-        try
-        {
-            int imageId = R.drawable.momonga;
-            try
-            {
-                String connectionMethod = preferences.getString(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD, IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
-                if (connectionMethod != null)
-                {
-                    imageId = (connectionMethod.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA)) ? R.drawable.kamakura : R.drawable.momonga;
-                }
-            }
-            catch (Throwable tt)
-            {
-                tt.printStackTrace();
-            }
-            imageBitmap = BitmapFactory.decodeResource(context.getResources(), imageId);
-        }
-        catch (Throwable t)
-        {
-            t.printStackTrace();
-            imageBitmap = null;
-        }
+        setupInitialBackgroundImage(context);
     }
 
     /**
@@ -386,6 +367,32 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
         }
     }
 
+    public void setupInitialBackgroundImage(@NonNull Context context)
+    {
+        try
+        {
+            int imageId = R.drawable.momonga;
+            try
+            {
+                String connectionMethod = preferences.getString(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD, IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
+                if (connectionMethod != null)
+                {
+                    imageId = (connectionMethod.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA)) ? R.drawable.kamakura : R.drawable.momonga;
+                }
+            }
+            catch (Throwable tt)
+            {
+                tt.printStackTrace();
+            }
+            imageBitmap = BitmapFactory.decodeResource(context.getResources(), imageId);
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+            imageBitmap = null;
+        }
+    }
+
     /**
      *
      *