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);
}
}
} }
...@@ -143,8 +143,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -143,8 +143,6 @@ public class OperationListActivity extends ABVUIActivity {
private Dialog mSearchDialog; private Dialog mSearchDialog;
private Date mOperationLastEditDate; private Date mOperationLastEditDate;
private Dialog mPanoEntryDialog;
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class); private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class); private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
...@@ -153,12 +151,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -153,12 +151,6 @@ public class OperationListActivity extends ABVUIActivity {
private OperationGroupMasterLogic mOperationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class); private OperationGroupMasterLogic mOperationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class); private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
private ImageView mPanoCotnentImageView;
private TextView mPanoContentNameTextView;
private Uri mSelectPanoContentUri;
private final static int ABOOK_CHECK_OPERATION_PANO_CONTENT_IMAGE = 201;
private File mLocalFile;
private boolean activityResultFlg; private boolean activityResultFlg;
private OperationListHelper mListHelper = null; private OperationListHelper mListHelper = null;
...@@ -1158,175 +1150,30 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1158,175 +1150,30 @@ public class OperationListActivity extends ABVUIActivity {
*/ */
public void showPanoEntryDialog(final OperationDto operationDto) { public void showPanoEntryDialog(final OperationDto operationDto) {
Logger.d(TAG, "*****************showPanoEntryDialog"); Logger.d(TAG, "*****************showPanoEntryDialog");
//パーミッションチェック //インターネットチェック
ABookPermissionHelper helper = new ABookPermissionHelper(this, Constant.ABookPermissionType.ReadExternalStorage, null); if (checkNetworkConnected()) {
if (helper.checkMultiPermissions(true)) { //パーミッションチェック
mSelectedOperationId = operationDto.operationId; ABookPermissionHelper helper = new ABookPermissionHelper(this, Constant.ABookPermissionType.ReadExternalStorage, null);
//シーン画像選択画面表示 if (helper.checkMultiPermissions(true)) {
Intent intent = new Intent(); mSelectedOperationId = operationDto.operationId;
intent.putExtra(ABookKeys.BASE_CONTENT_REGISTER, true); //シーン画像選択画面表示
intent.putExtra(ABookKeys.OPERATION_ID, mSelectedOperationId); Intent intent = new Intent();
intent.putExtra(ABookKeys.OPERATION_NAME, operationDto.operationName); intent.putExtra(ABookKeys.BASE_CONTENT_REGISTER, true);
intent.putExtra(ABookKeys.OPERATION_ID, mSelectedOperationId);
String className = DeviceImageListActivity.class.getName(); intent.putExtra(ABookKeys.OPERATION_NAME, operationDto.operationName);
if (isNormalSize() == false) {
className += "Dialog";
}
intent.setClassName(getPackageName(), className); String className = DeviceImageListActivity.class.getName();
startActivityForResult(intent, SUB_DIVICE_IMAGE_LIST_ACTIVITY); if (isNormalSize() == false) {
className += "Dialog";
}
} else { intent.setClassName(getPackageName(), className);
Logger.w(TAG, "ReadExternalStorage checkMultiPermissions false"); startActivityForResult(intent, SUB_DIVICE_IMAGE_LIST_ACTIVITY);
} else {
Logger.w(TAG, "ReadExternalStorage checkMultiPermissions false");
}
} }
// if (contentRefresher != null && contentRefresher.isRefreshing()) {
// // 新着更新処理が行っていれば、止める
// contentRefresher.stopRefresh();
// }
// if (mPanoEntryDialog == null) {
// mPanoEntryDialog = new Dialog(OperationListActivity.this);
// mPanoEntryDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
// mPanoEntryDialog.setCanceledOnTouchOutside(false);
// mPanoEntryDialog.setContentView(R.layout.operation_pano_entry_dialog);
// }
// mPanoCotnentImageView = (ImageView) mPanoEntryDialog.findViewById(R.id.pano_image_view);
// mPanoContentNameTextView = (TextView) mPanoEntryDialog.findViewById(R.id.operation_name);
//
// mPanoContentNameTextView.setText(operationDto.operationName);
// mPanoCotnentImageView.setImageBitmap(null);
// FileUtil.delete(ABVEnvironment.getInstance().getCacheTempAttachedImageDirPath());
//
// // 閉じるボタン
// mPanoEntryDialog.findViewById(R.id.closeBtn).setOnClickListener(new View.OnClickListener() {
//
// @Override
// public void onClick(View v) {
// mPanoCotnentImageView.setImageBitmap(null);
// mSelectPanoContentUri = null;
// mPanoEntryDialog.dismiss();
// FileUtil.delete(ABVEnvironment.getInstance().getCacheTempAttachedImageDirPath());
// }
// });
//
//
// // 画像選択ボタン
// mPanoEntryDialog.findViewById(R.id.select_image).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// startCameraIntent(ABOOK_CHECK_OPERATION_PANO_CONTENT_IMAGE, "Camera", ABookKeys.IMAGE, false);
// }
// });
//
//
// // 登録ボタン
// mPanoEntryDialog.findViewById(R.id.btn_entry).setOnClickListener(new View.OnClickListener() {
//
// @Override
// public void onClick(View v) {
// if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
// ABVToastUtil.showMakeText(OperationListActivity.this, R.string.msg_network_offline, Toast.LENGTH_SHORT);
// return;
// }
// if (mSelectPanoContentUri == null) {
// ABVToastUtil.showMakeText(OperationListActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
// R.string.msg_pano_image_no_selected,
// getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
// return;
// }
// // リソースパターンの適用
// showProgressView(PatternStringUtil.patternToString(getApplicationContext(),
// R.string.msg_common_processing,
// getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
// CommonExecutor.execute(new Runnable() {
// @Override
// public void run() {
// boolean isError = true;
// String[] projection = {MediaStore.MediaColumns.DATA};
// Cursor cursor = getContentResolver().query(mSelectPanoContentUri, projection, null, null, null);
//
// String scenePath = null;
// if (mSelectPanoContentUri.toString().contains("file")) { //アプリ内に臨時保存した画像ファイル
// scenePath = mSelectPanoContentUri.getPath();
// } else {
// if (cursor != null) {
// if (cursor.moveToFirst()) {
// scenePath = cursor.getString(0);
// }
// cursor.close();
// }
//
// }
// if (scenePath != null) {
// File file = new File(scenePath);
// isError = true;
// try {
// mOperationLogic.sendPanoContent(operationDto.operationId, operationDto.operationName, file);
// isError = false;
// } catch (ABVException e) {
// //noinspection EnumSwitchStatementWhichMissesCases
// switch (e.getCode()) {
// case P_E_ACMS_P001:
// showSimpleAlertDialog(R.string.app_name,
// PatternStringUtil.patternToInt(getApplicationContext(),
// R.string.P001,
// getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
// break;
// case P_E_ACMS_P002:
// showSimpleAlertDialog(R.string.app_name,
// PatternStringUtil.patternToInt(getApplicationContext(),
// R.string.P002,
// getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
// break;
// case S_E_ACMS_0500:
// handleErrorMessageToast(ABVExceptionCode.S_E_ACMS_0500);
// break;
// default:
// Logger.e(TAG, "PanoContent send error", e);
// handleErrorMessageToast(ErrorCode.E107);
// break;
// }
// } catch (Exception e) {
// Logger.e(TAG, e);
// ErrorMessage.showErrorMessageToast(OperationListActivity.this, ErrorCode.E107);
// }
// }
// if (isError) {
// closeProgressPopup();
// } else {
// handler.post(new Runnable() {
// @Override
// public void run() {
// progressDialogHorizontal.setProgress(20);
// mOperationLogic.setContentCreatingFlg(operationDto.operationId);
// refreshOperationList();
// }
// });
//
// //10秒後に新着更新させる
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// int progress = progressDialogHorizontal.getProgress();
// progressDialogHorizontal.setProgress(progress + 8);
// if (progress >= 100) {
// closeProgressPopup();
// mPanoEntryDialog.dismiss();
// mPanoCotnentImageView.setImageBitmap(null);
// dataRefresh(true);
// } else {
// handler.postDelayed(this, 1000);
// }
// }
// }, 1000);
// }
// }
// });
// }
// });
//
// if (mPanoEntryDialog != null) {
// mPanoEntryDialog.show();
// }
} }
@Override @Override
...@@ -1334,7 +1181,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1334,7 +1181,7 @@ public class OperationListActivity extends ABVUIActivity {
activityResultFlg = true; activityResultFlg = true;
Uri result = (intent == null || resultCode != RESULT_OK) ? null : intent.getData(); Uri result = (intent == null || resultCode != RESULT_OK) ? null : intent.getData();
//ベースファイル登録した後にシーン画像選択画面閉じた後に呼ばれる //ベースファイル登録した後にシーン画像選択画面閉じた後に呼ばれる
if (requestCode == SUB_DIVICE_IMAGE_LIST_ACTIVITY) { if (requestCode == SUB_DIVICE_IMAGE_LIST_ACTIVITY && resultCode == RESULT_OK) {
mOperationLogic.setContentCreatingFlg(mSelectedOperationId); mOperationLogic.setContentCreatingFlg(mSelectedOperationId);
refreshOperationList(); refreshOperationList();
...@@ -1356,31 +1203,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1356,31 +1203,6 @@ public class OperationListActivity extends ABVUIActivity {
} }
}, 1000); }, 1000);
} }
// if (requestCode == ABOOK_CHECK_OPERATION_PANO_CONTENT_IMAGE) {
// if (result != null) {
// mSelectPanoContentUri = result;
// try {
// String[] projection = {MediaStore.MediaColumns.DATA};
// Cursor cursor = getContentResolver().query(mSelectPanoContentUri, projection, null, null, null);
// String photoFilePath = ABookCheckWebViewHelper.getInstance().contentSchemeUriToFilePath(cursor);
// int rotationAngle = ABookCheckWebViewHelper.getInstance().rotateBitmapOrientation(photoFilePath);
// if (rotationAngle != 0) {
// mLocalFile = ABookCheckWebViewHelper.getInstance().rotateBitmapToImageFile(rotationAngle, photoFilePath, ABVEnvironment.getInstance().getCacheTempAttachedImageDirPath());
// mSelectPanoContentUri = Uri.fromFile(mLocalFile);
// }
// if (mSelectPanoContentUri != null) {
// InputStream stream = getContentResolver().openInputStream(mSelectPanoContentUri);
// Bitmap bitmap = BitmapFactory.decodeStream(stream);
// mPanoCotnentImageView.setImageBitmap(bitmap);
// }
//
// } catch (FileNotFoundException e) {
// Logger.e(TAG, "panoImageContent is not found", e);
// } catch (IOException e) {
// Logger.e(TAG, "IOException = ", e);
// }
// }
// }
} }
/** /**
......
...@@ -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;
}
}
package jp.agentec.abook.abv.ui.viewer.activity.theta; 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.Intent;
import android.content.IntentFilter; import android.graphics.drawable.Drawable;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.res.ResourcesCompat;
import android.util.TypedValue;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import com.theta.helper.ThetaHelper;
import com.theta.network.ThetaDeviceInfo;
import com.theta.view.MJpegInputStream; import com.theta.view.MJpegInputStream;
import com.theta.view.MJpegView; import com.theta.view.MJpegView;
...@@ -29,9 +23,6 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys; ...@@ -29,9 +23,6 @@ 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.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.viewer.activity.theta.task.FinishWlanTask;
import jp.agentec.abook.abv.ui.viewer.activity.theta.task.GetOptionExposureTask; import jp.agentec.abook.abv.ui.viewer.activity.theta.task.GetOptionExposureTask;
import jp.agentec.abook.abv.ui.viewer.activity.theta.task.SetOptionExposureTask; import jp.agentec.abook.abv.ui.viewer.activity.theta.task.SetOptionExposureTask;
import jp.agentec.abook.abv.ui.viewer.activity.theta.task.ShootTask; import jp.agentec.abook.abv.ui.viewer.activity.theta.task.ShootTask;
...@@ -43,40 +34,35 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.task.ShowLiveViewTask; ...@@ -43,40 +34,35 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.task.ShowLiveViewTask;
* @since 2020/05/19 * @since 2020/05/19
* @author 金鎭星 * @author 金鎭星
*/ */
public class ThetaCameraActivity extends ABVUIActivity { public class ThetaCameraActivity extends ThetaActivity {
private static final String TAG = "ThetaCameraActivity"; private static final String TAG = "ThetaCameraActivity";
//画面表示後、ライブビューア取得を0.5秒後に取得 //画面表示後、ライブビューア取得を0.5秒後に取得
private static final int LIVE_VIEW_START_DELAY = 500; private static final int LIVE_VIEW_START_DELAY = 500;
private static final int EV_TEXT_VIEW_TEXT_SIZE_PHONE = 16;
private MJpegView mLiveView; private MJpegView mLiveView;
private ShowLiveViewTask mLivePreviewTask; private ShowLiveViewTask mLivePreviewTask;
private Button mShootBtn; private Button mShootBtn;
private Button mImageListBtn; private Button mImageListBtn;
TextView mExposureTextView; private TextView mExposureTextView;
SeekBar mExposureSeekBar; private SeekBar mExposureSeekBar;
int mCurrentSeekBarProgress; private int mCurrentSeekBarProgress;
private WifiManager mWifiManager;
private static final List<String> mExposureValues = new ArrayList<>(Arrays.asList("-2.0", "-1.7", "-1.3", "-1.0", "-0.7", "-0.3", "0.0", "0.3", "0.7", "1.0", "1.3", "1.7", "2.0")); private static final List<String> mExposureValues = new ArrayList<>(Arrays.asList("-2.0", "-1.7", "-1.3", "-1.0", "-0.7", "-0.3", "0.0", "0.3", "0.7", "1.0", "1.3", "1.7", "2.0"));
private ThetaHelper mThetaHelper = new ThetaHelper(this);
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.ac_theta_camera); setContentView(R.layout.ac_theta_camera);
mLiveView = findViewById(R.id.live_view); mLiveView = findViewById(R.id.live_view);
mWifiManager = (WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
// 閉じるボタン // 閉じるボタン
Button closeBtn = findViewById(R.id.btn_close); final Button closeBtn = findViewById(R.id.btn_close);
closeBtn.setOnClickListener(new View.OnClickListener() { closeBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Logger.v(TAG, "CloseBtn.onClick"); Logger.v(TAG, "CloseBtn.onClick");
buttonDoubleTapControl(closeBtn);
mLiveView.stopPlay(); mLiveView.stopPlay();
if (deviceWifiEnable()) { if (deviceWifiEnable()) {
showProgressPopup(); closeThetaCameraActivity();
//現在接続状態なのかチェック
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
mWifiManager.startScan();
} else { } else {
finish(); finish();
} }
...@@ -100,18 +86,10 @@ public class ThetaCameraActivity extends ABVUIActivity { ...@@ -100,18 +86,10 @@ public class ThetaCameraActivity extends ABVUIActivity {
mImageListBtn.setOnClickListener(new View.OnClickListener() { mImageListBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mImageListBtn.setEnabled(false); buttonDoubleTapControl(mImageListBtn);
Intent intent = new Intent(); Intent intent = new Intent();
intent.setClassName(getPackageName(), ThetaImageListActivity.class.getName()); intent.setClassName(getPackageName(), ThetaImageListActivity.class.getName());
startActivity(intent); startActivity(intent);
//連続タップ防止
handler.postDelayed(new Runnable() {
@Override
public void run() {
mImageListBtn.setEnabled(true);
}
}, BUTTON_ENABLE_DELAY_MILLIS);
} }
}); });
//露出シークバー //露出シークバー
...@@ -170,6 +148,12 @@ public class ThetaCameraActivity extends ABVUIActivity { ...@@ -170,6 +148,12 @@ public class ThetaCameraActivity extends ABVUIActivity {
*/ */
private void settingSeekbar() { private void settingSeekbar() {
mExposureTextView = findViewById(R.id.tv_exposure); mExposureTextView = findViewById(R.id.tv_exposure);
//スマートフォンの場合、テキストサイズを小さく変更
if (isNormalSize()) {
mExposureTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, EV_TEXT_VIEW_TEXT_SIZE_PHONE);
}
//Android6.0以下の場合、古いシークバー利用 //Android6.0以下の場合、古いシークバー利用
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
mExposureSeekBar = findViewById(R.id.sb_exposure_old); mExposureSeekBar = findViewById(R.id.sb_exposure_old);
...@@ -177,6 +161,11 @@ public class ThetaCameraActivity extends ABVUIActivity { ...@@ -177,6 +161,11 @@ public class ThetaCameraActivity extends ABVUIActivity {
} else { } else {
mExposureSeekBar = findViewById(R.id.sb_exposure); mExposureSeekBar = findViewById(R.id.sb_exposure);
findViewById(R.id.sb_exposure_old).setVisibility(View.GONE); findViewById(R.id.sb_exposure_old).setVisibility(View.GONE);
if (isNormalSize()) {
Drawable icon = ResourcesCompat.getDrawable(getResources(),
R.drawable.ic_seek_bar_thumb_phone, null);
mExposureSeekBar.setThumb(icon);
}
} }
mExposureSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { mExposureSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
...@@ -215,7 +204,13 @@ public class ThetaCameraActivity extends ABVUIActivity { ...@@ -215,7 +204,13 @@ public class ThetaCameraActivity extends ABVUIActivity {
public void run() { public void run() {
mShootBtn.setEnabled(true); mShootBtn.setEnabled(true);
if (fileId.equals(ABookValues.FAIL)) { if (fileId.equals(ABookValues.FAIL)) {
showSimpleAlertDialog(R.string.msg_theta_shoot_fail); mLiveView.play();
if (mLivePreviewTask != null) {
mLivePreviewTask.cancel(true);
mLivePreviewTask = new ShowLiveViewTask(ThetaCameraActivity.this);
mLivePreviewTask.execute();
}
thetaConnectError(R.string.msg_theta_shoot_fail);
} else { } else {
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra(ABookKeys.THETA_FILE_ID, fileId); intent.putExtra(ABookKeys.THETA_FILE_ID, fileId);
...@@ -237,12 +232,7 @@ public class ThetaCameraActivity extends ABVUIActivity { ...@@ -237,12 +232,7 @@ public class ThetaCameraActivity extends ABVUIActivity {
new GetOptionExposureTask(ThetaCameraActivity.this).execute(); new GetOptionExposureTask(ThetaCameraActivity.this).execute();
} else { } else {
Logger.e("failed to start live view"); Logger.e("failed to start live view");
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_theta_live_image_fail, true, new DialogInterface.OnClickListener() { thetaConnectError(R.string.msg_theta_live_image_fail);
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
} }
} }
...@@ -270,7 +260,7 @@ public class ThetaCameraActivity extends ABVUIActivity { ...@@ -270,7 +260,7 @@ public class ThetaCameraActivity extends ABVUIActivity {
} }
mExposureTextView.setText(getString(R.string.title_theta_exposure_value, exposure)); mExposureTextView.setText(getString(R.string.title_theta_exposure_value, exposure));
} else { } else {
showSimpleAlertDialog(R.string.msg_theta_get_exposure_fail); thetaConnectError(R.string.msg_theta_get_exposure_fail);
Logger.e(TAG, "getOptionExposureTaskFinish fail"); Logger.e(TAG, "getOptionExposureTaskFinish fail");
} }
} }
...@@ -281,61 +271,8 @@ public class ThetaCameraActivity extends ABVUIActivity { ...@@ -281,61 +271,8 @@ public class ThetaCameraActivity extends ABVUIActivity {
*/ */
public void setOptionExposureTaskFinish(String result) { public void setOptionExposureTaskFinish(String result) {
if (!ABookValues.SUCCESS.equals(result)) { if (!ABookValues.SUCCESS.equals(result)) {
showSimpleAlertDialog(R.string.msg_theta_set_exposure_fail); thetaConnectError(R.string.msg_theta_set_exposure_fail);
Logger.e(TAG, "setOptionExposureTaskFinish fail"); Logger.e(TAG, "setOptionExposureTaskFinish fail");
} }
} }
/**
* Wifiスキャンするブロードキャストリスナークラス
*/
BroadcastReceiver wifiReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
unregisterReceiver(wifiReceiver);
thetaWifiScanResult();
}
};
/**
* Wifiスキャン結果を処理
* ①接続済みの場合、THETAカメラ遷移
* ②登録済みの端末情報取得し、画面再描画
* ③未登録の端末情報取得し、画面再描画
*/
public void thetaWifiScanResult() {
List<ScanResult> results = mWifiManager.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);
ThetaDeviceInfo deviceInfo = new ThetaDeviceInfo();
if (index != -1) {
int networkId = -1;
for (WifiConfiguration configuration : mWifiManager.getConfiguredNetworks()) {
// Android4.2以降よりダブルクォーテーションが付いてくるので除去
String configurationSSID = configuration.SSID.replace("\"", "");
if (configurationSSID.equals(scanSSID)) {
if (configuration.status == WifiConfiguration.Status.CURRENT) {
isConnected = true;
}
break;
}
}
if (isConnected) {
break;
}
}
}
}
//THETA接続状態の場合、カメラ画面へ遷移
if (isConnected) {
new FinishWlanTask(ThetaCameraActivity.this).execute();
} else {
closeProgressPopup();
finish();
}
}
} }
...@@ -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