Commit bc755451 by onuma

Merge branch 'communication/develop_onuma' into 'communication/develop'

プッシュメッセージからチャットと協業に遷移する時、iOSと同じ遷移にした.

See merge request !206
parents ac488c42 b7220ec9
......@@ -46,7 +46,6 @@ public class ChatPushDataJSON extends AcmsCommonJSON {
if (pushMessagetJsonArray.getJSONObject(k).length() == 0) {
break;
}
PushMessageDto pushMessageDto = new PushMessageDto();
String tempDate = DateTimeUtil.toString(DateTimeUtil.toDate(pushMessagetJsonArray.getJSONObject(k).getString(PushSendDate), DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmssSSS_none);
pushMessageDto.pushMessageId = Long.valueOf(tempDate);
......
......@@ -169,8 +169,9 @@ public interface ABookCommConstants {
String CONTACT_URL = "file:///android_asset/chat/public_new/contact.html";
String COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration.html";
String DEFAULT_CHECKSUM = "0000000000";
String PLATFORM_NAME = "android";
String CHAT_MESSAGE_SEPERATOR = "<::split>";
String INVITE_COLLABORATION = "inviteCollaboration" + CHAT_MESSAGE_SEPERATOR;
int PUSH_MESSAGE_DLG_REQUEST_CODE = 200;
interface PUSH_MESSAGE_DLG_RESULT {
......
......@@ -19,6 +19,7 @@ import org.json.adf.JSONObject;
import java.util.Map;
import java.util.Objects;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
......@@ -36,14 +37,14 @@ 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.abook.abv.ui.viewer.activity.ImageViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.VideoViewActivity;
import jp.agentec.adf.util.StringUtil;
public class ABVFcmListenerService extends FirebaseMessagingService {
private static final String TAG = "ABVFcmListenerService";
private NotificationManager mNotificationManager;
private static int mNotificationConnect = 0;
private final String CHAT_MESSAGE_SEPERATOR = "<::split>";
private final String INVITE_COLLABORATION = "inviteCollaboration" + CHAT_MESSAGE_SEPERATOR;
@Override
public void onCreate() {
......@@ -59,41 +60,26 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
}
}
/**
* プッシュメッセージ受信時処理
* @param remoteMessage プッシュメッセージ
*/
@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;
String textMessage = "";
String strRoomType = "";
Log.d(TAG,"tempMsg : "+ tempMsg);
if (Objects.requireNonNull(tempMsg).indexOf(AppDefType.ChatPushMessageKey.pushSendLoginId) > 0) {
JSONObject json = new JSONObject(tempMsg);
Log.d(TAG,"messageBody : "+ messageBody);
roomId = json.getLong(AppDefType.ChatPushMessageKey.roomId);
roomName = json.getString(AppDefType.ChatPushMessageKey.roomName);
pushSendLoginId = json.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
pushSendDate = json.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
textMessage = json.getString(AppDefType.PushMessageKey.message);
strRoomType = Integer.toString(json.getInt(AppDefType.ChatPushMessageKey.roomType));
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;
......@@ -101,46 +87,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)) {
String data = msg.get(AppDefType.PushMessageKey.data);
String operationID = msg.get(AppDefType.PushMessageKey.operationId);
msg.put(AppDefType.PushMessageKey.message, textMessage);
if (textMessage.contains(INVITE_COLLABORATION)) {
// 協業に招待された場合
String[] inviteMessage = textMessage.split(CHAT_MESSAGE_SEPERATOR);
showChatRoomPopupMessage(getString(R.string.msg_invite_collaboration),
"",
"",
roomId,
roomName,
strRoomType,
pushSendLoginId,
pushSendDate,
inviteMessage[1]);
return;
}
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 {
// 通知用Intent作成(アプリがバックグラウンド時用)
sendNotification(msg);
sendNotification(messageMap);
}
}
} catch (ABVException e) {
......@@ -151,87 +110,52 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
}
}
private void showCollaborationPopUpMessage(
String textMessage,
String data,
String operationID,
Long roomId,
String roomName,
String roomType,
String pushSendLoginId,
long pushSendDate,
String collaborationType)
{
Activity currentActivity = ActivityHandlingHelper.getInstance().getCurrentActivity();
String fromClassName = currentActivity.getClass().getName();
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.roomType, roomType);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, collaborationType);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName, fromClassName);
startActivity(pushMsgDialog);
}
/**
* プッシュメッセージをダイアログ表示する
* @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 のいずれか
* @param messageMap 受信したメッセージを格納したMapオブジェクト
*/
private void showChatRoomPopupMessage(
String textMessage,
String data,
String operationID,
Long roomID,
String roomName,
String roomType,
String pushSendLoginId,
long pushSendDate,
String collaborationType
) {
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);
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)
currentActivity.getClass().equals(OperationListActivity.class) ||
currentActivity.getClass().equals(ImageViewActivity.class) ||
currentActivity.getClass().equals(VideoViewActivity.class)
){
((ABVAuthenticatedActivity)currentActivity).showChatRoomPopupMessage((Context)currentActivity, textMessage,
data, operationID, roomID, roomName, roomType, pushSendLoginId, pushSendDate, collaborationType, fromClassName);
// 呼び出し元のActivityの名前をmessageMapに追加する
messageMap.put(AppDefType.ChatPushMessageKey.fromActivityName, fromClassName);
messageMap.put(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen, "true");
((ABVAuthenticatedActivity)currentActivity).showChatRoomPopupMessage((Context)currentActivity, messageMap);
} else {
// それ以外のActivityの場合の処理
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.roomType, roomType);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, collaborationType);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromClassName, fromClassName);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, getContentText(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.roomType, json.getRoomType());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, json.getCollaborationType());
startActivity(pushMsgDialog);
}
}
......@@ -245,6 +169,10 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
startActivity(pushMsgDialog);
}
/**
* アプリがバックグラウンドなので通知エリアにアイコン表示する。
* アイコンタップ時の情報を作成する。
*/
private void sendNotification(Map<String, String> message) {
Intent intent = instantiatePushNotificationIntent(message);
......@@ -261,7 +189,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);
......@@ -307,8 +234,21 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
return intent;
}
JSONObject json = new JSONObject(tempMsg);
String textMessage = json.getString(AppDefType.PushMessageKey.message);
if (textMessage.length() > 0){
//tempMsg = textMessage;
}
String roomType = "";
String collaborationType = "";
if (textMessage.contains(ABookCommConstants.INVITE_COLLABORATION)) {
roomType = Integer.toString(json.getInt(AppDefType.ChatPushMessageKey.roomType));
String[] inviteMessage = textMessage.split(ABookCommConstants.CHAT_MESSAGE_SEPERATOR);
collaborationType = inviteMessage[1];
}
String roomName = json.getString(AppDefType.ChatPushMessageKey.roomName);
String pushMsg = json.getString(AppDefType.PushMessageKey.message);
message.put(AppDefType.PushMessageKey.message, pushMsg);
......@@ -320,24 +260,28 @@ 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 strRoomType = Integer.toString(json.getInt(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);
intent.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
intent.putExtra(AppDefType.ChatPushMessageKey.roomType, strRoomType);
intent.putExtra(AppDefType.ChatPushMessageKey.roomType, roomType);
intent.putExtra(AppDefType.ChatPushMessageKey.collaborationType, collaborationType);
return intent;
}
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);
}
......@@ -348,4 +292,16 @@ 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(ABookCommConstants.INVITE_COLLABORATION)) {
return getString(R.string.msg_invite_collaboration);
}
return textMessage;
}
}
package jp.agentec.abook.abv.cl.push;
import android.content.Intent;
import org.json.adf.JSONObject;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.adf.util.StringUtil;
/**
* プッシュメッセージをJSONにしたクラス
* 既存のデータのキーは、AppDefType.PushMessageKey
* チャットで追加されたデータのキーは、AppDefType.ChatPushMessageKey
*/
public class PushMessageJSON {
private JSONObject jsonObject;
public PushMessageJSON(String jsonText) {
jsonObject = new JSONObject(jsonText);
}
// プッシュメッセージデータ
public String getMessage() {
return jsonObject.getString(AppDefType.PushMessageKey.message);
}
public String getData() {
try {
return jsonObject.getString(AppDefType.PushMessageKey.data);
} catch (Exception e) {
return "";
}
}
public String getOperationID() {
try {
return jsonObject.getString(AppDefType.PushMessageKey.operationId);
} catch (Exception e) {
return "";
}
}
// ここからチャットデータ
public String getRoomName() {
try {
return jsonObject.getString(AppDefType.ChatPushMessageKey.roomName);
} catch (Exception e){
return "";
}
}
public Long getRoomId() {
try {
return jsonObject.getLong(AppDefType.ChatPushMessageKey.roomId);
} catch (Exception e){
return new Long(0);
}
}
public String getRoomType() {
try {
int roomType = jsonObject.getInt(AppDefType.ChatPushMessageKey.roomType);
return Integer.toString(roomType);
} catch (Exception e){
return "";
}
}
public String getPushSendLoginId() {
try {
return jsonObject.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
} catch (Exception e) {
return "";
}
}
public long getPushSendDate() {
try {
return jsonObject.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
} catch (Exception e) {
return 0;
}
}
public boolean isCollaboration() {
String message = getMessage();
if (message.contains(ABookCommConstants.INVITE_COLLABORATION)) {
return true;
}
return false;
}
public String getCollaborationType() {
try {
String message = getMessage();
if (message.contains(ABookCommConstants.INVITE_COLLABORATION)) {
String[] inviteMessage = message.split(ABookCommConstants.CHAT_MESSAGE_SEPERATOR);
return inviteMessage[1];
}
return jsonObject.getString(AppDefType.ChatPushMessageKey.collaborationType);
} catch (Exception e) {
return "";
}
}
}
......@@ -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;
......@@ -68,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;
......@@ -159,12 +161,9 @@ 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 = "";
// 遷移元のアクティビティ名
// PushMessage受信時に直接ChatRoomへ行かずに、ひとつまえのActivityに戻る為に使用する。
public String baseActivityName;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -1247,61 +1246,77 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
/**
* プッシュメッセージ受信後のダイアログを表示する。
* @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;
public boolean goChatRoom(final Intent intent, final String nextActivityName, final String fromActivityName) {
if (!StringUtil.isNullOrEmpty(intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
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),
nextActivityName,
fromActivityName);
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(
intent.getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
intent.getStringExtra(AppDefType.ChatPushMessageKey.roomName),
nextActivityName,
fromActivityName);
}
}
}, 500);
return true;
}
return false;
}
/**
* チャットルームへ遷移する。
* プッシュメッセージ受信後のダイアログを表示する。
* @param context コンテキスト
* @param messageMap プッシュメッセージ
*/
public void goChatRoom() {
if (roomId <= 0 && StringUtil.isNullOrEmpty(roomName)) {
public void showChatRoomPopupMessage(Context context, Map<String, String> messageMap) {
String messageBody = messageMap.get(AppDefType.PushMessageKey.message);
if (StringUtil.isNullOrEmpty(messageBody)) {
return;
}
if (StringUtil.isNullOrEmpty(collaborationType)) {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(fromClassName, roomId, roomName, roomType);
PushMessageJSON json = new PushMessageJSON(messageBody);
// 協業
String messageText = json.getMessage();
if (json.isCollaboration()) {
messageText = getString(R.string.msg_invite_collaboration);
}
Intent pushMsgDialog = new Intent(context, ShowPushMessageDailogActivity.class);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, messageText);
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.roomType, json.getRoomType());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, json.getCollaborationType());
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, messageMap.get(AppDefType.ChatPushMessageKey.fromActivityName));
String newVersion = messageMap.get(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen);
if (newVersion != null && newVersion.equals(new String("true"))) {
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen, true);
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(fromClassName, roomId, roomName, collaborationType, roomType);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen, false);
}
startActivityForResult(pushMsgDialog, ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE);
}
}
......@@ -17,7 +17,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
......@@ -41,7 +40,6 @@ 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.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;
......@@ -72,12 +70,10 @@ 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.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.CheckOZDViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.NoPdfViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.PhotoEditActivity;
......@@ -163,6 +159,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
isLinkedContent = intent.getBooleanExtra("isLinkedContent", false);
mOperationId = intent.getLongExtra(ABookKeys.OPERATION_ID, -1);
// 遷移元のActivity
baseActivityName = getIntent().getStringExtra(AppDefType.ChatPushMessageKey.fromActivityName);
if (!isLinkedContent) {
operationDto = AbstractLogic.getLogic(OperationLogic.class).getOperation(mOperationId);
mXWalkOpenType = intent.getIntExtra(Constant.ABookCheck.XWALK_OPEN_TYPE, Constant.XWalkOpenType.DEFAULT);
......
......@@ -392,6 +392,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
intent.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, extras.getString(AppDefType.ChatPushMessageKey.pushSendLoginId)); // sendLoginId
intent.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, extras.getLong(AppDefType.ChatPushMessageKey.pushSendDate));
intent.putExtra(AppDefType.ChatPushMessageKey.roomType, extras.getString(AppDefType.ChatPushMessageKey.roomType));
intent.putExtra(AppDefType.ChatPushMessageKey.collaborationType, extras.getString(AppDefType.ChatPushMessageKey.collaborationType));
}
}
intent.setClassName(getApplicationContext().getPackageName(), getMainActivityClassName()).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
......
package jp.agentec.abook.abv.ui.common.activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
......@@ -17,6 +16,7 @@ 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;
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.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.StringUtil;
......@@ -125,8 +125,13 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
isCollabration = MeetingManager.getInstance().isCollaboration();
Bundle extras = getIntent().getExtras();
if (extras != null && !isMeetingRoomConnected) {
boolean isNewVersion = extras.getBoolean(AppDefType.ChatPushMessageKey.needsDisplayOperationOrOperationRelatedContentScreen);
if (isNewVersion) {
setResult(ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK, getIntent());
finish();
} else {
moveChatRoom(extras);
}
}
if (isMeetingRoomConnected || isCollabration) {
showCannotMoveChatRoomDialog();
......@@ -147,6 +152,29 @@ 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);
String collaborationType = extras.getString(AppDefType.ChatPushMessageKey.collaborationType);
String roomType = extras.getString(AppDefType.ChatPushMessageKey.roomType);
if (roomId > 0 && !StringUtil.isNullOrEmpty(roomName)) {
if (StringUtil.isNullOrEmpty(collaborationType)) {
ActivityHandlingHelper.getInstance().startChatWebViewActivity(roomId, roomName, ChatWebViewActivity.class.getName(),"");
} else {
ActivityHandlingHelper.getInstance().startChatWebViewActivityWithCollaboration(roomId,
roomName,
collaborationType,
roomType,
ChatWebViewActivity.class.getName(),
"");
}
}
}
/**
* 遠隔支援中(会議室接続中)はチャットルームにはいけない。
*/
private void showCannotMoveChatRoomDialog() {
......
......@@ -145,8 +145,9 @@ public interface AppDefType {
String pushSendDate = "pushSendDate";
String collaborationType = "collaborationType";
String roomType = "roomType";
String fromClassName = "fromClassName";
String shopName = "shopName";
String loginId = "loginId";
String fromActivityName = "fromActivityName";
String needsDisplayOperationOrOperationRelatedContentScreen = "needsDisplayOperationOrOperationRelatedContentScreen";
}
}
......@@ -166,6 +166,9 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
chatData.setIsOnline(false);
chatData.setContext(ChatWebViewActivity.this);
chatData.setIsMobile(!isNormalSize());
// どのアクティビティから遷移してきたか保存
baseActivityName = intent.getStringExtra(AppDefType.ChatPushMessageKey.fromActivityName);
}
private void setupChatWebView() {
......@@ -307,7 +310,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
result = startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
// 動画が選択された場合
} else if (fileChooserParams.getAcceptTypes()[0].toLowerCase().contains(ABookKeys.VIDEO)) {
result = startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_VIDEO, "Camera", ABookKeys.VIDEO, true);
result = startCameraIntent(ABookCommConstants.ABOOK_CHECK_TASK_VIDEO, "Video", ABookKeys.VIDEO, true);
}
if (result) {
if (mUploadMessage != null) {
......@@ -776,13 +779,20 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
/**
* 作業一覧へ遷移
*
*/
public void backToHome() {
mChatWebView.leaveRoom();
exitAndDeleteMeetingRoom();
finish();
// 戻るの作業一覧か、関連資料のどちらかのActivityのみ
Intent intent = new Intent();
if (OperationListActivity.class.getName().equals(baseActivityName)) {
intent.setClass(ChatWebViewActivity.this, OperationListActivity.class);
} else {
intent.setClass(ChatWebViewActivity.this, OperationRelatedContentActivity.class);
}
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent, NaviConsts.Left);
}
......
......@@ -7,6 +7,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
......@@ -97,6 +98,7 @@ import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.common.view.ABVListDialog;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.adapter.HierarchyOperationGroupListAdapter;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.HomeOperationListHelper;
......@@ -557,18 +559,8 @@ public class OperationListActivity extends ABVUIActivity {
screenRefresh();
// プッシュメッセージ処理
if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
ActivityHandlingHelper.getInstance().startChatWebViewActivity("",
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomType));
}
},1000);
// プッシュメッセージがある場合の処理
if (goChatRoom(getIntent(), ChatWebViewActivity.class.getName(), OperationListActivity.class.getName())) {
return;
}
......@@ -813,6 +805,7 @@ public class OperationListActivity extends ABVUIActivity {
intent.putExtra(ABookKeys.OPERATION_ID, operationDto.operationId);
intent.putExtra(Constant.ABookCheck.XWALK_OPEN_TYPE, Constant.XWalkOpenType.TASK_REPORT);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, OperationListActivity.class.getName());
if(operationDto.operationType == OperationType.PDF) {
intent.putExtra("LINKURL", "file://" + path);
......@@ -1030,6 +1023,7 @@ public class OperationListActivity extends ABVUIActivity {
intent.putExtra(ABookKeys.CONTENT_ID, operationDto.contentId);
intent.putExtra(ABookKeys.OPERATION_ID, operationDto.operationId);
intent.putExtra(Constant.ABookCheck.XWALK_OPEN_TYPE, Constant.XWalkOpenType.PANO_EDIT);
intent.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, OperationListActivity.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClass(OperationListActivity.this, HTMLXWalkWebViewActivity.class);
ActivityHandlingHelper.getInstance().startHTMLXWalkWebActivity(OperationListActivity.this, intent, url, operationDto.contentId, -1, -1, -1, -1, -1);
......@@ -1300,10 +1294,12 @@ 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();
goChatRoom(intent, ChatWebViewActivity.class.getName(), OperationListActivity.class.getName());
}
return;
}
......
......@@ -287,6 +287,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
}
Intent intent = new Intent();
intent.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, OperationRelatedContentActivity.class.getName());
ActivityHandlingHelper.getInstance().checkContentActivity(contentId, 0, intent);
}
} catch (Exception e) {
......@@ -542,21 +543,10 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
updateCollaborationInfo();
refreshCollaborationUI();
super.onResume();
showOperationRelatedContentList();
if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName)) &&
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0') > 0) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
ActivityHandlingHelper.getInstance().startChatWebViewActivity("",
getIntent().getLongExtra(AppDefType.ChatPushMessageKey.roomId, '0'),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomName),
getIntent().getStringExtra(AppDefType.ChatPushMessageKey.roomType));
}
},1000);
if(goChatRoom(getIntent(), ChatWebViewActivity.class.getName(), OperationRelatedContentActivity.class.getName())) {
return;
}
showOperationRelatedContentList();
}
@Override
......@@ -613,8 +603,8 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
backToHome();
goChatRoom();
finish();
goChatRoom(intent, ChatWebViewActivity.class.getName(), getClass().getName());
}
return;
}
......
......@@ -1632,7 +1632,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
//プシュメッセージ一覧からチャットに入る
public void startChatWebViewActivityWithPushMessage(PushMessageDto dto) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
......@@ -1643,7 +1642,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
intent.putExtra(AppDefType.ChatPushMessageKey.loginId, loginId);
intent.putExtra(AppDefType.ChatPushMessageKey.shopName, shopName);
if (dto != null) {
intent.putExtra(AppDefType.ChatPushMessageKey.roomId, dto.roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.loginId, dto.roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.roomName, dto.roomName);
}
intent.setClassName(mContext.getPackageName(), className);
......@@ -1654,7 +1653,6 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
//チャットに入る
public void startChatWebViewActivity() {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid;
......@@ -1669,49 +1667,13 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
/**
* プシュメッセージからチャットに入る
*/
public void startChatWebViewActivity(String fromClassName, Long roomId, String roomName, String roomType) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid;
intent.putExtra("sid", sid);
String loginId = ABVDataCache.getInstance().getMemberInfo().loginId;
String shopName = ABVDataCache.getInstance().getUrlPath();
intent.putExtra(AppDefType.ChatPushMessageKey.loginId, loginId);
intent.putExtra(AppDefType.ChatPushMessageKey.shopName, shopName);
intent.putExtra(AppDefType.ChatPushMessageKey.roomId, roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
intent.putExtra(AppDefType.ChatPushMessageKey.roomType, roomType);
String nextActivity = null;
if (fromClassName.equals(HTMLWebViewActivity.class.getName())) {
nextActivity = OperationListActivity.class.getName();
} else if(fromClassName.equals(ContentViewActivity.class.getName())){
nextActivity = OperationRelatedContentActivity.class.getName();
} else {
nextActivity = className;
}
intent.setClassName(mContext.getPackageName(), nextActivity);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
/**
* プシュメッセージからチャットに遷移する
* fromClassName の値によっては、作業一覧、コンテンツ一覧のどちらかに戻ってから、チャットに遷移する)
* @param fromClassName 呼び出し元のクラス名(
* @param roomId roomId
* @param roomName room
* @param roomType roomaType
* @param collaborationType ABookCommConstants.COLLABORATION_TYPE のいずれか
* @param roomId chatRoom の Id
* @param roomName chatRoom の名前
* @param targetActivityName 直接chatRoom に遷移する場合は、ChatWebViewActivity名。chatRoomに遷移する前に、別のActivityを経由する場合は、そのActivity名
* @param fromActivityName この関数を呼び出したActivity名
*/
public void startChatWebViewActivityWithCollaboration(String fromClassName, Long roomId, String roomName, String roomType, String collaborationType) {
String className = ChatWebViewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
public void startChatWebViewActivity(Long roomId, String roomName, String targetActivityName, String fromActivityName) {
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid;
......@@ -1719,22 +1681,11 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
String loginId = ABVDataCache.getInstance().getMemberInfo().loginId;
String shopName = ABVDataCache.getInstance().getUrlPath();
intent.putExtra(AppDefType.ChatPushMessageKey.loginId, loginId);
intent.putExtra(AppDefType.ChatPushMessageKey.collaborationType, collaborationType);
intent.putExtra(AppDefType.ChatPushMessageKey.shopName, shopName);
intent.putExtra(AppDefType.ChatPushMessageKey.roomId, roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
intent.putExtra(AppDefType.ChatPushMessageKey.roomType, roomType);
String nextActivity = null;
if (fromClassName.equals(HTMLWebViewActivity.class.getName())) {
nextActivity = OperationListActivity.class.getName();
} else if(fromClassName.equals(ContentViewActivity.class.getName())){
nextActivity = OperationRelatedContentActivity.class.getName();
} else {
nextActivity = className;
}
intent.setClassName(mContext.getPackageName(), nextActivity);
intent.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, fromActivityName);
intent.setClassName(mContext.getPackageName(), targetActivityName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
......@@ -1965,6 +1916,32 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
/**
* プッシュメッセージから協業に遷移する
* @param roomId
* @param roomName
* @param collaborationType
* @param roomType
*/
public void startChatWebViewActivityWithCollaboration(Long roomId, String roomName, String collaborationType, String roomType, String nextActivityName, String fromActivityName) {
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl", ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid;
intent.putExtra("sid", sid);
String loginId = ABVDataCache.getInstance().getMemberInfo().loginId;
String shopName = ABVDataCache.getInstance().getUrlPath();
intent.putExtra(AppDefType.ChatPushMessageKey.loginId, loginId);
intent.putExtra(AppDefType.ChatPushMessageKey.collaborationType, collaborationType);
intent.putExtra(AppDefType.ChatPushMessageKey.shopName, shopName);
intent.putExtra(AppDefType.ChatPushMessageKey.roomId, roomId);
intent.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName);
intent.putExtra(AppDefType.ChatPushMessageKey.roomType, roomType);
intent.putExtra(AppDefType.ChatPushMessageKey.fromActivityName, fromActivityName);
intent.setClassName(mContext.getPackageName(), nextActivityName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getCurrentActivity().startActivity(intent);
}
/**
* 図面タイプのみ利用
* OZ画面閉じた後、タスクアイコンの再描画
* @param taskKey
......
......@@ -120,7 +120,6 @@ import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.launcher.android.R.id;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppColor;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
......@@ -3828,10 +3827,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
Uri dataUri = null;
if (requestCode == ABookCommConstants.PUSH_MESSAGE_DLG_REQUEST_CODE) {
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK) {
// Activityを閉じて遷移する
exitActivity();
goChatRoom();
// プッシュメッセージダイアログのリザルトだった場合
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK && !StringUtil.isNullOrEmpty(baseActivityName)) {
finishActivity();
goChatRoom(intent, baseActivityName, ContentViewActivity.class.getName());
}
return;
}
......@@ -3849,7 +3848,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
case WEBVIEW:
case PREVIEW:
isAnotherViewOpenFlg = false;
// playPageBGMSound(mCurrentPageNumber); //프리뷰 모드 일때 음악재생 Bug
//playPageBGMSound(mCurrentPageNumber); //프리뷰 모드 일때 음악재생 Bug
break;
case ABookCommConstants.ABOOK_CHECK_TASK_IMAGE:
if (mUploadMessage == null) {
......@@ -5540,4 +5539,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
public void reloadPdfTaskIcon(String taskKey) {
operationTaskLayout.setIconStatus(taskKey,false);
}
}
......@@ -57,8 +57,6 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity;
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;
......@@ -66,6 +64,7 @@ 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.adf.util.StringUtil;
//TODO: later 遠隔連動関連はContentView,NoPdfViewと共通しているので要集約
public class HTMLWebViewActivity extends ParentWebViewActivity {
......@@ -747,13 +746,14 @@ 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) {
// プッシュメッセージダイアログのリザルトだった場合
if (resultCode == ABookCommConstants.PUSH_MESSAGE_DLG_RESULT.OK && !StringUtil.isNullOrEmpty(baseActivityName)) {
finishActivity();
goChatRoom();
goChatRoom(intent, baseActivityName, HTMLWebViewActivity.class.getName());
}
return;
}
......
package jp.agentec.abook.abv.ui.viewer.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
......@@ -12,17 +13,16 @@ import android.widget.ImageButton;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
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.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.options.Options;
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,HTMLWebViewと共通しているので要集約
public class NoPdfViewActivity extends ABVContentViewActivity {
......@@ -209,4 +209,17 @@ public class NoPdfViewActivity extends ABVContentViewActivity {
layout.addView(view);
}
@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 && !StringUtil.isNullOrEmpty(baseActivityName)) {
finishActivity();
goChatRoom(intent, baseActivityName, getClass().getName());
}
return;
}
}
}
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