OSDN Git Service

preferenceにプレビュー形式を設定できるようにする。その2。
authorMRSa <mrsa@myad.jp>
Sun, 7 Mar 2021 09:33:56 +0000 (18:33 +0900)
committerMRSa <mrsa@myad.jp>
Sun, 7 Mar 2021 09:33:56 +0000 (18:33 +0900)
app/src/main/java/jp/osdn/gokigen/thetaview/camera/theta/connection/ThetaCameraConnection.kt
app/src/main/java/jp/osdn/gokigen/thetaview/liveview/glrenderer/EquirectangularDrawer.kt
app/src/main/res/drawable/sample1.jpg [new file with mode: 0644]
app/src/main/res/drawable/sample2.jpg [new file with mode: 0644]
app/src/main/res/values-ja/strings.xml [new file with mode: 0644]
app/src/main/res/values/arrays.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preference_main.xml

index f08f816..56fd6e6 100644 (file)
@@ -237,6 +237,14 @@ class ThetaCameraConnection(private val context: AppCompatActivity, private val
     {
         try
         {
+/*
+            val optionGet = ThetaOptionGetControl(sessionIdProvider)
+            optionGet.getOptions("[\"previewFormat\", \"previewFormatSupport\"]", (sessionIdProvider.sessionId.isBlank()),
+                    object : IOperationCallback { override fun operationExecuted(result: Int, resultStr: String?)
+                    {
+                        Log.v(TAG, " >>>>> optionGet.getOptions : $resultStr ")
+                    }})
+*/
             val optionSet = ThetaOptionSetControl(sessionIdProvider)
             optionSet.setOptions("\"captureMode\" : \"image\"", (sessionIdProvider.sessionId.isBlank()),
                     object : IOperationCallback { override fun operationExecuted(result: Int, resultStr: String?)
@@ -247,7 +255,7 @@ class ThetaCameraConnection(private val context: AppCompatActivity, private val
                         optionSet.setOptions("\"previewFormat\" : $previewFormat", (sessionIdProvider.sessionId.isBlank()),
                                 object : IOperationCallback { override fun operationExecuted(result: Int, resultStr: String?)
                                 {
-                                    Log.v(TAG, " optionSet.setOptions(live view) : $resultStr ")
+                                    Log.v(TAG, " optionSet.setOptions(live view) : $resultStr ($previewFormat)")
                                     liveViewControl.startLiveView()
                                 }})
                     }})
index 7ac97e3..b1fcfa0 100644 (file)
@@ -3,8 +3,10 @@ package jp.osdn.gokigen.thetaview.liveview.glrenderer
 import android.content.Context
 import android.opengl.GLUtils
 import android.util.Log
+import androidx.preference.PreferenceManager
 import jp.osdn.gokigen.thetaview.R
 import jp.osdn.gokigen.thetaview.liveview.image.IImageProvider
+import jp.osdn.gokigen.thetaview.preference.IPreferencePropertyAccessor
 import java.nio.ByteBuffer
 import java.nio.ByteOrder
 import java.nio.FloatBuffer
@@ -13,7 +15,7 @@ import javax.microedition.khronos.opengles.GL10
 import kotlin.math.cos
 import kotlin.math.sin
 
-class EquirectangularDrawer(context: Context) : IGraphicsDrawer
+class EquirectangularDrawer(private val context: Context) : IGraphicsDrawer
 {
     private lateinit var imageProvider : IImageProvider
 
@@ -64,8 +66,35 @@ class EquirectangularDrawer(context: Context) : IGraphicsDrawer
 
     override fun prepareDrawer(gl: GL10?)
     {
-        Log.v(TAG, "prepareDrawer()")
-        mDroidTextureID = mGlUtils.prepareTexture(gl, R.drawable.sample)
+        try
+        {
+            val previewFormat = PreferenceManager.getDefaultSharedPreferences(context).getString(IPreferencePropertyAccessor.LIVEVIEW_RESOLUTION, IPreferencePropertyAccessor.LIVEVIEW_RESOLUTION_DEFAULT_VALUE)
+            if (previewFormat != null)
+            {
+                mDroidTextureID = when {
+                    previewFormat.contains("width:1920") -> {
+                        mGlUtils.prepareTexture(gl, R.drawable.sample2)
+                    }
+                    previewFormat.contains("width:1024") -> {
+                        mGlUtils.prepareTexture(gl, R.drawable.sample1)
+                    }
+                    else -> {
+                        mGlUtils.prepareTexture(gl, R.drawable.sample)
+                    }
+                }
+            }
+            else
+            {
+                // 取得できなかった場合は、640x320 にする
+                mDroidTextureID = mGlUtils.prepareTexture(gl, R.drawable.sample)
+            }
+            Log.v(TAG, "prepareDrawer() : $mDroidTextureID : $previewFormat")
+        }
+        catch (e : Exception)
+        {
+            e.printStackTrace()
+            mDroidTextureID = mGlUtils.prepareTexture(gl, R.drawable.sample)
+        }
     }
 
     override fun preprocessDraw(gl: GL10?)
diff --git a/app/src/main/res/drawable/sample1.jpg b/app/src/main/res/drawable/sample1.jpg
new file mode 100644 (file)
index 0000000..112ebf4
Binary files /dev/null and b/app/src/main/res/drawable/sample1.jpg differ
diff --git a/app/src/main/res/drawable/sample2.jpg b/app/src/main/res/drawable/sample2.jpg
new file mode 100644 (file)
index 0000000..738fe93
Binary files /dev/null and b/app/src/main/res/drawable/sample2.jpg differ
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
new file mode 100644 (file)
index 0000000..6b38742
--- /dev/null
@@ -0,0 +1,78 @@
+<resources>
+    <string name="app_name">Theta Thought ShutterS</string>
+    <string name="blank"> </string>
+    <string name="app_location">AirA01a</string>
+    <string name="action_refresh">再描画</string>
+    <string name="finish_refresh">再描画完了</string>
+
+    <string name="permission_not_granted">アプリの権限が許されていません。</string>
+
+    <string name="dialog_positive_execute">OK</string>
+    <string name="dialog_negative_cancel">Cancel</string>
+
+    <string name="capture_success">撮影完了: </string>
+
+    <string name="dialog_confirm_title_output_log">デバッグログの共有</string>
+    <string name="dialog_confirm_message_output_log">デバッグログを共有します。</string>
+
+    <string name="dialog_title_exit_application">アプリ終了</string>
+    <string name="dialog_message_exit_application">アプリケーションを終了します。</string>
+
+    <string name="pref_cat_application_control">アプリ制御</string>
+    <string name="pref_exit_power_off">アプリ終了</string>
+    <string name="pref_summary_exit_power_off"> </string>
+    <string name="pref_wifi_settings">WIFI設定</string>
+    <string name="pref_summary_wifi_settings"> </string>
+
+    <string name="pref_cat_application_settings">アプリ設定</string>
+    <string name="save_local_location">ローカル領域に保存</string>
+
+    <string name="pref_cat_camera">カメラ設定</string>
+    <string name="pref_capture_both_camera_and_live_view">ライブ画像を同時保存</string>
+    <string name="pref_summary_capture_both_live_view">撮影時にライブビュー画像を同時保存します</string>
+
+    <string name="pref_cat_eeg_settings">EEG設定</string>
+
+    <string name="pref_cat_gokigen">GOKIGEN</string>
+    <string name="pref_instruction_manual">操作説明</string>
+    <string name="pref_privacy_policy">プライバシーポリシー</string>
+    <string name="pref_degug_info">デバッグ情報</string>
+    <string name="pref_summary_debug_info">LogCat情報</string>
+
+    <string name="pref_use_camerax_preview">カメラプレビューの使用(要再起動)</string>
+
+    <string name="pref_liveview_resolution">ライブビュー形式(要再起動)</string>
+    <string name="pref_summary_liveview_resolution"> </string>
+
+    <string name="pref_show_camera_status">機器状態を画面に表示</string>
+    <string name="pref_summary_show_camera_status">機器の状態を画面表示します</string>
+
+    <string name="pref_use_mindwave_connection">Mindwave Mobile(EEGヘッドセット)を使用する</string>
+    <string name="pref_summary_use_mindwave_connection">EEGヘッドセットを使用する場合に設定してください</string>
+
+    <string name="pref_use_eeg_signal_type">脳波シャッタータイプ</string>
+    <string name="pref_summary_use_eeg_signal_type"> </string>
+
+    <string name="pref_show_eeg_wave_signal">脳波信号も画面表示</string>
+    <string name="pref_summary_show_eeg_wave_signal">「状態を画面に表示」のチェック時、脳波信号も画面表示します</string>
+
+    <string name="pref_record_eeg_wave_signal">脳波信号をCSVファイルに出力</string>
+    <string name="pref_summary_record_eeg_wave_signal">脳波信号をCSVファイルとしてDownloadフォルダに記録します</string>
+
+    <string name="shoot_camera">撮影しました!</string>
+
+    <string name="connect_start">開始</string>
+    <string name="connect_check_wifi">WIFI確認中</string>
+    <string name="connect_connect">接続</string>
+    <string name="connect_connecting">接続中&#8230;</string>
+    <string name="connect_connected">接続完了</string>
+    <string name="connect_change_run_mode">モード変更</string>
+    <string name="connect_restore_camera_settings">カメラ設定調整</string>
+
+    <string name="camera_not_found">Not Found&#8230;</string>
+    <string name="theta_connect_response_ng">カメラに接続できませんでした。</string>
+
+    <string name="dialog_title_connect_failed_theta">接続失敗(THETA)</string>
+    <string name="dialog_title_button_retry">再試行</string>
+    <string name="dialog_title_button_network_settings">WiFi設定</string>
+</resources>
index 36796b2..773d422 100644 (file)
     </string-array>
 
     <string-array name="preview_format_value">
-        <item>{"width": 640, "height": 320, "framerate": 30}</item>
-        <item>{"width": 640, "height": 320, "framerate":  8}</item>
-        <item>{“width”: 1024, “height”: 512, “framerate”: 30}</item>
-        <item>{“width”: 1024, “height”: 512, “framerate”: 8}</item>
-        <item>{“width”: 1920, “height”: 960, “framerate”: 8}</item>
+        <item>{"framerate":30,"height":320,"width":640}</item>
+        <item>{"framerate":8,"height":320,"width":640}</item>
+        <item>{"framerate":30,"height":512,"width":1024}</item>
+        <item>{"framerate":8,"height":512,"width":1024}</item>
+        <item>{"framerate":8,"height":960,"width":1920}</item>
         <!-- <item>{“width”: 640, “height”: 320, “framerate”: 10}</item> -->
     </string-array>
 
index 7a3b761..c47aa05 100644 (file)
@@ -41,7 +41,7 @@
 
     <string name="pref_use_camerax_preview">Use Camera preview(need restart)</string>
 
-    <string name="pref_liveview_resolution">Liveview Format</string>
+    <string name="pref_liveview_resolution">Liveview Format(need restart)</string>
     <string name="pref_summary_liveview_resolution"> </string>
 
     <string name="pref_show_camera_status">Show camera statuses</string>
@@ -57,7 +57,7 @@
     <string name="pref_summary_show_eeg_wave_signal"> </string>
 
     <string name="pref_record_eeg_wave_signal">Records EEG signals in a CSV file</string>
-    <string name="pref_summary_record_eeg_wave_signal"> </string>
+    <string name="pref_summary_record_eeg_wave_signal">The file location is the Download folder. </string>
 
     <string name="shoot_camera">Captured!</string>
 
index 349c0a0..6744818 100644 (file)
             android:summary="@string/pref_summary_wifi_settings" />
     </PreferenceCategory>
 
-<!--
     <PreferenceCategory
         app:title="@string/pref_cat_application_settings">
-
+<!--
         <SwitchPreferenceCompat
             android:key="use_camera_x_preview"
             android:title="@string/pref_use_camerax_preview"/>
         <SwitchPreferenceCompat
             android:key="save_local_location"
             android:title="@string/save_local_location"/>
-    </PreferenceCategory>
 -->
+        <SwitchPreferenceCompat
+            android:key="capture_both_camera_and_live_view"
+            android:title="@string/pref_capture_both_camera_and_live_view"
+            android:summary="@string/pref_summary_capture_both_live_view"/>
+
+        <SwitchPreferenceCompat
+            android:key="show_camera_status"
+            android:title="@string/pref_show_camera_status"
+            android:summary="@string/pref_summary_show_camera_status"/>
+    </PreferenceCategory>
 
     <PreferenceCategory
         android:title="@string/pref_cat_camera">
             android:title="@string/pref_liveview_resolution"
             android:summary="@string/pref_summary_liveview_resolution"
             />
-
-        <SwitchPreferenceCompat
-            android:key="capture_both_camera_and_live_view"
-            android:title="@string/pref_capture_both_camera_and_live_view"
-            android:summary="@string/pref_summary_capture_both_live_view"/>
-
-        <SwitchPreferenceCompat
-            android:key="show_camera_status"
-            android:title="@string/pref_show_camera_status"
-            android:summary="@string/pref_summary_show_camera_status"/>
-
     </PreferenceCategory>
 
     <PreferenceCategory