Map<String, String> headerMap = new HashMap<>();
headerMap.put("User-Agent", "OlympusCameraKit"); // "OI.Share"
headerMap.put("X-Protocol", "OlympusCameraKit"); // "OI.Share"
+
Bitmap bmp = SimpleHttpClient.httpGetBitmap(url, headerMap, timeoutValue);
- HashMap<String, Object> map = new HashMap<>();
- map.put("Orientation", 0);
- callback.onCompleted(bmp, map);
+ if (bmp != null)
+ {
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("Orientation", 0);
+ callback.onCompleted(bmp, map);
+ return;
+ }
+
+ // screennail取得失敗時...リカバリする
+ try
+ {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ boolean smallSize = preferences.getBoolean(IPreferencePropertyAccessor.OLYMPUS_USE_SCREENNAIL_AS_SMALL, false);
+ if (smallSize)
+ {
+ // 小さい画像をscreennailとして利用する
+ url = "http://192.168.0.10/get_resizeimg.cgi?DIR=" + path + "&size=1024";
+ bmp = SimpleHttpClient.httpGetBitmap(url, headerMap, timeoutValue);
+ if (bmp != null)
+ {
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("Orientation", 0);
+ callback.onCompleted(bmp, map);
+ return;
+ }
+ // それでもダメな場合はサムネイル画像を使う...
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+
+ // サムネイルでscreennail表示...
+ downloadContentThumbnail(path, callback);
}
catch (Throwable e)
{
String CANON_USE_SCREENNAIL_AS_SMALL = "canon_get_screennail_as_small_picture";
+ String OLYMPUS_USE_SCREENNAIL_AS_SMALL = "olympus_get_screennail_as_small_picture";
+
/*
//String GR2_DISPLAY_MODE = "gr2_display_mode";
//String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0";
if (!items.containsKey(IPreferencePropertyAccessor.PEN_SMALL_PICTURE_SIZE)) {
editor.putString(IPreferencePropertyAccessor.PEN_SMALL_PICTURE_SIZE, IPreferencePropertyAccessor.PEN_SMALL_PICTURE_SIZE_DEFAULT_VALUE);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.OLYMPUS_USE_SCREENNAIL_AS_SMALL)) {
+ editor.putBoolean(IPreferencePropertyAccessor.OLYMPUS_USE_SCREENNAIL_AS_SMALL, false);
+ }
editor.apply();
}
catch (Exception e)
Log.v(TAG, " " + key + " , " + value);
break;
+ case IPreferencePropertyAccessor.OLYMPUS_USE_SCREENNAIL_AS_SMALL:
+ value = preferences.getBoolean(key, true);
+ Log.v(TAG, " " + key + " , " + value);
+ break;
+
default:
String strValue = preferences.getString(key, "");
setListPreference(key, key, strValue);
// Preferenceの画面に反映させる
setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, true);
setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, true);
+ setBooleanPreference(IPreferencePropertyAccessor.OLYMPUS_USE_SCREENNAIL_AS_SMALL, IPreferencePropertyAccessor.OLYMPUS_USE_SCREENNAIL_AS_SMALL, false);
}
catch (Exception e)
{
<string name="canon_connect_connecting4">接続中…(4/5)</string>
<string name="canon_connect_connecting5">接続中…(5/5)</string>
+ <string name="pref_olympus_get_screennail_as_small_picture">表示画像はスモール画像を使用</string>
+ <string name="pref_summary_olympus_get_screennail_as_small_picture">すこし時間がかかりますが、画像表示にスモール画像を使用します。</string>
<string name="pref_canon_get_screennail_as_small_picture">表示画像はスモール画像を使用</string>
<string name="pref_summary_canon_get_screennail_as_small_picture">すこし時間がかかりますが、画像表示にスモール画像を使用します。</string>
<string name="canon_connect_connecting4">Connecting…(4/5)</string>
<string name="canon_connect_connecting5">Connecting…(5/5)</string>
+ <string name="pref_olympus_get_screennail_as_small_picture">Use small image as screen nail</string>
+ <string name="pref_summary_olympus_get_screennail_as_small_picture">Use small size image as </string>
+
<string name="pref_canon_get_screennail_as_small_picture">Use small image as screen nail</string>
<string name="pref_summary_canon_get_screennail_as_small_picture">Use small size image as </string>
<string name="canon_get_image_screennail">Get Image…</string>
android:key="pen_download_small_picture_size"
android:defaultValue="1600"/>
+ <CheckBoxPreference
+ android:key="olympus_get_screennail_as_small_picture"
+ android:title="@string/pref_olympus_get_screennail_as_small_picture"
+ android:summary="@string/pref_summary_olympus_get_screennail_as_small_picture" />
+
</PreferenceCategory>
<PreferenceCategory