OSDN Git Service

Fixing crash in previous CL.
authorWinson Chung <winsonc@google.com>
Thu, 21 May 2015 21:39:54 +0000 (14:39 -0700)
committerWinson Chung <winsonc@google.com>
Thu, 21 May 2015 21:39:54 +0000 (14:39 -0700)
- Shouldn't be referencing mApps before it is set.

src/com/android/launcher3/AlphabeticalAppsList.java
src/com/android/launcher3/AppsContainerView.java

index 5e05d11..2505c80 100644 (file)
@@ -199,16 +199,21 @@ public class AlphabeticalAppsList {
     private int mNumAppsPerRow;
     private int mNumPredictedAppsPerRow;
 
-    public AlphabeticalAppsList(Context context, AdapterChangedCallback auCb, int numAppsPerRow,
-            int numPredictedAppsPerRow) {
+    public AlphabeticalAppsList(Context context, int numAppsPerRow, int numPredictedAppsPerRow) {
         mContext = context;
         mIndexer = new AlphabeticIndexCompat(context);
         mAppNameComparator = new AppNameComparator(context);
-        mAdapterChangedCallback = auCb;
         setNumAppsPerRow(numAppsPerRow, numPredictedAppsPerRow);
     }
 
     /**
+     * Sets the apps updated callback.
+     */
+    public void setAppsUpdatedCallback(AdapterChangedCallback auCb) {
+        mAdapterChangedCallback = auCb;
+    }
+
+    /**
      * Sets the number of apps per row.  Used only for AppsContainerView.SECTIONED_GRID_COALESCED.
      */
     public void setNumAppsPerRow(int numAppsPerRow, int numPredictedAppsPerRow) {
index 612c19c..5661df6 100644 (file)
@@ -210,7 +210,8 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
         mLayoutInflater = LayoutInflater.from(context);
         mNumAppsPerRow = grid.appsViewNumCols;
         mNumPredictedAppsPerRow = grid.appsViewNumPredictiveCols;
-        mApps = new AlphabeticalAppsList(context, this, mNumAppsPerRow, mNumPredictedAppsPerRow);
+        mApps = new AlphabeticalAppsList(context, mNumAppsPerRow, mNumPredictedAppsPerRow);
+        mApps.setAppsUpdatedCallback(this);
         mAdapter = new AppsGridAdapter(context, mApps, mNumAppsPerRow, this, this, mLauncher, this);
         mAdapter.setEmptySearchText(res.getString(R.string.loading_apps_message));
         mAdapter.setNumAppsPerRow(mNumAppsPerRow);