• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

OPC(Olympus Air)用望遠鏡アプリ。


Commit MetaInfo

Révision9c11cdaf2ba5cf506f4ccdc0f2c70286e45ef386 (tree)
l'heure2018-06-14 00:15:25
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

OPC機でのZoomin / Zoomoutボタンの制御を追加した。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/OlyCameraZoomLensControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/olympus/wrapper/OlyCameraZoomLensControl.java
@@ -57,6 +57,7 @@ class OlyCameraZoomLensControl implements IZoomLensControl
5757 @Override
5858 public boolean canZoom()
5959 {
60+ initialize();
6061 return (canZoom);
6162 }
6263
@@ -188,8 +189,8 @@ class OlyCameraZoomLensControl implements IZoomLensControl
188189 return;
189190 }
190191
191- float scale = 0.0f;
192- float focalLength = 0.0f;
192+ float scale;
193+ float focalLength;
193194 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
194195 String value = preferences.getString(IPreferencePropertyAccessor.POWER_ZOOM_LEVEL, IPreferencePropertyAccessor.POWER_ZOOM_LEVEL_DEFAULT_VALUE);
195196 try
--- a/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
@@ -6,6 +6,7 @@ import android.content.SharedPreferences;
66 import android.os.Bundle;
77 import android.support.annotation.NonNull;
88 import android.support.v4.app.Fragment;
9+import android.support.v4.app.FragmentManager;
910 import android.support.v4.content.res.ResourcesCompat;
1011 import android.support.v7.preference.PreferenceManager;
1112 import android.util.Log;
@@ -384,14 +385,17 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
384385 // propertyを取得
385386 try
386387 {
387- SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
388-
389- // グリッド・フォーカスアシストの情報を戻す
390- boolean showGrid = preferences.getBoolean(IPreferencePropertyAccessor.SHOW_GRID_STATUS, false);
391- if ((imageView != null)&&(imageView.isShowGrid() != showGrid))
388+ Context context = getContext();
389+ if (context != null)
392390 {
393- imageView.toggleShowGridFrame();
394- imageView.postInvalidate();
391+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
392+
393+ // グリッド・フォーカスアシストの情報を戻す
394+ boolean showGrid = preferences.getBoolean(IPreferencePropertyAccessor.SHOW_GRID_STATUS, false);
395+ if ((imageView != null) && (imageView.isShowGrid() != showGrid)) {
396+ imageView.toggleShowGridFrame();
397+ imageView.postInvalidate();
398+ }
395399 }
396400 if (currentConnectionStatus == ICameraConnection.CameraConnectionStatus.CONNECTED)
397401 {
@@ -402,7 +406,6 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
402406 {
403407 e.printStackTrace();
404408 }
405-
406409 Log.v(TAG, "onResume() End");
407410 }
408411
@@ -478,8 +481,12 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
478481 try
479482 {
480483 // ライブビューの開始
481- SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
482- liveViewControl.changeLiveViewSize(preferences.getString(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY, IPreferencePropertyAccessor.LIVE_VIEW_QUALITY_DEFAULT_VALUE));
484+ Context context = getContext();
485+ if (context != null)
486+ {
487+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
488+ liveViewControl.changeLiveViewSize(preferences.getString(IPreferencePropertyAccessor.LIVE_VIEW_QUALITY, IPreferencePropertyAccessor.LIVE_VIEW_QUALITY_DEFAULT_VALUE));
489+ }
483490 ILiveViewListener lvListener;
484491 if (interfaceProvider.useOlympusCamera())
485492 {
@@ -496,8 +503,28 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
496503 // デジタルズームの設定
497504 liveViewControl.updateDigitalZoom();
498505
499- // パワーズームの設定 (初期化位置の設定)
500- zoomLensControl.moveInitialZoomPosition();
506+ // ズームが制御できない場合は、ボタンを消す
507+ if (!zoomLensControl.canZoom())
508+ {
509+ final Activity activity = getActivity();
510+ if (activity != null)
511+ {
512+ activity.runOnUiThread(new Runnable()
513+ {
514+ @Override
515+ public void run()
516+ {
517+ activity.findViewById(R.id.btn_zoomin).setVisibility(View.INVISIBLE);
518+ activity.findViewById(R.id.btn_zoomout).setVisibility(View.INVISIBLE);
519+ }
520+ });
521+ }
522+ }
523+ else
524+ {
525+ // パワーズームの設定 (初期化位置の設定)
526+ zoomLensControl.moveInitialZoomPosition();
527+ }
501528
502529 // 測光モードをスポットに切り替える
503530 setAEtoSpot();
@@ -542,7 +569,11 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
542569 LoadSaveMyCameraPropertyDialog dialog = new LoadSaveMyCameraPropertyDialog();
543570 dialog.setTargetFragment(this, COMMAND_MY_PROPERTY);
544571 dialog.setPropertyOperationsHolder(new LoadSaveCameraProperties(getActivity(), interfaceProvider.getOlympusInterface()));
545- dialog.show(getFragmentManager(), "my_dialog");
572+ FragmentManager manager = getFragmentManager();
573+ if (manager != null)
574+ {
575+ dialog.show(manager, "my_dialog");
576+ }
546577 }
547578 catch (Exception e)
548579 {
Afficher sur ancien navigateur de dépôt.