Commit 66352a60 by onuma

ActivityからDataクラスを分離した。

parent 0cd2a8de
......@@ -93,6 +93,15 @@ public interface ABookCommConstants {
String FILE = "file";
String COLLABORATION = "collaboration";
}
String SHOP_NAME = "shopName";
String LANGUAGE_CODE = "languageCode";
String SID = "sid";
String ROOM_ID_UPPERCASE_D = "roomID";
String CHAT_URL = "chatURL";
String CMS_URL = "cmsURL";
String IS_ONLINE = "isOnline";
String IS_MOBILE = "isMobile";
String PLATFORM = "platform";
}
interface FLAG {
......
......@@ -13,26 +13,25 @@ import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.data.ChatData;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationRelatedContentActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
public class ChatWebView extends WebView {
private Context context;
private CommunicationLogic communicationLogic;
private CommunicationLogic communicationLogic = AbstractLogic.getLogic(CommunicationLogic.class);
private ChatWebViewActivity chatActivity;
private ChatData chatData;
public ChatWebView(Context context) {
super(context);
this.context = context;
chatActivity = (ChatWebViewActivity)context;
}
public void init() {
public void init(ChatData chatData) {
setOverScrollMode(View.OVER_SCROLL_NEVER); //オーバースクロールしない。
setVerticalScrollBarEnabled(false); //スクロールバーを消す。
addJavascriptInterface(this, "android");
......@@ -54,19 +53,14 @@ public class ChatWebView extends WebView {
if (Logger.isDebugEnabled()) {
setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
}
}
public void setCommunicationLogic(CommunicationLogic communicationLogic){
this.communicationLogic = communicationLogic;
this.chatData = chatData;
}
@JavascriptInterface
public void saveVisitRoomInfo(String roomId, String roomName) {
// 最後のチャットのルーム名
PreferenceUtil.putUserPref(context, AppDefType.UserPrefKey.CHAT_LAST_ROOMNAME, roomName);
// 最後のチャットのルーム
PreferenceUtil.putUserPref(context, AppDefType.UserPrefKey.CHAT_LAST_ROOMID, roomId);
chatActivity.saveVisitRoomInfo(roomId, roomName);
}
@JavascriptInterface
public void getLoginParameter() {
post(new Runnable() {
......@@ -145,8 +139,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public String getRoomList(String roomType, String keyword) {
String chatRoomListStr = communicationLogic.getChatRoomList(Integer.parseInt(roomType), keyword);
return chatRoomListStr;
return communicationLogic.getChatRoomList(Integer.parseInt(roomType), keyword);
}
@JavascriptInterface
......@@ -157,7 +150,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
chatActivity.updateRoomList();
chatData.updateRoomList();
}
@JavascriptInterface
......@@ -336,7 +329,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void updateArchiveList() throws NetworkDisconnectedException, AcmsException {
chatActivity.updateArchiveList();
chatData.updateArchiveList();
}
@JavascriptInterface
......@@ -366,7 +359,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void updateArchiveDetail(String archiveId) throws NetworkDisconnectedException, AcmsException {
chatActivity.updateArchiveDetail(archiveId);
chatData.updateArchiveDetail(archiveId);
}
@JavascriptInterface
......@@ -376,12 +369,12 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void joinChangedCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
chatActivity.joinChangedCollaboration(collaborationType, meetingId);
chatData.joinChangedCollaboration(collaborationType, meetingId);
}
@JavascriptInterface
public void inviteCollaboration(String inviteUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
chatActivity.inviteCollaboration(inviteUserIds, collaborationType);
chatData.inviteCollaboration(inviteUserIds, collaborationType);
}
@JavascriptInterface
......@@ -391,32 +384,32 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void finishCollaboration() throws NetworkDisconnectedException, AcmsException {
chatActivity.finishCollaboration();
chatData.finishCollaboration();
}
@JavascriptInterface
public void finishAllCollaboration() throws NetworkDisconnectedException, AcmsException {
chatActivity.finishAllCollaboration();
chatData.finishAllCollaboration();
}
@JavascriptInterface
public String getCollaborationJoinFlg() {
return chatActivity.getCollaborationJoinFlg();
return chatData.getCollaborationJoinFlg();
}
@JavascriptInterface
public String getCollaborationType() {
return chatActivity.getStrCollaborationType();
return chatData.getStrCollaborationType();
}
@JavascriptInterface
public String getToMoveGroupId() {
return chatActivity.getToMoveGroupId();
return chatData.getToMoveGroupId();
}
@JavascriptInterface
public void setToMoveGroupId(String moveToGroupId) {
chatActivity.setToMoveGroupId(moveToGroupId);
chatData.setToMoveGroupId(moveToGroupId);
}
@JavascriptInterface
......@@ -472,7 +465,7 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void changeCollaboration(int changeCollaborationType, int meetingId) throws NetworkDisconnectedException, AcmsException {
chatActivity.changeCollaboration(changeCollaborationType, meetingId);
chatData.changeCollaboration(changeCollaborationType, meetingId);
}
@JavascriptInterface
......@@ -490,12 +483,12 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void setHostRequestFlg(int hostRequestFlg) {
chatActivity.setHostRequestFlg(hostRequestFlg);
chatData.setHostRequestFlg(hostRequestFlg);
}
@JavascriptInterface
public int getHostRequestFlg() {
return chatActivity.getHostRequestFlg();
return chatData.getHostRequestFlg();
}
@JavascriptInterface
......@@ -515,33 +508,32 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void updatePreMessage(String messageId) throws NetworkDisconnectedException, AcmsException {
chatActivity.updatePreMessage(messageId);
chatData.updatePreMessage(messageId);
}
@JavascriptInterface
public String getMessageListFromMessageId(String messageId) {
return chatActivity.getMessageListFromMessageId(messageId);
return chatData.getMessageListFromMessageId(messageId);
}
@JavascriptInterface
public boolean getDeviceInfo() {
return true;
public String getDeviceInfo() {
return chatData.getDeviceInfo();
}
@JavascriptInterface
public String getServerInfo() {
String json = "{\"chatURL\":\"hoge\", \"cmsURL\":\"fuga\", \"isOnline\": true }";
return json;
return chatData.getServerInfo();
}
@JavascriptInterface
public String getMyUserInfo() {
return "hogehoge";
return chatData.getMyUserInfo();
}
@JavascriptInterface
public String getRoomInfo() {
return "fugafuga";
return chatData.getRoomInfo();
}
public void loadChatViewUrl(final String urlString) {
......
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