Loading core/java/android/widget/AbsListView.java +16 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; import android.view.inputmethod.InputMethodManager; import android.widget.RemoteViews.OnClickHandler; import com.android.internal.R; Loading Loading @@ -5874,6 +5875,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } } /** * Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews * * @param handler The OnClickHandler to use when inflating RemoteViews. * * @hide */ public void setRemoteViewsOnClickHandler(OnClickHandler handler) { // Ensure that we don't already have a RemoteViewsAdapter that is bound to an existing // service handling the specified intent. if (mRemoteAdapter != null) { mRemoteAdapter.setRemoteViewsOnClickHandler(handler); } } /** * This defers a notifyDataSetChanged on the pending RemoteViewsAdapter if it has not * connected yet. Loading core/java/android/widget/AdapterViewAnimator.java +16 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.OnClickHandler; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -992,6 +993,21 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> } } /** * Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews * * @param handler The OnClickHandler to use when inflating RemoteViews. * * @hide */ public void setRemoteViewsOnClickHandler(OnClickHandler handler) { // Ensure that we don't already have a RemoteViewsAdapter that is bound to an existing // service handling the specified intent. if (mRemoteViewsAdapter != null) { mRemoteViewsAdapter.setRemoteViewsOnClickHandler(handler); } } @Override public void setSelection(int position) { setDisplayedChild(position); Loading core/java/android/widget/RemoteViews.java +2 −0 Original line number Diff line number Diff line Loading @@ -530,9 +530,11 @@ public class RemoteViews implements Parcelable, Filter { if (target instanceof AbsListView) { AbsListView v = (AbsListView) target; v.setRemoteViewsAdapter(intent); v.setRemoteViewsOnClickHandler(handler); } else if (target instanceof AdapterViewAnimator) { AdapterViewAnimator v = (AdapterViewAnimator) target; v.setRemoteViewsAdapter(intent); v.setRemoteViewsOnClickHandler(handler); } } Loading core/java/android/widget/RemoteViewsAdapter.java +18 −10 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.widget.RemoteViews.OnClickHandler; import com.android.internal.widget.IRemoteViewsAdapterConnection; import com.android.internal.widget.IRemoteViewsFactory; Loading Loading @@ -68,6 +69,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback private LayoutInflater mLayoutInflater; private RemoteViewsAdapterServiceConnection mServiceConnection; private WeakReference<RemoteAdapterConnectionCallback> mCallback; private OnClickHandler mRemoteViewsOnClickHandler; private FixedSizeRemoteViewsCache mCache; private int mVisibleWindowLowerBound; private int mVisibleWindowUpperBound; Loading Loading @@ -277,11 +279,11 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback * @param view the RemoteViews that was loaded. If null, the RemoteViews was not loaded * successfully. */ public void onRemoteViewsLoaded(RemoteViews view) { public void onRemoteViewsLoaded(RemoteViews view, OnClickHandler handler) { try { // Remove all the children of this layout first removeAllViews(); addView(view.apply(getContext(), this)); addView(view.apply(getContext(), this, handler)); } catch (Exception e) { Log.e(TAG, "Failed to apply RemoteViews."); } Loading Loading @@ -330,7 +332,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback // Notify all the references for that position of the newly loaded RemoteViews final LinkedList<RemoteViewsFrameLayout> refs = mReferences.get(pos); for (final RemoteViewsFrameLayout ref : refs) { ref.onRemoteViewsLoaded(view); ref.onRemoteViewsLoaded(view, mRemoteViewsOnClickHandler); } refs.clear(); Loading Loading @@ -421,7 +423,8 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback } private RemoteViewsFrameLayout createLoadingView(int position, View convertView, ViewGroup parent, Object lock, LayoutInflater layoutInflater) { ViewGroup parent, Object lock, LayoutInflater layoutInflater, OnClickHandler handler) { // Create and return a new FrameLayout, and setup the references for this position final Context context = parent.getContext(); RemoteViewsFrameLayout layout = new RemoteViewsFrameLayout(context); Loading @@ -433,7 +436,8 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback if (mUserLoadingView != null) { // Try to inflate user-specified loading view try { View loadingView = mUserLoadingView.apply(parent.getContext(), parent); View loadingView = mUserLoadingView.apply(parent.getContext(), parent, handler); loadingView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(0)); layout.addView(loadingView); Loading @@ -448,7 +452,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback // Use the size of the first row as a guide for the size of the loading view if (mFirstViewHeight < 0) { try { View firstView = mFirstView.apply(parent.getContext(), parent); View firstView = mFirstView.apply(parent.getContext(), parent, handler); firstView.measure( MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); Loading Loading @@ -815,6 +819,10 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback return mDataReady; } public void setRemoteViewsOnClickHandler(OnClickHandler handler) { mRemoteViewsOnClickHandler = handler; } public void saveRemoteViewsCache() { final Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison, Integer> (new Intent.FilterComparison(mIntent), mAppWidgetId); Loading Loading @@ -1102,7 +1110,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback // Reuse the convert view where possible if (layout != null) { if (convertViewTypeId == typeId) { rv.reapply(context, convertViewChild); rv.reapply(context, convertViewChild, mRemoteViewsOnClickHandler); return layout; } layout.removeAllViews(); Loading @@ -1111,7 +1119,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback } // Otherwise, create a new view to be returned View newView = rv.apply(context, parent); View newView = rv.apply(context, parent, mRemoteViewsOnClickHandler); newView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(typeId)); layout.addView(newView); Loading @@ -1127,7 +1135,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback final RemoteViewsMetaData metaData = mCache.getMetaData(); synchronized (metaData) { loadingView = metaData.createLoadingView(position, convertView, parent, mCache, mLayoutInflater); mCache, mLayoutInflater, mRemoteViewsOnClickHandler); } return loadingView; } finally { Loading @@ -1140,7 +1148,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback final RemoteViewsMetaData metaData = mCache.getMetaData(); synchronized (metaData) { loadingView = metaData.createLoadingView(position, convertView, parent, mCache, mLayoutInflater); mCache, mLayoutInflater, mRemoteViewsOnClickHandler); } mRequestedViews.add(position, loadingView); Loading Loading
core/java/android/widget/AbsListView.java +16 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; import android.view.inputmethod.InputMethodManager; import android.widget.RemoteViews.OnClickHandler; import com.android.internal.R; Loading Loading @@ -5874,6 +5875,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } } /** * Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews * * @param handler The OnClickHandler to use when inflating RemoteViews. * * @hide */ public void setRemoteViewsOnClickHandler(OnClickHandler handler) { // Ensure that we don't already have a RemoteViewsAdapter that is bound to an existing // service handling the specified intent. if (mRemoteAdapter != null) { mRemoteAdapter.setRemoteViewsOnClickHandler(handler); } } /** * This defers a notifyDataSetChanged on the pending RemoteViewsAdapter if it has not * connected yet. Loading
core/java/android/widget/AdapterViewAnimator.java +16 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.OnClickHandler; import java.util.ArrayList; import java.util.HashMap; Loading Loading @@ -992,6 +993,21 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> } } /** * Sets up the onClickHandler to be used by the RemoteViewsAdapter when inflating RemoteViews * * @param handler The OnClickHandler to use when inflating RemoteViews. * * @hide */ public void setRemoteViewsOnClickHandler(OnClickHandler handler) { // Ensure that we don't already have a RemoteViewsAdapter that is bound to an existing // service handling the specified intent. if (mRemoteViewsAdapter != null) { mRemoteViewsAdapter.setRemoteViewsOnClickHandler(handler); } } @Override public void setSelection(int position) { setDisplayedChild(position); Loading
core/java/android/widget/RemoteViews.java +2 −0 Original line number Diff line number Diff line Loading @@ -530,9 +530,11 @@ public class RemoteViews implements Parcelable, Filter { if (target instanceof AbsListView) { AbsListView v = (AbsListView) target; v.setRemoteViewsAdapter(intent); v.setRemoteViewsOnClickHandler(handler); } else if (target instanceof AdapterViewAnimator) { AdapterViewAnimator v = (AdapterViewAnimator) target; v.setRemoteViewsAdapter(intent); v.setRemoteViewsOnClickHandler(handler); } } Loading
core/java/android/widget/RemoteViewsAdapter.java +18 −10 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.widget.RemoteViews.OnClickHandler; import com.android.internal.widget.IRemoteViewsAdapterConnection; import com.android.internal.widget.IRemoteViewsFactory; Loading Loading @@ -68,6 +69,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback private LayoutInflater mLayoutInflater; private RemoteViewsAdapterServiceConnection mServiceConnection; private WeakReference<RemoteAdapterConnectionCallback> mCallback; private OnClickHandler mRemoteViewsOnClickHandler; private FixedSizeRemoteViewsCache mCache; private int mVisibleWindowLowerBound; private int mVisibleWindowUpperBound; Loading Loading @@ -277,11 +279,11 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback * @param view the RemoteViews that was loaded. If null, the RemoteViews was not loaded * successfully. */ public void onRemoteViewsLoaded(RemoteViews view) { public void onRemoteViewsLoaded(RemoteViews view, OnClickHandler handler) { try { // Remove all the children of this layout first removeAllViews(); addView(view.apply(getContext(), this)); addView(view.apply(getContext(), this, handler)); } catch (Exception e) { Log.e(TAG, "Failed to apply RemoteViews."); } Loading Loading @@ -330,7 +332,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback // Notify all the references for that position of the newly loaded RemoteViews final LinkedList<RemoteViewsFrameLayout> refs = mReferences.get(pos); for (final RemoteViewsFrameLayout ref : refs) { ref.onRemoteViewsLoaded(view); ref.onRemoteViewsLoaded(view, mRemoteViewsOnClickHandler); } refs.clear(); Loading Loading @@ -421,7 +423,8 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback } private RemoteViewsFrameLayout createLoadingView(int position, View convertView, ViewGroup parent, Object lock, LayoutInflater layoutInflater) { ViewGroup parent, Object lock, LayoutInflater layoutInflater, OnClickHandler handler) { // Create and return a new FrameLayout, and setup the references for this position final Context context = parent.getContext(); RemoteViewsFrameLayout layout = new RemoteViewsFrameLayout(context); Loading @@ -433,7 +436,8 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback if (mUserLoadingView != null) { // Try to inflate user-specified loading view try { View loadingView = mUserLoadingView.apply(parent.getContext(), parent); View loadingView = mUserLoadingView.apply(parent.getContext(), parent, handler); loadingView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(0)); layout.addView(loadingView); Loading @@ -448,7 +452,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback // Use the size of the first row as a guide for the size of the loading view if (mFirstViewHeight < 0) { try { View firstView = mFirstView.apply(parent.getContext(), parent); View firstView = mFirstView.apply(parent.getContext(), parent, handler); firstView.measure( MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); Loading Loading @@ -815,6 +819,10 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback return mDataReady; } public void setRemoteViewsOnClickHandler(OnClickHandler handler) { mRemoteViewsOnClickHandler = handler; } public void saveRemoteViewsCache() { final Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison, Integer> (new Intent.FilterComparison(mIntent), mAppWidgetId); Loading Loading @@ -1102,7 +1110,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback // Reuse the convert view where possible if (layout != null) { if (convertViewTypeId == typeId) { rv.reapply(context, convertViewChild); rv.reapply(context, convertViewChild, mRemoteViewsOnClickHandler); return layout; } layout.removeAllViews(); Loading @@ -1111,7 +1119,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback } // Otherwise, create a new view to be returned View newView = rv.apply(context, parent); View newView = rv.apply(context, parent, mRemoteViewsOnClickHandler); newView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(typeId)); layout.addView(newView); Loading @@ -1127,7 +1135,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback final RemoteViewsMetaData metaData = mCache.getMetaData(); synchronized (metaData) { loadingView = metaData.createLoadingView(position, convertView, parent, mCache, mLayoutInflater); mCache, mLayoutInflater, mRemoteViewsOnClickHandler); } return loadingView; } finally { Loading @@ -1140,7 +1148,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback final RemoteViewsMetaData metaData = mCache.getMetaData(); synchronized (metaData) { loadingView = metaData.createLoadingView(position, convertView, parent, mCache, mLayoutInflater); mCache, mLayoutInflater, mRemoteViewsOnClickHandler); } mRequestedViews.add(position, loadingView); Loading