Commit 0e1c9ffd by Kim Jinsung

#37841 THETA連携

・デザイン反映
・Wifi接続改善
・不要なソースコード削除
parent b436d292
...@@ -168,4 +168,10 @@ public class Constant { ...@@ -168,4 +168,10 @@ public class Constant {
int NO = 0; int NO = 0;
int YES = 1; int YES = 1;
} }
//Wifiスキャンタイプ
public interface WifiScanType {
int CloseCameraActivity = 0;
int ThetaConnectError = 1;
}
} }
...@@ -3,8 +3,8 @@ package jp.agentec.abook.abv.bl.common.constant; ...@@ -3,8 +3,8 @@ package jp.agentec.abook.abv.bl.common.constant;
public class ABookValues { public class ABookValues {
public static final String THETA_IP_ADDRESS = "192.168.1.1"; public static final String THETA_IP_ADDRESS = "192.168.1.1";
public static final String THETA_MODEL_NAME_THETA = "THETA"; public static final String THETA_MODEL_NAME_THETA = "THETA";
public static final String THETA_MODEL_NAME_THETA_SC = "THETA SC"; public static final String THETA_MODEL_NAME_THETA_SC = "RICOH THETA SC";
public static final String THETA_MODEL_NAME_THETA_S = "THETA S"; public static final String THETA_MODEL_NAME_THETA_S = "RICOH THETA S";
public static final String SUCCESS = "success"; public static final String SUCCESS = "success";
public static final String FAIL = "fail"; public static final String FAIL = "fail";
......

11.5 KB | W: | H:

638 Bytes | W: | H:

ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_list.png
ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_list.png
ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_list.png
ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_list.png
  • 2-up
  • Swipe
  • Onion skin

48.8 KB | W: | H:

2.86 KB | W: | H:

ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_shoot.png
ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_shoot.png
ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_shoot.png
ABVJE_Res_Default_Android/res/drawable-xhdpi/btn_theta_shoot.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -1442,7 +1442,7 @@ ...@@ -1442,7 +1442,7 @@
<string name="msg_theta_image_delete_confirm">この画像を削除しますか?</string> <string name="msg_theta_image_delete_confirm">この画像を削除しますか?</string>
<string name="msg_theta_image_delete_success">画像削除に成功しました。</string> <string name="msg_theta_image_delete_success">画像削除に成功しました。</string>
<string name="msg_theta_image_delete_fail">画像削除に失敗しました。\nWi-Fi接続状態を確認してください。</string> <string name="msg_theta_image_delete_fail">画像削除に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="msg_theta_image_load_fail">画像情報取得に失敗しました。\nWi-Fi接続状態を確認してください。</string> → プレビュー、ライブラリ画面から閉じる処理追加 <string name="msg_theta_image_load_fail">画像情報取得に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="msg_deleting">削除中...</string> <string name="msg_deleting">削除中...</string>
<string name="msg_theta_shoot_fail">THETAカメラの撮影に失敗しました。\nWi-Fi接続状態を確認してください。</string> <string name="msg_theta_shoot_fail">THETAカメラの撮影に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="msg_transferred">転送済み</string> <string name="msg_transferred">転送済み</string>
...@@ -1453,4 +1453,8 @@ ...@@ -1453,4 +1453,8 @@
<string name="msg_theta_set_exposure_fail">露出情報の設定に失敗しました。\nWi-Fi接続状態を確認してください。</string> <string name="msg_theta_set_exposure_fail">露出情報の設定に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="msg_theta_get_exposure_fail">露出情報の取得に失敗しました。\nWi-Fi接続状態を確認してください。</string> <string name="msg_theta_get_exposure_fail">露出情報の取得に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="title_theta_exposure_value">EV:%s</string> <string name="title_theta_exposure_value">EV:%s</string>
<string name="msg_device_location_off">端末の位置情報機能がONにしてください。</string>
<string name="msg_theta_wifi_disconnect">THETAカメラとWi-Fi接続が切断されましたので、シーン画像選択画面に戻ります。</string>
</resources> </resources>
...@@ -1459,4 +1459,6 @@ ...@@ -1459,4 +1459,6 @@
<string name="msg_theta_set_exposure_fail">노출 정보 설정에 실패하였습니다.\nWi-Fi접속 상태를 확인해 주세요.</string> <string name="msg_theta_set_exposure_fail">노출 정보 설정에 실패하였습니다.\nWi-Fi접속 상태를 확인해 주세요.</string>
<string name="msg_theta_get_exposure_fail">노출 정보 취득에 실패하였습니다.\nWi-Fi접속 상태를 확인해 주세요.</string> <string name="msg_theta_get_exposure_fail">노출 정보 취득에 실패하였습니다.\nWi-Fi접속 상태를 확인해 주세요.</string>
<string name="title_theta_exposure_value">EV:%s</string> <string name="title_theta_exposure_value">EV:%s</string>
<string name="msg_device_location_off">단말기의 위치정보 기능을 ON으로 설정해 주세요.</string>
<string name="msg_theta_wifi_disconnect">THETA 카메라 Wi-Fi 접속이 끊겼습니다. 장면 이미지 선택 화면으로 돌아갑니다.</string>
</resources> </resources>
\ No newline at end of file
...@@ -1457,4 +1457,7 @@ ...@@ -1457,4 +1457,7 @@
<string name="msg_theta_set_exposure_fail">Failed to set exposure value.\nPlease check the Wi-Fi connection status.</string> <string name="msg_theta_set_exposure_fail">Failed to set exposure value.\nPlease check the Wi-Fi connection status.</string>
<string name="msg_theta_get_exposure_fail">Failed to acquire exposure value.\nPlease check the Wi-Fi connection status.</string> <string name="msg_theta_get_exposure_fail">Failed to acquire exposure value.\nPlease check the Wi-Fi connection status.</string>
<string name="title_theta_exposure_value">EV:%s</string> <string name="title_theta_exposure_value">EV:%s</string>
<string name="msg_device_location_off">Set the location information function of the Device to ON.</string>
<string name="msg_theta_wifi_disconnect">THETA camera Wi-Fi connection has been lost. return to Select scene image screen.</string>
</resources> </resources>
\ No newline at end of file
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
android:layout_toRightOf="@id/regist" android:layout_toRightOf="@id/regist"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:text="camera" /> android:text="THETA" />
<TextView <TextView
android:id="@+id/device_image_list_title" android:id="@+id/device_image_list_title"
......
...@@ -83,7 +83,8 @@ ...@@ -83,7 +83,8 @@
android:paddingRight="10dp" android:paddingRight="10dp"
android:progress="2" android:progress="2"
android:progressDrawable="@drawable/theta_exposure_progress_drawable" android:progressDrawable="@drawable/theta_exposure_progress_drawable"
android:thumb="@android:drawable/radiobutton_off_background" /> android:thumb="@android:drawable/radiobutton_off_background"
android:visibility="gone"/>
<SeekBar <SeekBar
android:id="@+id/sb_exposure" android:id="@+id/sb_exposure"
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:text="@string/save"/> android:text="@string/title_theta_image_save" />
</RelativeLayout> </RelativeLayout>
<com.theta.glview.GLPhotoView <com.theta.glview.GLPhotoView
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
android:id="@+id/object_thumbnail" android:id="@+id/object_thumbnail"
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_gravity="center_vertical" android:scaleType="fitXY"
android:scaleType="fitXY" /> android:layout_centerVertical="true" />
<LinearLayout <LinearLayout
android:id="@+id/ll_content" android:id="@+id/ll_content"
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
android:id="@+id/btn_theta_image_save" android:id="@+id/btn_theta_image_save"
android:layout_width="85dp" android:layout_width="85dp"
android:layout_height="45dp" android:layout_height="45dp"
android:layout_toLeftOf="@+id/btn_theta_image_delete"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/btn_theta_image_delete"
android:text="@string/title_theta_image_save" /> android:text="@string/title_theta_image_save" />
<Button <Button
......
...@@ -6,16 +6,15 @@ import android.content.Context; ...@@ -6,16 +6,15 @@ import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.wifi.ScanResult; import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.Environment; import android.os.Environment;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.annotation.NonNull;
import com.theta.network.ThetaDeviceInfo;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -33,11 +32,8 @@ public class ThetaHelper { ...@@ -33,11 +32,8 @@ public class ThetaHelper {
private static final String TAG = "ThetaHelper"; private static final String TAG = "ThetaHelper";
private static final String THETA_IMAGE_SAVE_PATH = Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_PICTURES + "/RICOH THETA/"; private static final String THETA_IMAGE_SAVE_PATH = Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_PICTURES + "/RICOH THETA/";
private Context mContext; private Context mContext;
public ThetaHelper(Context context) { public ThetaHelper(Context context) {
mContext = context; mContext = context;
} }
...@@ -53,10 +49,12 @@ public class ThetaHelper { ...@@ -53,10 +49,12 @@ public class ThetaHelper {
Logger.e(TAG, "wifiManager == null"); Logger.e(TAG, "wifiManager == null");
return false; return false;
} }
wifiManager.disconnect(); //既存接続中のネットワーク切断
boolean result = wifiManager.enableNetwork(networkId, true); WifiInfo wifi_inf = wifiManager.getConnectionInfo();
wifiManager.reconnect(); if (wifi_inf.getNetworkId() != -1 ) {
return result; wifiManager.disableNetwork(wifi_inf.getNetworkId());
}
return wifiManager.enableNetwork(networkId, true);
} }
/** /**
...@@ -73,6 +71,7 @@ public class ThetaHelper { ...@@ -73,6 +71,7 @@ public class ThetaHelper {
//保存する前にSSIDがWi-Fiリストに存在するかチェック //保存する前にSSIDがWi-Fiリストに存在するかチェック
if (!checkWifiNetwork(ssid)) { if (!checkWifiNetwork(ssid)) {
Logger.e(TAG, "wifi list not found ssid = " + ssid);
return -1; return -1;
} }
...@@ -106,7 +105,6 @@ public class ThetaHelper { ...@@ -106,7 +105,6 @@ public class ThetaHelper {
*/ */
private boolean checkWifiNetwork(String ssid) { private boolean checkWifiNetwork(String ssid) {
WifiManager wifiManager = (WifiManager)mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiManager wifiManager = (WifiManager)mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
List<ThetaDeviceInfo> wifiList = new ArrayList<>();
if (wifiManager == null) { if (wifiManager == null) {
Logger.e(TAG, "wifiManager == null"); Logger.e(TAG, "wifiManager == null");
return false; return false;
...@@ -116,7 +114,7 @@ public class ThetaHelper { ...@@ -116,7 +114,7 @@ public class ThetaHelper {
boolean hasWifiList = false; boolean hasWifiList = false;
for (ScanResult scanResult : wifiManager.getScanResults()) { for (ScanResult scanResult : wifiManager.getScanResults()) {
String scanResultSSID = scanResult.SSID.replace("\"", ""); String scanResultSSID = scanResult.SSID.replace("\"", "");
int index = scanResultSSID.indexOf(ABookValues.THETA_MODEL_NAME_THETA); int index = scanResultSSID.indexOf(ssid);
Logger.d(TAG, "scanResultSSID = " + scanResultSSID); Logger.d(TAG, "scanResultSSID = " + scanResultSSID);
if (index != -1) { if (index != -1) {
hasWifiList = true; hasWifiList = true;
...@@ -128,12 +126,12 @@ public class ThetaHelper { ...@@ -128,12 +126,12 @@ public class ThetaHelper {
/** /**
* SSIDからパスワード情報を取り出す * SSIDからパスワード情報を取り出す
* @param ssid アクセスポイント * @param ssid アクセスポイント
* @return * @return 接続パスワード
*/ */
private String getPassword(String ssid) { private String getPassword(String ssid) {
String password = ssid.replace("THETA",""); String password = ssid.replace("THETA","");
password = password.replace(".OSC",""); password = password.replace(".OSC","");
return password.substring(2, password.length()); return password.substring(2);
} }
/** /**
...@@ -208,4 +206,37 @@ public class ThetaHelper { ...@@ -208,4 +206,37 @@ public class ThetaHelper {
return saveImageFiles.length != 0; return saveImageFiles.length != 0;
} }
/**
* ThetaカメラとWi-Fi接続状態をチェック
* @param wifiManager Wifiマネージャー
* @return true:接続状態、false:非接続状態
*/
public boolean checkThetaCameraWifiConnected(@NonNull WifiManager wifiManager) {
List<ScanResult> results = wifiManager.getScanResults();
boolean isConnected = false;
for (ScanResult scanResult : results) {
String scanSSID = scanResult.SSID.replace("\"", "");
Logger.d(TAG, "*****scanSSID = " + scanSSID);
if (scanSSID.length() != 0) {
int index = scanSSID.indexOf(ABookValues.THETA_MODEL_NAME_THETA);
if (index != -1) {
for (WifiConfiguration configuration : wifiManager.getConfiguredNetworks()) {
// Android4.2以降よりダブルクォーテーションが付いてくるので除去
String configurationSSID = configuration.SSID.replace("\"", "");
if (configurationSSID.equals(scanSSID)) {
if (configuration.status == WifiConfiguration.Status.CURRENT) {
isConnected = true;
}
break;
}
}
if (isConnected) {
break;
}
}
}
}
return isConnected;
}
} }
...@@ -245,18 +245,24 @@ public class HttpConnector { ...@@ -245,18 +245,24 @@ public class HttpConnector {
for (int continuation = 0; continuation < 10; continuation++) { for (int continuation = 0; continuation < 10; continuation++) {
ArrayList<ImageInfo> receivedImageInfo = getListInternal(GET_IMAGE_MAX_COUNT, imageInfos.size()); ArrayList<ImageInfo> receivedImageInfo = getListInternal(GET_IMAGE_MAX_COUNT, imageInfos.size());
imageInfos.addAll(receivedImageInfo); if (receivedImageInfo == null) {
if (mIsOldApi) { imageInfos = null;
//API2.0 break;
if (mContinuationToken == null) {
break;
}
} else { } else {
//API2.1 imageInfos.addAll(receivedImageInfo);
if (receivedImageInfo.size() < GET_IMAGE_MAX_COUNT) { if (mIsOldApi) {
break; //API2.0
if (mContinuationToken == null) {
break;
}
} else {
//API2.1
if (receivedImageInfo.size() < GET_IMAGE_MAX_COUNT) {
break;
}
} }
} }
} }
return imageInfos; return imageInfos;
...@@ -310,7 +316,11 @@ public class HttpConnector { ...@@ -310,7 +316,11 @@ public class HttpConnector {
JSONArray entries = results.getJSONArray("entries"); JSONArray entries = results.getJSONArray("entries");
int entrySize = entries.length(); int entrySize = entries.length();
if (mIsOldApi) { if (mIsOldApi) {
mContinuationToken = results.getString("continuationToken"); try {
mContinuationToken = results.getString("continuationToken");
} catch (JSONException e) {
mContinuationToken = null;
}
} }
for (int index = 0; index < entrySize; index++) { for (int index = 0; index < entrySize; index++) {
...@@ -358,14 +368,17 @@ public class HttpConnector { ...@@ -358,14 +368,17 @@ public class HttpConnector {
} }
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
imageInfos = null;
} catch (JSONException e) { } catch (JSONException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
imageInfos = null;
} finally { } finally {
if (is != null) { if (is != null) {
try { try {
is.close(); is.close();
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
imageInfos = null;
} }
} }
} }
...@@ -563,12 +576,17 @@ public class HttpConnector { ...@@ -563,12 +576,17 @@ public class HttpConnector {
@Override @Override
public void run() { public void run() {
String capturedFileId = checkCaptureStatus(mCommandId); String capturedFileId = checkCaptureStatus(mCommandId);
if (capturedFileId != null) { if (capturedFileId != null) {
mHttpEventListener.onCheckStatus(true); if (capturedFileId.equals("fail")) {
mCheckStatusTimer.cancel(); mCheckStatusTimer.cancel();
mHttpEventListener.onObjectChanged(capturedFileId); mHttpEventListener.onError("Execption Catch");
mHttpEventListener.onCompleted(); } else {
mHttpEventListener.onCheckStatus(true);
mCheckStatusTimer.cancel();
mHttpEventListener.onObjectChanged(capturedFileId);
mHttpEventListener.onCompleted();
}
} else { } else {
mHttpEventListener.onCheckStatus(false); mHttpEventListener.onCheckStatus(false);
} }
...@@ -616,13 +634,16 @@ public class HttpConnector { ...@@ -616,13 +634,16 @@ public class HttpConnector {
} }
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
capturedFileId = "fail";
} catch (JSONException e) { } catch (JSONException e) {
capturedFileId = "fail";
Logger.e(TAG, e); Logger.e(TAG, e);
} finally { } finally {
if (is != null) { if (is != null) {
try { try {
is.close(); is.close();
} catch (IOException e) { } catch (IOException e) {
capturedFileId = "fail";
Logger.e(TAG, e); Logger.e(TAG, e);
} }
} }
...@@ -676,14 +697,17 @@ public class HttpConnector { ...@@ -676,14 +697,17 @@ public class HttpConnector {
imageData.setRoll(xmp.getPoseRollDegrees()); imageData.setRoll(xmp.getPoseRollDegrees());
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
imageData = null;
} catch (JSONException e) { } catch (JSONException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
imageData = null;
} finally { } finally {
if (is != null) { if (is != null) {
try { try {
is.close(); is.close();
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
imageData = null;
} }
} }
} }
...@@ -738,13 +762,14 @@ public class HttpConnector { ...@@ -738,13 +762,14 @@ public class HttpConnector {
imageData.setRoll(xmp.getPoseRollDegrees()); imageData.setRoll(xmp.getPoseRollDegrees());
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
return null; imageData = null;
} finally { } finally {
if (is != null) { if (is != null) {
try { try {
is.close(); is.close();
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, e); Logger.e(TAG, e);
imageData = null;
} }
} }
} }
......
...@@ -9,6 +9,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger; ...@@ -9,6 +9,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
* Information class of media file * Information class of media file
*/ */
public class ImageInfo { public class ImageInfo {
private static final String TAG = "ImageInfo";
public static String FILE_FORMAT_CODE_EXIF_JPEG = "JPEG"; public static String FILE_FORMAT_CODE_EXIF_JPEG = "JPEG";
public static String FILE_FORMAT_CODE_EXIF_MPEG = "MPEG"; public static String FILE_FORMAT_CODE_EXIF_MPEG = "MPEG";
...@@ -81,14 +82,19 @@ public class ImageInfo { ...@@ -81,14 +82,19 @@ public class ImageInfo {
* @param captureDate Shooting time * @param captureDate Shooting time
*/ */
public void setCaptureDate(String captureDate) { public void setCaptureDate(String captureDate) {
//文字列の最後のタイムゾーン情報+09:00除外 String createDateStr = null;
String createDateStr = captureDate.substring(0, captureDate.length() - 6); if (captureDate.length() > 20) {
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss"); //文字列の最後のタイムゾーン情報+09:00除外
createDateStr = captureDate.substring(0, captureDate.length() - 6);
} else {
createDateStr = captureDate;
}
try { try {
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
Date date = sdFormat.parse(createDateStr); Date date = sdFormat.parse(createDateStr);
mCaptureDate = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date); mCaptureDate = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date);
} catch (Exception e) { } catch (Exception e) {
Logger.e(e.toString()); Logger.e(TAG, e.toString());
} }
} }
......
...@@ -13,7 +13,9 @@ import android.os.Build; ...@@ -13,7 +13,9 @@ import android.os.Build;
import android.os.Debug; import android.os.Debug;
import android.os.Environment; import android.os.Environment;
import android.os.StatFs; import android.os.StatFs;
import android.provider.Settings;
import android.provider.Settings.Secure; import android.provider.Settings.Secure;
import android.text.TextUtils;
import android.util.Base64; import android.util.Base64;
import android.view.Display; import android.view.Display;
import android.view.WindowManager; import android.view.WindowManager;
...@@ -263,7 +265,30 @@ public class DeviceInfo { ...@@ -263,7 +265,30 @@ public class DeviceInfo {
if (wifiManager == null) { if (wifiManager == null) {
return false; return false;
} }
return true; return wifiManager.isWifiEnabled();
} }
/**
* 端末の位置情報機能の有無チェック
* @return true:位置情報機能ON, false:位置情報機能OFF
*/
public static boolean isDeviceLocationEnabled(Context context) {
int locationMode = 0;
String locationProviders;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
try {
locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE);
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
return false;
}
return locationMode != Settings.Secure.LOCATION_MODE_OFF;
}else{
locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
return !TextUtils.isEmpty(locationProviders);
}
}
} }
...@@ -86,6 +86,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.ImageViewActivity; ...@@ -86,6 +86,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.ImageViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity; import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.PreviewActivity; import jp.agentec.abook.abv.ui.viewer.activity.PreviewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.VideoViewActivity; import jp.agentec.abook.abv.ui.viewer.activity.VideoViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaActivity;
import jp.agentec.abook.abv.ui.viewer.view.OperationTaskLayout; import jp.agentec.abook.abv.ui.viewer.view.OperationTaskLayout;
import jp.agentec.adf.net.http.HttpDownloadSimpleNotification; import jp.agentec.adf.net.http.HttpDownloadSimpleNotification;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
...@@ -1732,4 +1733,15 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1732,4 +1733,15 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
public void setPreviousOfSettingActivity(ABVUIActivity activity) { public void setPreviousOfSettingActivity(ABVUIActivity activity) {
this.previousOfSettingActivity = activity; this.previousOfSettingActivity = activity;
} }
/**
* THETAカメラと接続が切れたときにTHETA関連Activityをすべて終了させる
*/
public synchronized void finishAllThetaActivity() {
for (ABVAuthenticatedActivity activity : currentActivityStack) {
if (activity instanceof ThetaActivity) {
activity.finish();
}
}
}
} }
...@@ -16,7 +16,9 @@ import android.net.wifi.WifiManager; ...@@ -16,7 +16,9 @@ import android.net.wifi.WifiManager;
import android.os.Bundle; import android.os.Bundle;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
...@@ -39,6 +41,7 @@ import jp.agentec.abook.abv.bl.common.Constant; ...@@ -39,6 +41,7 @@ import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.constant.ABookValues; import jp.agentec.abook.abv.bl.common.constant.ABookValues;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity; import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType; import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
...@@ -57,23 +60,24 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -57,23 +60,24 @@ public class DeviceImageListActivity extends ABVUIActivity {
//表示画像の解像度(低くなると画質が悪くなる) //表示画像の解像度(低くなると画質が悪くなる)
private static final int THUMBNAIL_SIZE = 700; private static final int THUMBNAIL_SIZE = 700;
//タブレットの1行最大表示数 //タブレットの1行最大表示数
private static final int TABLET_COLUMNS = 4; private static final int TABLET_COLUMNS = 4;
//タブレットの縦表示時、1行最大表示数 //タブレットの縦表示時、1行最大表示数
private static final int PHONE_COLUMNS_PORTRAIT = 3; private static final int PHONE_COLUMNS_PORTRAIT = 3;
//画像選択最大数 //画像選択最大数
private static final int IMAGE_SELECT_MAX_COUNT = 20; private static final int IMAGE_SELECT_MAX_COUNT = 20;
//登録完了後、100%プログレスバー表示のため、完了ダイアログ表示タイム //登録完了後、100%プログレスバー表示のため、完了ダイアログ表示タイム
public static final int SEND_FINISH_DIALOG_DELAY_MILLIS = 200; public static final int SEND_FINISH_DIALOG_DELAY_MILLIS = 200;
//THETAカメラWIFI接続後、切り替える時間が必要のため、カメラ情報取得ディレータイム //THETAカメラWIFI接続後、切り替える時間が必要のため、カメラ情報取得ディレータイム
private static final int GET_THETA_CAMERA_INFO_DELAY = 1500; private static final int GET_THETA_CAMERA_INFO_DELAY = 3000;
//サムネイルの保存するとき、キャッシュの中のフォルダ名 //サムネイルの保存するとき、キャッシュの中のフォルダ名
private static final String THUMB_IMAGE_CACHE_DIRECTORY_NAME = "thumb"; private static final String THUMB_IMAGE_CACHE_DIRECTORY_NAME = "thumb";
//スマートフォン表示時、登録ボタンスケール
private static final float PHONE_REGISTER_BUTTON_SCALE = 0.55f;
//スマートフォン表示時、THETAボタンスケール
private static final float PHONE_THETA_BUTTON_SCALE = 0.8f;
GridView mGalleryGridView; GridView mGalleryGridView;
ImageGalleryAdapter mGalleryAdapter; ImageGalleryAdapter mGalleryAdapter;
...@@ -93,7 +97,7 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -93,7 +97,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
private boolean mIsBaseSceneUpload = false; private boolean mIsBaseSceneUpload = false;
private boolean mIsBaseSceneUploadSuccess = true; private boolean mIsBaseSceneUploadSuccess = true;
private ThetaHelper mThetaHelper = new ThetaHelper(this); protected ThetaHelper mThetaHelper = new ThetaHelper(this);
private SceneSendHelper mSceneSendHelper = new SceneSendHelper(this); private SceneSendHelper mSceneSendHelper = new SceneSendHelper(this);
private WifiManager mWifiManager; private WifiManager mWifiManager;
...@@ -155,16 +159,31 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -155,16 +159,31 @@ public class DeviceImageListActivity extends ABVUIActivity {
public void onClick(View v) { public void onClick(View v) {
Logger.v(TAG, "RegistBtn.onClick"); Logger.v(TAG, "RegistBtn.onClick");
buttonDoubleTapControl(mCameraBtn); buttonDoubleTapControl(mCameraBtn);
if (deviceWifiEnable()) { if (deviceWifiEnable()) { //端末のWifi機能ON・OFFチェック
//位置情報権限チェック if (DeviceInfo.isDeviceLocationEnabled(DeviceImageListActivity.this)) { //端末の位置情報ON・OFFチェック
ABookPermissionHelper helper = new ABookPermissionHelper(DeviceImageListActivity.this, Constant.ABookPermissionType.AccessFineLocation, null); //位置情報権限チェック
if (helper.checkMultiPermissions(true)) { ABookPermissionHelper helper = new ABookPermissionHelper(DeviceImageListActivity.this, Constant.ABookPermissionType.AccessFineLocation, null);
showThetaDeviceConnectDialog(); if (helper.checkMultiPermissions(true)) { //アプリの位置情報ON・OFFチェック
showThetaDeviceConnectDialog();
}
} else {
showSimpleAlertDialog(R.string.msg_device_location_off);
} }
} }
} }
}); });
//スマートフォンの場合、「登録」「THETA」ボタンサイズ変更
if (isNormalSize()) {
ViewGroup.LayoutParams params = mRegistBtn.getLayoutParams();
//サイズに変更
params.width = (int) (params.width * PHONE_REGISTER_BUTTON_SCALE);
mRegistBtn.setLayoutParams(params);
params = mCameraBtn.getLayoutParams();
params.width = (int) (params.width * PHONE_THETA_BUTTON_SCALE);
mCameraBtn.setLayoutParams(params);
}
//表示中にストレージ権限がなくなった場合、シーン画像選択画面を非表示 //表示中にストレージ権限がなくなった場合、シーン画像選択画面を非表示
final Callback resultCallback = new Callback() { final Callback resultCallback = new Callback() {
...@@ -204,6 +223,18 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -204,6 +223,18 @@ public class DeviceImageListActivity extends ABVUIActivity {
mIsOnResume = true; mIsOnResume = true;
} }
//端末の戻るボタン禁止
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Logger.v(TAG, "dispatchKeyEvent %s", event);
if (event.getAction()==KeyEvent.ACTION_UP) { // 戻るボタンを抑止
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
return true;
}
}
return super.dispatchKeyEvent(event);
}
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
...@@ -385,7 +416,7 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -385,7 +416,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (mIsBaseSceneUpload) { if (mIsBaseSceneUpload && !mIsBaseSceneUploadSuccess) {
mIsBaseSceneUploadSuccess = true; mIsBaseSceneUploadSuccess = true;
} }
progressDialogHorizontal.setProgress(progress); progressDialogHorizontal.setProgress(progress);
...@@ -461,6 +492,7 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -461,6 +492,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
mThetaDeviceConnectDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mThetaDeviceConnectDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mThetaDeviceConnectDialog.setCanceledOnTouchOutside(false); mThetaDeviceConnectDialog.setCanceledOnTouchOutside(false);
mThetaDeviceConnectDialog.setContentView(R.layout.theta_device_connect_dialog); mThetaDeviceConnectDialog.setContentView(R.layout.theta_device_connect_dialog);
mThetaDeviceConnectDialog.setCancelable(false);
} }
//更新ボタン //更新ボタン
...@@ -536,11 +568,13 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -536,11 +568,13 @@ public class DeviceImageListActivity extends ABVUIActivity {
if (networkId == -1) { if (networkId == -1) {
networkId = mThetaHelper.saveThetaCameraWifi(ssid); networkId = mThetaHelper.saveThetaCameraWifi(ssid);
if (networkId == -1) { if (networkId == -1) {
Logger.e(TAG, "saveThetaCameraWifi networkId -1");
closeProgressPopup(); closeProgressPopup();
showSimpleAlertDialog(getString(R.string.msg_fail_connect_theta_wifi)); showSimpleAlertDialog(getString(R.string.msg_fail_connect_theta_wifi));
return; return;
} }
} }
boolean isSuccess = mThetaHelper.connectThetaCameraWifi(networkId); boolean isSuccess = mThetaHelper.connectThetaCameraWifi(networkId);
if (isSuccess) { if (isSuccess) {
handler.postDelayed(new Runnable() { handler.postDelayed(new Runnable() {
...@@ -550,8 +584,14 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -550,8 +584,14 @@ public class DeviceImageListActivity extends ABVUIActivity {
} }
}, GET_THETA_CAMERA_INFO_DELAY); }, GET_THETA_CAMERA_INFO_DELAY);
} else { } else {
Logger.e(TAG, "connectThetaCameraWifi fail");
closeProgressPopup(); closeProgressPopup();
showSimpleAlertDialog(getString(R.string.msg_fail_connect_theta_wifi)); AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_fail_connect_theta_wifi, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
wifiScanStart();
}
});
} }
} }
...@@ -576,7 +616,6 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -576,7 +616,6 @@ public class DeviceImageListActivity extends ABVUIActivity {
*/ */
public void thetaDeviceInfoTaskFinish(ThetaDeviceInfo deviceInfo) { public void thetaDeviceInfoTaskFinish(ThetaDeviceInfo deviceInfo) {
closeProgressPopup(); closeProgressPopup();
if (deviceInfo != null && deviceInfo.getModel().length() != 0) { if (deviceInfo != null && deviceInfo.getModel().length() != 0) {
if (deviceInfo.getModel().equals(ABookValues.THETA_MODEL_NAME_THETA_S) || deviceInfo.getModel().equals(ABookValues.THETA_MODEL_NAME_THETA_SC)) { if (deviceInfo.getModel().equals(ABookValues.THETA_MODEL_NAME_THETA_S) || deviceInfo.getModel().equals(ABookValues.THETA_MODEL_NAME_THETA_SC)) {
putUserPref(ABookKeys.THETA_OLD_VERSION_FLG, true); putUserPref(ABookKeys.THETA_OLD_VERSION_FLG, true);
...@@ -589,12 +628,18 @@ public class DeviceImageListActivity extends ABVUIActivity { ...@@ -589,12 +628,18 @@ public class DeviceImageListActivity extends ABVUIActivity {
if (mThetaDeviceConnectDialog != null && mThetaDeviceConnectDialog.isShowing()) { if (mThetaDeviceConnectDialog != null && mThetaDeviceConnectDialog.isShowing()) {
mThetaDeviceConnectDialog.dismiss(); mThetaDeviceConnectDialog.dismiss();
} }
//THETAカメラ画面表示 //THETAカメラ画面表示
Intent intent = new Intent(); Intent intent = new Intent();
intent.setClassName(getPackageName(), ThetaCameraActivity.class.getName()); intent.setClassName(getPackageName(), ThetaCameraActivity.class.getName());
startActivity(intent); startActivity(intent);
} else { } else {
showSimpleAlertDialog(getString(R.string.msg_fail_connect_theta_wifi)); AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_fail_connect_theta_wifi, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
wifiScanStart();
}
});
} }
} }
......
package jp.agentec.abook.abv.ui.viewer.activity.theta;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import com.theta.helper.ThetaHelper;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.theta.task.FinishWlanTask;
/**
* Theta関連共通クラス
* @version 1.2.300
* @since 2020/06/18
* @author 金鎭星
*/
public class ThetaActivity extends ABVUIActivity {
private static final String TAG = "ThetaActivity";
private WifiManager mWifiManager;
protected ThetaHelper mThetaHelper = new ThetaHelper(this);
private int mWifiScanType;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mWifiManager = (WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
}
/**
* Wifiスキャンするブロードキャストリスナークラス
*/
BroadcastReceiver wifiReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
unregisterReceiver(wifiReceiver);
boolean isConnected = mThetaHelper.checkThetaCameraWifiConnected(mWifiManager);
if (isConnected) {
Logger.d(TAG, "ThetaカメラWi-Fi接続状態");
if (mWifiScanType == Constant.WifiScanType.CloseCameraActivity) {
//THETAカメラのWi-Fi機能を無効にするAPI送信
new FinishWlanTask((ThetaCameraActivity) ActivityHandlingHelper.getInstance().getCurrentActivity()).execute();
}
} else {
Logger.d(TAG, "ThetaカメラWi-Fi非接続状態");
if (mWifiScanType == Constant.WifiScanType.CloseCameraActivity) {
finish();
} else if (mWifiScanType == Constant.WifiScanType.ThetaConnectError) {
AlertDialogUtil.showAlertDialog(ThetaActivity.this, R.string.app_name, R.string.msg_theta_wifi_disconnect, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
closeProgressPopup();
//Thetaカメラ関連Activity終了
ActivityHandlingHelper.getInstance().finishAllThetaActivity();
}
});
}
}
}
};
/**
* Thetaカメラと通信失敗時、共通メソッド
* @param errorMessageResourceId エラーメッセージリソースID
*/
protected void thetaConnectError(int errorMessageResourceId) {
AlertDialogUtil.showAlertDialog(this, R.string.app_name, errorMessageResourceId, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
changeProgressPopup(getString(R.string.progress));
//現在接続状態なのかチェック
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
mWifiManager.startScan();
mWifiScanType = Constant.WifiScanType.ThetaConnectError;
}
});
}
/**
* THETAカメラ画面から閉じるボタンタップ時にTHETAカメラのWi-Fi機能を無効にするため、
* Wi-Fiが接続状態かチェックする。
*/
protected void closeThetaCameraActivity() {
showProgressPopup();
//現在接続状態なのかチェック
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
mWifiManager.startScan();
mWifiScanType = Constant.WifiScanType.CloseCameraActivity;
}
}
...@@ -11,7 +11,6 @@ import android.widget.AdapterView; ...@@ -11,7 +11,6 @@ import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import android.widget.ListView; import android.widget.ListView;
import com.theta.helper.ThetaHelper;
import com.theta.network.ImageData; import com.theta.network.ImageData;
import com.theta.view.ImageListArrayAdapter; import com.theta.view.ImageListArrayAdapter;
import com.theta.view.ImageRow; import com.theta.view.ImageRow;
...@@ -21,7 +20,6 @@ import java.util.List; ...@@ -21,7 +20,6 @@ import java.util.List;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.viewer.activity.theta.task.DeleteImageTask; import jp.agentec.abook.abv.ui.viewer.activity.theta.task.DeleteImageTask;
import jp.agentec.abook.abv.ui.viewer.activity.theta.task.ImageListTask; import jp.agentec.abook.abv.ui.viewer.activity.theta.task.ImageListTask;
...@@ -33,12 +31,12 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.task.LoadPhotoTask; ...@@ -33,12 +31,12 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.task.LoadPhotoTask;
* @since 2020/05/19 * @since 2020/05/19
* @author 金鎭星 * @author 金鎭星
*/ */
public class ThetaImageListActivity extends ABVUIActivity { public class ThetaImageListActivity extends ThetaActivity {
private static final String TAG = "ThetaImageListActivity"; private static final String TAG = "ThetaImageListActivity";
private ListView mImageListView; private ListView mImageListView;
private ThetaHelper mThetaHelper = new ThetaHelper(this);
private List<ImageRow> mImageRows; private List<ImageRow> mImageRows;
private int mSelectedPosition; private int mSelectedPosition;
private boolean isSelected = false;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -110,25 +108,30 @@ public class ThetaImageListActivity extends ABVUIActivity { ...@@ -110,25 +108,30 @@ public class ThetaImageListActivity extends ABVUIActivity {
} }
}); });
} else { //通常アイテムタップ時 } else { //通常アイテムタップ時
if (selectedItem.isPhoto()) { if (!isSelected) {
Intent intent = new Intent(); isSelected = true;
intent.putExtra(ABookKeys.THETA_FILE_ID, selectedItem.getFileId()); if (selectedItem.isPhoto()) {
intent.setClassName(getPackageName(), ThetaImagePreviewActivity.class.getName()); Intent intent = new Intent();
startActivity(intent); intent.putExtra(ABookKeys.THETA_FILE_ID, selectedItem.getFileId());
} else { intent.setClassName(getPackageName(), ThetaImagePreviewActivity.class.getName());
Logger.e(TAG, "is not Photo"); startActivity(intent);
} else {
Logger.e(TAG, "is not Photo");
}
//ダブルタップ防止
handler.postDelayed(new Runnable() {
@Override
public void run() {
isSelected = false;
}
}, 1000);
} }
} }
} }
}); });
closeProgressPopup(); closeProgressPopup();
} else { } else {
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_theta_image_load_fail, true, new DialogInterface.OnClickListener() { thetaConnectError(R.string.msg_theta_image_load_fail);
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
Logger.e(TAG, "failed to get image list"); Logger.e(TAG, "failed to get image list");
} }
} }
...@@ -158,11 +161,12 @@ public class ThetaImageListActivity extends ABVUIActivity { ...@@ -158,11 +161,12 @@ public class ThetaImageListActivity extends ABVUIActivity {
Logger.e(TAG,"failed to local save image"); Logger.e(TAG,"failed to local save image");
showSimpleAlertDialog(R.string.msg_theta_image_send_fail); showSimpleAlertDialog(R.string.msg_theta_image_send_fail);
} }
closeProgressPopup();
} else { } else {
Logger.e(TAG,"failed loadPhotoTaskFinish"); Logger.e(TAG,"failed loadPhotoTaskFinish");
showSimpleAlertDialog(R.string.msg_theta_image_load_fail); thetaConnectError(R.string.msg_theta_image_load_fail);
} }
closeProgressPopup();
} }
/** /**
...@@ -181,8 +185,8 @@ public class ThetaImageListActivity extends ABVUIActivity { ...@@ -181,8 +185,8 @@ public class ThetaImageListActivity extends ABVUIActivity {
} }
}); });
} else { } else {
showSimpleAlertDialog(R.string.msg_theta_image_delete_fail);
Logger.e(TAG,"failed to delete image"); Logger.e(TAG,"failed to delete image");
thetaConnectError(R.string.msg_theta_image_delete_fail);
} }
closeProgressPopup(); closeProgressPopup();
} }
......
...@@ -10,7 +10,6 @@ import android.view.View; ...@@ -10,7 +10,6 @@ import android.view.View;
import android.widget.Button; import android.widget.Button;
import com.theta.glview.GLPhotoView; import com.theta.glview.GLPhotoView;
import com.theta.helper.ThetaHelper;
import com.theta.model.Photo; import com.theta.model.Photo;
import com.theta.model.RotateInertia; import com.theta.model.RotateInertia;
import com.theta.network.ImageData; import com.theta.network.ImageData;
...@@ -18,7 +17,6 @@ import com.theta.network.ImageData; ...@@ -18,7 +17,6 @@ import com.theta.network.ImageData;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.viewer.activity.theta.task.LoadPhotoTask; import jp.agentec.abook.abv.ui.viewer.activity.theta.task.LoadPhotoTask;
...@@ -28,7 +26,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.task.LoadPhotoTask; ...@@ -28,7 +26,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.task.LoadPhotoTask;
* @since 2020/05/19 * @since 2020/05/19
* @author 金鎭星 * @author 金鎭星
*/ */
public class ThetaImagePreviewActivity extends ABVUIActivity { public class ThetaImagePreviewActivity extends ThetaActivity {
private static final String TAG = "ThetaImagePreviewActivity"; private static final String TAG = "ThetaImagePreviewActivity";
private RotateInertia mRotateInertia = RotateInertia.INERTIA_0; private RotateInertia mRotateInertia = RotateInertia.INERTIA_0;
...@@ -36,7 +34,7 @@ public class ThetaImagePreviewActivity extends ABVUIActivity { ...@@ -36,7 +34,7 @@ public class ThetaImagePreviewActivity extends ABVUIActivity {
private GLPhotoView mGLPhotoView; private GLPhotoView mGLPhotoView;
private Photo mTexture; private Photo mTexture;
private String mFileId; private String mFileId;
private ThetaHelper mThetaHelper = new ThetaHelper(this);
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -113,12 +111,7 @@ public class ThetaImagePreviewActivity extends ABVUIActivity { ...@@ -113,12 +111,7 @@ public class ThetaImagePreviewActivity extends ABVUIActivity {
} }
closeProgressPopup(); closeProgressPopup();
} else { } else {
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_theta_image_load_fail, true, new DialogInterface.OnClickListener() { thetaConnectError(R.string.msg_theta_image_load_fail);
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
Logger.e(TAG,"failed loadPhotoTaskFinish"); Logger.e(TAG,"failed loadPhotoTaskFinish");
} }
} }
......
...@@ -37,8 +37,6 @@ public class DeleteImageTask extends AsyncTask<String, String, Void> { ...@@ -37,8 +37,6 @@ public class DeleteImageTask extends AsyncTask<String, String, Void> {
return null; return null;
} }
private class DeleteEventListener implements HttpEventListener { private class DeleteEventListener implements HttpEventListener {
@Override @Override
public void onCheckStatus(boolean newStatus) { public void onCheckStatus(boolean newStatus) {
...@@ -56,7 +54,7 @@ public class DeleteImageTask extends AsyncTask<String, String, Void> { ...@@ -56,7 +54,7 @@ public class DeleteImageTask extends AsyncTask<String, String, Void> {
@Override @Override
public void onCompleted() { public void onCompleted() {
Logger.e(TAG, "onCompleted deleted."); Logger.d(TAG, "onCompleted deleted.");
refActivity.get().runOnUiThread(new Runnable() { refActivity.get().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
......
...@@ -6,8 +6,8 @@ import android.net.Network; ...@@ -6,8 +6,8 @@ import android.net.Network;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.AsyncTask; import android.os.AsyncTask;
import com.theta.network.ThetaDeviceInfo;
import com.theta.network.HttpConnector; import com.theta.network.HttpConnector;
import com.theta.network.ThetaDeviceInfo;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
...@@ -24,7 +24,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity; ...@@ -24,7 +24,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity;
public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> { public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
private static final String TAG = "DeviceInfoTask"; private static final String TAG = "DeviceInfoTask";
private final WeakReference<DeviceImageListActivity> refActivity; private final WeakReference<DeviceImageListActivity> refActivity;
public static final int FAIL_RETRAY_DELAY_MILLIS = 2000; private static final int FAIL_RETRAY_DELAY_MILLIS = 2000;
public DeviceInfoTask(DeviceImageListActivity refActivity) { public DeviceInfoTask(DeviceImageListActivity refActivity) {
this.refActivity = new WeakReference<>(refActivity); this.refActivity = new WeakReference<>(refActivity);
...@@ -34,7 +34,7 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> { ...@@ -34,7 +34,7 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
protected ThetaDeviceInfo doInBackground(Void... params) { protected ThetaDeviceInfo doInBackground(Void... params) {
Logger.d(TAG, "doInBackground"); Logger.d(TAG, "doInBackground");
HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS); HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS);
final int MAX_RETRY_COUNT = 5; final int MAX_RETRY_COUNT = 6;
ThetaDeviceInfo deviceInfo = null; ThetaDeviceInfo deviceInfo = null;
//Wifi切り替え時間が必要なので、失敗した場合、5回リトライする。 //Wifi切り替え時間が必要なので、失敗した場合、5回リトライする。
for (int retryCount = 0; retryCount < MAX_RETRY_COUNT; retryCount++) { for (int retryCount = 0; retryCount < MAX_RETRY_COUNT; retryCount++) {
...@@ -45,7 +45,10 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> { ...@@ -45,7 +45,10 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
thetaConnectedWifiOnly(); if (retryCount == 0) {
thetaConnectedWifiOnly();
}
} else { } else {
retryCount = MAX_RETRY_COUNT; retryCount = MAX_RETRY_COUNT;
} }
...@@ -60,6 +63,9 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> { ...@@ -60,6 +63,9 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
activity.thetaDeviceInfoTaskFinish(deviceInfo); activity.thetaDeviceInfoTaskFinish(deviceInfo);
} }
/**
* LTE環境の場合、THETA端末のWifi接続後、LTE接続される問題でWifi利用するように設定
*/
private void thetaConnectedWifiOnly() { private void thetaConnectedWifiOnly() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
DeviceImageListActivity activity = refActivity.get(); DeviceImageListActivity activity = refActivity.get();
......
package jp.agentec.abook.abv.ui.viewer.activity.theta.task; package jp.agentec.abook.abv.ui.viewer.activity.theta.task;
import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;
import com.theta.helper.ThetaHelper; import com.theta.helper.ThetaHelper;
import com.theta.network.HttpConnector; import com.theta.network.HttpConnector;
import com.theta.network.ImageInfo; import com.theta.network.ImageInfo;
import com.theta.view.ImageListArrayAdapter;
import com.theta.view.ImageRow; import com.theta.view.ImageRow;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -23,10 +18,7 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys; ...@@ -23,10 +18,7 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.constant.ABookValues; import jp.agentec.abook.abv.bl.common.constant.ABookValues;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaImageListActivity; import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaImageListActivity;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaImagePreviewActivity;
/** /**
* THETAカメラ内の画像情報取得スレッド * THETAカメラ内の画像情報取得スレッド
...@@ -54,8 +46,11 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> { ...@@ -54,8 +46,11 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> {
Logger.d(TAG, "doInBackground"); Logger.d(TAG, "doInBackground");
boolean isOldApi = PreferenceUtil.getUserPref(refActivity.get(), ABookKeys.THETA_OLD_VERSION_FLG, false); boolean isOldApi = PreferenceUtil.getUserPref(refActivity.get(), ABookKeys.THETA_OLD_VERSION_FLG, false);
HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS, isOldApi); HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS, isOldApi);
List<ImageRow> imageRows = new ArrayList<>();
ArrayList<ImageInfo> objects = camera.getList(); ArrayList<ImageInfo> objects = camera.getList();
if (objects == null) { //エラー発生
return null;
}
List<ImageRow> imageRows = new ArrayList<>();
int objectSize = objects.size(); int objectSize = objects.size();
ThetaHelper thetaHelper = new ThetaHelper(refActivity.get()); ThetaHelper thetaHelper = new ThetaHelper(refActivity.get());
for (int i = 0; i < objectSize; i++) { for (int i = 0; i < objectSize; i++) {
...@@ -70,7 +65,6 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> { ...@@ -70,7 +65,6 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> {
imageRow.setFileName(object.getFileName()); imageRow.setFileName(object.getFileName());
imageRow.setCaptureDate(object.getCaptureDate()); imageRow.setCaptureDate(object.getCaptureDate());
imageRow.setIsPhoto(true); imageRow.setIsPhoto(true);
Bitmap thumbnail = camera.getThumb(object.getFileId()); Bitmap thumbnail = camera.getThumb(object.getFileId());
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
thumbnail.compress(Bitmap.CompressFormat.JPEG, 100, baos); thumbnail.compress(Bitmap.CompressFormat.JPEG, 100, baos);
...@@ -82,11 +76,9 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> { ...@@ -82,11 +76,9 @@ public class ImageListTask extends AsyncTask<Void, String, List<ImageRow>> {
} else { } else {
imageRow.setIsTransferred(false); imageRow.setIsTransferred(false);
} }
imageRows.add(imageRow); imageRows.add(imageRow);
} }
return imageRows; return imageRows;
} catch (Throwable throwable) { } catch (Throwable throwable) {
String errorLog = Log.getStackTraceString(throwable); String errorLog = Log.getStackTraceString(throwable);
Logger.e(errorLog); Logger.e(errorLog);
......
...@@ -39,22 +39,24 @@ public class ShootTask extends AsyncTask<Void, Void, HttpConnector.ShootResult> ...@@ -39,22 +39,24 @@ public class ShootTask extends AsyncTask<Void, Void, HttpConnector.ShootResult>
CaptureListener postviewListener = new CaptureListener(); CaptureListener postviewListener = new CaptureListener();
boolean isOldApi = PreferenceUtil.getUserPref(refActivity.get(), ABookKeys.THETA_OLD_VERSION_FLG, false); boolean isOldApi = PreferenceUtil.getUserPref(refActivity.get(), ABookKeys.THETA_OLD_VERSION_FLG, false);
HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS, isOldApi); HttpConnector camera = new HttpConnector(ABookValues.THETA_IP_ADDRESS, isOldApi);
HttpConnector.ShootResult result = camera.takePicture(postviewListener); return camera.takePicture(postviewListener);
return result;
} }
@Override @Override
protected void onPostExecute(HttpConnector.ShootResult result) { protected void onPostExecute(HttpConnector.ShootResult result) {
if (result == HttpConnector.ShootResult.FAIL_CAMERA_DISCONNECTED) { if (result == HttpConnector.ShootResult.FAIL_CAMERA_DISCONNECTED) {
Logger.d(TAG, "takePicture:FAIL_CAMERA_DISCONNECTED"); Logger.e(TAG, "takePicture:FAIL_CAMERA_DISCONNECTED");
} else if (result == HttpConnector.ShootResult.FAIL_STORE_FULL) { } else if (result == HttpConnector.ShootResult.FAIL_STORE_FULL) {
Logger.d(TAG, "takePicture:FAIL_STORE_FULL"); Logger.e(TAG, "takePicture:FAIL_STORE_FULL");
} else if (result == HttpConnector.ShootResult.FAIL_DEVICE_BUSY) { } else if (result == HttpConnector.ShootResult.FAIL_DEVICE_BUSY) {
Logger.d(TAG, "takePicture:FAIL_DEVICE_BUSY"); Logger.e(TAG, "takePicture:FAIL_DEVICE_BUSY");
} else if (result == HttpConnector.ShootResult.SUCCESS) { } else if (result == HttpConnector.ShootResult.SUCCESS) {
Logger.d(TAG, "takePicture:SUCCESS"); Logger.d(TAG, "takePicture:SUCCESS");
} }
if (result != HttpConnector.ShootResult.SUCCESS) {
ThetaCameraActivity activity = refActivity.get();
activity.shootTaskFinish(ABookValues.FAIL);
}
} }
private class CaptureListener implements HttpEventListener { private class CaptureListener implements HttpEventListener {
......
...@@ -25,7 +25,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity; ...@@ -25,7 +25,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity;
*/ */
public class ShowLiveViewTask extends AsyncTask<Void, String, MJpegInputStream> { public class ShowLiveViewTask extends AsyncTask<Void, String, MJpegInputStream> {
private static final String TAG = "ShowLiveViewTask"; private static final String TAG = "ShowLiveViewTask";
public static final int FAIL_RETRAY_DELAY_MILLIS = 500; private static final int FAIL_RETRAY_DELAY_MILLIS = 500;
private final WeakReference<ThetaCameraActivity> refActivity; private final WeakReference<ThetaCameraActivity> refActivity;
public ShowLiveViewTask(ThetaCameraActivity refActivity) { public ShowLiveViewTask(ThetaCameraActivity refActivity) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment