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

Commit 167b5b06 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio Committed by Android (Google) Code Review
Browse files

Merge "Optimize Dashboard loading"

parents a821f832 b644f293
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -325,7 +325,9 @@ public class SettingsActivity extends Activity
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MSG_BUILD_CATEGORIES: {
                    if(mNeedToRebuildCategories) {
                        buildDashboardCategories(mCategories);
                    }
                } break;
            }
        }
@@ -342,7 +344,7 @@ public class SettingsActivity extends Activity
    }

    public List<DashboardCategory> getDashboardCategories() {
        if (mNeedToRebuildCategories) {
        if (mNeedToRebuildCategories || mCategories.size() == 0) {
            buildDashboardCategories(mCategories);
            mNeedToRebuildCategories = false;
        }
@@ -491,18 +493,13 @@ public class SettingsActivity extends Activity
                switchToFragment( initialFragmentName, initialArguments, true, false,
                        mInitialTitle, false);
            } else {
                // We need to build the Categories in all cases
                buildDashboardCategories(mCategories);

                // No UP if we are displaying the main Dashboard
                mDisplayHomeAsUpEnabled = false;
                if (mCategories.size() > 0) {
                mInitialTitle = getText(R.string.dashboard_title);
                switchToFragment(DashboardSummary.class.getName(), null, false, false,
                        mInitialTitle, false);
            }
        }
        }

        mActionBar = getActionBar();
        if (mActionBar != null) {
+4 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -79,6 +80,7 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
    }

    private void rebuildUI(Context context) {
        long start = System.currentTimeMillis();
        final Resources res = getResources();

        mDashboard.removeAllViews();
@@ -116,6 +118,8 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
            // Add the category
            mDashboard.addView(categoryView);
        }
        long delta = System.currentTimeMillis() - start;
        Log.d(LOG_TAG, "rebuildUI took: " + delta + " ms");
    }

    @Override