Commit 99424cef by onuma

Merge branch 'communication/develop_44068' into 'communication/develop'

タスクが残らないように修正

See merge request !220
parents 71de575e e0c76faf
...@@ -251,9 +251,11 @@ ...@@ -251,9 +251,11 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" > android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" >
</activity> </activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" <activity android:name="jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:taskAffinity=".ChatWebViewActivity" android:taskAffinity=".ChatWebViewActivity"
android:resizeableActivity="true" android:resizeableActivity="true"
android:excludeFromRecents="true"
android:supportsPictureInPicture="true"/> android:supportsPictureInPicture="true"/>
</application> </application>
......
...@@ -112,7 +112,13 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -112,7 +112,13 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
private String selectedUserIdList; private String selectedUserIdList;
private String mSkey; private String mSkey;
private boolean isPIP; private boolean isPIP;
private boolean startPIP = false; // PIPモードを開始していたらtrue;
private boolean needFinishOnStop = false; // ×ボタンでPIP閉じた時用
private boolean isStop; private boolean isStop;
private boolean doneOnStopEvent = false;
private String collaborationType = null;
private String meetingId = null;
private String encodedFilePath; private String encodedFilePath;
private MeetingManager meetingManager = MeetingManager.getInstance(); private MeetingManager meetingManager = MeetingManager.getInstance();
...@@ -408,7 +414,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -408,7 +414,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
} }
}); });
myAlertDialog = dialog; //myAlertDialog = dialog; TODO: ダイアログの表示タイミングの調整が必要。
if (!isFinishing() && !message.equals("false")) { if (!isFinishing() && !message.equals("false")) {
dialog.show(); dialog.show();
} }
...@@ -584,11 +590,11 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -584,11 +590,11 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
mChatWebView.refreshForOnline(); mChatWebView.refreshForOnline();
if ( if (
mChatWebView.getUrl() != null && mChatWebView.getUrl() != null &&
(mChatWebView.getUrl().equals(ABookCommConstants.CHAT_ROOM_PAGE_URL) || (mChatWebView.getUrl().equals(ABookCommConstants.CHAT_ROOM_PAGE_URL) ||
mChatWebView.getUrl().equals(ABookCommConstants.CHAT_PAGE_URL) || mChatWebView.getUrl().equals(ABookCommConstants.CHAT_PAGE_URL) ||
mChatWebView.getUrl().equals(ABookCommConstants.CONTACT_URL) || mChatWebView.getUrl().equals(ABookCommConstants.CONTACT_URL) ||
mChatWebView.getUrl().equals(ABookCommConstants.ARCHIVE_URL) || mChatWebView.getUrl().equals(ABookCommConstants.ARCHIVE_URL) ||
mChatWebView.getUrl().indexOf(ABookCommConstants.ARCHIVE_DETAIL_URL) != -1) mChatWebView.getUrl().indexOf(ABookCommConstants.ARCHIVE_DETAIL_URL) != -1)
) { ) {
mChatWebView.windowReload(); mChatWebView.windowReload();
} }
...@@ -794,11 +800,14 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -794,11 +800,14 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
} else { } else {
intent.setClass(ChatWebViewActivity.this, OperationListActivity.class); intent.setClass(ChatWebViewActivity.this, OperationListActivity.class);
} }
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(AppDefType.ChatPushMessageKey.baseActivityName, ChatWebViewActivity.class.getName()); intent.putExtra(AppDefType.ChatPushMessageKey.baseActivityName, ChatWebViewActivity.class.getName());
startActivity(intent, NaviConsts.Left); startActivity(intent, NaviConsts.Left);
} }
/**
* 以前の関連資料(共通)の画面を終了する
*/
public void finishBeforeContentListActivity() { public void finishBeforeContentListActivity() {
OperationRelatedContentActivity beforeActiryty = activityHandlingHelper.getActivity(OperationRelatedContentActivity.class); OperationRelatedContentActivity beforeActiryty = activityHandlingHelper.getActivity(OperationRelatedContentActivity.class);
if (beforeActiryty != null) { if (beforeActiryty != null) {
...@@ -806,17 +815,21 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -806,17 +815,21 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
} }
} }
public void finishPIPmode() { /**
if (!isPIP) { return; } * PIPモードから元にもどる
getApplication() */
.startActivity(new Intent(this, ChatWebViewActivity.class) public void finishPIPMode() {
.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK) if (!isPIP) {
); return;
} }
if (startPIP) {
public void startPIPmode() { Intent intent = new Intent();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder(); intent.setClass(this, ChatWebViewActivity.class);
enterPictureInPictureMode(mPipBuilder.build()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(intent);
collaborationType = Integer.toString(0);
startPIP = false;
}
} }
public void exitAndDeleteMeetingRoom() { public void exitAndDeleteMeetingRoom() {
...@@ -833,6 +846,11 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -833,6 +846,11 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
public void startContentListActivity(boolean isOwner) { public void startContentListActivity(boolean isOwner) {
Activity targetActivity = activityHandlingHelper.getCurrentActivity(); Activity targetActivity = activityHandlingHelper.getCurrentActivity();
OperationRelatedContentActivity beforeActiryty = activityHandlingHelper.getActivity(OperationRelatedContentActivity.class);
if (beforeActiryty != null) {
// すでにあるなら作らない。
return;
}
if (targetActivity instanceof ChatWebViewActivity) { if (targetActivity instanceof ChatWebViewActivity) {
Stack<ABVAuthenticatedActivity> stack = activityHandlingHelper.getCurrentActivityStack(); Stack<ABVAuthenticatedActivity> stack = activityHandlingHelper.getCurrentActivityStack();
if (stack.size() > 1){ if (stack.size() > 1){
...@@ -842,8 +860,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -842,8 +860,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
Intent intent = new Intent(); Intent intent = new Intent();
intent.setClass(targetActivity, OperationRelatedContentActivity.class); intent.setClass(targetActivity, OperationRelatedContentActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
intent.putExtra("isCollaboration", true);
intent.putExtra("isCollaborationOwner", isOwner);
targetActivity.startActivity(intent); targetActivity.startActivity(intent);
} }
public void connectMeetingServer() throws Exception { public void connectMeetingServer() throws Exception {
...@@ -870,7 +886,9 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -870,7 +886,9 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
.getInstance(ABVEnvironment.getInstance().networkAdapter) .getInstance(ABVEnvironment.getInstance().networkAdapter)
.deleteFavoriteGroup(chatData.sid, Integer.parseInt(groupId)); .deleteFavoriteGroup(chatData.sid, Integer.parseInt(groupId));
if (!result) { return false; } if (!result) {
return false;
}
List<Integer> deleteFavoriteList = new ArrayList<Integer>(); List<Integer> deleteFavoriteList = new ArrayList<Integer>();
deleteFavoriteList.add(Integer.parseInt(groupId)); deleteFavoriteList.add(Integer.parseInt(groupId));
...@@ -882,16 +900,13 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -882,16 +900,13 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) { public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
isPIP = isInPictureInPictureMode; isPIP = isInPictureInPictureMode;
if (isInPictureInPictureMode) { if (isInPictureInPictureMode) {
// true になったら、PIPのインディケーターを消す
mChatWebView.removePIPIndicator(); mChatWebView.removePIPIndicator();
return; return;
} }
if (isStop) {
if (doneOnStopEvent) {
mChatWebView.exitCollaboration(); mChatWebView.exitCollaboration();
Intent intent = new Intent();
Activity currentActivity = ActivityHandlingHelper.getInstance().getCurrentActivity();
intent.setClass(currentActivity, OperationListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent, NaviConsts.Left);
} }
mChatWebView.addPIPIndicator(); mChatWebView.addPIPIndicator();
if (!meetingManager.isConnected()) { if (!meetingManager.isConnected()) {
...@@ -1002,7 +1017,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1002,7 +1017,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
@Override @Override
protected void onResume() { protected void onResume() {
isStop = false; doneOnStopEvent = false; // activity動いている
super.onResume(); super.onResume();
if (mChatWebView.getUrl() != null && mChatWebView.getUrl().equals(ABookCommConstants.CHAT_ROOM_PAGE_URL)) { if (mChatWebView.getUrl() != null && mChatWebView.getUrl().equals(ABookCommConstants.CHAT_ROOM_PAGE_URL)) {
mChatWebView.socketCheck(); mChatWebView.socketCheck();
...@@ -1011,8 +1026,22 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1011,8 +1026,22 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
@Override @Override
protected void onStop() { protected void onStop() {
isStop = true;
super.onStop(); super.onStop();
doneOnStopEvent = true; // activity 停止
if (needFinishOnStop) {
try {
chatData.finishCollaboration();
} catch (NetworkDisconnectedException e) {
e.printStackTrace();
} catch (AcmsException e) {
e.printStackTrace();
}
// PIPモードは、状態変化のイベントがonStopくらいしかない。なので、PIPの時は、ここでfinish()する
finish();
needFinishOnStop = false;
}
} }
@Override @Override
...@@ -1023,6 +1052,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1023,6 +1052,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
unregisterReceiver(receiver); unregisterReceiver(receiver);
receiver = null; receiver = null;
} }
finishBeforeContentListActivity();
} }
@Override @Override
...@@ -1109,7 +1139,13 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1109,7 +1139,13 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
} }
public void joinRoom(String joinRoomId, String joinRoomName) { public void joinRoom(String joinRoomId, String joinRoomName) {
chatData.joinRoom(joinRoomId,joinRoomName); if (!StringUtil.isNullOrEmpty(this.collaborationType) && !StringUtil.isNullOrEmpty(this.meetingId)
&& this.collaborationType.equals(Integer.toString(ABookCommConstants.FLAG.COLLABORATION_TYPE.DOCUMENT))) {
if (startPIP) {
finishPIPMode();
}
}
chatData.joinRoom(joinRoomId, joinRoomName);
mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL); mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL);
} }
...@@ -1248,8 +1284,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1248,8 +1284,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
public int createContentView() { public int createContentView() {
finishBeforeContentListActivity(); finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder(); startPIPMode();
enterPictureInPictureMode(mPipBuilder.build());
Integer meetingId = null; Integer meetingId = null;
meetingManager.close(); meetingManager.close();
try { try {
...@@ -1272,8 +1307,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1272,8 +1307,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
public void startContentView() { public void startContentView() {
finishBeforeContentListActivity(); finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder(); startPIPMode();
enterPictureInPictureMode(mPipBuilder.build());
meetingManager.close(); meetingManager.close();
try { try {
connectMeetingServer(); connectMeetingServer();
...@@ -1288,8 +1322,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1288,8 +1322,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
public void joinMeetingRoom(int newMeetingId) { public void joinMeetingRoom(int newMeetingId) {
finishBeforeContentListActivity(); finishBeforeContentListActivity();
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder(); startPIPMode();
enterPictureInPictureMode(mPipBuilder.build());
meetingManager.close(); meetingManager.close();
try { try {
connectMeetingServer(); connectMeetingServer();
...@@ -1301,23 +1334,27 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1301,23 +1334,27 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
} }
startContentListActivity(false); startContentListActivity(false);
} }
/**
* PIPモードに変更
*/
public void startPIPMode() { public void startPIPMode() {
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder(); PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build()); enterPictureInPictureMode(mPipBuilder.build());
needFinishOnStop = true;
startPIP = true;
} }
public void exitPIPmode() { public void exitPIPmode() {
finishPIPmode(); finishPIPMode();
} }
public void exitMeetingRoom() { public void exitMeetingRoom() {
exitAndDeleteMeetingRoom(); exitAndDeleteMeetingRoom();
finishPIPmode(); finishPIPMode();
} }
public void finishPIP() { public void finishPIP() {
finishPIPmode(); finishPIPMode();
} }
public void setExitHostAlert() { public void setExitHostAlert() {
...@@ -1333,6 +1370,8 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1333,6 +1370,8 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
} }
public void joinCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException { public void joinCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
this.collaborationType = collaborationType;
this.meetingId = meetingId;
chatData.joinCollaboration(collaborationType, meetingId); chatData.joinCollaboration(collaborationType, meetingId);
moveCollaborationScreen(Integer.parseInt(collaborationType)); moveCollaborationScreen(Integer.parseInt(collaborationType));
} }
...@@ -1348,5 +1387,4 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1348,5 +1387,4 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
// 最後のチャットのルーム // 最後のチャットのルーム
PreferenceUtil.putUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, roomId); PreferenceUtil.putUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, roomId);
} }
} }
...@@ -388,7 +388,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -388,7 +388,7 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
//資料が変更されたらPIPモードに更新する。 //資料が変更されたらPIPモードに更新する。
ChatWebViewActivity chatWebViewActivity = getActivity(ChatWebViewActivity.class); ChatWebViewActivity chatWebViewActivity = getActivity(ChatWebViewActivity.class);
if (chatWebViewActivity != null && meetingManager.isSubscribed() && !chatWebViewActivity.isInPictureInPictureMode()) { if (chatWebViewActivity != null && meetingManager.isSubscribed() && !chatWebViewActivity.isInPictureInPictureMode()) {
chatWebViewActivity.startPIPmode(); chatWebViewActivity.startPIPMode();
} }
if (!StringUtil.equalsAny( if (!StringUtil.equalsAny(
......
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