1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-06-30 10:14:04 +00:00

Fixed broken photo viewer after main activity destroy

This commit is contained in:
DrKLO 2014-07-12 02:14:13 +04:00
parent fa1734518d
commit 780ca63d8d
3 changed files with 18 additions and 1 deletions

View File

@ -83,7 +83,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 274
versionCode 275
versionName "1.6.0"
}
}

View File

@ -500,6 +500,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
@Override
protected void onDestroy() {
PhotoViewer.getInstance().destroyPhotoViewer();
super.onDestroy();
onFinish();
}

View File

@ -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;