Commit 66352a60 by onuma

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

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