Commit 0760f0fc by onuma

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

parent 3ceba6c7
...@@ -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,6 +112,8 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -112,6 +112,8 @@ 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 String encodedFilePath; private String encodedFilePath;
...@@ -794,7 +796,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -794,7 +796,7 @@ 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);
} }
...@@ -806,17 +808,20 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -806,17 +808,20 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
} }
} }
/**
* PIPモードから元にもどる
*/
public void finishPIPmode() { public void finishPIPmode() {
if (!isPIP) { return; } if (!isPIP) {
getApplication() return;
.startActivity(new Intent(this, ChatWebViewActivity.class) }
.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK) if (startPIP) {
); Intent intent = new Intent();
} intent.setClass(this, ChatWebViewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
public void startPIPmode() { getApplication().startActivity(intent);
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder(); startPIP = false;
enterPictureInPictureMode(mPipBuilder.build()); }
} }
public void exitAndDeleteMeetingRoom() { public void exitAndDeleteMeetingRoom() {
...@@ -842,8 +847,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -842,8 +847,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 {
...@@ -1013,6 +1016,19 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1013,6 +1016,19 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements
protected void onStop() { protected void onStop() {
isStop = true; isStop = true;
super.onStop(); 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 @Override
...@@ -1248,8 +1264,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1248,8 +1264,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 +1287,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1272,8 +1287,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 +1302,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1288,8 +1302,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,10 +1314,14 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1301,10 +1314,14 @@ 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() {
...@@ -1348,5 +1365,4 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity implements ...@@ -1348,5 +1365,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