OSDN Git Service

コミット忘れ...。
authorMRSa <mrsa@myad.jp>
Sat, 12 Aug 2017 13:14:05 +0000 (22:14 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 12 Aug 2017 13:14:05 +0000 (22:14 +0900)
wear/src/main/java/jp/sfjp/gokigen/a01c/olycamerawrapper/property/LoadSaveCameraProperties.java
wear/src/main/res/layout-notround/column_load.xml [new file with mode: 0644]
wear/src/main/res/layout-notround/column_save.xml [new file with mode: 0644]
wear/src/main/res/layout-notround/dialog_my_camera_properties.xml [new file with mode: 0644]
wear/src/main/res/layout-notround/list_camera_properties.xml [new file with mode: 0644]
wear/src/main/res/layout-round/column_load.xml [new file with mode: 0644]
wear/src/main/res/layout-round/column_save.xml [new file with mode: 0644]
wear/src/main/res/layout-round/dialog_my_camera_properties.xml [new file with mode: 0644]
wear/src/main/res/layout-round/list_camera_properties.xml [new file with mode: 0644]

index d8a1389..a15c3b6 100644 (file)
@@ -7,10 +7,12 @@ import android.util.Log;
 
 import java.text.DateFormat;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
 import jp.co.olympus.camerakit.OLYCamera;
+import jp.co.olympus.camerakit.OLYCameraKitException;
 import jp.sfjp.gokigen.a01c.olycamerawrapper.IOLYCameraObjectProvider;
 
 /**
@@ -84,6 +86,7 @@ public class LoadSaveCameraProperties implements ILoadSaveCameraProperties
     {
         Log.v(TAG, "loadCameraSettings() : START [" + idHeader + "]");
         //loadCameraSettingsBatch(idHeader);
+        //loadCameraSettingsMiniBatch(idHeader);
         loadCameraSettingsSequential(idHeader);
     }
 
@@ -142,7 +145,7 @@ public class LoadSaveCameraProperties implements ILoadSaveCameraProperties
             Log.v(TAG, "loadCameraSettingsSequential() : END [" + idHeader + "]" + " " + setCount);
         }
     }
-/*
+/**/
     //// プロパティの一括設定
     private void loadCameraSettingsBatch(String idHeader)
     {
@@ -199,5 +202,61 @@ public class LoadSaveCameraProperties implements ILoadSaveCameraProperties
             Log.v(TAG, "loadCameraSettingsBatch() : END [" + idHeader + "]" + " " + values.size());
         }
     }
-*/
+
+    //// プロパティの一括設定
+    private void loadCameraSettingsMiniBatch(String idHeader)
+    {
+        // Restores my settings.
+        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(parent);
+        if (camera.isConnected())
+        {
+            String takeModeValue = preferences.getString(idHeader + TAKEMODE, null);
+            try
+            {
+                // TAKEMODE だけは先行して設定する(設定できないカメラプロパティもあるので...)
+                if (takeModeValue != null)
+                {
+                    camera.setCameraPropertyValue(TAKEMODE, takeModeValue);
+                    Log.v(TAG, "loadCameraSettings() TAKEMODE : " + takeModeValue);
+                }
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+                Log.v(TAG, "loadCameraSettings() : setCameraPropertyValue() fail...");
+            }
+
+            Map<String, String> values = new HashMap<>();
+            Set<String> names = camera.getCameraPropertyNames();
+            for (String name : names)
+            {
+                String value = preferences.getString(idHeader + name, null);
+                if (value != null)
+                {
+                    if (propertyProvider.canSetCameraProperty(name))
+                    {
+                        // Read Onlyのプロパティを除外して登録
+                        values.put(name, value);
+                        Log.v(TAG, "loadCameraSettings(): " + value);
+                    }
+                }
+            }
+            if (values.size() > 0)
+            {
+                try
+                {
+                    camera.setCameraPropertyValues(values);
+                }
+                catch (OLYCameraKitException e)
+                {
+                    Log.w(TAG, "To change the camera properties is failed: " + e.getMessage());
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+            }
+            Log.v(TAG, "loadCameraSettingsBatch() : END [" + idHeader + "]" + " " + values.size());
+        }
+    }
 }
