From 7cd468261419bd89ade7f8ea4e33198c3397ad58 Mon Sep 17 00:00:00 2001 From: Charles Munger Date: Thu, 7 Nov 2019 14:21:55 -0800 Subject: [PATCH] Deprecate ListActivity and ExpandableListActivity These classes provide minimal functionality over the view classes, and are incompatible with appcompat or other activity base classes. Plus, RecyclerView implements all this functionality in a more modern way now anyway. Bug: 144042891 Change-Id: Ibd1faba0f2e05028da867aa4bb3ce5d2ae14e004 Test: No behavior changes --- api/current.txt | 80 +++++++++---------- .../android/app/ExpandableListActivity.java | 4 + core/java/android/app/LauncherActivity.java | 4 + core/java/android/app/ListActivity.java | 4 + 4 files changed, 52 insertions(+), 40 deletions(-) diff --git a/api/current.txt b/api/current.txt index 1a87b2257d279..faa8cf324bcc2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -4698,18 +4698,18 @@ package android.app { field public static final int VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION = 3; // 0x3 } - public class ExpandableListActivity extends android.app.Activity implements android.widget.ExpandableListView.OnChildClickListener android.widget.ExpandableListView.OnGroupCollapseListener android.widget.ExpandableListView.OnGroupExpandListener android.view.View.OnCreateContextMenuListener { - ctor public ExpandableListActivity(); - method public android.widget.ExpandableListAdapter getExpandableListAdapter(); - method public android.widget.ExpandableListView getExpandableListView(); - method public long getSelectedId(); - method public long getSelectedPosition(); - method public boolean onChildClick(android.widget.ExpandableListView, android.view.View, int, int, long); - method public void onGroupCollapse(int); - method public void onGroupExpand(int); - method public void setListAdapter(android.widget.ExpandableListAdapter); - method public boolean setSelectedChild(int, int, boolean); - method public void setSelectedGroup(int); + @Deprecated public class ExpandableListActivity extends android.app.Activity implements android.widget.ExpandableListView.OnChildClickListener android.widget.ExpandableListView.OnGroupCollapseListener android.widget.ExpandableListView.OnGroupExpandListener android.view.View.OnCreateContextMenuListener { + ctor @Deprecated public ExpandableListActivity(); + method @Deprecated public android.widget.ExpandableListAdapter getExpandableListAdapter(); + method @Deprecated public android.widget.ExpandableListView getExpandableListView(); + method @Deprecated public long getSelectedId(); + method @Deprecated public long getSelectedPosition(); + method @Deprecated public boolean onChildClick(android.widget.ExpandableListView, android.view.View, int, int, long); + method @Deprecated public void onGroupCollapse(int); + method @Deprecated public void onGroupExpand(int); + method @Deprecated public void setListAdapter(android.widget.ExpandableListAdapter); + method @Deprecated public boolean setSelectedChild(int, int, boolean); + method @Deprecated public void setSelectedGroup(int); } @Deprecated public class Fragment implements android.content.ComponentCallbacks2 android.view.View.OnCreateContextMenuListener { @@ -5151,40 +5151,40 @@ package android.app { method @Deprecated public void onKeyguardExitResult(boolean); } - public abstract class LauncherActivity extends android.app.ListActivity { - ctor public LauncherActivity(); - method protected android.content.Intent getTargetIntent(); - method protected android.content.Intent intentForPosition(int); - method protected android.app.LauncherActivity.ListItem itemForPosition(int); - method public java.util.List makeListItems(); - method protected java.util.List onQueryPackageManager(android.content.Intent); - method protected void onSetContentView(); + @Deprecated public abstract class LauncherActivity extends android.app.ListActivity { + ctor @Deprecated public LauncherActivity(); + method @Deprecated protected android.content.Intent getTargetIntent(); + method @Deprecated protected android.content.Intent intentForPosition(int); + method @Deprecated protected android.app.LauncherActivity.ListItem itemForPosition(int); + method @Deprecated public java.util.List makeListItems(); + method @Deprecated protected java.util.List onQueryPackageManager(android.content.Intent); + method @Deprecated protected void onSetContentView(); } - public class LauncherActivity.IconResizer { - ctor public LauncherActivity.IconResizer(); - method public android.graphics.drawable.Drawable createIconThumbnail(android.graphics.drawable.Drawable); + @Deprecated public class LauncherActivity.IconResizer { + ctor @Deprecated public LauncherActivity.IconResizer(); + method @Deprecated public android.graphics.drawable.Drawable createIconThumbnail(android.graphics.drawable.Drawable); } - public static class LauncherActivity.ListItem { - ctor public LauncherActivity.ListItem(); - field public String className; - field public android.os.Bundle extras; - field public android.graphics.drawable.Drawable icon; - field public CharSequence label; - field public String packageName; - field public android.content.pm.ResolveInfo resolveInfo; + @Deprecated public static class LauncherActivity.ListItem { + ctor @Deprecated public LauncherActivity.ListItem(); + field @Deprecated public String className; + field @Deprecated public android.os.Bundle extras; + field @Deprecated public android.graphics.drawable.Drawable icon; + field @Deprecated public CharSequence label; + field @Deprecated public String packageName; + field @Deprecated public android.content.pm.ResolveInfo resolveInfo; } - public class ListActivity extends android.app.Activity { - ctor public ListActivity(); - method public android.widget.ListAdapter getListAdapter(); - method public android.widget.ListView getListView(); - method public long getSelectedItemId(); - method public int getSelectedItemPosition(); - method protected void onListItemClick(android.widget.ListView, android.view.View, int, long); - method public void setListAdapter(android.widget.ListAdapter); - method public void setSelection(int); + @Deprecated public class ListActivity extends android.app.Activity { + ctor @Deprecated public ListActivity(); + method @Deprecated public android.widget.ListAdapter getListAdapter(); + method @Deprecated public android.widget.ListView getListView(); + method @Deprecated public long getSelectedItemId(); + method @Deprecated public int getSelectedItemPosition(); + method @Deprecated protected void onListItemClick(android.widget.ListView, android.view.View, int, long); + method @Deprecated public void setListAdapter(android.widget.ListAdapter); + method @Deprecated public void setSelection(int); } @Deprecated public class ListFragment extends android.app.Fragment { diff --git a/core/java/android/app/ExpandableListActivity.java b/core/java/android/app/ExpandableListActivity.java index e08f25a1c40c3..22de878433415 100644 --- a/core/java/android/app/ExpandableListActivity.java +++ b/core/java/android/app/ExpandableListActivity.java @@ -150,7 +150,11 @@ import java.util.Map; * * @see #setListAdapter * @see android.widget.ExpandableListView + * + * @deprecated Use {@link androidx.recyclerview.widget.RecyclerView} or use + * {@link android.widget.ExpandableListView} directly */ +@Deprecated public class ExpandableListActivity extends Activity implements OnCreateContextMenuListener, ExpandableListView.OnChildClickListener, ExpandableListView.OnGroupCollapseListener, diff --git a/core/java/android/app/LauncherActivity.java b/core/java/android/app/LauncherActivity.java index 88e235660c097..b495b3c98047b 100644 --- a/core/java/android/app/LauncherActivity.java +++ b/core/java/android/app/LauncherActivity.java @@ -53,7 +53,11 @@ import java.util.List; * Displays a list of all activities which can be performed * for a given intent. Launches when clicked. * + * @deprecated Applications can implement this UI themselves using + * {@link androidx.recyclerview.widget.RecyclerView} and + * {@link android.content.pm.PackageManager#queryIntentActivities(Intent, int)} */ +@Deprecated public abstract class LauncherActivity extends ListActivity { Intent mIntent; PackageManager mPackageManager; diff --git a/core/java/android/app/ListActivity.java b/core/java/android/app/ListActivity.java index 2162521edce19..810cca22a918b 100644 --- a/core/java/android/app/ListActivity.java +++ b/core/java/android/app/ListActivity.java @@ -171,7 +171,11 @@ import android.widget.ListView; * * @see #setListAdapter * @see android.widget.ListView + * + * @deprecated Use {@link androidx.fragment.app.ListFragment} or + * {@link androidx.recyclerview.widget.RecyclerView} to implement your Activity instead. */ +@Deprecated public class ListActivity extends Activity { /** * This field should be made private, so it is hidden from the SDK.