diff options
author | Winson Chung <winsonc@google.com> | 2015-04-20 04:40:41 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-20 04:40:42 +0000 |
commit | 4897af520533115aebf375e554e0b140be95d3c5 (patch) | |
tree | 29f730b86ef1761bf5a37ad1c2de991599c43a18 /src | |
parent | 4cea4c830283e017fc36197cfe9d7ce713aec49d (diff) | |
parent | 75ae8d3bf9992440314a55f0ed3ff3285e6cd8fa (diff) | |
download | android_packages_apps_Trebuchet-4897af520533115aebf375e554e0b140be95d3c5.tar.gz android_packages_apps_Trebuchet-4897af520533115aebf375e554e0b140be95d3c5.tar.bz2 android_packages_apps_Trebuchet-4897af520533115aebf375e554e0b140be95d3c5.zip |
Merge "Notify data-set changed when new items are added/removed." into ub-launcher3-burnaby
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/AlphabeticalAppsList.java | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/com/android/launcher3/AlphabeticalAppsList.java b/src/com/android/launcher3/AlphabeticalAppsList.java index 8d1db632e..2ee5a62ed 100644 --- a/src/com/android/launcher3/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/AlphabeticalAppsList.java @@ -239,17 +239,9 @@ public class AlphabeticalAppsList { for (AppInfo info : apps) { int removeIndex = findAppByComponent(mApps, info); if (removeIndex != -1) { - int sectionedIndex = mSectionedFilteredApps.indexOf(info); - int numAppsInSection = numAppsInSection(info); mApps.remove(removeIndex); onAppsUpdated(); - if (numAppsInSection == 1) { - // Remove the section and the icon - mAdapter.notifyItemRemoved(sectionedIndex - 1); - mAdapter.notifyItemRemoved(sectionedIndex - 1); - } else { - mAdapter.notifyItemRemoved(sectionedIndex); - } + mAdapter.notifyDataSetChanged(); } } } @@ -278,32 +270,8 @@ public class AlphabeticalAppsList { if (index < 0) { mApps.add(-(index + 1), info); onAppsUpdated(); - - int sectionedIndex = mSectionedFilteredApps.indexOf(info); - int numAppsInSection = numAppsInSection(info); - if (numAppsInSection == 1) { - // New section added along with icon - mAdapter.notifyItemInserted(sectionedIndex - 1); - mAdapter.notifyItemInserted(sectionedIndex - 1); - } else { - mAdapter.notifyItemInserted(sectionedIndex); - } - } - } - - /** - * Returns the number of apps in the section that the given info is in. - */ - private int numAppsInSection(AppInfo info) { - int appIndex = mFilteredApps.indexOf(info); - int appCount = 0; - for (SectionInfo section : mSections) { - if (appCount + section.numAppsInSection > appIndex) { - return section.numAppsInSection; - } - appCount += section.numAppsInSection; + mAdapter.notifyDataSetChanged(); } - return 1; } /** |