Refresh support screen more often

Support screen is now refreshed in the onResume.
This will prevent the situation where you open the
support tab and then you cross a hours of operation
boundary and the button is not updated.

Test: make RunSettingsRoboTests
Bug: 33272736
Change-Id: I9312b3b6f711eda91d5d60b3ff30e5ac12bf89c1
This commit is contained in:
Salvador Martinez
2016-12-19 11:35:34 -08:00
parent 38c844eb11
commit 1cea5d199b
3 changed files with 47 additions and 3 deletions

View File

@@ -119,6 +119,7 @@ public final class SupportFragment extends InstrumentedFragment implements View.
.build(),
mNetworkCallback);
mSupportItemAdapter.setHasInternet(hasInternet());
mSupportItemAdapter.refreshData();
}
@Override

View File

@@ -192,7 +192,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
* Create data for the adapter. If there is already data in the adapter, they will be
* destroyed and recreated.
*/
private void refreshData() {
void refreshData() {
mSupportData.clear();
addEscalationCards();
addMoreHelpItems();
@@ -601,7 +601,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
/**
* Data for a single support item.
*/
private static class SupportData {
@VisibleForTesting
static class SupportData {
final Intent intent;
final int metricsEvent;
@@ -688,7 +689,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
/**
* Data model for escalation cards.
*/
private static class EscalationData extends SupportData {
@VisibleForTesting
static class EscalationData extends SupportData {
@StringRes
final int text1;
@@ -813,4 +815,9 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
}
}
}
@VisibleForTesting
List<SupportData> getSupportData() {
return mSupportData;
}
}