@@ -0,0 +1,2793 @@
+package com.camnter.newlife.widget;%0A%0Aimport android.app.Activity;%0Aimport android.content.Context;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0Aimport android.widget.PopupWindow;%0A%0Aimport java.lang.ref.WeakReference;%0A%0A/**%0A * Description%EF%BC%9ASafePopupWindow%0A * Created by%EF%BC%9ACaMnter%0A * Time%EF%BC%9A2016-03-21 15:23%0A */%0Apublic class SafePopupWindow extends PopupWindow %7B%0A%0A    private WeakReference%3CContext%3E mContext;%0A%0A    public SafePopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) %7B%0A        super(context, attrs, defStyleAttr, defStyleRes);%0A        this.mContext = new WeakReference%3C%3E(context);%0A    %7D%0A%0A    public SafePopupWindow(Context context, AttributeSet attrs, int defStyleAttr) %7B%0A        super(context, attrs, defStyleAttr);%0A        this.mContext = new WeakReference%3C%3E(context);%0A    %7D%0A%0A    public SafePopupWindow(Context context, AttributeSet attrs) %7B%0A        super(context, attrs);%0A        this.mContext = new WeakReference%3C%3E(context);%0A    %7D%0A%0A    public SafePopupWindow(Context context) %7B%0A        super(context);%0A        this.mContext = new WeakReference%3C%3E(context);%0A    %7D%0A%0A    public SafePopupWindow(View contentView) %7B%0A        super(contentView);%0A        this.mContext = new WeakReference%3C%3E(contentView.getContext());%0A    %7D%0A%0A    public SafePopupWindow(View contentView, int width, int height) %7B%0A        super(contentView, width, height);%0A        this.mContext = new WeakReference%3C%3E(contentView.getContext());%0A    %7D%0A%0A    public SafePopupWindow(View contentView, int width, int height, boolean focusable) %7B%0A        super(contentView, width, height, focusable);%0A        this.mContext = new WeakReference%3C%3E(contentView.getContext());%0A    %7D%0A%0A    @Override%0A    public void showAtLocation(View parent, int gravity, int x, int y) %7B%0A        Context context = mContext.get();%0A        if (context instanceof Activity && ((Activity) context).isFinishing())%0A            return;%0A        super.showAtLocation(parent, gravity, x, y);%0A    %7D%0A%0A    @Override%0A    public void showAsDropDown(View anchor) %7B%0A        Context context = mContext.get();%0A        if (context instanceof Activity && ((Activity) context).isFinishing())%0A            return;%0A        super.showAsDropDown(anchor);%0A    %7D%0A%0A    @Override%0A    public void showAsDropDown(View anchor, int xoff, int yoff) %7B%0A        Context context = mContext.get();%0A        if (context instanceof Activity && ((Activity) context).isFinishing())%0A            return;%0A        super.showAsDropDown(anchor, xoff, yoff);%0A    %7D%0A%0A    @Override%0A    public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) %7B%0A        Context context = mContext.get();%0A        if (context instanceof Activity && ((Activity) context).isFinishing())%0A            return;%0A        super.showAsDropDown(anchor, xoff, yoff, gravity);%0A    %7D%0A%0A%7D%0A

Add SafePopupWindow