Commit 99424cef by onuma

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

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

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