Commit 0760f0fc by onuma

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

parent 3ceba6c7
......@@ -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,6 +112,8 @@ 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 String encodedFilePath;
......@@ -794,7 +796,7 @@ 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);
}
......@@ -806,17 +808,20 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
}
}
/**
* PIPモードから元にもどる
*/
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)
);
if (!isPIP) {
return;
}
if (startPIP) {
Intent intent = new Intent();
intent.setClass(this, ChatWebViewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
getApplication().startActivity(intent);
startPIP = false;
}
public void startPIPmode() {
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
}
public void exitAndDeleteMeetingRoom() {
......@@ -842,8 +847,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 {
......@@ -1013,6 +1016,19 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
protected void onStop() {
isStop = true;
super.onStop();
if (needFinishOnStop) {
try {
chatData.finishCollaboration();
} catch (NetworkDisconnectedException e) {
e.printStackTrace();
} catch (AcmsException e) {
e.printStackTrace();
}
// PIPモードは、状態変化のイベントがonStopくらいしかない。なので、PIPの時は、ここでfinish()する
finish();
needFinishOnStop = false;
}
}
@Override
......@@ -1248,8 +1264,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 +1287,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 +1302,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,10 +1314,14 @@ 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() {
......@@ -1348,5 +1365,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