Fixed broken photo viewer after main activity destroy
This commit is contained in:
parent
fa1734518d
commit
780ca63d8d
@ -83,7 +83,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 19
|
||||
versionCode 274
|
||||
versionCode 275
|
||||
versionName "1.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -500,6 +500,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
PhotoViewer.getInstance().destroyPhotoViewer();
|
||||
super.onDestroy();
|
||||
onFinish();
|
||||
}
|
||||
|
@ -1697,6 +1697,22 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
}
|
||||
}
|
||||
|
||||
public void destroyPhotoViewer() {
|
||||
if (parentActivity == null || windowView == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||
if (windowView.getParent() != null) {
|
||||
wm.removeViewImmediate(windowView);
|
||||
}
|
||||
windowView = null;
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
private void onPhotoClosed(PlaceProviderObject object) {
|
||||
disableShowCheck = true;
|
||||
currentMessageObject = null;
|
||||
|
Loading…
Reference in New Issue
Block a user