From 053d1c88552a728350ac1f860d795321d0b46991 Mon Sep 17 00:00:00 2001 From: Clark Scheff Date: Wed, 8 Oct 2014 14:56:17 -0700 Subject: Destroy loader when done loading components A strange bug was uncovered where items keep loading into the selector which causes many duplicates. Once we load the data we can simply destroy the loader so we will not get any further updates. The root cause appears to be caused by the post processing of themes in the ThemeService. The ThemesProvider listens for changes to theme resources and updates the preview blobs which triggers the loaders to be triggered. Change-Id: Ifbeddadd2cd47d0f04755036fbb432d0fafb3df2 --- src/com/cyngn/theme/chooser/ComponentSelector.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/com') diff --git a/src/com/cyngn/theme/chooser/ComponentSelector.java b/src/com/cyngn/theme/chooser/ComponentSelector.java index 881f636..9450c4a 100644 --- a/src/com/cyngn/theme/chooser/ComponentSelector.java +++ b/src/com/cyngn/theme/chooser/ComponentSelector.java @@ -416,7 +416,6 @@ public class ComponentSelector extends LinearLayout @Override public void onLoaderReset(Loader loader) { - mContent.removeAllViews(); } public void setOnItemClickedListener(OnItemClickedListener listener) { @@ -670,6 +669,14 @@ public class ComponentSelector extends LinearLayout } }); } + // destroy the loader now that we are done with it + ComponentSelector.this.post(new Runnable() { + @Override + public void run() { + ((FragmentActivity)mContext).getSupportLoaderManager().destroyLoader( + getLoaderIdFromComponent(mComponentType)); + } + }); return null; } } -- cgit v1.2.3