Commit 09e97798 by onuma

チャットルームへ遷移する関数を作成

parent d1d7ccfa
......@@ -5,6 +5,7 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;
......@@ -25,11 +26,16 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.util.AppUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationRelatedContentActivity;
import jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity;
import jp.agentec.adf.util.StringUtil;
public class ABVFcmListenerService extends FirebaseMessagingService {
......@@ -55,33 +61,24 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> msg = remoteMessage.getData();
Map<String, String> messageMap = remoteMessage.getData();
Logger.d(TAG,"onMessageReceived(): msg :"+ msg);
Logger.d(TAG,"onMessageReceived(): messageMap :"+ messageMap);
try {
UserAuthenticateLogic logic = AbstractLogic.getLogic(UserAuthenticateLogic.class);
MemberInfoDto memberInfo = logic.getMemberInfo();
boolean hasMessageBody = !StringUtil.isNullOrWhiteSpace(msg.get(AppDefType.PushMessageKey.message));
boolean hasMessageBody = !StringUtil.isNullOrWhiteSpace(messageMap.get(AppDefType.PushMessageKey.message));
boolean isPushMessageEnabled = this.getResources().getInteger(R.integer.push_message) == 1;
if (hasMessageBody && isPushMessageEnabled && memberInfo != null) {
// Check pushmessage by chat
String tempMsg = msg.get(AppDefType.PushMessageKey.message);
Long roomId = null;
String messageBody = messageMap.get(AppDefType.PushMessageKey.message);
String roomName = "";
String pushSendLoginId = "";
long pushSendDate = 0;
Log.d(TAG,"tempMsg : "+ tempMsg);
if (Objects.requireNonNull(tempMsg).indexOf(AppDefType.ChatPushMessageKey.pushSendLoginId) > 0) {
JSONObject json = new JSONObject(tempMsg);
roomId = json.getLong(AppDefType.ChatPushMessageKey.roomId);
roomName = json.getString(AppDefType.ChatPushMessageKey.roomName);
pushSendLoginId = json.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
pushSendDate = json.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
String textMessage = json.getString(AppDefType.PushMessageKey.message);
Log.d(TAG,"messageBody : "+ messageBody);
if (Objects.requireNonNull(messageBody).indexOf(AppDefType.ChatPushMessageKey.pushSendLoginId) > 0) {
PushMessageJSON json = new PushMessageJSON(messageBody);
roomName = json.getRoomName();
//TODO pushメッセージが到着した際、新着メッセージかルーム招待か判別してDB格納が必要
//Integer insertId = 0;
//Integer messageType = 0;
......@@ -89,37 +86,19 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
//ChatMessageDto chatMessageDto = new ChatMessageDto();
//chatMessageDto.chatRoomId =
//chatRoomId shopMemberId messge messageType insertDate
if (textMessage.length() > 0) {
tempMsg = textMessage;
}
if (AppUtil.isAppForground(this)) {
msg.put(AppDefType.PushMessageKey.message, textMessage);
}
String roomType = null;
String[] inviteMessage;
if (textMessage.contains(INVITE_COLLABORATION)) {
roomType = Integer.toString(json.getInt(AppDefType.ChatPushMessageKey.roomType));
inviteMessage = textMessage.split(CHAT_MESSAGE_SEPERATOR);
//showCollaborationPopUpMessage(roomId, roomName, roomType, pushSendLoginId, pushSendDate, inviteMessage[1]);
//return;
Logger.i(TAG,"" + roomType);
Logger.i(TAG,"" + inviteMessage[1]);
}
}
if (AppUtil.isAppForground(this)) {
String data = msg.get(AppDefType.PushMessageKey.data);
String operationID = msg.get(AppDefType.PushMessageKey.operationId);
if (roomName.length() > 0) {
showChatRoomPopupMessage(tempMsg, data, operationID, roomId, roomName, pushSendLoginId, pushSendDate);
//showChatRoomPopupMessage(tempMsg, data, operationID, roomId, roomName, pushSendLoginId, pushSendDate);
showChatRoomPopupMessage(messageMap);
} else {
showOperationPopUpMessage(tempMsg, data, operationID);
String data = messageMap.get(AppDefType.PushMessageKey.data);
String operationID = messageMap.get(AppDefType.PushMessageKey.operationId);
showOperationPopUpMessage(messageBody, data, operationID);
}
} else {
sendNotification(msg);
sendNotification(messageMap);
}
}
} catch (ABVException e) {
......@@ -130,6 +109,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
}
}
/*
private void showCollaborationPopUpMessage(
Long roomId,
String roomName,
......@@ -151,35 +131,50 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomType, roomType);
startActivity(pushMsgDialog);
}
*/
/**
* プッシュメッセージをダイアログ表示する
*/
private void showChatRoomPopupMessage(Map<String, String> messageMap) {
String messageBody = messageMap.get(AppDefType.PushMessageKey.message);
PushMessageJSON json;
if (StringUtil.isNullOrEmpty(messageBody)) {
return;
}
json = new PushMessageJSON(messageBody);
private void showChatRoomPopupMessage(
String textMessage,
String data,
String operationID,
Long roomID,
String roomName,
String pushSendLoginId,
long pushSendDate)
{
Activity currentActivity = ActivityHandlingHelper.getInstance().getCurrentActivity();
if (currentActivity.getClass().equals(ChatWebViewActivity.class)) {
ChatWebViewActivity chatWebViewActivity = (ChatWebViewActivity) currentActivity;
if (chatWebViewActivity.getRoomID().equals(roomID)) {
if (chatWebViewActivity.getRoomID().equals(json.getRoomId())) {
// push messageと同じ部屋にいる場合はpushmessageを送信しない。
return;
}
}
String fromClassName = currentActivity.getClass().getName();
if (currentActivity.getClass().equals(HTMLWebViewActivity.class) ||
currentActivity.getClass().equals(ContentViewActivity.class) ||
currentActivity.getClass().equals(OperationRelatedContentActivity.class) ||
currentActivity.getClass().equals(OperationListActivity.class)
){
// 呼び出し元のActivity名を保存しておく
messageMap.put(AppDefType.ChatPushMessageKey.fromClassName, fromClassName);
((ABVAuthenticatedActivity)currentActivity).showChatRoomPopupMessage((Context)currentActivity, messageMap);
} else {
// 既存の処理
Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class);
pushMsgDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, textMessage);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, data);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, operationID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, roomID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, json.getMessage());
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, json.getData());
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, json.getOperationID());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, json.getRoomId());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, json.getRoomName());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, json.getPushSendLoginId());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, json.getPushSendDate());
startActivity(pushMsgDialog);
}
}
private void showOperationPopUpMessage(String textMessage, String data, String operationID) {
Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class);
......@@ -190,6 +185,10 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
startActivity(pushMsgDialog);
}
/**
* アプリがバックグラウンドなので通知エリアにアイコン表示する。
* アイコンタップ時の情報を作成する。
*/
private void sendNotification(Map<String, String> message) {
Intent intent = instantiatePushNotificationIntent(message);
......@@ -206,7 +205,6 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
mNotificationManager.notify(uniqueId, notification);
}
} else {
//mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification.Builder nb = getNotificationBuilder(pendingIntent, message);
......@@ -266,8 +264,6 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
roomType = Integer.toString(json.getInt(AppDefType.ChatPushMessageKey.roomType));
String[] inviteMessage = textMessage.split(CHAT_MESSAGE_SEPERATOR);
collaborationType = inviteMessage[1];
//showCollaborationPopUpMessage(roomId, roomName, roomType, pushSendLoginId, pushSendDate, inviteMessage[1]);
//return;
}
String roomName = json.getString(AppDefType.ChatPushMessageKey.roomName);
String pushMsg = json.getString(AppDefType.PushMessageKey.message);
......@@ -280,8 +276,9 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
long roomId = json.getLong(AppDefType.ChatPushMessageKey.roomId);
long pushSendDate = json.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
String pushSendLoginId = json.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
//String roomType = json.getString(AppDefType.ChatPushMessageKey.roomType);
String collaobrationInvitedMessage = getContentText(textMessage);
intent.putExtra(AppDefType.PushMessageKey.message, collaobrationInvitedMessage);
intent.putExtra(AppDefType.ChatPushMessageKey.roomId, roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
intent.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
......@@ -293,13 +290,14 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
}
private Notification.Builder getNotificationBuilder(PendingIntent pendingIntent, Map<String, String> message) {
String txtMessage = getContentText(message.get(AppDefType.PushMessageKey.message));
return new Notification.Builder(this)
.setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon(R.drawable.icon)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentTitle(getString(R.string.app_name))
.setContentText(message.get(AppDefType.PushMessageKey.message))
.setContentText(txtMessage)
.setContentIntent(pendingIntent);
}
......@@ -310,4 +308,25 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
}
return downloadUrl;
}
/**
* 通知エリアに表示するテキストを決定する
* @param textMessage プッシュメッセージをJSONOjbcetにした時の、AppDefType.PushMessageKey.message の値
* @return 表示するテキスト
*/
private String getContentText(String textMessage) {
if (!StringUtil.isNullOrEmpty(textMessage) && textMessage.contains(INVITE_COLLABORATION)) {
return getString(R.string.msg_invite_collaboration);
}
return textMessage;
}
/**
* プッシュメッセージからJSONObjectを作成する。
* @param jsonText 受信したプッシュメッセージをJSONObjectにする。
* @return
*/
private JSONObject createMessageJsonObject(String jsonText) {
return new JSONObject(jsonText);
}
}
......@@ -30,6 +30,7 @@ import com.google.firebase.iid.FirebaseInstanceId;
import java.io.FileNotFoundException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
......@@ -40,6 +41,7 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.AlertMessageLevel;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
......@@ -67,6 +69,7 @@ import jp.agentec.abook.abv.bl.logic.MemoLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.push.PushMessageJSON;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.cl.util.StorageUtil;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
......@@ -158,6 +161,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
int PAYMENT = 3;
}
// ABookCommunicationでチャットの情報を格納しておく
private Long roomId = new Long(0);
private String roomName = "";
private String collaborationType = "";
private String roomType = "";
private String fromClassName = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -1235,4 +1245,129 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
return existUnreadFlg;
}
/**
* プッシュメッセージ受信後のダイアログを表示する。
* @param context コンテキスト
* @param textMessage プッシュメッセージ
* @param data Intentに付属するデータ
* @param operationID operationID
* @param roomID roomID
* @param roomName roomName
* @param roomType roomType
* @param pushSendLoginId pushSendLoginId
* @param pushSendDate pushSendDate
* @param collaborationType ABookCommConstants.COLLABORATION_TYPE のいずれか
*/
/**
public void showChatRoomPopupMessage(
Context context,
String textMessage,
String data,
String operationID,
Long roomID,
String roomName,
String roomType,
String pushSendLoginId,
long pushSendDate,
String collaborationType,
String fromClassName
) {
Intent pushMsgDialog = new Intent(context, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, textMessage);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, data);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, operationID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, roomID);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName, fromClassName);
this.roomId = roomID;
this.roomName = roomName;
this.collaborationType = collaborationType;
this.roomType = roomType;
this.fromClassName = fromClassName;
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
}
*/
/**
* チャットルームへ遷移する。
*/
/**
public void goChatRoom() {
if (roomId <= 0 && StringUtil.isNullOrEmpty(roomName)) {
return;
}
if (StringUtil.isNullOrEmpty(collaborationType)) {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(roomId, roomName, "");
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(roomId, roomName, collaborationType, roomType, "");
}
}
*/
/**
* ッシュメッセージがあるので、チャットルームに遷移する。
*/
public void goChatRoom(final Intent intent, final String fromClassName) {
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
Logger.d(TAG,"fromClassName = " + fromClassName);
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomType)) &&
!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.collaborationType))
) {
// roomTypeと、collaborationType が存在する場合は、協業を開始する。
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName),
intent.getStringExtra(AppDefType.ChatPushMessageKey.collaborationType),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomType),
intent.getStringExtra(AppDefType.ChatPushMessageKey.fromClassName));
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName),"");
}
}
}, 500);
}
}
/**
* プッシュメッセージ受信後のダイアログを表示する。
* @param context コンテキスト
* @param messageMap プッシュメッセージ
*/
public void showChatRoomPopupMessage(Context context, Map<String, String> messageMap) {
String messageBody = messageMap.get(AppDefType.PushMessageKey.message);
PushMessageJSON json;
if (StringUtil.isNullOrEmpty(messageBody)) {
return;
}
json = new PushMessageJSON(messageBody);
Intent pushMsgDialog = new Intent(context, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, json.getMessage());
pushMsgDialog.putExtra(AppDefType.PushMessageKey.data, json.getData());
pushMsgDialog.putExtra(AppDefType.PushMessageKey.operationId, json.getOperationID());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, json.getRoomId());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, json.getRoomName());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, json.getPushSendLoginId());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, json.getPushSendDate());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName, messageMap.get(AppDefType.ChatPushMessageKey.fromClassName));
/**
this.roomId = roomID;
this.roomName = roomName;
this.collaborationType = collaborationType;
this.roomType = roomType;
this.fromClassName = fromClassName;
*/
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
}
}
......@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.ui.common.activity;
import android.content.DialogInterface;
import android.os.Bundle;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
......@@ -123,7 +124,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
isCollabration = MeetingManager.getInstance().isCollaboration();
Bundle extras = getIntent().getExtras();
if (extras != null && !isMeetingRoomConnected) {
moveChatRoom(extras);
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK, getIntent());
finish();
}
if (isMeetingRoomConnected || isCollabration) {
......@@ -134,6 +135,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.CANCEL, getIntent());
finish();
}
});
......@@ -147,6 +149,8 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
* チャットルームへ遷移するための処理
* @param extras
*/
/** ここでチャットルームには移動させない */
/**
private void moveChatRoom(Bundle extras) {
Long roomId = extras.getLong(AppDefType.ChatPushMessageKey.roomId, 0);
String roomName = extras.getString(AppDefType.ChatPushMessageKey.roomName);
......@@ -161,6 +165,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
}
}
}
*/
/**
* 遠隔支援中(会議室接続中)はチャットルームにはいけない。
......
......@@ -776,6 +776,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
/**
* 作業一覧へ遷移
*
*/
public void backToHome() {
mChatWebView.leaveRoom();
......
......@@ -63,6 +63,7 @@ import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.common.Constant.TaskReportLevel;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
......@@ -354,24 +355,6 @@ public class OperationListActivity extends ABVUIActivity {
alertDialog.show();
}
}
// プッシュメッセージがある場合
else if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomType)) &&
!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.ChatPushMessageKey.collaborationType))
) {
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.collaborationType),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomType));
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName));
}
}
// リスト更新
setOperationListView();
......@@ -532,6 +515,11 @@ public class OperationListActivity extends ABVUIActivity {
return;
}
refreshOperationList();
// プッシュメッセージがある場合の処理
getIntent().putExtra(AppDefType.ChatPushMessageKey.fromClassName, this.getClass().getName());
goChatRoom(getIntent(), "");
// 報告画面から作業一覧へ戻った時の同期処理
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
if (operationId != -1) {
......@@ -569,6 +557,37 @@ public class OperationListActivity extends ABVUIActivity {
configurationToolbarIcon();
}
/**
* ッシュメッセージがあるので、チャットルームに遷移する。
*/
/*
public void goChatRoom(final Intent intent) {
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomType)) &&
!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.collaborationType))
) {
// roomTypeと、collaborationType が存在する場合は、協業を開始する。
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName),
intent.getStringExtra(AppDefType.ChatPushMessageKey.collaborationType),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomType), "");
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName), "");
}
}
}, 500);
}
}
*/
// 検索ダイアログ表示
private void showSearchDialog() {
contentRefresher.stopRefresh();
......@@ -1261,6 +1280,15 @@ public class OperationListActivity extends ABVUIActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode,requestCode, intent);
// プッシュメッセージダイアログのリザルトだった場合
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
goChatRoom(intent, "");
}
return;
}
activityResultFlg = true;
Uri result = (intent == null || resultCode != RESULT_OK) ? null : intent.getData();
//ベースファイル登録した後にシーン画像選択画面閉じた後に呼ばれる
......
......@@ -26,6 +26,7 @@ import java.util.Stack;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.ExceptionHandler;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
......@@ -595,4 +596,17 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
super.showAlertDialog(alertDialog);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
//backToHome();
finish();
goChatRoom(intent, "");
}
return;
}
}
}
......@@ -1668,8 +1668,12 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
getCurrentActivity().startActivity(intent);
}
// プシュメッセージからチャットに入る
public void startChatWebViewActivity(Long roomId, String roomName) {
/**
* プシュメッセージからチャットに遷移する
* @param roomId
* @param roomName
*/
public void startChatWebViewActivity(Long roomId, String roomName, String nextActivityName) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
......@@ -1682,7 +1686,19 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.putExtra(AppDefType.ChatPushMessageKey.shopName, shopName);
intent.putExtra(AppDefType.ChatPushMessageKey.roomId, roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
intent.setClassName(mContext.getPackageName(), className);
String nextActivity = className;
//if (fromClassName.equals(HTMLWebViewActivity.class.getName())) {
// フォームからきたら
//nextActivity = OperationListActivity.class.getName();
//} else if(fromClassName.equals(ContentViewActivity.class.getName())){
// 資料からきたら
//nextActivity = OperationRelatedContentActivity.class.getName();
//}
//intent.setClassName(mContext.getPackageName(), className);
intent.setClassName(mContext.getPackageName(), nextActivity);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
......@@ -1912,7 +1928,14 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
this.previousOfSettingActivity2 = activity;
}
public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType) {
/**
* プッシュメッセージから協業に遷移する
* @param roomId
* @param roomName
* @param collaborationType
* @param roomType
*/
public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType, String fromClassName) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
......
......@@ -94,6 +94,7 @@ import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ExceptionHandler;
import jp.agentec.abook.abv.bl.common.log.Logger;
......@@ -3829,6 +3830,15 @@ public class ContentViewActivity extends ABVContentViewActivity {
Uri[] result = null;
Uri dataUri = null;
// プッシュメッセージダイアログのリザルトだった場合
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
finishActivity();
goChatRoom(intent, "");
}
return;
}
if (intent != null && resultCode == RESULT_OK) {
String dataString = intent.getDataString();
if (dataString != null) {
......@@ -3844,7 +3854,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
isAnotherViewOpenFlg = false;
// playPageBGMSound(mCurrentPageNumber); //프리뷰 모드 일때 음악재생 Bug
break;
case ABOOK_CHECK_TASK_IMAGE:
case ABookCommConstants.ABOOK_CHECK_TASK_IMAGE:
if (mUploadMessage == null) {
return;
}
......@@ -3865,7 +3875,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107);
}
break;
case ABOOK_CHECK_TASK_VIDEO:
case ABookCommConstants.ABOOK_CHECK_TASK_VIDEO:
if (mUploadMessage == null) {
return;
}
......
......@@ -32,6 +32,7 @@ import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
......@@ -42,6 +43,7 @@ import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.launcher.android.R;
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.constant.NaviConsts;
......@@ -49,6 +51,8 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.StringUtil;
//TODO: later 遠隔連動関連はContentView,NoPdfViewと共通しているので要集約
public class HTMLWebViewActivity extends ParentWebViewActivity {
......@@ -219,10 +223,10 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
FileChooserParams fileChooserParams) {
boolean result = false;
if (fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.IMAGE) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
result = startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
} else if (fileChooserParams.getAcceptTypes()[0].toLowerCase().indexOf(ABookKeys.VIDEO) != -1) {
result = startCameraIntent(ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
result = startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
if (result) {
......@@ -683,8 +687,18 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
protected void onActivityResult(int requestCode, int resultCode, final Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
// プッシュメッセージダイアログのリザルトだった場合
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
finishActivity();
goChatRoom(intent, this.getClass().getName());
}
return;
}
Uri[] result = null;
Uri dataUri = null;
if (intent != null && resultCode == RESULT_OK) {
......@@ -695,7 +709,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
}
if (requestCode == ABOOK_CHECK_TASK_IMAGE) {
if (requestCode == ABookCommConstants.ABOOK_CHECK_TASK_IMAGE) {
if (mUploadMessage == null) {
return;
}
......@@ -715,12 +729,12 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
mUploadMessage.onReceiveValue(null);
ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107);
}
} else if (requestCode == ABOOK_CHECK_TASK_VIDEO) {
} else if (requestCode == ABookCommConstants.ABOOK_CHECK_TASK_VIDEO) {
if (mUploadMessage == null) {
return;
}
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
} else if (requestCode == ABookCommConstants.ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result[0]);
}
......
......@@ -257,7 +257,6 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
}
}
}
......
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