Make ContextualCardLoader do entire loading upon fragment's onStart()
For dismissal mechanism, we will have to get information about those dismissed cards that are stored in Card DB with flag "dismiss" to filter them out. Currently we only do the entire loading in fragment's onCreate(), so only when the fragment is recreated users can get the new data. Now we are changing it to onStart() and make the loader restart so we are able to show the latest cards. Change-Id: I4c0be297232f026b46feb8084084816e1acc8f11 Fixes: 119090460 Bug: 113783548 Test: visual
This commit is contained in:
@@ -84,7 +84,7 @@ public class ContextualCardManager implements ContextualCardLoader.CardContentLo
|
||||
final CardContentLoaderCallbacks cardContentLoaderCallbacks =
|
||||
new CardContentLoaderCallbacks(mContext);
|
||||
cardContentLoaderCallbacks.setListener(this);
|
||||
LoaderManager.getInstance(fragment).initLoader(CARD_CONTENT_LOADER_ID, null /* bundle */,
|
||||
LoaderManager.getInstance(fragment).restartLoader(CARD_CONTENT_LOADER_ID, null /* bundle */,
|
||||
cardContentLoaderCallbacks);
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,11 @@ public class ContextualCardsFragment extends InstrumentedFragment {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mContextualCardManager = new ContextualCardManager(getContext(), getSettingsLifecycle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mContextualCardManager.loadContextualCards(this);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user