Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d725461 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Fixing the sections not getting created the first time

Change-Id: I9b8888d1633eba29e9ec79924d26cff0fce33ead
parent 4d2e7789
Loading
Loading
Loading
Loading
+41 −37
Original line number Diff line number Diff line
@@ -758,6 +758,7 @@ public class ManageApplications extends InstrumentedFragment
            protected void publishResults(CharSequence constraint, FilterResults results) {
                mCurFilterPrefix = constraint;
                mEntries = (ArrayList<ApplicationsState.AppEntry>) results.values;
                rebuildSections();
                notifyDataSetChanged();
            }
        };
@@ -891,8 +892,30 @@ public class ManageApplications extends InstrumentedFragment
            mBaseEntries = entries;
            if (mBaseEntries != null) {
                mEntries = applyPrefixFilter(mCurFilterPrefix, mBaseEntries);
                rebuildSections();
            } else {
                mEntries = null;
                mSections = EMPTY_SECTIONS;
                mPositionToSectionIndex = null;
            }

            notifyDataSetChanged();

            if (mSession.getAllApps().size() != 0
                    && mManageApplications.mListContainer.getVisibility() != View.VISIBLE) {
                Utils.handleLoadingContainer(mManageApplications.mLoadingContainer,
                        mManageApplications.mListContainer, true, true);
            }
            if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
                // No enabled or disabled filters for usage access.
                return;
            }

            mManageApplications.setHasDisabled(mState.haveDisabledApps());
        }

                if (mManageApplications.mListView.isFastScrollEnabled()) {
        private void rebuildSections() {
            if (mEntries!= null && mManageApplications.mListView.isFastScrollEnabled()) {
                // Rebuild sections
                if (mIndex == null) {
                    LocaleList locales = mContext.getResources().getConfiguration().getLocales();
@@ -928,25 +951,6 @@ public class ManageApplications extends InstrumentedFragment
                mSections = EMPTY_SECTIONS;
                mPositionToSectionIndex = null;
            }
            } else {
                mEntries = null;
                mSections = EMPTY_SECTIONS;
                mPositionToSectionIndex = null;
            }

            notifyDataSetChanged();

            if (mSession.getAllApps().size() != 0
                    && mManageApplications.mListContainer.getVisibility() != View.VISIBLE) {
                Utils.handleLoadingContainer(mManageApplications.mLoadingContainer,
                        mManageApplications.mListContainer, true, true);
            }
            if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
                // No enabled or disabled filters for usage access.
                return;
            }

            mManageApplications.setHasDisabled(mState.haveDisabledApps());
        }

        private void updateLoading() {