Loading core/java/android/widget/RemoteViews.java +33 −36 Original line number Diff line number Diff line Loading @@ -128,7 +128,6 @@ public class RemoteViews implements Parcelable, Filter { private boolean mIsWidgetCollectionChild = false; private static final OnClickHandler DEFAULT_ON_CLICK_HANDLER = new OnClickHandler(); private OnClickHandler mOnClickHandler = DEFAULT_ON_CLICK_HANDLER; /** * This annotation indicates that a subclass of View is alllowed to be used Loading Loading @@ -185,8 +184,8 @@ public class RemoteViews implements Parcelable, Filter { * SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!! */ private abstract static class Action implements Parcelable { public abstract void apply(RemoteViews owner, View root, ViewGroup rootParent) throws ActionException; public abstract void apply(View root, ViewGroup rootParent, OnClickHandler handler) throws ActionException; public int describeContents() { return 0; Loading Loading @@ -229,7 +228,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View view = root.findViewById(viewId); if (!(view instanceof AdapterView<?>)) return; Loading Loading @@ -260,7 +259,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, final OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading @@ -272,7 +271,6 @@ public class RemoteViews implements Parcelable, Filter { if (target == root) { target.setTagInternal(com.android.internal.R.id.fillInIntent, fillInIntent); } else if (target != null && fillInIntent != null) { final OnClickHandler clicker = owner.mOnClickHandler; OnClickListener listener = new OnClickListener() { public void onClick(View v) { // Insure that this view is a child of an AdapterView Loading Loading @@ -310,7 +308,7 @@ public class RemoteViews implements Parcelable, Filter { rect.bottom = (int) ((pos[1] + v.getHeight()) * appScale + 0.5f); fillInIntent.setSourceBounds(rect); clicker.onClickHandler(v, pendingIntent, fillInIntent); handler.onClickHandler(v, pendingIntent, fillInIntent); } }; Loading Loading @@ -342,14 +340,13 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, final OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; // If the view isn't an AdapterView, setting a PendingIntent template doesn't make sense if (target instanceof AdapterView<?>) { AdapterView<?> av = (AdapterView<?>) target; final OnClickHandler clicker = owner.mOnClickHandler; // The PendingIntent template is stored in the view's tag. OnItemClickListener listener = new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, Loading Loading @@ -389,7 +386,7 @@ public class RemoteViews implements Parcelable, Filter { final Intent intent = new Intent(); intent.setSourceBounds(rect); clicker.onClickHandler(view, pendingIntentTemplate, fillInIntent); handler.onClickHandler(view, pendingIntentTemplate, fillInIntent); } } }; Loading Loading @@ -426,7 +423,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading Loading @@ -494,7 +491,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, final OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading @@ -515,7 +512,6 @@ public class RemoteViews implements Parcelable, Filter { if (target != null) { // If the pendingIntent is null, we clear the onClickListener final OnClickHandler clicker = owner.mOnClickHandler; OnClickListener listener = null; if (pendingIntent != null) { listener = new OnClickListener() { Loading @@ -535,7 +531,7 @@ public class RemoteViews implements Parcelable, Filter { final Intent intent = new Intent(); intent.setSourceBounds(rect); clicker.onClickHandler(v, pendingIntent, intent); handler.onClickHandler(v, pendingIntent, intent); } }; } Loading Loading @@ -602,7 +598,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading Loading @@ -662,7 +658,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View view = root.findViewById(viewId); if (view == null) return; Loading Loading @@ -786,11 +782,11 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) throws ActionException { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) throws ActionException { ReflectionAction ra = new ReflectionAction(viewId, methodName, ReflectionAction.BITMAP, bitmap); ra.apply(owner, root, rootParent); ra.apply(root, rootParent, handler); } @Override Loading Loading @@ -1006,7 +1002,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View view = root.findViewById(viewId); if (view == null) return; Loading Loading @@ -1108,13 +1104,13 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final ViewGroup target = (ViewGroup) root.findViewById(viewId); if (target == null) return; if (nestedViews != null) { // Inflate nested views and add as children target.addView(nestedViews.apply(owner, context, target)); target.addView(nestedViews.apply(context, target, handler)); } else { // Clear all children when nested views omitted target.removeAllViews(); Loading Loading @@ -1175,7 +1171,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final TextView target = (TextView) root.findViewById(viewId); if (target == null) return; Loading Loading @@ -1217,7 +1213,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final TextView target = (TextView) root.findViewById(viewId); if (target == null) return; Loading Loading @@ -1261,7 +1257,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final View target = root.findViewById(viewId); if (target == null) return; Loading Loading @@ -2099,11 +2095,6 @@ public class RemoteViews implements Parcelable, Filter { return this; } /** @hide */ public void setOnClickHandler(OnClickHandler handler) { mOnClickHandler = handler; } /** * Inflates the view hierarchy represented by this object and applies * all of the actions. Loading @@ -2116,10 +2107,11 @@ public class RemoteViews implements Parcelable, Filter { * @return The inflated view hierarchy */ public View apply(Context context, ViewGroup parent) { return apply(this, context, parent); return apply(context, parent, DEFAULT_ON_CLICK_HANDLER); } View apply(RemoteViews owner, Context context, ViewGroup parent) { /** @hide */ public View apply(Context context, ViewGroup parent, OnClickHandler handler) { RemoteViews rvToApply = getRemoteViewsToApply(context); View result; Loading @@ -2134,7 +2126,7 @@ public class RemoteViews implements Parcelable, Filter { result = inflater.inflate(rvToApply.getLayoutId(), parent, false); rvToApply.performApply(owner, result, parent); rvToApply.performApply(result, parent, handler); return result; } Loading @@ -2148,6 +2140,11 @@ public class RemoteViews implements Parcelable, Filter { * the {@link #apply(Context,ViewGroup)} call. */ public void reapply(Context context, View v) { reapply(context, v, DEFAULT_ON_CLICK_HANDLER); } /** @hide */ public void reapply(Context context, View v, OnClickHandler handler) { RemoteViews rvToApply = getRemoteViewsToApply(context); // In the case that a view has this RemoteViews applied in one orientation, is persisted Loading @@ -2161,15 +2158,15 @@ public class RemoteViews implements Parcelable, Filter { } prepareContext(context); rvToApply.performApply(this, v, (ViewGroup) v.getParent()); rvToApply.performApply(v, (ViewGroup) v.getParent(), handler); } private void performApply(RemoteViews owner, View v, ViewGroup parent) { private void performApply(View v, ViewGroup parent, OnClickHandler handler) { if (mActions != null) { final int count = mActions.size(); for (int i = 0; i < count; i++) { Action a = mActions.get(i); a.apply(owner, v, parent); a.apply(v, parent, handler); } } } Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +4 −6 Original line number Diff line number Diff line Loading @@ -577,11 +577,9 @@ public abstract class BaseStatusBar extends SystemUI implements View expandedLarge = null; Exception exception = null; try { oneU.setOnClickHandler(mOnClickHandler); expandedOneU = oneU.apply(mContext, adaptive); expandedOneU = oneU.apply(mContext, adaptive, mOnClickHandler); if (large != null) { large.setOnClickHandler(mOnClickHandler); expandedLarge = large.apply(mContext, adaptive); expandedLarge = large.apply(mContext, adaptive, mOnClickHandler); } } catch (RuntimeException e) { Loading Loading @@ -872,9 +870,9 @@ public abstract class BaseStatusBar extends SystemUI implements oldEntry.notification = notification; try { // Reapply the RemoteViews contentView.reapply(mContext, oldEntry.expanded); contentView.reapply(mContext, oldEntry.expanded, mOnClickHandler); if (bigContentView != null && oldEntry.getLargeView() != null) { bigContentView.reapply(mContext, oldEntry.getLargeView()); bigContentView.reapply(mContext, oldEntry.getLargeView(), mOnClickHandler); } // update the contentIntent final PendingIntent contentIntent = notification.notification.contentIntent; Loading Loading
core/java/android/widget/RemoteViews.java +33 −36 Original line number Diff line number Diff line Loading @@ -128,7 +128,6 @@ public class RemoteViews implements Parcelable, Filter { private boolean mIsWidgetCollectionChild = false; private static final OnClickHandler DEFAULT_ON_CLICK_HANDLER = new OnClickHandler(); private OnClickHandler mOnClickHandler = DEFAULT_ON_CLICK_HANDLER; /** * This annotation indicates that a subclass of View is alllowed to be used Loading Loading @@ -185,8 +184,8 @@ public class RemoteViews implements Parcelable, Filter { * SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!! */ private abstract static class Action implements Parcelable { public abstract void apply(RemoteViews owner, View root, ViewGroup rootParent) throws ActionException; public abstract void apply(View root, ViewGroup rootParent, OnClickHandler handler) throws ActionException; public int describeContents() { return 0; Loading Loading @@ -229,7 +228,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View view = root.findViewById(viewId); if (!(view instanceof AdapterView<?>)) return; Loading Loading @@ -260,7 +259,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, final OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading @@ -272,7 +271,6 @@ public class RemoteViews implements Parcelable, Filter { if (target == root) { target.setTagInternal(com.android.internal.R.id.fillInIntent, fillInIntent); } else if (target != null && fillInIntent != null) { final OnClickHandler clicker = owner.mOnClickHandler; OnClickListener listener = new OnClickListener() { public void onClick(View v) { // Insure that this view is a child of an AdapterView Loading Loading @@ -310,7 +308,7 @@ public class RemoteViews implements Parcelable, Filter { rect.bottom = (int) ((pos[1] + v.getHeight()) * appScale + 0.5f); fillInIntent.setSourceBounds(rect); clicker.onClickHandler(v, pendingIntent, fillInIntent); handler.onClickHandler(v, pendingIntent, fillInIntent); } }; Loading Loading @@ -342,14 +340,13 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, final OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; // If the view isn't an AdapterView, setting a PendingIntent template doesn't make sense if (target instanceof AdapterView<?>) { AdapterView<?> av = (AdapterView<?>) target; final OnClickHandler clicker = owner.mOnClickHandler; // The PendingIntent template is stored in the view's tag. OnItemClickListener listener = new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, Loading Loading @@ -389,7 +386,7 @@ public class RemoteViews implements Parcelable, Filter { final Intent intent = new Intent(); intent.setSourceBounds(rect); clicker.onClickHandler(view, pendingIntentTemplate, fillInIntent); handler.onClickHandler(view, pendingIntentTemplate, fillInIntent); } } }; Loading Loading @@ -426,7 +423,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading Loading @@ -494,7 +491,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, final OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading @@ -515,7 +512,6 @@ public class RemoteViews implements Parcelable, Filter { if (target != null) { // If the pendingIntent is null, we clear the onClickListener final OnClickHandler clicker = owner.mOnClickHandler; OnClickListener listener = null; if (pendingIntent != null) { listener = new OnClickListener() { Loading @@ -535,7 +531,7 @@ public class RemoteViews implements Parcelable, Filter { final Intent intent = new Intent(); intent.setSourceBounds(rect); clicker.onClickHandler(v, pendingIntent, intent); handler.onClickHandler(v, pendingIntent, intent); } }; } Loading Loading @@ -602,7 +598,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View target = root.findViewById(viewId); if (target == null) return; Loading Loading @@ -662,7 +658,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View view = root.findViewById(viewId); if (view == null) return; Loading Loading @@ -786,11 +782,11 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) throws ActionException { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) throws ActionException { ReflectionAction ra = new ReflectionAction(viewId, methodName, ReflectionAction.BITMAP, bitmap); ra.apply(owner, root, rootParent); ra.apply(root, rootParent, handler); } @Override Loading Loading @@ -1006,7 +1002,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final View view = root.findViewById(viewId); if (view == null) return; Loading Loading @@ -1108,13 +1104,13 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final ViewGroup target = (ViewGroup) root.findViewById(viewId); if (target == null) return; if (nestedViews != null) { // Inflate nested views and add as children target.addView(nestedViews.apply(owner, context, target)); target.addView(nestedViews.apply(context, target, handler)); } else { // Clear all children when nested views omitted target.removeAllViews(); Loading Loading @@ -1175,7 +1171,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final TextView target = (TextView) root.findViewById(viewId); if (target == null) return; Loading Loading @@ -1217,7 +1213,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final TextView target = (TextView) root.findViewById(viewId); if (target == null) return; Loading Loading @@ -1261,7 +1257,7 @@ public class RemoteViews implements Parcelable, Filter { } @Override public void apply(RemoteViews owner, View root, ViewGroup rootParent) { public void apply(View root, ViewGroup rootParent, OnClickHandler handler) { final Context context = root.getContext(); final View target = root.findViewById(viewId); if (target == null) return; Loading Loading @@ -2099,11 +2095,6 @@ public class RemoteViews implements Parcelable, Filter { return this; } /** @hide */ public void setOnClickHandler(OnClickHandler handler) { mOnClickHandler = handler; } /** * Inflates the view hierarchy represented by this object and applies * all of the actions. Loading @@ -2116,10 +2107,11 @@ public class RemoteViews implements Parcelable, Filter { * @return The inflated view hierarchy */ public View apply(Context context, ViewGroup parent) { return apply(this, context, parent); return apply(context, parent, DEFAULT_ON_CLICK_HANDLER); } View apply(RemoteViews owner, Context context, ViewGroup parent) { /** @hide */ public View apply(Context context, ViewGroup parent, OnClickHandler handler) { RemoteViews rvToApply = getRemoteViewsToApply(context); View result; Loading @@ -2134,7 +2126,7 @@ public class RemoteViews implements Parcelable, Filter { result = inflater.inflate(rvToApply.getLayoutId(), parent, false); rvToApply.performApply(owner, result, parent); rvToApply.performApply(result, parent, handler); return result; } Loading @@ -2148,6 +2140,11 @@ public class RemoteViews implements Parcelable, Filter { * the {@link #apply(Context,ViewGroup)} call. */ public void reapply(Context context, View v) { reapply(context, v, DEFAULT_ON_CLICK_HANDLER); } /** @hide */ public void reapply(Context context, View v, OnClickHandler handler) { RemoteViews rvToApply = getRemoteViewsToApply(context); // In the case that a view has this RemoteViews applied in one orientation, is persisted Loading @@ -2161,15 +2158,15 @@ public class RemoteViews implements Parcelable, Filter { } prepareContext(context); rvToApply.performApply(this, v, (ViewGroup) v.getParent()); rvToApply.performApply(v, (ViewGroup) v.getParent(), handler); } private void performApply(RemoteViews owner, View v, ViewGroup parent) { private void performApply(View v, ViewGroup parent, OnClickHandler handler) { if (mActions != null) { final int count = mActions.size(); for (int i = 0; i < count; i++) { Action a = mActions.get(i); a.apply(owner, v, parent); a.apply(v, parent, handler); } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +4 −6 Original line number Diff line number Diff line Loading @@ -577,11 +577,9 @@ public abstract class BaseStatusBar extends SystemUI implements View expandedLarge = null; Exception exception = null; try { oneU.setOnClickHandler(mOnClickHandler); expandedOneU = oneU.apply(mContext, adaptive); expandedOneU = oneU.apply(mContext, adaptive, mOnClickHandler); if (large != null) { large.setOnClickHandler(mOnClickHandler); expandedLarge = large.apply(mContext, adaptive); expandedLarge = large.apply(mContext, adaptive, mOnClickHandler); } } catch (RuntimeException e) { Loading Loading @@ -872,9 +870,9 @@ public abstract class BaseStatusBar extends SystemUI implements oldEntry.notification = notification; try { // Reapply the RemoteViews contentView.reapply(mContext, oldEntry.expanded); contentView.reapply(mContext, oldEntry.expanded, mOnClickHandler); if (bigContentView != null && oldEntry.getLargeView() != null) { bigContentView.reapply(mContext, oldEntry.getLargeView()); bigContentView.reapply(mContext, oldEntry.getLargeView(), mOnClickHandler); } // update the contentIntent final PendingIntent contentIntent = notification.notification.contentIntent; Loading