diff --git a/wear/src/main/res/layout-notround/column_load.xml b/wear/src/main/res/layout-notround/column_load.xml
new file mode 100644 (file)
index 0000000..ea7cdfd
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal"
+    >
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="26dp"
+        android:layout_height="wrap_content"
+        android:textStyle="normal"
+        android:textSize="6pt"
+        android:clickable="false"
+        android:focusable="false"
+        android:tag="id"
+        />
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:textSize="4pt"
+        android:clickable="false"
+        android:focusable="false"
+        android:tag="info"
+        />
+
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textStyle="normal"
+        android:textSize="9pt"
+        android:clickable="false"
+        android:focusable="false"
+        android:tag="title"
+        />
+</LinearLayout>
diff --git a/wear/src/main/res/layout-notround/column_save.xml b/wear/src/main/res/layout-notround/column_save.xml
new file mode 100644 (file)
index 0000000..d1c7988
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal"
+    >
+    <TextView
+        android:layout_width="0px"
+        android:layout_height="0px"
+      />
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textSize="5pt"
+        android:tag="id"
+        />
+    <Button xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:tag="button"
+        android:text="@string/save_props"
+        />
+    <EditText xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="88dp"
+        android:layout_height="wrap_content"
+        android:hint="@string/hint_save_props"
+        android:textSize="8pt"
+        android:tag="title"
+        />
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textSize="4pt"
+        android:tag="info"
+        />
+</LinearLayout>
diff --git a/wear/src/main/res/layout-notround/dialog_my_camera_properties.xml b/wear/src/main/res/layout-notround/dialog_my_camera_properties.xml
new file mode 100644 (file)
index 0000000..c2ac6c7
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:orientation="vertical"
+    >
+    <android.support.v4.app.FragmentTabHost
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/tabHost01"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+    </android.support.v4.app.FragmentTabHost>
+
+    <android.support.v4.view.ViewPager
+        android:id="@+id/pager"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="center"/>
+</LinearLayout>
diff --git a/wear/src/main/res/layout-notround/list_camera_properties.xml b/wear/src/main/res/layout-notround/list_camera_properties.xml
new file mode 100644 (file)
index 0000000..91864c8
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:orientation="vertical"
+    >
+    <ListView
+        android:id="@id/android:list"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:scrollbars="vertical"
+        android:scrollbarFadeDuration="1000000"/>
+</LinearLayout>
diff --git a/wear/src/main/res/layout-round/column_load.xml b/wear/src/main/res/layout-round/column_load.xml
new file mode 100644 (file)
index 0000000..ea7cdfd
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal"
+    >
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="26dp"
+        android:layout_height="wrap_content"
+        android:textStyle="normal"
+        android:textSize="6pt"
+        android:clickable="false"
+        android:focusable="false"
+        android:tag="id"
+        />
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:textSize="4pt"
+        android:clickable="false"
+        android:focusable="false"
+        android:tag="info"
+        />
+
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textStyle="normal"
+        android:textSize="9pt"
+        android:clickable="false"
+        android:focusable="false"
+        android:tag="title"
+        />
+</LinearLayout>
diff --git a/wear/src/main/res/layout-round/column_save.xml b/wear/src/main/res/layout-round/column_save.xml
new file mode 100644 (file)
index 0000000..d1c7988
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal"
+    >
+    <TextView
+        android:layout_width="0px"
+        android:layout_height="0px"
+      />
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textSize="5pt"
+        android:tag="id"
+        />
+    <Button xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:tag="button"
+        android:text="@string/save_props"
+        />
+    <EditText xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="88dp"
+        android:layout_height="wrap_content"
+        android:hint="@string/hint_save_props"
+        android:textSize="8pt"
+        android:tag="title"
+        />
+    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textSize="4pt"
+        android:tag="info"
+        />
+</LinearLayout>
diff --git a/wear/src/main/res/layout-round/dialog_my_camera_properties.xml b/wear/src/main/res/layout-round/dialog_my_camera_properties.xml
new file mode 100644 (file)
index 0000000..c2ac6c7
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:orientation="vertical"
+    >
+    <android.support.v4.app.FragmentTabHost
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/tabHost01"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+    </android.support.v4.app.FragmentTabHost>
+
+    <android.support.v4.view.ViewPager
+        android:id="@+id/pager"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="center"/>
+</LinearLayout>
diff --git a/wear/src/main/res/layout-round/list_camera_properties.xml b/wear/src/main/res/layout-round/list_camera_properties.xml
new file mode 100644 (file)
index 0000000..91864c8
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:orientation="vertical"
+    >
+    <ListView
+        android:id="@id/android:list"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:scrollbars="vertical"
+        android:scrollbarFadeDuration="1000000"/>
+</LinearLayout>