Commit 62397df1 by Kim Jinsung

ベースシーンとシーン登録処理追加

parent cc209be0
......@@ -616,21 +616,19 @@ public class AcmsClient implements AcmsClientResponseListener {
/**
* パノラマで使用するシーンを登録
* @param sid
* @param contentId
* @param FormFile シーンで使用する画像
* @return
* @throws IOException
* @throws AcmsException
*/
public SceneEntryJSON sceneEntry(String sid, Long contentId, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
public SceneEntryJSON sceneEntry(String sid, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック
throw new NetworkDisconnectedException();
}
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSceneEntry);
HttpMultipart part1 = new HttpMultipart(ABookKeys.SID, sid);
HttpMultipart part2 = new HttpMultipart(ABookKeys.CONTENT_ID, StringUtil.toString(contentId));
HttpMultipart part3 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2, part3});
HttpMultipart part2 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2});
SceneEntryJSON json = new SceneEntryJSON(result.httpResponseBody);
if (json.httpStatus != 200) {
if (json.errorMessage != null) {
......
......@@ -129,6 +129,7 @@ public class ABookKeys {
public static final String EDITABLE = "editable"; //commonAttachedDataUrl()で編集可否を判別するパラメタをWebからもらう。
public static final String FILE_PATH = "filePath"; //再編集する場合、クリックしたイマージのパスのパラメタ
public static final String BASE_CONTENT_REGISTER = "BaseContentRegister";
//THETA端末関連
public static final String THETA_FILE_ID = "OBJECT_ID";
public static final String THETA_THUMBNAIL = "THUMBNAIL";
......
......@@ -1380,12 +1380,11 @@ public class OperationLogic extends AbstractLogic {
/**
* シーンの登録
* @param file
* @param contentId
* @throws IOException
* @throws AcmsException
*/
public Integer sendScene(File file, Long contentId) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, contentId, file);
public Integer sendScene(File file) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, file);
return json.resourceId;
}
......
......@@ -44,6 +44,21 @@ public class AlertDialogUtil {
}
/**
* 共通ダイアログ表示用(OKボタンコールバック、CANCELボタンコールバック)
* @param context コンテキスト
* @param title タイトル
* @param message メッセージ
* @param okOnClick OKボタンコールバック
* @param okOnClick CANCELボタンコールバック
*/
public static void showAlertDialog(Context context, int title, int message, DialogInterface.OnClickListener okOnClick, DialogInterface.OnClickListener canOnClick) {
ABookAlertDialog alertDialog = createAlertDialog(context, context.getResources().getString(title), context.getResources().getString(message));
alertDialog.setNegativeButton(R.string.cancel, canOnClick);
alertDialog.setPositiveButton(R.string.ok, okOnClick);
alertDialog.show();
}
/**
* 共通ダイアログ表示用(Cancel表示・非表示、OKボタンコールバック)
* @param context コンテキスト
* @param title タイトル
......
......@@ -94,7 +94,7 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
if (helper.checkMultiPermissions(true)) {
//シーン画像選択画面表示
Intent intent = new Intent();
intent.putExtra(ABookKeys.CONTENT_ID, contentId);
intent.putExtra(ABookKeys.BASE_CONTENT_REGISTER, false);
String className = DeviceImageListActivity.class.getName();
if (isNormalSize() == false) {
className += "Dialog";
......
......@@ -18,11 +18,12 @@ public class ImageGalleryAdapter extends BaseAdapter {
LayoutInflater inflater;
List<CustomImage> imageUriList;
int mRowHeight;
public ImageGalleryAdapter(Context context, List<CustomImage> imageUriList, int rowHeight) {
boolean isBaseSceneUpload;
public ImageGalleryAdapter(Context context, List<CustomImage> imageUriList, int rowHeight, boolean isBaseSceneUpload) {
this.context = context;
this.imageUriList = imageUriList;
this.mRowHeight = rowHeight;
this.isBaseSceneUpload = isBaseSceneUpload;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
......@@ -59,10 +60,19 @@ public class ImageGalleryAdapter extends BaseAdapter {
CustomImage customImage = getItem(position);
boolean isSelected = ((DeviceImageListActivity)context).containsCustomImageUri(customImage.mUri);
holder.mThumbnailSelected.setImageResource(R.drawable.check_mark);
holder.mThumbnailSelected.setVisibility(View.INVISIBLE);
//ベースシーンチェック画像設定
if (isBaseSceneUpload) {
boolean isFirstImage = ((DeviceImageListActivity)context).firstCustomImageUri(customImage.mUri);
if (isFirstImage) {
holder.mThumbnailSelected.setImageResource(R.drawable.icon_base_content_check);
}
}
if (isSelected) {
holder.mThumbnailSelected.setVisibility(View.VISIBLE);
} else {
holder.mThumbnailSelected.setVisibility(View.INVISIBLE);
}
if (holder.customImage == null || !holder.customImage.mUri.equals(customImage.mUri)) {
......
package jp.agentec.abook.abv.ui.viewer.helper;
import android.content.Context;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.launcher.android.R;
/**
* シーン画像ファイルをサーバへ登録する処理クラス
*/
public class SceneSendHelper {
private static final String TAG = "DeviceImageListHelper";
private SceneSendHelper.DeviceImageListSendListener listener;
private Context mContext;
public SceneSendHelper(Context context) {
mContext = context;
}
public void setListener(SceneSendHelper.DeviceImageListSendListener listener) {
this.listener = listener;
}
public interface DeviceImageListSendListener {
void sceneSendfinish();
void changeProgress(final int progress);
void sceneSendFail(final String errorMessage);
void sceneSendFailRetry(List<String> retrySendImages);
}
/**
* シーン画像をサーバへ送信
* @param sendImages シーン画像ファイルPath配列
* @param operationId 作業ID
* @param OperationName 作業名
* @param isBaseSceneUpload ベースシーン登録フラグ(true:登録、false:登録しない)
*/
public void sendSceneImages(final List<String> sendImages, final Long operationId, final String OperationName, final boolean isBaseSceneUpload) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
String firstFilePath = sendImages.get(0);
final List<String> needSendImages = new ArrayList<>(sendImages);
for(String filePath : sendImages){
File file = new File(filePath);
try {
if (isBaseSceneUpload && firstFilePath.equals(filePath)) {
AbstractLogic.getLogic(OperationLogic.class).sendPanoContent(operationId, OperationName, file);
} else {
AbstractLogic.getLogic(OperationLogic.class).sendScene(file);
}
needSendImages.remove(filePath);
//プログレスバー進捗
int progress = (int) (((float)(sendImages.size() - needSendImages.size()) / sendImages.size()) * 100);
listener.changeProgress(progress);
//送信終了
if (needSendImages.size() == 0) {
listener.sceneSendfinish();
}
} catch (AcmsException ex) {
Logger.e(TAG, ex);
if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P007) {
listener.sceneSendFail(mContext.getString(R.string.error_msg_open_pano_edit));
} else {
listener.sceneSendFailRetry(needSendImages);
}
break;
} catch (Exception e) {
Logger.e(TAG, e);
listener.sceneSendFailRetry(needSendImages);
break;
}
}
}
});
}
}
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