Commit 2ed6b474 by yuichiro ogawa

Chat機能移植及びリファクタリング

parent 7218f80e
......@@ -625,19 +625,21 @@ public class AcmsClient implements AcmsClientResponseListener {
/**
* パノラマで使用するシーンを登録
* @param sid
* @param contentId
* @param FormFile シーンで使用する画像
* @return
* @throws IOException
* @throws AcmsException
*/
public SceneEntryJSON sceneEntry(String sid, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
public SceneEntryJSON sceneEntry(String sid, Long contentId, 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.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2});
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});
SceneEntryJSON json = new SceneEntryJSON(result.httpResponseBody);
if (json.httpStatus != 200) {
if (json.errorMessage != null) {
......
......@@ -1391,11 +1391,12 @@ public class OperationLogic extends AbstractLogic {
/**
* シーンの登録
* @param file
* @param contentId
* @throws IOException
* @throws AcmsException
*/
public Integer sendScene(File file) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, file);
public Integer sendScene(File file, Long contentId) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, contentId, file);
return json.resourceId;
}
......
......@@ -344,7 +344,6 @@
<string name="operation_related_content">関連資料</string>
<string name="new_content">新着</string>
<string name="save_all">一括保存</string>
<string name="content_update">更新</string>
<string name="remote_support">遠隔支援</string>
<string name="remote_support_list">遠隔支援一覧</string>
<string name="new_make">新規作成</string>
......
......@@ -168,6 +168,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected PushMessageListAdapter mPushMessageListAdapter;
protected ListView mFixPushMessageListView;
protected Dialog mPushMessageSendDialog;
protected ImageButton communicationButton; // コミュニケーションボタン
protected int mSelectedFixPuchMessagePosition;
protected int mSendType;
protected PushMessageLogic pushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
......@@ -978,6 +979,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} else {
showPushMessageDetailView(dto);
}
// プッシュメッセージで未読がなければ、下辺ツールバーのコミュニケーションボタンのバッジを外す
List<PushMessageDto> checkPushMessageList = mPushMessageListAdapter.getItems();
if (!checkUnReadCommunication(checkPushMessageList)) {
communicationButton.setImageResource(R.drawable.ic_communication_menu);
}
}
});
mPushMessageListView.invalidate();
......@@ -1238,4 +1244,28 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
ProgressDialogHelper.closeProgressPopup();
}
}
// コミュニケーションのアイコン設定(未既読があれば、バッチ付きアイコンでセット)
protected void setCommunicationImageButton() {
List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = checkUnReadCommunication(pushMessageDtoList);
communicationButton.setImageResource(existUnreadFlg ? R.drawable.ic_communication_menu_with_badge : R.drawable.ic_communication_menu);
}
/**
* 未読のプッシュメッセージが存在するかチェック
* @param pushMessageDtoList チェックするリスト
* @return
*/
private boolean checkUnReadCommunication(List<PushMessageDto> pushMessageDtoList) {
boolean existUnreadFlg = false;
for (PushMessageDto pushMessageDto : pushMessageDtoList) {
if (!pushMessageDto.readingFlg) {
existUnreadFlg = true;
break;
}
}
return existUnreadFlg;
}
}
......@@ -90,6 +90,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
private static final String TAG ="ABVContentViewActivity";
public final static int ABOOK_CHECK_TASK_IMAGE = 103;
public final static int ABOOK_CHECK_TASK_VIDEO = 104;
protected final static int ABOOK_CHECK_SELECT_SCENE = 105;
protected long contentId;// 表示中のコンテンツID
protected long objectId; // オブジェクトID(オブジェクト用のActivityのときのみ使用)
......
......@@ -85,8 +85,6 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
protected TextView mUpdatedDate; // add by jang
protected TextView mLoadingText; // add by jang;
protected ImageButton communicationButton; // コミュニケーションボタン
// 新着更新処理の終了後、プルダウンを完了させるためのビュー
protected PullToRefreshBase refreshBaseView;
......@@ -530,416 +528,6 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
finish();
}
/**
* コミュニケーションメニューダイアログ
*/
@Override
public void showCommunicationMenuDialog() {
mCommunicationMenuDialog = new Dialog(this);
mCommunicationMenuDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mCommunicationMenuDialog.setCanceledOnTouchOutside(false);
mCommunicationMenuDialog.setContentView(R.layout.communication_menu_dialog);
List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = false;
for (PushMessageDto pushMessageDto : pushMessageDtoList) {
if (!pushMessageDto.readingFlg) {
existUnreadFlg = true;
break;
}
}
ImageView ivIcon = (ImageView)mCommunicationMenuDialog.findViewById(R.id.btn_push_message_list);
if (existUnreadFlg) {
ivIcon.setBackgroundResource(R.drawable.ic_communication_push_message_list_with_badge);
} else {
ivIcon.setBackgroundResource(R.drawable.ic_communication_push_message_list);
}
LinearLayout ll_menuItem_meeting = (LinearLayout)mCommunicationMenuDialog.findViewById(R.id.ll_item_meeting);
ll_menuItem_meeting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityHandlingHelper.getInstance().startMeetingActivity();
mCommunicationMenuDialog.dismiss();
}
});
LinearLayout ll_menuItem_push_message = (LinearLayout)mCommunicationMenuDialog.findViewById(R.id.ll_item_push_message);
ll_menuItem_push_message.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showOperationSelectDialog();
mCommunicationMenuDialog.dismiss();
}
});
LinearLayout ll_menuItem_push_message_list = (LinearLayout)mCommunicationMenuDialog.findViewById(R.id.ll_item_push_message_list);
ll_menuItem_push_message_list.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showPushMessageListDialog();
mCommunicationMenuDialog.dismiss();
}
});
mCommunicationMenuDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCommunicationMenuDialog.dismiss();
}
});
mCommunicationMenuDialog.show();
}
private void showOperationSelectDialog() {
OperationDao operationDao = AbstractDao.getDao(OperationDao.class);
mOperationSelectDialog = new Dialog(this);
mOperationSelectDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mOperationSelectDialog.setCanceledOnTouchOutside(false);
mOperationSelectDialog.setContentView(R.layout.operation_select_dialog);
mOperationSelectListView = (ListView) mOperationSelectDialog.findViewById(R.id.lv_operation_select);
List<OperationDto> operationDtoList = operationDao.getAllOperation();
mOperationSelectAdapter = new OperationSelectAdapter(this, operationDtoList);
mOperationSelectListView.setAdapter(mOperationSelectAdapter);
mOperationSelectListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
OperationDto operationDto = mOperationSelectAdapter.getItem(position);
showPushMessageSendDialog(operationDto);
mOperationSelectDialog.dismiss();
}
});
// リソースパターンを適用
TextView operationSelect = (TextView) mOperationSelectDialog.findViewById(R.id.tv_toolbar_title);
operationSelect.setText(PatternStringUtil.patternToInt(getApplicationContext(),
R.string.operation_select,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
mOperationSelectDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOperationSelectDialog.dismiss();
}
});
mOperationSelectDialog.show();
}
/**
* プッシュメッセージダイアログ表示
*/
private void showPushMessageListDialog() {
mPushMessageListDialog = new Dialog(this);
mPushMessageListDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mPushMessageListDialog.setCanceledOnTouchOutside(false);
mPushMessageListDialog.setContentView(R.layout.push_message_list_dialog);
mPushMessageListView = (ListView) mPushMessageListDialog.findViewById(R.id.lv_push_message);
final List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
mPushMessageListAdapter = new PushMessageListAdapter(this, pushMessageDtoList);
mPushMessageListView.setAdapter(mPushMessageListAdapter);
mPushMessageListAdapter.setAdapterListener(new PushMessageListAdapter.PushMessageListAdapterListener() {
@Override
public void onDetailView(final PushMessageDto dto) {
showPushMessageDetailView(dto);
// プッシュメッセージで未読がなければ、下辺ツールバーのコミュニケーションボタンのバッジを外す
List<PushMessageDto> checkPushMessageList = mPushMessageListAdapter.getItems();
if (!checkUnReadCommunication(checkPushMessageList)) {
communicationButton.setImageResource(R.drawable.ic_communication_menu);
}
}
});
mPushMessageListView.invalidate();
mPushMessageListView.setClickable(false);
mPushMessageListDialog.findViewById(R.id.back_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
mPushMessageListAdapter.setItem(pushMessageDtoList);
showPushMessgeListView(true);
}
});
mPushMessageListDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mPushMessageListDialog.dismiss();
}
});
showPushMessgeListView(true);
mPushMessageListDialog.show();
}
// プッシュメッセージの詳細表示
private void showPushMessageDetailView(final PushMessageDto dto) {
dto.readingFlg = true;
TextView messageTextView = (TextView)mPushMessageListDialog.findViewById(R.id.tv_message);
TextView sendDateTextView = (TextView)mPushMessageListDialog.findViewById(R.id.tv_send_date);
TextView sendOperationNameTextView = (TextView)mPushMessageListDialog.findViewById(R.id.tv_operation_name);
TextView sendUserTextView = (TextView)mPushMessageListDialog.findViewById(R.id.tv_send_user);
messageTextView.setText(dto.pushMessage);
sendDateTextView.setText(DateTimeUtil.toString(dto.pushSendDate, DateTimeFormat.yyyyMMddHHmm_slash));
sendOperationNameTextView.setText(dto.operationName);
sendUserTextView.setText(dto.pushSendLoginId);
pushMessageLogic.updateReadingFlg(dto.pushMessageId);
showPushMessgeListView(false);
}
// プッシュメッセージの一覧表示
private void showPushMessgeListView(boolean pushMessageListViewFlg) {
TextView titleTextView = (TextView)mPushMessageListDialog.findViewById(R.id.tv_toolbar_title);
if (pushMessageListViewFlg) {
mPushMessageListView.setVisibility(View.VISIBLE);
mPushMessageListDialog.findViewById(R.id.close_btn).setVisibility(View.VISIBLE);
mPushMessageListDialog.findViewById(R.id.back_btn).setVisibility(View.GONE);
mPushMessageListDialog.findViewById(R.id.ll_detail).setVisibility(View.GONE);
// リソースパターンの適用
titleTextView.setText(PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_list,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else {
mPushMessageListView.setVisibility(View.GONE);
mPushMessageListDialog.findViewById(R.id.close_btn).setVisibility(View.VISIBLE);
mPushMessageListDialog.findViewById(R.id.back_btn).setVisibility(View.VISIBLE);
mPushMessageListDialog.findViewById(R.id.ll_detail).setVisibility(View.VISIBLE);
// リソースパターンの適用
titleTextView.setText(PatternStringUtil.patternToString(getApplicationContext(),
R.string.title_message_detail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
}
}
/**
* プッシュメッセージ送信ダイヤログ表示
*/
private void showPushMessageSendDialog(final OperationDto operationDto) {
mPushMessageSendDialog = new Dialog(this);
mPushMessageSendDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mPushMessageSendDialog.setCanceledOnTouchOutside(false);
mPushMessageSendDialog.setContentView(R.layout.push_message_send_dialog);
mFixPushMessageListView = (ListView) mPushMessageSendDialog.findViewById(R.id.listView);
mPushMessageSendDialog.findViewById(R.id.back_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showOperationSelectDialog();
mPushMessageSendDialog.dismiss();
}
});
mPushMessageSendDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mPushMessageSendDialog.dismiss();
}
});
mPushMessageSendDialog.findViewById(R.id.send_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendPushMessageRequest(operationDto.operationId);
}
});
RadioGroup searchTarget = (RadioGroup) mPushMessageSendDialog.findViewById(R.id.send_target_group);
searchTarget.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.in_gourp) {
mSendType = Constant.PushMessageSendType.InGroup;
} else {
mSendType = Constant.PushMessageSendType.AllOperation;
}
}
});
mPushMessageSendDialog.findViewById(R.id.fix_push_message_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFixPushMessageView();
}
});
TextView messageTitleTextView = (TextView) mPushMessageSendDialog.findViewById(R.id.message_title);
// リソースパターンの適用
messageTitleTextView.setText(PatternStringUtil.patternToString(getApplicationContext(),
R.string.free_input,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)) + " > ");
TextView tvOperationName = (TextView) mPushMessageSendDialog.findViewById(R.id.operation_name);
tvOperationName.setText(operationDto.operationName);
mPushMessageSendDialog.show();
}
/**
* プッシュメッセージ送信画面、定型文一覧画面切り替え
* @param sendPushMessageViewFlg (true : プッシュメッセージ送信画面、false : 定型文一覧画面)
*/
private void showSendPushMessgeView(boolean sendPushMessageViewFlg) {
if (sendPushMessageViewFlg) {
mFixPushMessageListView.setVisibility(View.GONE);
mPushMessageSendDialog.findViewById(R.id.back_btn).setVisibility(View.GONE);
mPushMessageSendDialog.findViewById(R.id.push_send_layout).setVisibility(View.VISIBLE);
mPushMessageSendDialog.findViewById(R.id.close_btn).setVisibility(View.VISIBLE);
EditText messageEditText = (EditText) mPushMessageSendDialog.findViewById(R.id.message);
KeyboardUtils.show(this, messageEditText);
} else {
mFixPushMessageListView.setVisibility(View.VISIBLE);
mPushMessageSendDialog.findViewById(R.id.back_btn).setVisibility(View.VISIBLE);
mPushMessageSendDialog.findViewById(R.id.push_send_layout).setVisibility(View.GONE);
mPushMessageSendDialog.findViewById(R.id.close_btn).setVisibility(View.GONE);
}
}
/**
* プッシュメッセージ送信依頼
*/
private void sendPushMessageRequest(long operationId) {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(this, R.string.request_network_connection, Toast.LENGTH_SHORT);
return;
}
//文字列チェック
EditText messageEditText = (EditText) mPushMessageSendDialog.findViewById(R.id.message);
String message = messageEditText.getText().toString();
String checkMessage = message.replace(" ", "");
if (checkMessage.length() == 0) {
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_input_null,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
return;
}
byte[] messageByte = message.getBytes(StandardCharsets.UTF_8);
if (messageByte.length >= 207) {
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_input_over,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
return;
}
// リソースパターンの適用
ProgressDialogHelper.showProgressPopup(this, true, PatternStringUtil.patternToString(getApplicationContext(),
R.string.file_initialization,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
try {
boolean result = pushMessageLogic.sendPushMessageRequest(mSendType, message, operationId);
if (result) {
mPushMessageSendDialog.dismiss();
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_send_success,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
} else {
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_send_fail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
}
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_send_fail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
} finally {
ProgressDialogHelper.closeProgressPopup();
}
}
private void showFixPushMessageView() {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(this, R.string.request_network_connection, Toast.LENGTH_SHORT);
return;
}
EditText messageEditText = (EditText) mPushMessageSendDialog.findViewById(R.id.message);
KeyboardUtils.hide(this, messageEditText);
// リソースパターンの適用
ProgressDialogHelper.showProgressPopup(this, true, PatternStringUtil.patternToString(getApplicationContext(),
R.string.file_initialization,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
try {
List<FixPushMessageDto> fixPushMessageList = pushMessageLogic.getFixPushMessage();
FixPushMessageDto dto = new FixPushMessageDto();
// リソースパターンの適用
dto.name = PatternStringUtil.patternToString(getApplicationContext(),
R.string.free_input,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
fixPushMessageList.add(0, dto);
mFixPushMessageListView.setAdapter(new FixPushMessageAdapter(this, fixPushMessageList, mSelectedFixPuchMessagePosition));
mFixPushMessageListView.invalidate();
mFixPushMessageListView.setClickable(true);
mFixPushMessageListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mSelectedFixPuchMessagePosition = position;
FixPushMessageDto item = (FixPushMessageDto)parent.getItemAtPosition(position);
TextView messageTitleTextView = (TextView) mPushMessageSendDialog.findViewById(R.id.message_title);
messageTitleTextView.setText(item.name + " > ");
EditText messageEditText = (EditText) mPushMessageSendDialog.findViewById(R.id.message);
messageEditText.setText(item.value);
messageEditText.setSelection(messageEditText.getText().length());
showSendPushMessgeView(true);
}
});
showSendPushMessgeView(false);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.respons_fix_push_message_fail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
} finally {
ProgressDialogHelper.closeProgressPopup();
}
}
// コミュニケーションのアイコン設定(未既読があれば、バッチ付きアイコンでセット)
protected void setCommunicationImageButton() {
List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = checkUnReadCommunication(pushMessageDtoList);
communicationButton.setImageResource(existUnreadFlg ? R.drawable.ic_communication_menu_with_badge : R.drawable.ic_communication_menu);
}
/**
* 未読のプッシュメッセージが存在するかチェック
* @param pushMessageDtoList チェックするリスト
* @return
*/
private boolean checkUnReadCommunication(List<PushMessageDto> pushMessageDtoList) {
boolean existUnreadFlg = false;
for (PushMessageDto pushMessageDto : pushMessageDtoList) {
if (!pushMessageDto.readingFlg) {
existUnreadFlg = true;
break;
}
}
return existUnreadFlg;
}
/**
* デバイスのWifi有効・無効チェックし
* 無効の場合、ダイアログ表示
......
......@@ -37,6 +37,7 @@ import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
......@@ -83,10 +84,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private ImageButton mOperationHomeButton; // ホームボタン
private ImageButton mOperationRelatedContentButton; // 関連資料ボタン
private ImageButton mCommunicationButton; // コミュニケーションボタン
protected PushMessageLogic pushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private Dialog mCommunicationMenuDialog;
private BroadcastReceiver receiver;
......@@ -281,7 +278,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(DownloadManager.ACTION_DOWNLOAD_COMPLETE)) {
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) {
mChatWebView.loadUrl("javascript:dismissLoadingIndicator()");
}
}
......@@ -303,7 +300,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
Logger.d("url", "url : " + url);
Uri uri = Uri.parse(url);
String fileName = new File(uri.getPath()).getName();
String fileName = new File(Objects.requireNonNull(uri.getPath())).getName();
// イメージをダウンロードする(png, jpg, jpeg, mp4, mov)
if (url.toLowerCase().endsWith(".png") || url.toLowerCase().endsWith(".jpg") || url.toLowerCase().endsWith(".jpeg")
......@@ -315,6 +312,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
File destinationFile = new File(Environment.getExternalStorageDirectory(), fileName); request.setDescription("Downloading ...");
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationUri(Uri.fromFile(destinationFile));
assert mdDownloadManager != null;
mdDownloadManager.enqueue(request);
} else { // その他のファイルはurlのみ確認
Logger.d("download ", "download URL :" + url);
......@@ -349,7 +347,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
showCommonContent();
}
});
mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
communicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
// Toolbar
settingBottomToolbar();
......@@ -385,7 +383,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// コミュニケーションボタン
mCommunicationButton.setOnClickListener(new View.OnClickListener() {
communicationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// ABVUIActivity activity = ActivityHandlingHelper.getInstance().getPreviousOfSettingActivity();
......@@ -643,13 +641,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mUploadMessage = null;
}
// コミュニケーションのアイコン設定(未既読があれば、バッチ付きアイコンでセット)
private void setCommunicationImageButton() {
List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = checkUnReadCommunication(pushMessageDtoList);
mCommunicationButton.setImageResource(existUnreadFlg ? R.drawable.ic_communication_menu_with_badge : R.drawable.ic_communication_menu);
}
/**
* 未読のプッシュメッセージが存在するかチェック
* @param pushMessageDtoList チェックするリスト
......@@ -761,7 +752,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName = directory.list();
if (fileName == null) break;
if (fileName == null) {
break;
}
n = 0;
while(fileName.length > n){
......@@ -806,7 +799,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// java.io.File クラスのメソッド list()
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName = directory.list();
if (fileName == null) break;
if (fileName == null) {
break;
}
n = 0;
while(fileName.length > n){
......
......@@ -398,8 +398,13 @@ public class LoginActivity extends ABVLoginActivity {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
if (oldMemberInfoDto != null && oldMemberInfoDto.loginStatus == LoginStatus.LimitLogin.statusCode()) {
// アプリロックの場合サーバ認証せずにログイン
offlineLogin();
} else {
fcmRegister();
}
}
});
}
......
......@@ -364,7 +364,14 @@ public class CheckOZDViewActivity extends ABVContentViewActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode != KeyEvent.KEYCODE_BACK) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mAddReport) {
ozdCancelProcess(); // Ozd作業画面を閉じる
} else {
// 作業追加区分がなしの場合
goToMain(); // 一覧画面に遷移
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
......
......@@ -1535,6 +1535,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Logger.d(TAG, "KeyEvent.KEYCODE_BACK");
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isVideoMax) {
videoMaxToDefault();
} else if (isMarking) {
......
......@@ -709,6 +709,10 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
return;
}
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result[0]);
}
}
mUploadMessage = null;
}
......
......@@ -729,6 +729,10 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
// 動画
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result);
}
}
mUploadMessage = null;
}
......
......@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
......@@ -11,6 +12,7 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
......@@ -19,19 +21,25 @@ import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
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.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentObjectLogLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
......@@ -223,6 +231,9 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
if (mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
showConfirmSavePanoEdit();
} else {
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isLinkedContent) {
goToBack();
} else {
......@@ -262,6 +273,125 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
super.onDestroy();
}
// シーン追加ダイアログ表示
protected void confirmEntrySceneDialog(Uri result) {
// 画像
try {
final Uri responseUri = attachmentImageProcessing(result);
// リソースパターンの適用
ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.pano_edit,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
alertDialog.setMessage(PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_confirm_entry_scene,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
alertDialog.setNegativeButton(R.string.cancel, null);
alertDialog.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
// リソースパターンの適用
showProgressView(PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_common_processing,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
if (responseUri != null && responseUri.getPath() != null) {
File file = new File(responseUri.getPath());
try {
final Integer resourceId = AbstractLogic.getLogic(OperationLogic.class).sendScene(file, contentId);
if (resourceId != null) {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialogHorizontal.setProgress(20);
webViewLoadUrl(String.format("javascript:CHK_E.checkResourceEntry('%s')", resourceId));
}
});
handler.post(new Runnable() {
@Override
public void run() {
int progress = progressDialogHorizontal.getProgress();
if (progress == 0) {
return;
} else if (progress == 100) {
progressDialogHorizontal.setProgress(0);
closeProgressPopup();
} else if (progress < 100 && progress > 80) {
progressDialogHorizontal.setProgress(progress + 1);
handler.postDelayed(this, 2000);
} else if (progress <= 80 && progress >= 60) {
progressDialogHorizontal.setProgress(progress + 2);
handler.postDelayed(this, 1000);
} else if (progress < 60) {
progressDialogHorizontal.setProgress(progress + 4);
handler.postDelayed(this, 1000);
}
}
});
} else {
Logger.e(TAG, "resourceId == null");
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
}
});
}
} catch (AcmsException ex) {
Logger.e(TAG, ex);
if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P007) {
// シーン追加時、ロック状態である場合
runOnUiThread(new Runnable() {
@Override
public void run() {
closeProgressPopup();
webViewLoadUrl(String.format("javascript:EDC.handleError({ 'status' : 400 }, '', {'message' : 'C018'})"));
}
});
} else {
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
showFailedSceneApiDialog();
}
});
}
} catch (Exception e) {
Logger.e(TAG, e);
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
showFailedSceneApiDialog();
}
});
} finally {
//アプリ内のファイルのみ削除(Galleryファイルは削除しない)
if (mLocalFile != null && mLocalFile.getPath().contains(getPackageName())) {
FileUtil.delete(mLocalFile);
}
mLocalFile = null;
}
}
}
});
}
});
alertDialog.show();
} catch (Exception e) {
Logger.e(TAG, e);
closeProgressPopup();
ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107);
}
}
/**
* シーン追加API通信で失敗時のダイアログ表示
*/
......
......@@ -58,7 +58,7 @@ public class SceneSendHelper {
if (isBaseSceneUpload && !isBaseSceneUploadSuccess && firstFilePath.equals(filePath)) {
AbstractLogic.getLogic(OperationLogic.class).sendPanoContent(operationId, OperationName, file);
} else {
AbstractLogic.getLogic(OperationLogic.class).sendScene(file);
AbstractLogic.getLogic(OperationLogic.class).sendScene(file, null);
}
needSendImages.remove(filePath);
......
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