OSDN Git Service

フラッシュモードとセルフタイマーの設定を変更できるようにする。
[gokigen/Gr2Control.git] / app / src / main / java / net / osdn / gokigen / gr2control / liveview / LiveViewFragment.java
index b3ba8b9..f8aa972 100644 (file)
@@ -1,34 +1,46 @@
 package net.osdn.gokigen.gr2control.liveview;
 
-import android.app.Activity;
 import android.content.Context;
 import android.content.SharedPreferences;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Vibrator;
-import android.support.annotation.NonNull;
-import android.support.v4.app.Fragment;
-import android.support.v4.content.res.ResourcesCompat;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.preference.PreferenceManager;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.drawable.DrawableCompat;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
+import androidx.preference.PreferenceManager;
+
 import android.util.Log;
+import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
-import android.widget.ImageButton;
 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;
+import net.osdn.gokigen.gr2control.camera.ICameraRunModeCallback;
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
 import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
 import net.osdn.gokigen.gr2control.camera.IDisplayInjector;
 import net.osdn.gokigen.gr2control.camera.IFocusingModeNotify;
 import net.osdn.gokigen.gr2control.camera.IInterfaceProvider;
 import net.osdn.gokigen.gr2control.camera.ILiveViewControl;
+import net.osdn.gokigen.gr2control.camera.IZoomLensControl;
+import net.osdn.gokigen.gr2control.camera.olympus.myolycameraprops.LoadSaveCameraProperties;
+import net.osdn.gokigen.gr2control.camera.olympus.myolycameraprops.LoadSaveMyCameraPropertyDialog;
 import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener;
 import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
 import net.osdn.gokigen.gr2control.scene.IChangeScene;
@@ -39,12 +51,12 @@ 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, ICameraRunModeCallback
 {
     private final String TAG = this.toString();
 
     private ILiveViewControl liveViewControl = null;
-    //private IZoomLensControl zoomLensControl = null;
+    private IZoomLensControl zoomLensControl = null;
     private IInterfaceProvider interfaceProvider = null;
     private IDisplayInjector interfaceInjector = null;
     //private OlympusCameraLiveViewListenerImpl liveViewListener = null;
@@ -54,13 +66,14 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     private LiveViewClickTouchListener onClickTouchListener = null;
     private LiveViewControlPanelClickListener onPanelClickListener = null;
     private LiveViewKeyPanelClickListener onKeyPanelClickListener = null;
+    private LiveViewFujiXKeyPanelClickListener fujiXOnKeyPanelClickListener = null;
 
     private TextView statusArea = null;
     private TextView focalLengthArea = null;
     private CameraLiveImageView imageView = null;
 
     private ImageView manualFocus = null;
-    private ImageButton showGrid = null;
+    private ImageView showGrid = null;
     private ImageView connectStatus = null;
     private Button changeLiveViewScale = null;
 
@@ -106,7 +119,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
      *
      */
     @Override
-    public void onAttach(Context context)
+    public void onAttach(@NonNull Context context)
     {
         super.onAttach(context);
         Log.v(TAG, "onAttach()");
@@ -144,7 +157,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             {
                 Log.v(TAG, "interfaceInjector is NULL...");
             }
-            Activity activity = this.getActivity();
+            FragmentActivity activity = this.getActivity();
             Vibrator vibrator = (activity != null) ? (Vibrator) activity.getSystemService(VIBRATOR_SERVICE) : null;
             if ((onClickTouchListener == null)&&(activity != null))
             {
@@ -153,6 +166,10 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             imageView.setOnClickListener(onClickTouchListener);
             imageView.setOnTouchListener(onClickTouchListener);
 
+            // キーイベントを拾うことにする
+            view.setOnKeyListener(onClickTouchListener);
+            view.setFocusableInTouchMode(true);
+
             setOnClickListener(view, R.id.hideControlPanelTextView);
             setOnClickListener(view, R.id.showControlPanelTextView);
             setOnClickListener(view, R.id.showKeyPanelImageView);
@@ -162,6 +179,11 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             setOnClickListener(view, R.id.show_images_button);
             setOnClickListener(view, R.id.camera_power_off_button);
             setOnClickListener(view, R.id.show_preference_button);
+            setOnClickListener(view, R.id.show_hide_grid_button);
+            setOnClickListener(view, R.id.zoom_in_button);
+            setOnClickListener(view, R.id.zoom_out_button);
+            setOnClickListener(view, R.id.specialButtonImageView);
+            setOnClickListener(view, R.id.fuji_x_hideKeyPanelTextView);
 
             if (onPanelClickListener == null)
             {
@@ -171,13 +193,14 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             setPanelClickListener(view, R.id.shutterSpeedTextView);
             setPanelClickListener(view, R.id.apertureValueTextView);
             setPanelClickListener(view, R.id.exposureCompensationTextView);
-            setPanelClickListener(view, R.id.aeModeTextView);
-            setPanelClickListener(view, R.id.whiteBalanceImageView);
+            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);
@@ -197,85 +220,36 @@ 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)
+            if (fujiXOnKeyPanelClickListener == null)
             {
-                manualFocus.setOnClickListener(onClickTouchListener);
+                fujiXOnKeyPanelClickListener = new LiveViewFujiXKeyPanelClickListener(getActivity(), interfaceProvider, vibrator);
             }
-            changedFocusingMode();
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_sv_minus);
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_sv_plus);
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_tv_minus);
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_tv_plus);
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_xv_minus);
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_xv_plus);
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_flash);
+            setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_timer);
 
