From 9ee493accc3573485c5c20de9354676255cfa029 Mon Sep 17 00:00:00 2001 From: Roman Birg Date: Thu, 14 Jan 2016 09:45:34 -0800 Subject: SystemUI: handle custom tile long press PendingIntents Ref: CYNGNOS-1602 Change-Id: I30dc09a48f7fcf7bcac85f173129c8bc04a10d37 Signed-off-by: Roman Birg --- .../src/com/android/systemui/qs/tiles/CustomQSTile.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'packages/SystemUI/src/com/android/systemui/qs/tiles') diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java index f0c4f52..d09ca92 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomQSTile.java @@ -55,6 +55,7 @@ public class CustomQSTile extends QSTile { private CustomTile.ExpandedStyle mExpandedStyle; private PendingIntent mOnClick; + private PendingIntent mOnLongClick; private Uri mOnClickUri; private int mCurrentUserId; private StatusBarPanelCustomTile mTile; @@ -92,7 +93,16 @@ public class CustomQSTile extends QSTile { @Override protected void handleLongClick() { - if (mExpandedStyle == null) { + if (mOnLongClick != null) { + if (mOnLongClick.isActivity()) { + getHost().collapsePanels(); + } + try { + mOnLongClick.send(); + } catch (Throwable e) { + Log.w(TAG, "Error sending long click intent", e); + } + } else if (mExpandedStyle == null) { showDetail(true); } } @@ -143,6 +153,7 @@ public class CustomQSTile extends QSTile { state.icon = new ExternalBitmapIcon(customTile.remoteIcon); } mOnClick = customTile.onClick; + mOnLongClick = customTile.onLongClick; mOnClickUri = customTile.onClickUri; mExpandedStyle = customTile.expandedStyle; mCollapsePanel = customTile.collapsePanel; -- cgit v1.1