OSDN Git Service

ボタン操作を少し追加した。
authorMRSa <mrsa@myad.jp>
Wed, 15 Aug 2018 15:24:07 +0000 (00:24 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 15 Aug 2018 15:24:07 +0000 (00:24 +0900)
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewControlPanelClickListener.java
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewFragment.java
app/src/main/java/net/osdn/gokigen/gr2control/liveview/LiveViewKeyPanelClickListener.java
app/src/main/res/drawable/ic_highlight_black_24dp.xml [new file with mode: 0644]
app/src/main/res/drawable/ic_panorama_wide_angle_black_24dp.xml [new file with mode: 0644]
app/src/main/res/layout-land/fragment_live_view.xml

index 4685c7d..487ddd8 100644 (file)
@@ -45,7 +45,6 @@ class LiveViewControlPanelClickListener  implements View.OnClickListener
             switch (id)
             {
                 case R.id.takemodeTextView:
-                    //  撮影モードは変えられない...なぜ?
                     selectTakeMode(statusList);
                     break;
 
@@ -69,6 +68,10 @@ class LiveViewControlPanelClickListener  implements View.OnClickListener
                     selectWhiteBalance(statusList);
                     break;
 
+                case R.id.isoSensitivityTextView:
+                    selectIsoSensitivity(statusList);
+                    break;
+
                 case R.id.setEffectImageView:
                     selectEffect(statusList);
                     break;
@@ -165,6 +168,19 @@ class LiveViewControlPanelClickListener  implements View.OnClickListener
         }
     }
 