-            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)
         {
@@ -325,6 +299,24 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             if (button != null)
             {
                 button.setOnClickListener(onKeyPanelClickListener);
+                button.setOnLongClickListener(onKeyPanelClickListener);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private void setFujiXKeyPanelClickListener(View view, int id)
+    {
+        try
+        {
+            View button = view.findViewById(id);
+            if (button != null)
+            {
+                button.setOnClickListener(fujiXOnKeyPanelClickListener);
+                button.setOnLongClickListener(fujiXOnKeyPanelClickListener);
             }
         }
         catch (Exception e)
@@ -344,7 +336,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         this.interfaceProvider = interfaceProvider;
         this.interfaceInjector = interfaceProvider.getDisplayInjector();
         this.liveViewControl = interfaceProvider.getLiveViewControl();
-        //this.zoomLensControl = interfaceProvider.getZoomLensControl();
+        this.zoomLensControl = interfaceProvider.getZoomLensControl();
         this.cameraInformation = interfaceProvider.getCameraInformation();
         this.statusWatcher = interfaceProvider.getCameraStatusWatcher();
     }
@@ -401,10 +393,26 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     {
         try
         {
-            int id = (imageView.isShowGrid()) ? R.drawable.ic_grid_off_black_24dp : R.drawable.ic_grid_on_black_24dp;
-            showGrid.setImageDrawable(ResourcesCompat.getDrawable(getResources(), id, null));
-            showGrid.invalidate();
-            imageView.invalidate();
+            FragmentActivity activity = getActivity();
+            if (activity != null)
+            {
+                if (showGrid == null) {
+                    showGrid = activity.findViewById(R.id.show_hide_grid_button);
+                }
+                activity.runOnUiThread(new Runnable() {
+                    @Override
+                    public void run()
+                    {
+                        int id = (imageView.isShowGrid()) ? R.drawable.ic_grid_off_black_24dp : R.drawable.ic_grid_on_black_24dp;
+                        if (showGrid != null)
+                        {
+                            showGrid.setImageDrawable(ResourcesCompat.getDrawable(getResources(), id, null));
+                            showGrid.invalidate();
+                        }
+                        imageView.invalidate();
+                    }
+                });
+            }
         }
         catch (Exception e)
         {
@@ -413,7 +421,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     }
 
     /**
-     *   AF/MFの表示を更新する
+     *
      *
      */
     @Override
@@ -519,17 +527,16 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         if ((changeRunModeExecutor != null)&&(!changeRunModeExecutor.isRecordingMode()))
         {
             // Runモードを切り替える。(でも切り替えると、設定がクリアされてしまう...。)
-            changeRunModeExecutor.changeRunMode(true);
+            changeRunModeExecutor.changeRunMode(true, this);
+            Log.v(TAG, "onResume() End");
+            return;
         }
+        prepareToStart();
+        Log.v(TAG, "onResume() End");
+    }
 
-/*
-        // ステータスの変更を通知してもらう
-        camera.setCameraStatusListener(statusListener);
-
-        // 画面下部の表示エリアの用途を切り替える
-        setupLowerDisplayArea();
-*/
-        // propertyを取得
+    private void prepareToStart()
+    {
         try
         {
             Context context = getContext();
@@ -553,7 +560,18 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         {
             e.printStackTrace();
         }
-        Log.v(TAG, "onResume() End");
+    }
+
+    @Override
+    public void onCompleted(boolean isRecording)
+    {
+        prepareToStart();
+    }
+
+    @Override
+    public void onErrorOccurred(boolean isRecording)
+    {
+        prepareToStart();
     }
 
     /**
@@ -613,6 +631,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     @Override
     public void startLiveView()
     {
+        Log.v(TAG, " LiveViewFragment::startLiveView() ");
         ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod();
         if (liveViewControl == null)
         {
@@ -645,6 +664,22 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             }
             liveViewControl.startLiveView(isCameraScreen);   // false : ライブビューのみ、 true : カメラ画面をミラー
 
+            // ここでグリッドアイコンを更新する
+            updateGridIcon();
+
+            // ここでズームレンズ制御ができるか確認する
+            if ((zoomLensControl != null)&&(zoomLensControl.canZoom()))
+            {
+                //Log.v(TAG, "CAN ZOOM LENS");
+                updateZoomlensControl(true);
+            }
+            else
+            {
+                //Log.v(TAG, "NO ZOOM LENS");
+                updateZoomlensControl(false);
+            }
+
+
             // ステータス監視も実施する
             startWatchStatus();
         }
@@ -660,16 +695,8 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         try
         {
             Log.v(TAG, "showFavoriteSettingDialog()");
-/*
-            LoadSaveMyCameraPropertyDialog dialog = new LoadSaveMyCameraPropertyDialog();
-            dialog.setTargetFragment(this, COMMAND_MY_PROPERTY);
-            dialog.setPropertyOperationsHolder(new LoadSaveCameraProperties(getActivity(), interfaceProvider.getOlympusInterface()));
-            FragmentManager manager = getFragmentManager();
-            if (manager != null)
-            {
-                dialog.show(manager, "my_dialog");
-            }
-*/
+            LoadSaveMyCameraPropertyDialog dialog = LoadSaveMyCameraPropertyDialog.newInstance(new LoadSaveCameraProperties(getActivity(), interfaceProvider.getOlympusInterfaceProvider()));
+            dialog.show(getChildFragmentManager(), "favorite_dialog");
         }
         catch (Exception e)
         {
@@ -680,6 +707,45 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     /**
      *
      *
+     *
+     */
+    private void updateZoomlensControl(final boolean isVisible)
+    {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                // isVisibleがtrueなら、ズームレンズボタンを有効にする
+                FragmentActivity activity = getActivity();
+                if (activity != null)
+                {
+                    try
+                    {
+                        View view1 = activity.findViewById(R.id.zoom_out_button);
+                        if (view1 != null)
+                        {
+                            view1.setVisibility((isVisible) ? View.VISIBLE : View.INVISIBLE);
+                            view1.invalidate();
+                        }
+
+                        View view2 = activity.findViewById(R.id.zoom_in_button);
+                        if (view2 != null)
+                        {
+                            view2.setVisibility((isVisible) ? View.VISIBLE : View.INVISIBLE);
+                            view2.invalidate();
+                        }
+                    }
+                    catch (Exception e)
+                    {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        });
+    }
+
+    /**
+     *
+     *
      */
     private void startWatchStatus()
     {
@@ -697,7 +763,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     {
         if (statusWatcher != null)
         {
-            statusWatcher.stoptStatusWatch();
+            statusWatcher.stopStatusWatch();
         }
     }
 
@@ -707,7 +773,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
      */
     private void runOnUiThread(Runnable action)
     {
-        Activity activity = getActivity();
+        FragmentActivity activity = getActivity();
         if (activity == null)
         {
             return;
@@ -720,7 +786,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     {
         try
         {
-            final Activity activity = getActivity();
+            final FragmentActivity activity = getActivity();
             if (activity == null)
             {
                 return;
@@ -751,7 +817,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         try
         {
             final String shutterSpeed = tv.replace(".", "/");
-            final Activity activity = getActivity();
+            final FragmentActivity activity = getActivity();
             if (activity == null)
             {
                 return;
@@ -782,7 +848,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         try
         {
             final String apertureValue = (av.length() > 1) ? ("F" + av) : "";
-            final Activity activity = getActivity();
+            final FragmentActivity activity = getActivity();
             if (activity == null)
             {
                 return;
@@ -812,7 +878,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     {
         try
         {
-            final Activity activity = getActivity();
+            final FragmentActivity activity = getActivity();
             if (activity == null)
             {
                 return;
@@ -842,20 +908,39 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     {
         try
         {
-            final Activity activity = getActivity();
-            if (activity == null)
+            Log.v(TAG, "updatedMeteringMode() : " + meteringMode);
+            final FragmentActivity activity = getActivity();
+            if ((activity == null)||(meteringMode == null))
             {
                 return;
             }
+
+            int iconId = R.drawable.ic_crop_free_black_24dp;
+            switch (meteringMode)
+            {
+                case ICameraStatus.AE_STATUS_MULTI:
+                case ICameraStatus.AE_STATUS_ESP:
+                    iconId = R.drawable.ic_crop_free_black_24dp;
+                    break;
+                case ICameraStatus.AE_STATUS_CENTER:
+                case ICameraStatus.AE_STATUS_CENTER2:
+                    iconId = R.drawable.ic_center_focus_weak_black_24dp;
+                    break;
+                case ICameraStatus.AE_STATUS_SPOT:
+                case ICameraStatus.AE_STATUS_PINPOINT:
+                    iconId = R.drawable.ic_filter_center_focus_black_24dp;
+                    break;
+            }
+            final int id = iconId;
             activity.runOnUiThread(new Runnable()
             {
                 @Override
                 public void run()
                 {
-                    TextView view = activity.findViewById(R.id.aeModeTextView);
+                    ImageView view = activity.findViewById(R.id.aeModeImageView);
                     if (view != null)
                     {
-                        view.setText(meteringMode);
+                        view.setImageDrawable(ResourcesCompat.getDrawable(getResources(), id, null));
                         view.invalidate();
                     }
                 }
@@ -870,7 +955,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     @Override
     public void updatedWBMode(final String wbMode)
     {
-        // とりあえず何もしない... 選択肢は以下
+        // とりあえず何もしない... 選択肢は以下 (Ricohの場合...)
         // auto, multiAuto, daylight, shade, cloud, tungsten, warmWhiteFluorescent, daylightFluorescent, dayWhiteFluorescent, coolWhiteFluorescent, incandescent,manual1, cte, custom
     }
 
@@ -879,11 +964,11 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
      *
      */
     @Override
-    public void updateRemainBattery(int percentage)
+    public void updateRemainBattery(final int percentage)
     {
         try
         {
-            final Activity activity = getActivity();
+            final FragmentActivity activity = getActivity();
             if (activity == null)
             {
                 return;
@@ -914,8 +999,19 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
                     ImageView view = activity.findViewById(R.id.currentBatteryImageView);
                     if (view != null)
                     {
-                        view.setImageDrawable(ResourcesCompat.getDrawable(getResources(), id, null));
-                        view.invalidate();
+                        Drawable target = ResourcesCompat.getDrawable(getResources(), id, null);
+                        if (target != null)
+                        {
+                            if (percentage <= 20)
+                            {
+                                DrawableCompat.setTint(target, Color.RED);
+                            } else if (percentage <= 40)
+                            {
+                                DrawableCompat.setTint(target, Color.YELLOW);
+                            }
+                            view.setImageDrawable(target);
+                            view.invalidate();
+                        }
                     }
                 }
             });
@@ -925,4 +1021,132 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             e.printStackTrace();
         }
     }
+
+    @Override
+    public void updateFocusedStatus(final boolean focused, final boolean focusLocked)
+    {
+        final FragmentActivity activity = getActivity();
+        try
+        {
+            if (activity != null)
+            {
+                activity.runOnUiThread(new Runnable() {
+                    @Override
+                    public void run() {
+                        try
+                        {
+                            ImageView view = activity.findViewById(R.id.focusUnlockImageView);
+                            if (focused) {
+                                Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_center_focus_strong_black_24dp, null);
+                                if (icon != null) {
+                                    DrawableCompat.setTint(icon, Color.GREEN);
+                                    view.setImageDrawable(icon);
+                                }
+                            } else {
+                                Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_focus_free_black_24dp, null);
+                                if (icon != null) {
+                                    int color = Color.BLACK;
+                                    if (focusLocked) {
+                                        color = Color.RED;
+                                    }
+                                    DrawableCompat.setTint(icon, color);
+                                    view.setImageDrawable(icon);
+                                }
+                            }
+                            view.invalidate();
+                        }
+                        catch (Exception e)
+                        {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void updateIsoSensitivity(String sv)
+    {
+        Log.v(TAG, "updateIsoSensitivity : " + sv);
+    }
+
+    @Override
+    public void updateWarning(String warning)
+    {
+        Log.v(TAG, "updateWarning : " + warning);
+    }
+
+    @Override
+    public void updateStorageStatus(String status)
+    {
+        Log.v(TAG, "updateStorageStatus : " + status);
+    }
+
+    @Override
+    public void updateToggleButton(boolean isOn)
+    {
+        try
+        {
+            FragmentActivity 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
+        {
+            FragmentActivity 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();
+        }
+    }
+
+    public boolean handleKeyDown(int keyCode, KeyEvent event)
+    {
+        return (onClickTouchListener.onKey(null, keyCode, event));
+    }
 }