From 20a4b2e613da65a37b5277cb54641e2bf7b70104 Mon Sep 17 00:00:00 2001 From: d34d Date: Wed, 20 Aug 2014 20:25:50 -0700 Subject: Use a projection for themes loader and don't call in onCreate There is no need to be retrieving all columns for all themes so we can use a projection to get just the two columns we want. We were also starting the cursor loader in onCreate() and then again in onResume(). This commit removes the call in onCreate(). Change-Id: Ic12f287034cc7b877d29f3d606309065fd134365 --- src/com/cyngn/theme/chooser/ChooserActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java index e6d1fd7..a852df7 100644 --- a/src/com/cyngn/theme/chooser/ChooserActivity.java +++ b/src/com/cyngn/theme/chooser/ChooserActivity.java @@ -150,7 +150,6 @@ public class ChooserActivity extends FragmentActivity mSelector.setOnOpenCloseListener(mOpenCloseListener); mService = (ThemeManager) getSystemService(Context.THEME_SERVICE); - getSupportLoaderManager().restartLoader(LOADER_ID_APPLIED, null, this); mShopThemesLayout = findViewById(R.id.shop_themes_layout); @@ -592,6 +591,7 @@ public class ChooserActivity extends FragmentActivity String selection = null; String selectionArgs[] = null; String sortOrder = null; + String[] projection = null; Uri contentUri = null; switch (id) { @@ -604,6 +604,7 @@ public class ChooserActivity extends FragmentActivity + "(" + ThemesColumns.PKG_NAME + "='" + mAppliedBaseTheme + "') DESC, " + ThemesColumns.INSTALL_TIME + " DESC"; contentUri = ThemesColumns.CONTENT_URI; + projection = new String[] {ThemesColumns.PKG_NAME, ThemesColumns.TITLE}; break; case LOADER_ID_APPLIED: //TODO: Mix n match query should only be done once @@ -614,7 +615,7 @@ public class ChooserActivity extends FragmentActivity } - return new CursorLoader(this, contentUri, null, selection, + return new CursorLoader(this, contentUri, projection, selection, selectionArgs, sortOrder); } -- cgit v1.1