+    private void selectIsoSensitivity(@NonNull ICameraStatus statusList)
+    {
+        Log.v(TAG,"selectIsoSensitivity()");
+        try
+        {
+            choiceStatusList(statusList, ICameraStatus.ISO_SENSITIVITY);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
     private void selectEffect(@NonNull ICameraStatus statusList)
     {
         Log.v(TAG,"selectWhiteBalance()");
index f5ff133..6e9277e 100644 (file)
@@ -7,6 +7,7 @@ import android.os.Bundle;
 import android.os.Vibrator;
 import android.support.annotation.NonNull;
 import android.support.v4.app.Fragment;
+import android.support.v4.content.ContextCompat;
 import android.support.v4.content.res.ResourcesCompat;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
@@ -21,6 +22,7 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import net.osdn.gokigen.gr2control.R;
+import net.osdn.gokigen.gr2control.camera.ICameraButtonControl;
 import net.osdn.gokigen.gr2control.camera.ICameraConnection;
 import net.osdn.gokigen.gr2control.camera.ICameraInformation;
 import net.osdn.gokigen.gr2control.camera.ICameraRunMode;
@@ -40,7 +42,7 @@ import static android.content.Context.VIBRATOR_SERVICE;
  *  撮影用ライブビュー画面
  *
  */
-public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFocusingModeNotify, IFavoriteSettingDialogKicker, ICameraStatusUpdateNotify
+public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFocusingModeNotify, IFavoriteSettingDialogKicker, ICameraStatusUpdateNotify, LiveViewKeyPanelClickListener.KeyPanelFeedback
 {
     private final String TAG = this.toString();
 
@@ -174,11 +176,12 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             setPanelClickListener(view, R.id.exposureCompensationTextView);
             setPanelClickListener(view, R.id.aeModeImageView);
             setPanelClickListener(view, R.id.whiteBalanceTextView);
+            setPanelClickListener(view, R.id.isoSensitivityTextView);
             setPanelClickListener(view, R.id.setEffectImageView);
 
             if (onKeyPanelClickListener == null)
             {
-                onKeyPanelClickListener = new LiveViewKeyPanelClickListener(interfaceProvider, vibrator);
+                onKeyPanelClickListener = new LiveViewKeyPanelClickListener(interfaceProvider, this, vibrator);
             }
             setKeyPanelClickListener(view, R.id.button_front_left);
             setKeyPanelClickListener(view, R.id.button_front_right);
@@ -198,85 +201,23 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             setKeyPanelClickListener(view, R.id.button_plus);
             setKeyPanelClickListener(view, R.id.button_minus);
             setKeyPanelClickListener(view, R.id.button_playback);
+            setKeyPanelClickListener(view, R.id.button_acclock);
+            setKeyPanelClickListener(view, R.id.button_lcd_onoff);
+            setKeyPanelClickListener(view, R.id.button_highlight);
 
-            /*
-            view.findViewById(R.id.show_preference_button).setOnClickListener(onClickTouchListener);
-            view.findViewById(R.id.camera_property_settings_button).setOnClickListener(onClickTouchListener);
-            view.findViewById(R.id.shutter_button).setOnClickListener(onClickTouchListener);
-            view.findViewById(R.id.btn_zoomin).setOnClickListener(onClickTouchListener);
-            view.findViewById(R.id.btn_zoomout).setOnClickListener(onClickTouchListener);
-
-            manualFocus = view.findViewById(R.id.focusing_button);
-            changeLiveViewScale = view.findViewById(R.id.live_view_scale_button);
-
-            ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod();
-
-            if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
-            {
-                view.findViewById(R.id.show_favorite_settings_button).setOnClickListener(onClickTouchListener);
-            }
-            else
-            {
-                // お気に入りボタン(とMFボタン)は、SONYモード, RICOH GR2モードのときには表示しない
-                final View favoriteButton = view.findViewById(R.id.show_favorite_settings_button);
-                final View propertyButton = view.findViewById(R.id.camera_property_settings_button);
-                if ((favoriteButton != null)&&(manualFocus != null))
-                {
-                    runOnUiThread(new Runnable()
-                    {
-                        @Override
-                        public void run()
-                        {
-                            favoriteButton.setVisibility(View.INVISIBLE);
-                            if (manualFocus != null)
-                            {
-                                manualFocus.setVisibility(View.INVISIBLE);
-                            }
-                            propertyButton.setVisibility(View.INVISIBLE);
-                        }
-                    });
-                }
-                if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
-                {
-                    if (changeLiveViewScale != null)
-                    {
-                        changeLiveViewScale.setVisibility(View.INVISIBLE);
-                    }
-                }
-                else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
-                {
-                    if (changeLiveViewScale != null)
-                    {
-                        changeLiveViewScale.setVisibility(View.VISIBLE);
-                    }
-                }
-            }
-
-            if (manualFocus != null)
-            {
-                manualFocus.setOnClickListener(onClickTouchListener);
-            }
-            changedFocusingMode();
-
-            if (changeLiveViewScale != null)
-            {
-                changeLiveViewScale.setOnClickListener(onClickTouchListener);
-            }
-
-            showGrid = view.findViewById(R.id.show_hide_grid_button);
-            showGrid.setOnClickListener(onClickTouchListener);
-            updateGridIcon();
-
-            updateConnectionStatus(ICameraConnection.CameraConnectionStatus.UNKNOWN);
-
-            statusArea = view.findViewById(R.id.informationMessageTextView);
-            focalLengthArea = view.findViewById(R.id.focal_length_with_digital_zoom_view);
-*/
             connectStatus = view.findViewById(R.id.connect_disconnect_button);
             if (connectStatus != null)
             {
                 connectStatus.setOnClickListener(onClickTouchListener);
             }
+
+            View keyPanel = view.findViewById(R.id.showKeyPanelImageView);
+            ICameraButtonControl buttonControl = interfaceProvider.getButtonControl();
+            if (keyPanel != null)
+            {
+                keyPanel.setVisibility((buttonControl == null) ? View.INVISIBLE : View.VISIBLE);
+                keyPanel.invalidate();
+            }
         }
         catch (Exception e)
         {
@@ -414,7 +355,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     }
 
     /**
-     *   AF/MFの表示を更新する
+     *
      *
      */
     @Override
@@ -523,13 +464,6 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             changeRunModeExecutor.changeRunMode(true);
         }
 
-/*
-        // ステータスの変更を通知してもらう
-        camera.setCameraStatusListener(statusListener);
-
-        // 画面下部の表示エリアの用途を切り替える
-        setupLowerDisplayArea();
-*/
         // propertyを取得
         try
         {
@@ -963,4 +897,62 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     {
         Log.v(TAG, "updateStorageStatus : " + status);
     }
+
+    @Override
+    public void updateToggleButton(boolean isOn)
+    {
+        try
+        {
+            Activity activity = getActivity();
+            if (activity != null)
+            {
+                ImageView imageView = activity.findViewById(R.id.button_toggle_aeaf);
+                if (isOn)
+                {
+                    imageView.setImageDrawable(ContextCompat.getDrawable(activity,R.drawable.ic_radio_button_checked_black_24dp));
+                }
+                else
+                {
+                    imageView.setImageDrawable(ContextCompat.getDrawable(activity,R.drawable.ic_radio_button_unchecked_black_24dp));
+                }
+                imageView.invalidate();
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void updateLcdOnOff(boolean isOn)
+    {
+        Log.v(TAG, "updateLcdOnOff() " + isOn);
+    }
+
+    @Override
+    public void updateAFLlever(boolean isCaf)
+    {
+        try
+        {
+            Activity activity = getActivity();
+            if (activity != null)
+            {
+                TextView textView = activity.findViewById(R.id.lever_ael_caf);
+                if (isCaf)
+                {
+                    textView.setText(getString(R.string.label_c_af));
+                }
+                else
+                {
+                    textView.setText(getString(R.string.label_aelock));
+                }
+                textView.invalidate();
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
 }
index dacae11..49e1ff9 100644 (file)
@@ -18,11 +18,26 @@ class LiveViewKeyPanelClickListener  implements View.OnClickListener
 {
     private final String TAG = toString();
     private final IInterfaceProvider interfaceProvider;
+    private final KeyPanelFeedback feedback;
     private final Vibrator vibrator;
 
-    LiveViewKeyPanelClickListener(@NonNull IInterfaceProvider interfaceProvider, @Nullable Vibrator vibrator)
+    private boolean lcdOffOn = false;
+    private boolean lightOnOff = false;
+    private boolean accLock = false;
+    private boolean toggleButton = false;
+    private boolean leverAfl = false;
+
+    interface KeyPanelFeedback
+    {
+        void updateToggleButton(boolean isOn);
+        void updateLcdOnOff(boolean isOn);
+        void updateAFLlever(boolean isCaf);
+    };
+
+    LiveViewKeyPanelClickListener(@NonNull IInterfaceProvider interfaceProvider, @Nullable KeyPanelFeedback feedback, @Nullable Vibrator vibrator)
     {
         this.interfaceProvider = interfaceProvider;
+        this.feedback = feedback;
         this.vibrator = vibrator;
     }
 
@@ -107,6 +122,18 @@ class LiveViewKeyPanelClickListener  implements View.OnClickListener
                     // プレイボタン
                     keyId = ICameraButtonControl.BUTTON_PLAYBACK;
                     break;
+                case R.id.button_acclock:
+                    // アクセサリーロックボタン
+                    keyId = decideAccLock();
+                    break;
+                case R.id.button_highlight:
+                    // ライトオンオフボタン
+                    keyId = decideLightOnOff();
+                    break;
+                case R.id.button_lcd_onoff:
+                    // LCDオンオフボタン
+                    keyId = decideLCDOnOff();
+                    break;
                 default:
                     Log.v(TAG, "onClick() : " + id);
                     break;
@@ -130,17 +157,52 @@ class LiveViewKeyPanelClickListener  implements View.OnClickListener
         }
     }
 
+    private String decideAccLock()
+    {
+        // アクセサリーロック・ロック解除ボタン
+        accLock = !accLock;
+        return ((accLock) ? "acclock on" : "acclock off");
+    }
+
+    private String decideLightOnOff()
+    {
+        // Light ON/OFFボタン
+        lightOnOff = !lightOnOff;
+        return ((lightOnOff) ? "led on 1" : "led off 1");
+    }
+
+    private String decideLCDOnOff()
+    {
+        // LCD ON/OFFボタン
+        lcdOffOn = !lcdOffOn;
+        if (feedback != null)
+        {
+            feedback.updateLcdOnOff(lcdOffOn);
+        }
+        return ((lcdOffOn) ? "lcd sleep on" : "lcd sleep off");
+    }
+
     private String decideToggle()
     {
         // AEL/AFL ボタン状態から次のボタン状態指示を決める
         // あわせて、ボタン状態の表示更新を行う
-        return ("");
+        toggleButton = !toggleButton;
+        if (feedback != null)
+        {
+            feedback.updateToggleButton(toggleButton);
+        }
+        return ((toggleButton) ? "baf 1" : "baf 0");
     }
 
     private String decideLever()
     {
         // AEL/AFL - C-AF レバー状態から、次のレバー状態指示を決める。
         // あわせて、ボタン状態の表示更新を行う
-        return ("");
+        leverAfl = !leverAfl;
+        if (feedback != null)
+        {
+            feedback.updateAFLlever(leverAfl);
+        }
+        return ((leverAfl) ? "bafl" : "bafc");
     }
 }
diff --git a/app/src/main/res/drawable/ic_highlight_black_24dp.xml b/app/src/main/res/drawable/ic_highlight_black_24dp.xml
new file mode 100644 (file)
index 0000000..2646f57
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M6,14l3,3v5h6v-5l3,-3L18,9L6,9zM11,2h2v3h-2zM3.5,5.875L4.914,4.46l2.12,2.122L5.62,7.997zM16.96,6.585l2.123,-2.12 1.414,1.414L18.375,8z"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_panorama_wide_angle_black_24dp.xml b/app/src/main/res/drawable/ic_panorama_wide_angle_black_24dp.xml
new file mode 100644 (file)
index 0000000..900b34e
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M12,6c2.45,0 4.71,0.2 7.29,0.64 0.47,1.78 0.71,3.58 0.71,5.36 0,1.78 -0.24,3.58 -0.71,5.36 -2.58,0.44 -4.84,0.64 -7.29,0.64s-4.71,-0.2 -7.29,-0.64C4.24,15.58 4,13.78 4,12c0,-1.78 0.24,-3.58 0.71,-5.36C7.29,6.2 9.55,6 12,6m0,-2c-2.73,0 -5.22,0.24 -7.95,0.72l-0.93,0.16 -0.25,0.9C2.29,7.85 2,9.93 2,12s0.29,4.15 0.87,6.22l0.25,0.89 0.93,0.16c2.73,0.49 5.22,0.73 7.95,0.73s5.22,-0.24 7.95,-0.72l0.93,-0.16 0.25,-0.89c0.58,-2.08 0.87,-4.16 0.87,-6.23s-0.29,-4.15 -0.87,-6.22l-0.25,-0.89 -0.93,-0.16C17.22,4.24 14.73,4 12,4z"/>
+</vector>
index 4a50ebe..6ed40f1 100644 (file)
             android:textColor="@color/setting_text_color"
             android:textStyle="bold"
             android:textSize="12pt" />
-<!--
+
         <TextView
-            android:id="@+id/isoSensitivityTextView"
+            android:id="@+id/whiteBalanceTextView"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_weight="1"
             android:gravity="center"
             android:clickable="true"
             android:focusable="true"
-            android:text="ISO#"
+            android:text="@string/white_balance"
             android:textColor="@color/setting_text_color"
             android:textStyle="bold"
             android:textSize="12pt" />
--->
 
-        <ImageView
-            android:id="@+id/aeModeImageView"
+        <TextView
+            android:id="@+id/isoSensitivityTextView"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_weight="1"
             android:gravity="center"
             android:clickable="true"
             android:focusable="true"
-            android:src="@drawable/ic_crop_free_black_24dp" />
+            android:text="ISO"
+            android:textColor="@color/setting_text_color"
+            android:textStyle="bold"
+            android:textSize="12pt" />
 
-        <TextView
-            android:id="@+id/whiteBalanceTextView"
+        <ImageView
+            android:id="@+id/aeModeImageView"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_weight="1"
             android:gravity="center"
             android:clickable="true"
             android:focusable="true"
-            android:text="@string/white_balance"
-            android:textColor="@color/setting_text_color"
-            android:textStyle="bold"
-            android:textSize="12pt" />
+            android:src="@drawable/ic_crop_free_black_24dp" />
 
         <ImageView
             android:id="@+id/setEffectImageView"
     <RelativeLayout
         android:id="@+id/keyPanelLayout"
         android:orientation="horizontal"
-        android:layout_width="100pt"
+        android:layout_width="125pt"
         android:layout_height="120pt"
         android:layout_alignLeft="@id/controlPanelLayout"
         android:layout_alignStart="@id/controlPanelLayout"
             android:layout_alignParentBottom="true"
             android:layout_marginBottom="4dp"
             android:textSize="6pt" />
+
+        <ImageView
+            android:id="@+id/button_lcd_onoff"
+            android:layout_width="20pt"
+            android:layout_height="12pt"
+            android:layout_alignTop="@id/button_function_3"
+            android:layout_toEndOf="@id/button_function_3"
+            android:layout_toRightOf="@id/button_function_3"
+            android:scaleType="fitCenter"
+            android:visibility="visible"
+            android:clickable="true"
+            android:focusable="true"
+            android:layout_marginLeft="8pt"
+            android:layout_marginStart="8pt"
+            android:src="@drawable/ic_panorama_wide_angle_black_24dp"
+            android:gravity="center" />
+
+        <ImageView
+            android:id="@+id/button_highlight"
+            android:layout_width="20pt"
+            android:layout_height="12pt"
+            android:layout_alignLeft="@id/button_lcd_onoff"
+            android:layout_alignStart="@id/button_lcd_onoff"
+            android:layout_alignTop="@id/button_minus"
+            android:scaleType="fitCenter"
+            android:visibility="visible"
+            android:clickable="true"
+            android:focusable="true"
+            android:src="@drawable/ic_highlight_black_24dp"
+            android:gravity="center" />
+
+        <ImageView
+            android:id="@+id/button_acclock"
+            android:layout_width="20pt"
+            android:layout_height="12pt"
+            android:layout_alignLeft="@id/button_lcd_onoff"
+            android:layout_alignStart="@id/button_lcd_onoff"
+            android:layout_alignTop="@id/button_front_right"
+            android:scaleType="fitCenter"
+            android:visibility="invisible"
+            android:clickable="true"
+            android:focusable="true"
+            android:src="@drawable/ic_photo_camera_black_24dp"
+            android:gravity="center" />
+
     </RelativeLayout>
 </RelativeLayout>