Commit b436d292 by Kim Jinsung

#37841 360編集THETA連携

①Wifiスキャン処理追加
②WifiからLTEに変更される問題対応
③メッセージ整理及びソース整理
④シーン画像選択画面の表示サムネールキャッシュ化
parent 62397df1
......@@ -1425,59 +1425,32 @@
<string name="msg_image_select_send_success">シーン画像の登録に成功しました。</string>
<string name="msg_image_select_send_fail_retry">シーン画像の登録に失敗しました。再度登録処理を実行しますか?</string>
<string name="msg_access_registing">登録中</string>
<string name="title_theta_camera">THETAカメラ</string>
<string name="title_theta_camera_shoot">撮影</string>
<string name="title_theta_camera_image">画像選択</string>
<string name="title_theta_library">THETAライブラリ</string>
<string name="title_theta_image_preview">THETAプレビュー</string>
<string name="title_theta_connect">カメラ選択</string>
<string name="msg_no_save_theta">カメラ情報がありません。</string>
<string name="msg_no_save_theta_info">THETAカメラを先に登録してください。\n</string>
<string name="msg_theta_connect_info">THETAカメラと接続するにはWIFI設定をONにする必要があります。</string>
<string name="title_theta_register">カメラ登録</string>
<string name="msg_theta_register_info">接続するThetaのシリアルNOとパスワードを入力してください。</string>
<string name="title_serial_number">シリアルNO</string>
<string name="msg_wifi_connecting">Wi-Fi接続中...</string>
<string name="msg_no_exists_theta_wifi">THETAカメラのWi-Fi機能をONにしてください。</string>
<string name="msg_fail_connect_theta_wifi">THETAカメラに接続失敗しました。THETAカメラのWi-Fi設定を確認してください。</string>
<string name="msg_fail_input_all_null">全ての情報を入力してください。</string>
<string name="msg_fail_connect_theta_wifi">THETAカメラへの接続に失敗しました。THETAカメラのWi-Fi設定を確認してください。</string>
<string name="title_theta_wifi_saved">登録済みの端末</string>
<string name="title_theta_wifi_not_saved">未登録の端末</string>
<string name="title_theta_image_save">転送</string>
<string name="msg_theta_image_send_confirm">この画像を転送しますか?</string>
<string name="msg_theta_image_send_success">画像転送に成功しました。</string>
<string name="msg_theta_image_send_fail">画像転送に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="msg_theta_image_delete_confirm">この画像を削除しますか?</string>
<string name="msg_theta_image_delete_success">画像削除に成功しました。</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_theta_shoot_fail">THETAカメラの撮影に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="msg_transferred">転送済み</string>
<string name="msg_error_device_wifi_off">端末のWi-FiをONにしてください。</string>
<string name="msg_transferring">転送中...</string>
<string name="msg_theta_live_image_fail">THETA端末からライブ画像データ取得に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<!--TheTa関連 開始 -->
<string name="menu_configuration">inertia</string>
<string name="menu_connection">connection</string>
<string name="rotate_inertia">rotation inertia</string>
<string name="inertia_0">none</string>
<string name="inertia_50">weak</string>
<string name="inertia_100">strong</string>
<string name="delete_dialog_message">Delete this file?</string>
<string name="dialog_positive_button">OK</string>
<string name="label_btn_image_size">Image Size</string>
<string name="image_size_2048x1024">2048 x 1024</string>
<string name="image_size_5376x2688">5376 x 2688</string>
<!--TheTa関連 終了 -->
<string name="msg_theta_set_exposure_fail">露出情報の設定に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="msg_theta_get_exposure_fail">露出情報の取得に失敗しました。\nWi-Fi接続状態を確認してください。</string>
<string name="title_theta_exposure_value">EV:%s</string>
</resources>
......@@ -1432,22 +1432,14 @@
<string name="msg_image_select_send_success">장면 이미지 등록에 성공하였습니다.</string>
<string name="msg_image_select_send_fail_retry">장면 이미지 등록에 실패하였습니다. 다시 등록 처리를 실행 하시겠습니까?</string>
<string name="msg_access_registing">등록중</string>
<string name="title_theta_camera">THETA카메라</string>
<string name="title_theta_camera_shoot">촬영</string>
<string name="title_theta_camera_image">이미지선택</string>
<string name="title_theta_library">THETA라이브러리</string>
<string name="title_theta_image_preview">THETA 미리보기</string>
<string name="title_theta_connect">카메라 선택</string>
<string name="msg_no_save_theta">카메라 정보가 없습니다.</string>
<string name="msg_no_save_theta_info">THETA단말기를 먼저 등록해 주세요.\n</string>
<string name="msg_theta_connect_info">THETA카메라와 접속하기 위해서는 Wifi설정을 ON으로 설정해야 합니다.</string>
<string name="title_theta_register">카메라 등록</string>
<string name="msg_theta_register_info">Theta카메라 접속에 필요한 시리얼 번호와 패스워드를 입력해 주세요.</string>
<string name="title_serial_number">시리얼 번호</string>
<string name="msg_wifi_connecting">Wi-Fi 접속중...</string>
<string name="msg_no_exists_theta_wifi">THETA카메라의 Wi-Fi기능을 ON으로 설정해 주세요.</string>
<string name="msg_fail_connect_theta_wifi">THETA카메라 접속 실패 하였습니다. THETA카메라의 Wi-Fi설정을 확이해 주세요.</string>
<string name="msg_fail_input_all_null">모든 정보를 입력해 주세요.</string>
<string name="title_theta_wifi_saved">등록된 단말기</string>
<string name="title_theta_wifi_not_saved">등록되지 않은 단말기</string>
<string name="title_theta_image_save">전송</string>
......@@ -1463,19 +1455,8 @@
<string name="msg_transferred">전송 완료</string>
<string name="msg_error_device_wifi_off">단말기의 Wi-Fi를 ON으로 설정해 주세요.</string>
<string name="msg_transferring">전송중...</string>
<!--TheTa関連 開始 -->
<string name="menu_configuration">inertia</string>
<string name="menu_connection">connection</string>
<string name="rotate_inertia">rotation inertia</string>
<string name="inertia_0">none</string>
<string name="inertia_50">weak</string>
<string name="inertia_100">strong</string>
<string name="delete_dialog_message">Delete this file?</string>
<string name="dialog_positive_button">OK</string>
<string name="label_btn_image_size">Image Size</string>
<string name="image_size_2048x1024">2048 x 1024</string>
<string name="image_size_5376x2688">5376 x 2688</string>
<!--TheTa関連 終了 -->
<string name="msg_theta_live_image_fail">THETA카메라에서 라이브 영상정보 취득에 실패하였습니다.\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="title_theta_exposure_value">EV:%s</string>
</resources>
\ No newline at end of file
......@@ -1433,20 +1433,11 @@
<string name="msg_access_registing">Registring</string>
<string name="title_theta_camera">THETA Camera</string>
<string name="title_theta_camera_shoot">Shoot</string>
<string name="title_theta_camera_image">Image Select</string>
<string name="title_theta_library">THETA Library</string>
<string name="title_theta_image_preview">THETA Preview</string>
<string name="title_theta_connect">Camera Select</string>
<string name="msg_no_save_theta">There is no camera information.</string>
<string name="msg_no_save_theta_info">Register the THETA Device first.\n </string>
<string name="msg_theta_connect_info">To connect with THETA camera, WIFI setting must be ON.</string>
<string name="title_theta_register">Camera Register</string>
<string name="msg_theta_register_info">Enter the Serial Number and password of Theta to connect.</string>
<string name="title_serial_number">Serial Number</string>
<string name="msg_wifi_connecting">Wi-Fi connecting...</string>
<string name="msg_no_exists_theta_wifi">Set the THEA camera Wi-Fi function to ON.</string>
<string name="msg_fail_connect_theta_wifi">THETA camera connection failed. Check the Wi-Fi settings of THETA camera.</string>
<string name="msg_fail_input_all_null">Please enter all information.</string>
<string name="title_theta_wifi_saved">Registered device</string>
<string name="title_theta_wifi_not_saved">Unregistered device</string>
<string name="title_theta_image_save">transfer</string>
......@@ -1462,18 +1453,8 @@
<string name="msg_transferred">Transferred</string>
<string name="msg_error_device_wifi_off">Set the Wi-Fi of the device to ON.</string>
<string name="msg_transferring">transferring...</string>
<!--TheTa関連 開始 -->
<string name="menu_configuration">inertia</string>
<string name="menu_connection">connection</string>
<string name="rotate_inertia">rotation inertia</string>
<string name="inertia_0">none</string>
<string name="inertia_50">weak</string>
<string name="inertia_100">strong</string>
<string name="delete_dialog_message">Delete this file?</string>
<string name="dialog_positive_button">OK</string>
<string name="label_btn_image_size">Image Size</string>
<string name="image_size_2048x1024">2048 x 1024</string>
<string name="image_size_5376x2688">5376 x 2688</string>
<!--TheTa関連 終了 -->
</resources>
\ No newline at end of file
<string name="msg_theta_live_image_fail">Failed to acquire live video information from THETA camera.\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="title_theta_exposure_value">EV:%s</string>
</resources>
\ No newline at end of file
......@@ -8,6 +8,7 @@
<uses-sdk tools:overrideLibrary="org.xwalk.core"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
......
......@@ -40,7 +40,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_height="120dp"
android:layout_alignParentBottom="true"
android:alpha="0.3"
android:background="@android:color/black">
......@@ -49,7 +49,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_height="120dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
......@@ -83,7 +83,7 @@
android:paddingRight="10dp"
android:progress="2"
android:progressDrawable="@drawable/theta_exposure_progress_drawable"
android:thumb="@android:drawable/radiobutton_off_background"/>
android:thumb="@android:drawable/radiobutton_off_background" />
<SeekBar
android:id="@+id/sb_exposure"
......@@ -104,7 +104,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="80dp"
android:orientation="horizontal">
<RelativeLayout
......@@ -121,8 +121,8 @@
<Button
android:id="@+id/btn_theta_camera_shoot"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:background="@drawable/btn_theta_shoot" />
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/configuration"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:minHeight="47dp"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rotate_inertia"
android:id="@+id/textView" />
<RadioGroup
android:id="@+id/rotation_inertia"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/inertia_0"
android:id="@+id/inertia_0"
android:checked="false" />
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/inertia_50"
android:id="@+id/inertia_50"
android:checked="false" />
<RadioButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/inertia_100"
android:id="@+id/inertia_100"
android:checked="false" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_positive_button"
android:id="@+id/btn_commit" />
</RadioGroup>
</LinearLayout>
\ No newline at end of file
......@@ -57,7 +57,7 @@ public class ImageCache {
private static final String TAG = "ImageCache";
// Default memory cache size in kilobytes
private static final int DEFAULT_MEM_CACHE_SIZE = 1024 * 5; // 5MB
private static final int DEFAULT_MEM_CACHE_SIZE = 1024 * 500; // 500MB
// Default disk cache size in bytes
private static final int DEFAULT_DISK_CACHE_SIZE = 1024 * 1024 * 100; // 100MB
......@@ -74,7 +74,7 @@ public class ImageCache {
private DiskLruCache mDiskLruCache;
private LruCache<String, BitmapDrawable> mMemoryCache;
private ImageCacheParams mCacheParams;
public ImageCacheParams mCacheParams;
private final Object mDiskCacheLock = new Object();
private boolean mDiskCacheStarting = true;
......
......@@ -83,20 +83,29 @@ public abstract class ImageWorker {
if (data == null) {
return;
}
// BitmapDrawable value = null;
Bitmap value = null;
if (mImageCache != null) {
value = mImageCache.getBitmapFromDiskCache(String.valueOf(data));
if (mImageCache.mCacheParams.memoryCacheEnabled) {
Logger.d(TAG, "mImageCache.mCacheParams.memoryCacheEnabled true");
BitmapDrawable value = mImageCache.getBitmapFromMemCache(String.valueOf(data));
if (value != null) {
Logger.d(TAG, "memoryCache get image success");
imageView.setImageDrawable(value);
return;
}
} else if (mImageCache.mCacheParams.diskCacheEnabled) {
Logger.d(TAG, "mImageCache.mCacheParams.diskCacheEnabled true");
Bitmap value = mImageCache.getBitmapFromDiskCache(String.valueOf(data));
if (value != null) {
Logger.d(TAG, "Bitmap found in memory cache");
// Bitmap found in memory cache
// imageView.setImageDrawable(value);
Logger.d(TAG, "diskCache get image success");
imageView.setImageBitmap(value);
} else if (cancelPotentialWork(data, imageView)) {
Logger.d(TAG, "Bitmap not found in memory cache");
return;
}
}
}
if (cancelPotentialWork(data, imageView)) {
Logger.d(TAG, "Bitmap not found in memory&disk cache");
//BEGIN_INCLUDE(execute_background_task)
final BitmapWorkerTask task = new BitmapWorkerTask(data, imageView, orientation);
final AsyncDrawable asyncDrawable =
......@@ -159,6 +168,9 @@ public abstract class ImageWorker {
public void addImageCache(Context context, String diskCacheDirectoryName) {
mImageCacheParams = new ImageCache.ImageCacheParams(context, diskCacheDirectoryName);
mImageCacheParams.memoryCacheEnabled = false;
mImageCacheParams.diskCacheEnabled = true;
mImageCache = ImageCache.getInstance(mImageCacheParams);
new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE);
}
......
......@@ -43,89 +43,6 @@ public class ThetaHelper {
}
/**
* THETAカメラがすでに接続状態チェック
* @return true:接続中, false:非接続中
*/
public boolean connectedDeviceWifiThetaCamera() {
WifiManager wifiManager = (WifiManager)mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiManager == null) {
return false;
}
wifiManager.startScan();
boolean connectedWifi = false;
for (ScanResult result : wifiManager.getScanResults()) {
String scanSSID = result.SSID.replace("\"", "");
int index = scanSSID.indexOf(ABookValues.THETA_MODEL_NAME_THETA);
if (index != -1) {
for (WifiConfiguration configuration : wifiManager.getConfiguredNetworks()) {
// Android4.2以降よりダブルクォーテーションが付いてくるので除去
String resultSSID = configuration.SSID.replace("\"", "");
if (resultSSID.equals(scanSSID)) {
if (configuration.status == WifiConfiguration.Status.CURRENT) {
connectedWifi = true;
}
break;
}
}
}
if (connectedWifi) {
break;
}
}
return connectedWifi;
}
/**
* THETAカメラWi-Fi情報を取得する。
* @param savedFlg Wifi保存フラグ
* @return THETAカメラWi-Fi情報配列
*/
public List<ThetaDeviceInfo> getThetaWifiList(boolean savedFlg) {
WifiManager wifiManager = (WifiManager)mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
List<ThetaDeviceInfo> wifiList = new ArrayList<>();
if (wifiManager == null) {
Logger.e(TAG, "wifiManager == null");
return wifiList;
}
wifiManager.startScan();
boolean connectedWifi = false;
for (ScanResult scanResult : wifiManager.getScanResults()) {
String scanResultSSID = scanResult.SSID.replace("\"", "");
int index = scanResultSSID.indexOf(ABookValues.THETA_MODEL_NAME_THETA);
Logger.d(TAG, "scanResultSSID = "+ scanResultSSID);
if (index != -1) {
String saveSsid = "";
for (WifiConfiguration configuration : wifiManager.getConfiguredNetworks()) {
String configurationSSID = configuration.SSID.replace("\"", "");
if (scanResultSSID.equals(configurationSSID)) {
if (savedFlg) {//登録済みの端末情報
ThetaDeviceInfo info = new ThetaDeviceInfo();
info.setSSID(scanResultSSID);
//保存データがないので、-1に設定
info.setNetworkId(configuration.networkId);
wifiList.add(info);
Logger.d(TAG, "saved ssid = "+ scanResultSSID);
break;
}
saveSsid = scanResultSSID;
}
}
if (!savedFlg && saveSsid.length() == 0) { //未登録の端末情報
ThetaDeviceInfo info = new ThetaDeviceInfo();
info.setSSID(scanResultSSID);
//保存データがないので、-1に設定
info.setNetworkId(-1);
wifiList.add(info);
Logger.d(TAG, "not saved ssid = "+ scanResultSSID);
}
}
}
return wifiList;
}
/**
* THETAカメラWi-Fi接続
* @param networkId ネットワークID
* @return true:接続成功、false:接続失敗
......@@ -218,6 +135,7 @@ public class ThetaHelper {
password = password.replace(".OSC","");
return password.substring(2, password.length());
}
/**
* Thetaカメラから選択した画像をローカルフォットライブラリに保存
* @param bitmap 選択した画像データ
......
......@@ -35,6 +35,8 @@ public class HttpConnector {
private final static long CHECK_STATUS_PERIOD_MS = 50;
private final static int HTTP_CONNECT_TIME_OUT = 5000;
private final static int GET_IMAGE_MAX_COUNT = 1000;
private String mIpAddress = null;
private String mFingerPrint = null;
......@@ -242,7 +244,7 @@ public class HttpConnector {
ArrayList<ImageInfo> imageInfos = new ArrayList<>();
for (int continuation = 0; continuation < 10; continuation++) {
ArrayList<ImageInfo> receivedImageInfo = getListInternal(50, imageInfos.size());
ArrayList<ImageInfo> receivedImageInfo = getListInternal(GET_IMAGE_MAX_COUNT, imageInfos.size());
imageInfos.addAll(receivedImageInfo);
if (mIsOldApi) {
//API2.0
......@@ -251,7 +253,7 @@ public class HttpConnector {
}
} else {
//API2.1
if (receivedImageInfo.size() < 50) {
if (receivedImageInfo.size() < GET_IMAGE_MAX_COUNT) {
break;
}
}
......@@ -283,23 +285,13 @@ public class HttpConnector {
}
} else {
input.put("name", "camera.listFiles");
parameters.put("fileType", "all");
parameters.put("fileType", "image");
parameters.put("maxThumbSize", 0);
parameters.put("startPosition", startPosition);
}
parameters.put("entryCount", maxReceiveEntry);
input.put("parameters", parameters);
//AIP2.1
// send HTTP POST
// input.put("name", "camera.listFiles");
// JSONObject parameters = new JSONObject();
// parameters.put("entryCount", maxReceiveEntry);
// parameters.put("fileType", "all");
// parameters.put("maxThumbSize", 0);
// parameters.put("startPosition", startPosition);
// input.put("parameters", parameters);
OutputStream os = postConnection.getOutputStream();
os.write(input.toString().getBytes());
postConnection.connect();
......
package com.theta.network;
import java.text.SimpleDateFormat;
import java.util.Date;
import jp.agentec.abook.abv.bl.common.log.Logger;
/**
* Information class of media file
*/
......@@ -76,7 +81,15 @@ public class ImageInfo {
* @param captureDate Shooting time
*/
public void setCaptureDate(String captureDate) {
mCaptureDate = captureDate;
//文字列の最後のタイムゾーン情報+09:00除外
String createDateStr = captureDate.substring(0, captureDate.length() - 6);
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
try {
Date date = sdFormat.parse(createDateStr);
mCaptureDate = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date);
} catch (Exception e) {
Logger.e(e.toString());
}
}
/**
......
package com.theta.view;
import android.app.*;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import jp.agentec.abook.abv.launcher.android.R;
import com.theta.model.RotateInertia;
/**
* Setting dialog fragment
*/
public class ConfigurationDialog extends DialogFragment {
private RotateInertia mRotateInertia;
private DialogBtnListener mListener = null;
/**
*
*/
public ConfigurationDialog() {
super();
}
/**
* onCreateDialog Method
* @param savedInstanceState onCreateDialog Status value
* @return Dialog instance
*/
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
final View layout = inflater.inflate(R.layout.dialog_glphotoview_config, null);
if (null != layout) {
Button btn = (Button)layout.findViewById(R.id.btn_commit);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (null != mListener) {
mListener.onDialogCommitClick(mRotateInertia);
}
dismiss();
}
});
}
mRotateInertia = (RotateInertia) getArguments().getSerializable("rotate_inertia");
if (null != mRotateInertia) {
assert layout != null;
RadioGroup rg = (RadioGroup) layout.findViewById(R.id.rotation_inertia);
if (null != rg) {
switch (mRotateInertia) {
case INERTIA_0:
rg.check(R.id.inertia_0);
break;
case INERTIA_50:
rg.check(R.id.inertia_50);
break;
case INERTIA_100:
rg.check(R.id.inertia_100);
break;
default:
break;
}
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.inertia_0) {
mRotateInertia = RotateInertia.INERTIA_0;
} else if (checkedId == R.id.inertia_50) {
mRotateInertia = RotateInertia.INERTIA_50;
} else if (checkedId == R.id.inertia_100) {
mRotateInertia = RotateInertia.INERTIA_100;
} else {
mRotateInertia = null;
}
}
});
}
}
builder.setView(layout);
return builder.create();
}
/**
* Dialog display method
* @param mgr Fragment manager object
* @param inertia Inertia settings for rotation process
*/
public static void show(FragmentManager mgr, RotateInertia inertia) {
ConfigurationDialog dialog = new ConfigurationDialog();
Bundle bundle = new Bundle();
bundle.putSerializable("rotate_inertia", inertia);
dialog.setArguments(bundle);
dialog.show(mgr, ConfigurationDialog.class.getSimpleName());
}
/**
* onAttach Method
* @param activity Attached activity object
*/
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (DialogBtnListener) activity;
}
catch (ClassCastException e) {
e.printStackTrace();
mListener = null;
}
}
/**
* Event listener interface for when a dialog is exited
* If a selection value is required in this dialog, it is necessary to attach the activity that implemented this method
*/
public interface DialogBtnListener {
void onDialogCommitClick(RotateInertia inertia);
}
}
......@@ -21,17 +21,18 @@ import jp.agentec.abook.abv.launcher.android.R;
public class ImageListArrayAdapter extends ArrayAdapter<ImageRow> {
private List<ImageRow> rows;
private LayoutInflater inflater;
private boolean isPhone;
/**
* Constructor
* @param context Context
* @param resourceIdOfListLayout Resource ID for specifying line information
* @param rows Line object
*/
public ImageListArrayAdapter(Context context, int resourceIdOfListLayout, List<ImageRow> rows) {
public ImageListArrayAdapter(Context context, int resourceIdOfListLayout, List<ImageRow> rows, boolean isPhone) {
super(context, resourceIdOfListLayout, rows);
this.rows = rows;
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.isPhone = isPhone;
}
/**
......@@ -54,6 +55,13 @@ public class ImageListArrayAdapter extends ArrayAdapter<ImageRow> {
holder.deleteButton = convertView.findViewById(R.id.btn_theta_image_delete);
holder.transferredTextView = convertView.findViewById(R.id.tv_transferred_status);
convertView.setTag(holder);
//スマートフォンの場合、サイズ調整
if (isPhone) {
resizeView(holder.thumbnail, 0.6f);
resizeView(holder.saveButton, 0.7f);
resizeView(holder.deleteButton, 0.7f);
}
} else {
holder = (ViewHolder) convertView.getTag();
}
......@@ -90,6 +98,21 @@ public class ImageListArrayAdapter extends ArrayAdapter<ImageRow> {
return convertView;
}
/**
* ImageView, Buttonサイズ調整
* @param view (ImageView, Button)
* @param scale サイズ調整率
*/
private void resizeView(View view, float scale) {
ViewGroup.LayoutParams params = view.getLayoutParams();
//サイズに変更
params.width = (int) (params.width * scale);
if (view instanceof ImageView) {
params.height = (int) (params.height * scale);
}
view.setLayoutParams(params);
}
public void setListItem(List<ImageRow> changeRows) {
this.rows = changeRows;
}
......
......@@ -21,6 +21,7 @@ import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper;
import jp.agentec.abook.abv.cl.util.AndroidStringUtil;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
......@@ -40,6 +41,7 @@ import jp.agentec.abook.abv.ui.home.adapter.FixPushMessageAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationSelectAdapter;
import jp.agentec.abook.abv.ui.home.adapter.PushMessageListAdapter;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -113,8 +115,7 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
// OS 8.0で起きるバグ(ダイアログActivity表示後(windowIsTranslucent: true)、画面を固定するとCrashされる問題対策)
// showPushMessageActivityが存在する場合は、以下のメソッドを実行しない
if (!ActivityHandlingHelper.getInstance().hasShowPushMessageActivity() &&
!ActivityHandlingHelper.getInstance().hasShowDeviceImageListActivity()) {
if (!ActivityHandlingHelper.getInstance().hasShowPushMessageActivity()) {
setPortraitIfNormal();
}
......@@ -951,4 +952,18 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
}
return existUnreadFlg;
}
/**
* デバイスのWifi有効・無効チェックし
* 無効の場合、ダイアログ表示
* @return true:有効, false:無効
*/
protected boolean deviceWifiEnable() {
if (DeviceInfo.isDeviceWifiEnabled(this)) {
return true;
} else {
showSimpleAlertDialog(R.string.msg_error_device_wifi_off);
return false;
}
}
}
......@@ -821,21 +821,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
/**
* シーン選択画面Activityが存在確認
* @return true:表示中状態、false:非表示状態
*/
public boolean hasShowDeviceImageListActivity() {
if (CollectionUtil.isNotEmpty(currentActivityStack)) {
for (ABVAuthenticatedActivity activity : currentActivityStack) {
if ((activity instanceof DeviceImageListActivity)) {
return true;
}
}
}
return false;
}
/**
* 履歴から該当の360コンテンツを削除する
* @param contentId long
*/
......
package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.provider.MediaStore;
......@@ -33,7 +39,6 @@ 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.ABookValues;
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.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -51,13 +56,12 @@ public class DeviceImageListActivity extends ABVUIActivity {
private static final String TAG = "DeviceImageListActivity";
//表示画像の解像度(低くなると画質が悪くなる)
private static final int THUMBNALE_SIZE = 700;
private static final int THUMBNAIL_SIZE = 700;
//タブレットの1行最大表示数
private static final int TABLET_COLUMNS = 4;
//タブレットの縦表示時、1行最大表示数
private static final int PHONE_COLUMNS_PORTRAIT = 3;
//タブレットの横表示時、1行最大表示数
private static final int PHONE_COLUMNS_LANDSCAPE = 5;
//画像選択最大数
private static final int IMAGE_SELECT_MAX_COUNT = 20;
......@@ -81,7 +85,6 @@ public class DeviceImageListActivity extends ABVUIActivity {
private Button mCameraBtn;
private int mGridViewRowHeight;
private boolean mIsOnResume;
private Long mContentId;
private Long mOperationId;
private String mOperationName;
private Dialog mThetaDeviceConnectDialog;
......@@ -92,6 +95,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
private ThetaHelper mThetaHelper = new ThetaHelper(this);
private SceneSendHelper mSceneSendHelper = new SceneSendHelper(this);
private WifiManager mWifiManager;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -108,8 +112,8 @@ public class DeviceImageListActivity extends ABVUIActivity {
mLocalImageUriList = new HashSet<>();
mIsOnResume = false;
mIsBaseSceneUploadSuccess = false;
mImageFetcher = new ImageInternalFetcher(this, THUMBNALE_SIZE);
mWifiManager = (WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
mImageFetcher = new ImageInternalFetcher(this, THUMBNAIL_SIZE);
mImageFetcher.addImageCache(this, THUMB_IMAGE_CACHE_DIRECTORY_NAME);
mImageFetcher.clearCache();
......@@ -155,15 +159,9 @@ public class DeviceImageListActivity extends ABVUIActivity {
//位置情報権限チェック
ABookPermissionHelper helper = new ABookPermissionHelper(DeviceImageListActivity.this, Constant.ABookPermissionType.AccessFineLocation, null);
if (helper.checkMultiPermissions(true)) {
if (mThetaHelper.connectedDeviceWifiThetaCamera()) {
//カメラ選択
showProgressPopup(getString(R.string.msg_wifi_connecting));
new DeviceInfoTask(DeviceImageListActivity.this).execute();
} else {
showThetaDeviceConnectDialog();
}
}
}
}
});
......@@ -213,11 +211,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
int heightPixels = (int) (getResources().getDisplayMetrics().heightPixels * DIALOG_WINDOW_RESIZE_SCALE_09);
int numColumn;
if (isNormalSize()) { //スマートフォン
if (widthPixels > heightPixels) {
numColumn = PHONE_COLUMNS_LANDSCAPE;
} else {
numColumn = PHONE_COLUMNS_PORTRAIT;
}
} else { //タブレット端末
WindowManager.LayoutParams lp = getWindow().getAttributes();
if (widthPixels > heightPixels) {
......@@ -458,8 +452,6 @@ public class DeviceImageListActivity extends ABVUIActivity {
mSceneSendHelper.sendSceneImages(sendImages, mOperationId, mOperationName, mIsBaseSceneUpload);
}
/**
* THETAカメラ接続ダイアログを表示
*/
......@@ -478,22 +470,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
public void onClick(View v) {
buttonDoubleTapControl(registerButton);
if (deviceWifiEnable()) {
//THETA接続チェック
if (mThetaHelper.connectedDeviceWifiThetaCamera()) {
showProgressPopup(getString(R.string.msg_wifi_connecting));
new DeviceInfoTask(DeviceImageListActivity.this).execute();
} else {
//Wi-Fi情報を再度取得し、再描画
List<ThetaDeviceInfo> savedList = mThetaHelper.getThetaWifiList(true);
WifiThetaConnectAdapter savedAdapter = (WifiThetaConnectAdapter) savedListView.getAdapter();
savedAdapter.setListItem(savedList);
savedAdapter.notifyDataSetChanged();
List<ThetaDeviceInfo> notSaveList = mThetaHelper.getThetaWifiList(false);
WifiThetaConnectAdapter notSaveAdapter = (WifiThetaConnectAdapter) notSavedListView.getAdapter();
notSaveAdapter.setListItem(notSaveList);
notSaveAdapter.notifyDataSetChanged();
}
wifiScanStart();
}
}
});
......@@ -510,8 +487,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
//登録済みの端末リスト表示
savedListView = mThetaDeviceConnectDialog.findViewById(R.id.lv_theta_wifi_saved);
List<ThetaDeviceInfo> savedList = mThetaHelper.getThetaWifiList(true);
WifiThetaConnectAdapter wifiSavedAdapter = new WifiThetaConnectAdapter(this, savedList);
WifiThetaConnectAdapter wifiSavedAdapter = new WifiThetaConnectAdapter(this, new ArrayList<ThetaDeviceInfo>());
savedListView.setAdapter(wifiSavedAdapter);
savedListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
......@@ -525,8 +501,7 @@ public class DeviceImageListActivity extends ABVUIActivity {
//未登録の端末リスト表示
notSavedListView = mThetaDeviceConnectDialog.findViewById(R.id.lv_theta_wifi_not_saved);
List<ThetaDeviceInfo> notSaveList = mThetaHelper.getThetaWifiList(false);
WifiThetaConnectAdapter wifiNotSaveAdapter = new WifiThetaConnectAdapter(this, notSaveList);
WifiThetaConnectAdapter wifiNotSaveAdapter = new WifiThetaConnectAdapter(this, new ArrayList<ThetaDeviceInfo>());
notSavedListView.setAdapter(wifiNotSaveAdapter);
notSavedListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
......@@ -539,6 +514,16 @@ public class DeviceImageListActivity extends ABVUIActivity {
});
mThetaDeviceConnectDialog.show();
wifiScanStart();
}
/**
* ブロードキャスト リスナーを登録し、Wifiスキャンを開始する。
*/
private void wifiScanStart() {
showProgressPopup();
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
mWifiManager.startScan();
}
/**
......@@ -571,27 +556,12 @@ public class DeviceImageListActivity extends ABVUIActivity {
}
/**
* デバイスのWifi有効・無効チェックし
* 無効の場合、ダイアログ表示
* @return true:有効, false:無効
*/
private boolean deviceWifiEnable() {
if (DeviceInfo.isDeviceWifiEnabled(DeviceImageListActivity.this)) {
return true;
} else {
showSimpleAlertDialog(R.string.msg_error_device_wifi_off);
return false;
}
}
/**
* ActivityをFinishする
*/
private void activityClose() {
//ベースシーン登録成功後、新着更新させるため
if (mIsBaseSceneUpload) {
if (mIsBaseSceneUploadSuccess) {
Intent data = new Intent();
setResult(RESULT_OK);
}
}
......@@ -624,11 +594,79 @@ public class DeviceImageListActivity extends ABVUIActivity {
intent.setClassName(getPackageName(), ThetaCameraActivity.class.getName());
startActivity(intent);
} else {
if (mThetaDeviceConnectDialog != null && mThetaDeviceConnectDialog.isShowing()) {
showSimpleAlertDialog(getString(R.string.msg_fail_connect_theta_wifi));
}
}
/**
* 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;
List<ThetaDeviceInfo> scanWifiList = new ArrayList<>();
List<ThetaDeviceInfo> scanSavedWifiList = new ArrayList<>();
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;
} else {
showThetaDeviceConnectDialog();
networkId = configuration.networkId;
deviceInfo.setSSID(configurationSSID);
deviceInfo.setNetworkId(networkId);
}
break;
}
}
if (isConnected) {
break;
}
if (networkId == -1) { //保存されてない
deviceInfo.setSSID(scanSSID);
scanWifiList.add(deviceInfo);
} else {
scanSavedWifiList.add(deviceInfo);
}
}
}
}
//THETA接続状態の場合、カメラ画面へ遷移
if (isConnected) {
changeProgressPopup(getString(R.string.msg_wifi_connecting));
new DeviceInfoTask(DeviceImageListActivity.this).execute();
} else { //カメラ選択画面再描画
WifiThetaConnectAdapter savedAdapter = (WifiThetaConnectAdapter) savedListView.getAdapter();
savedAdapter.setListItem(scanSavedWifiList);
savedAdapter.notifyDataSetChanged();
WifiThetaConnectAdapter notSaveAdapter = (WifiThetaConnectAdapter) notSavedListView.getAdapter();
notSaveAdapter.setListItem(scanWifiList);
notSaveAdapter.notifyDataSetChanged();
}
closeProgressPopup();
}
}
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.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
......@@ -10,6 +17,7 @@ import android.widget.SeekBar;
import android.widget.TextView;
import com.theta.helper.ThetaHelper;
import com.theta.network.ThetaDeviceInfo;
import com.theta.view.MJpegInputStream;
import com.theta.view.MJpegView;
......@@ -22,6 +30,7 @@ import jp.agentec.abook.abv.bl.common.constant.ABookValues;
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.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.SetOptionExposureTask;
......@@ -38,10 +47,6 @@ public class ThetaCameraActivity extends ABVUIActivity {
private static final String TAG = "ThetaCameraActivity";
//画面表示後、ライブビューア取得を0.5秒後に取得
private static final int LIVE_VIEW_START_DELAY = 500;
//閉じる時にWi-Fi切り替える時間を2秒後に閉じる
private static final int WIFI_CHANGE_TIME_DELAY = 2000;
private MJpegView mLiveView;
private ShowLiveViewTask mLivePreviewTask;
private Button mShootBtn;
......@@ -49,6 +54,7 @@ public class ThetaCameraActivity extends ABVUIActivity {
TextView mExposureTextView;
SeekBar mExposureSeekBar;
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 ThetaHelper mThetaHelper = new ThetaHelper(this);
......@@ -58,7 +64,7 @@ public class ThetaCameraActivity extends ABVUIActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_theta_camera);
mLiveView = findViewById(R.id.live_view);
mWifiManager = (WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
// 閉じるボタン
Button closeBtn = findViewById(R.id.btn_close);
closeBtn.setOnClickListener(new View.OnClickListener() {
......@@ -66,12 +72,13 @@ public class ThetaCameraActivity extends ABVUIActivity {
public void onClick(View v) {
Logger.v(TAG, "CloseBtn.onClick");
mLiveView.stopPlay();
//現在接続状態なのかチェック
if (mThetaHelper.connectedDeviceWifiThetaCamera()) {
if (deviceWifiEnable()) {
showProgressPopup();
//THETAカメラのWi-Fi機能をOFFに設定
new FinishWlanTask(ThetaCameraActivity.this).execute();
//現在接続状態なのかチェック
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
mWifiManager.startScan();
} else {
finish();
}
}
});
......@@ -81,16 +88,10 @@ public class ThetaCameraActivity extends ABVUIActivity {
mShootBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mShootBtn.setEnabled(false);
buttonDoubleTapControl(mShootBtn);
showProgressPopup();
new ShootTask(ThetaCameraActivity.this).execute();
//連続タップ防止
handler.postDelayed(new Runnable() {
@Override
public void run() {
mShootBtn.setEnabled(true);
}
}, BUTTON_ENABLE_DELAY_MILLIS);
mLiveView.setSource(null);
}
});
......@@ -132,8 +133,7 @@ public class ThetaCameraActivity extends ABVUIActivity {
public boolean dispatchKeyEvent(KeyEvent event) {
Logger.v(TAG, "dispatchKeyEvent %s", event);
if (event.getAction()==KeyEvent.ACTION_UP) { // 戻るボタンを抑止
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
return true;
}
}
......@@ -182,7 +182,7 @@ public class ThetaCameraActivity extends ABVUIActivity {
mExposureSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mExposureTextView.setText("EV:" + mExposureValues.get(progress));
mExposureTextView.setText(getString(R.string.title_theta_exposure_value, mExposureValues.get(progress)));
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
......@@ -209,13 +209,12 @@ public class ThetaCameraActivity extends ABVUIActivity {
* @param fileId ファイルID
*/
public void shootTaskFinish(final String fileId) {
runOnUiThread(new Runnable() {
closeProgressPopup();
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
mShootBtn.setEnabled(true);
if (fileId.equals(ABookValues.FAIL)) {
//TODO:失敗エラーアラート
showSimpleAlertDialog(R.string.msg_theta_shoot_fail);
} else {
Intent intent = new Intent();
......@@ -237,8 +236,13 @@ public class ThetaCameraActivity extends ABVUIActivity {
mLiveView.setSource(mJpegInputStream);
new GetOptionExposureTask(ThetaCameraActivity.this).execute();
} else {
//TODO:失敗ダイアログ
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() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
}
}
......@@ -247,6 +251,9 @@ public class ThetaCameraActivity extends ABVUIActivity {
* @param result Wi-Fi設定OFF結果
*/
public void finishWlanTaskFinish(String result) {
if (result.equals(ABookValues.FAIL)) {
Logger.e(TAG, "finishWlanTaskFinish fail");
}
closeProgressPopup();
finish();
}
......@@ -256,11 +263,16 @@ public class ThetaCameraActivity extends ABVUIActivity {
* @param exposure 露出値
*/
public void getOptionExposureTaskFinish(String exposure) {
if (exposure != null) {
int progress = mExposureValues.indexOf(exposure);
if (progress != 1) {
mExposureSeekBar.setProgress(progress);
}
mExposureTextView.setText("EV:" + exposure);
mExposureTextView.setText(getString(R.string.title_theta_exposure_value, exposure));
} else {
showSimpleAlertDialog(R.string.msg_theta_get_exposure_fail);
Logger.e(TAG, "getOptionExposureTaskFinish fail");
}
}
/**
......@@ -268,11 +280,62 @@ public class ThetaCameraActivity extends ABVUIActivity {
* @param result 送信結果(Success:成功、fail:失敗)
*/
public void setOptionExposureTaskFinish(String result) {
if (ABookValues.SUCCESS.equals(result)) {
//
} else {
//TODO:エラーアラート
if (!ABookValues.SUCCESS.equals(result)) {
showSimpleAlertDialog(R.string.msg_theta_set_exposure_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();
}
}
}
......@@ -63,8 +63,7 @@ public class ThetaImageListActivity extends ABVUIActivity {
public boolean dispatchKeyEvent(KeyEvent event) {
Logger.v(TAG, "dispatchKeyEvent %s", event);
if (event.getAction()==KeyEvent.ACTION_UP) { // 戻るボタンを抑止
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
return true;
}
}
......@@ -77,7 +76,11 @@ public class ThetaImageListActivity extends ABVUIActivity {
public void imageListTaskFinish(List<ImageRow> imageRows) {
if (imageRows != null) {
mImageRows = imageRows;
ImageListArrayAdapter imageListArrayAdapter = new ImageListArrayAdapter(ThetaImageListActivity.this, R.layout.listlayout_object, imageRows);
boolean isPhone = false;
if (isNormalSize()) {
isPhone = true;
}
ImageListArrayAdapter imageListArrayAdapter = new ImageListArrayAdapter(ThetaImageListActivity.this, R.layout.listlayout_object, imageRows, isPhone);
mImageListView.setAdapter(imageListArrayAdapter);
mImageListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
......@@ -118,11 +121,16 @@ public class ThetaImageListActivity extends ABVUIActivity {
}
}
});
closeProgressPopup();
} else {
showSimpleAlertDialog(R.string.msg_theta_image_load_fail);
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_theta_image_load_fail, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
Logger.e(TAG, "failed to get image list");
}
closeProgressPopup();
}
/**
......@@ -151,7 +159,7 @@ public class ThetaImageListActivity extends ABVUIActivity {
showSimpleAlertDialog(R.string.msg_theta_image_send_fail);
}
} else {
Logger.e(TAG,"failed to download image");
Logger.e(TAG,"failed loadPhotoTaskFinish");
showSimpleAlertDialog(R.string.msg_theta_image_load_fail);
}
closeProgressPopup();
......
......@@ -40,6 +40,7 @@ public class ThetaImagePreviewActivity extends ABVUIActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Logger.d(TAG, "onCreate");
setContentView(R.layout.ac_theta_image_preview);
// 戻るボタン
......@@ -77,8 +78,7 @@ public class ThetaImagePreviewActivity extends ABVUIActivity {
mGLPhotoView = findViewById(R.id.photo_image);
mGLPhotoView.setmRotateInertia(mRotateInertia);
LoadPhotoTask loadPhotoTask = new LoadPhotoTask(this, mFileId);
loadPhotoTask.execute();
new LoadPhotoTask(this, mFileId).execute();
}
//端末の戻るボタン禁止
......@@ -86,8 +86,7 @@ public class ThetaImagePreviewActivity extends ABVUIActivity {
public boolean dispatchKeyEvent(KeyEvent event) {
Logger.v(TAG, "dispatchKeyEvent %s", event);
if (event.getAction()==KeyEvent.ACTION_UP) { // 戻るボタンを抑止
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
return true;
}
}
......@@ -114,8 +113,13 @@ public class ThetaImagePreviewActivity extends ABVUIActivity {
}
closeProgressPopup();
} else {
showSimpleAlertDialog(R.string.app_name, R.string.msg_theta_image_load_fail);
Logger.e("failed to download image");
AlertDialogUtil.showAlertDialog(this, R.string.app_name, R.string.msg_theta_image_load_fail, true, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
Logger.e(TAG,"failed loadPhotoTaskFinish");
}
}
}
......@@ -13,6 +13,12 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaImageListActivity;
/**
* THETAカメラから1つの画像を削除するスレッド
* @version 1.2.300
* @author kimjinsung
* @since 2020/05/29
*/
public class DeleteImageTask extends AsyncTask<String, String, Void> {
private static final String TAG = "DeleteImageTask";
private final WeakReference<ThetaImageListActivity> refActivity;
......
package jp.agentec.abook.abv.ui.viewer.activity.theta.task;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import com.theta.network.ThetaDeviceInfo;
......@@ -11,6 +15,12 @@ import jp.agentec.abook.abv.bl.common.constant.ABookValues;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity;
/**
* THETAカメラ情報を取得するスレッド
* @version 1.2.300
* @author kimjinsung
* @since 2020/05/29
*/
public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
private static final String TAG = "DeviceInfoTask";
private final WeakReference<DeviceImageListActivity> refActivity;
......@@ -35,6 +45,7 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
} catch (InterruptedException e1) {
e1.printStackTrace();
}
thetaConnectedWifiOnly();
} else {
retryCount = MAX_RETRY_COUNT;
}
......@@ -48,4 +59,20 @@ public class DeviceInfoTask extends AsyncTask<Void, String, ThetaDeviceInfo> {
DeviceImageListActivity activity = refActivity.get();
activity.thetaDeviceInfoTaskFinish(deviceInfo);
}
private void thetaConnectedWifiOnly() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
DeviceImageListActivity activity = refActivity.get();
ConnectivityManager connectivityManager = (ConnectivityManager)activity.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) {
for (Network net : connectivityManager.getAllNetworks()) {
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(net);
if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
connectivityManager.bindProcessToNetwork(net);
break;
}
}
}
}
}
}
......@@ -11,7 +11,12 @@ import jp.agentec.abook.abv.bl.common.constant.ABookValues;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity;
/**
* THETAカメラのWifi機能をOFFにするスレッド
* @version 1.2.300
* @author kimjinsung
* @since 2020/05/29
*/
public class FinishWlanTask extends AsyncTask<Void, String, String> {
private static final String TAG = "FinishWlanTask";
private static final int SLEEP_TIME = 2000;
......
......@@ -11,7 +11,12 @@ import jp.agentec.abook.abv.bl.common.constant.ABookValues;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity;
/**
* THETAカメラの露出情報を取得するスレッド
* @version 1.2.300
* @author kimjinsung
* @since 2020/05/29
*/
public class GetOptionExposureTask extends AsyncTask<Void, String, String> {
private static final String TAG = "GetOptionExposureTask";
private final WeakReference<ThetaCameraActivity> refActivity;
......
......@@ -11,7 +11,12 @@ import jp.agentec.abook.abv.bl.common.constant.ABookValues;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity;
/**
* THETAカメラの露出情報を設定するスレッド
* @version 1.2.300
* @author kimjinsung
* @since 2020/05/29
*/
public class SetOptionExposureTask extends AsyncTask<String, String, String> {
private static final String TAG = "SetOptionExposureTask";
private final WeakReference<ThetaCameraActivity> refActivity;
......
......@@ -86,5 +86,6 @@ public class ImageGalleryAdapter extends BaseAdapter {
ImageView mThumbnail;
ImageView mThumbnailSelected;
CustomImage customImage;
}
}
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