Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73f5c91c authored by Daniel Sandler's avatar Daniel Sandler Committed by Android Git Automerger
Browse files

am 20cfb606: Merge "Close notification blame popups when the panel disappears." into jb-dev

* commit '20cfb606':
  Close notification blame popups when the panel disappears.
parents f3fda077 20cfb606
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -74,6 +74,7 @@ public class SwipeHelper implements Gefingerpoken {
    private boolean mLongPressSent;
    private boolean mLongPressSent;
    private View.OnLongClickListener mLongPressListener;
    private View.OnLongClickListener mLongPressListener;
    private Runnable mWatchLongPress;
    private Runnable mWatchLongPress;
    private long mLongPressTimeout;


    public SwipeHelper(int swipeDirection, Callback callback, float densityScale,
    public SwipeHelper(int swipeDirection, Callback callback, float densityScale,
            float pagingTouchSlop) {
            float pagingTouchSlop) {
@@ -83,6 +84,8 @@ public class SwipeHelper implements Gefingerpoken {
        mVelocityTracker = VelocityTracker.obtain();
        mVelocityTracker = VelocityTracker.obtain();
        mDensityScale = densityScale;
        mDensityScale = densityScale;
        mPagingTouchSlop = pagingTouchSlop;
        mPagingTouchSlop = pagingTouchSlop;

        mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); // extra long-press!
    }
    }


    public void setLongPressListener(View.OnLongClickListener listener) {
    public void setLongPressListener(View.OnLongClickListener listener) {
@@ -180,7 +183,7 @@ public class SwipeHelper implements Gefingerpoken {
        }
        }
    }
    }


    private void removeLongPressCallback() {
    public void removeLongPressCallback() {
        if (mWatchLongPress != null) {
        if (mWatchLongPress != null) {
            mHandler.removeCallbacks(mWatchLongPress);
            mHandler.removeCallbacks(mWatchLongPress);
        }
        }
@@ -214,7 +217,7 @@ public class SwipeHelper implements Gefingerpoken {
                                }
                                }
                            };
                            };
                        }
                        }
                        mHandler.postDelayed(mWatchLongPress, ViewConfiguration.getLongPressTimeout());
                        mHandler.postDelayed(mWatchLongPress, mLongPressTimeout);
                    }
                    }


                }
                }
+15 −4
Original line number Original line Diff line number Diff line
@@ -91,6 +91,8 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected RecentsPanelView mRecentsPanel;
    protected RecentsPanelView mRecentsPanel;
    protected RecentTasksLoader mRecentTasksLoader;
    protected RecentTasksLoader mRecentTasksLoader;


    protected PopupMenu mNotificationBlamePopup;

    // UI-specific methods
    // UI-specific methods


    /**
    /**
@@ -238,9 +240,11 @@ public abstract class BaseStatusBar extends SystemUI implements
                final String packageNameF = (String) v.getTag();
                final String packageNameF = (String) v.getTag();
                if (packageNameF == null) return false;
                if (packageNameF == null) return false;
                if (v.getWindowToken() == null) return false;
                if (v.getWindowToken() == null) return false;
                PopupMenu popup = new PopupMenu(mContext, v);
                mNotificationBlamePopup = new PopupMenu(mContext, v);
                popup.getMenuInflater().inflate(R.menu.notification_popup_menu, popup.getMenu());
                mNotificationBlamePopup.getMenuInflater().inflate(
                popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                        R.menu.notification_popup_menu,
                        mNotificationBlamePopup.getMenu());
                mNotificationBlamePopup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    public boolean onMenuItemClick(MenuItem item) {
                    public boolean onMenuItemClick(MenuItem item) {
                        if (item.getItemId() == R.id.notification_inspect_item) {
                        if (item.getItemId() == R.id.notification_inspect_item) {
                            startApplicationDetailsActivity(packageNameF);
                            startApplicationDetailsActivity(packageNameF);
@@ -251,13 +255,20 @@ public abstract class BaseStatusBar extends SystemUI implements
                        return true;
                        return true;
                    }
                    }
                });
                });
                popup.show();
                mNotificationBlamePopup.show();


                return true;
                return true;
            }
            }
        };
        };
    }
    }


    public void dismissPopups() {
        if (mNotificationBlamePopup != null) {
            mNotificationBlamePopup.dismiss();
            mNotificationBlamePopup = null;
        }
    }

    public void dismissIntruder() {
    public void dismissIntruder() {
        // pass
        // pass
    }
    }
+4 −0
Original line number Original line Diff line number Diff line
@@ -1247,6 +1247,10 @@ public class PhoneStatusBar extends BaseStatusBar {
            return;
            return;
        }
        }
        mExpanded = false;
        mExpanded = false;

        // Close any "App info" popups that might have snuck on-screen
        dismissPopups();

        if (mPostCollapseCleanup != null) {
        if (mPostCollapseCleanup != null) {
            mPostCollapseCleanup.run();
            mPostCollapseCleanup.run();
            mPostCollapseCleanup = null;
            mPostCollapseCleanup = null;
+9 −0
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import android.widget.LinearLayout;


import com.android.systemui.ExpandHelper;
import com.android.systemui.ExpandHelper;
@@ -108,6 +109,14 @@ public class NotificationRowLayout
        mSwipeHelper.setLongPressListener(listener);
        mSwipeHelper.setLongPressListener(listener);
    }
    }


    @Override
    public void onWindowFocusChanged(boolean hasWindowFocus) {
        super.onWindowFocusChanged(hasWindowFocus);
        if (!hasWindowFocus) {
            mSwipeHelper.removeLongPressCallback();
        }
    }

    public void setAnimateBounds(boolean anim) {
    public void setAnimateBounds(boolean anim) {
        mAnimateBounds = anim;
        mAnimateBounds = anim;
    }
    }