Revert 948cc9d4: Adding support for simplified collection widgets. Do not merge.
Change-Id: I8b32c7a151abd5652e8efe8b07707c2b656b6595
diff --git a/v13/Android.mk b/v13/Android.mk
index c824716..2ba726f 100644
--- a/v13/Android.mk
+++ b/v13/Android.mk
@@ -17,13 +17,6 @@
# Note: the source code is in java/, not src/, because this code is also part of
# the framework library, and build/core/pathmap.mk expects a java/ subdirectory.
-# A helper sub-library that makes direct use of K APIs.
-include $(CLEAR_VARS)
-LOCAL_MODULE := android-support-v13-k
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, k)
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
# A helper sub-library that makes direct use of Ice Cream Sandwich APIs.
include $(CLEAR_VARS)
LOCAL_MODULE := android-support-v13-ics-mr1
@@ -46,8 +39,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, java)
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4 \
android-support-v13-ics \
- android-support-v13-ics-mr1 \
- android-support-v13-k
+ android-support-v13-ics-mr1
include $(BUILD_STATIC_JAVA_LIBRARY)
# Include this library in the build server's output directory
diff --git a/v13/java/android/support/v13/app/RemoteViewsCompat.java b/v13/java/android/support/v13/app/RemoteViewsCompat.java
deleted file mode 100644
index c8162ba..0000000
--- a/v13/java/android/support/v13/app/RemoteViewsCompat.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v13.app;
-
-import android.appwidget.AppWidgetManager;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.widget.RemoteViews;
-
-import java.util.ArrayList;
-
-/**
- * This is a compatibility version of RemoteViews which simplifies the creation of basic collection
- * widgets (ie. widgets containing {@link ListView}, {@link GridView}, {@link StackView} or
- * {@link AdapterViewAnimator}). This class provides a compatibility version of the method
- * {@link RemoteViews#setRemoteAdapter(int, ArrayList)}, introduced in API level 18. For platform
- * versions supporting the new API, this class will act as a simple pass-through, and for prior
- * versions will emulate the new API's behavior.
- *
- * Be sure to include declare {@link RemoteViewsServiceCompat} in your manifest, as specified in
- * the doc for {@link RemoteViews#setRemoteAdapter(int, ArrayList)}.
- *
- */
-public class RemoteViewsCompat {
-
- static final String EXTRA_VIEW_ID = "android.support.v13.app.EXTRA_VIEW_ID";
-
- interface RemoteViewsCompatImpl {
- void setRemoteAdapter(RemoteViews rv, Context ctx, int viewId, int widgetId,
- ArrayList<RemoteViews> list);
- }
-
- static final RemoteViewsCompatImpl IMPL;
- static {
- // TODO: Replace 17 with 18 when the API level gets bumped
- if (android.os.Build.VERSION.SDK_INT < 17) {
- IMPL = new BaseRemoteViewsCompatImpl();
- } else {
- IMPL = new KRemoteViewsCompatImpl();
- }
- }
-
- /**
- * Compatibility version of {@link RemoteViews#setRemoteAdapter(int, ArrayList).
- *
- * When using this method, it is required that include {@link RemoteViewsServiceCompat}
- * in your manifest:
- *
- * <code>
- * <service android:name="android.support.v13.app.RemoteViewsServiceCompat"
- * android:permission="android.permission.BIND_REMOTEVIEWS"
- * android:exported="false" />
- * </code>
- *
- * @param rv The RemoteViews object.
- * @param ctx Context.
- * @param viewId The id of the AdapterView to which this list of RemoteViews will be applied.
- * @param widgetId The app widget id.
- * @param list The list of RemoteViews which will become the children of the AdapterView.
- */
- public static void setRemoteAdapter(RemoteViews rv, Context ctx, int viewId, int widgetId,
- ArrayList<RemoteViews> list) {
- IMPL.setRemoteAdapter(rv, ctx, viewId, widgetId, list);
- }
-
- static class BaseRemoteViewsCompatImpl implements RemoteViewsCompatImpl {
- @Override
- public void setRemoteAdapter(RemoteViews rv, Context ctx, int viewId, int widgetId,
- ArrayList<RemoteViews> list) {
-
- // We embed the widget id and view id into the intent so that it can be used
- // as a unique key for the list of RemoteViews.
- final Intent intent = new Intent(ctx, RemoteViewsServiceCompat.class);
- intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
- intent.putExtra(EXTRA_VIEW_ID, viewId);
- intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
-
- RemoteViewsListFactory.addOrUpdateListFactory(ctx, intent, widgetId, viewId, list);
-
- rv.setRemoteAdapter(widgetId, viewId, intent);
- }
- }
-
- static class KRemoteViewsCompatImpl implements RemoteViewsCompatImpl {
- @Override
- public void setRemoteAdapter(RemoteViews rv, Context ctx, int viewId, int widgetId,
- ArrayList<RemoteViews> list) {
- RemoteViewsCompatK.setRemoteAdapter(rv, viewId, widgetId, list);
- }
- }
-}
diff --git a/v13/java/android/support/v13/app/RemoteViewsListFactory.java b/v13/java/android/support/v13/app/RemoteViewsListFactory.java
deleted file mode 100644
index aeb35ed..0000000
--- a/v13/java/android/support/v13/app/RemoteViewsListFactory.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v13.app;
-
-import android.appwidget.AppWidgetManager;
-import android.content.Context;
-import android.content.Intent;
-import android.widget.RemoteViews;
-import android.widget.RemoteViewsService.RemoteViewsFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-class RemoteViewsListFactory implements RemoteViewsFactory {
-
- ArrayList<RemoteViews> mRemoteViewsList;
- int mViewTypeCount;
-
- private static final HashMap<Intent.FilterComparison, RemoteViewsListFactory> sFactories =
- new HashMap<Intent.FilterComparison, RemoteViewsListFactory>();
-
- public RemoteViewsListFactory(ArrayList<RemoteViews> list) {
- setViewsList(list);
-
- }
-
- public void setViewsList(ArrayList<RemoteViews> list) {
- mRemoteViewsList = list;
- init();
- }
-
- private void init() {
- if (mRemoteViewsList == null) return;
-
- ArrayList<Integer> viewTypes = new ArrayList<Integer>();
- for (RemoteViews rv : mRemoteViewsList) {
- if (!viewTypes.contains(rv.getLayoutId())) {
- viewTypes.add(rv.getLayoutId());
- }
- }
- mViewTypeCount = viewTypes.size();
- }
-
- @Override
- public void onCreate() {
- }
-
- @Override
- public void onDataSetChanged() {
- init();
- }
-
- @Override
- public void onDestroy() {
- Intent.FilterComparison key = null;
- for (Intent.FilterComparison k : sFactories.keySet()) {
- if (sFactories.get(k) == this) {
- key = k;
- }
- }
- if (key != null) {
- sFactories.remove(key);
- }
- }
-
- @Override
- public int getCount() {
- if (mRemoteViewsList != null) {
- return mRemoteViewsList.size();
- } else {
- return 0;
- }
- }
-
- @Override
- public RemoteViews getViewAt(int position) {
- if (position < getCount()) {
- return mRemoteViewsList.get(position);
- } else {
- return null;
- }
- }
-
- @Override
- public RemoteViews getLoadingView() {
- return null;
- }
-
- @Override
- public int getViewTypeCount() {
- return mViewTypeCount;
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public boolean hasStableIds() {
- return false;
- }
-
- public static RemoteViewsFactory getFactory(Intent intent) {
- Intent.FilterComparison fc = new Intent.FilterComparison(intent);
- return sFactories.get(fc);
- }
-
- public static void addOrUpdateListFactory(Context ctx, Intent intent, int widgetId, int viewId,
- ArrayList<RemoteViews> list) {
-
- Intent.FilterComparison fc = new Intent.FilterComparison(intent);
- if (sFactories.containsKey(fc)) {
- AppWidgetManager mgr = AppWidgetManager.getInstance(ctx);
- RemoteViewsListFactory rvlf = sFactories.get(fc);
- rvlf.setViewsList(list);
- mgr.notifyAppWidgetViewDataChanged(widgetId, viewId);
- } else {
- RemoteViewsListFactory rvlf = new RemoteViewsListFactory(list);
- sFactories.put(fc, rvlf);
- }
- }
-}
diff --git a/v13/java/android/support/v13/app/RemoteViewsServiceCompat.java b/v13/java/android/support/v13/app/RemoteViewsServiceCompat.java
deleted file mode 100644
index 405e40d..0000000
--- a/v13/java/android/support/v13/app/RemoteViewsServiceCompat.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v13.app;
-
-import android.content.Intent;
-import android.widget.RemoteViewsService;
-
-/**
- * This is the service that provides the factory to be bound to the collection service. This class
- * needs to be declared in your manifest. For more details, refer to the docs for
- * {@link RemoteViewsCompat} for proper usage.
- */
-public class RemoteViewsServiceCompat extends RemoteViewsService {
- @Override
- public RemoteViewsFactory onGetViewFactory(Intent intent) {
- RemoteViewsFactory rvf = RemoteViewsListFactory.getFactory(intent);
- return rvf;
- }
-}
diff --git a/v13/k/android/support/v13/app/RemoteViewsCompatK.java b/v13/k/android/support/v13/app/RemoteViewsCompatK.java
deleted file mode 100644
index 36ef266..0000000
--- a/v13/k/android/support/v13/app/RemoteViewsCompatK.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v13.app;
-
-import android.widget.RemoteViews;
-
-import java.util.ArrayList;
-
-class RemoteViewsCompatK {
- public static void setRemoteAdapter(RemoteViews rv, int viewId, int widgetId,
- ArrayList<RemoteViews> list) {
- rv.setRemoteAdapter(viewId, list);
- }
-}