use of com.android.settingslib.drawer.DashboardCategory in project android_packages_apps_Settings by omnirom.
the class SecurityFeatureProviderImplTest method updateTilesData_shouldNotUpdateAlreadyUpdatedPreference.
@Test
@Config(shadows = { ShadowTileUtils.class })
public void updateTilesData_shouldNotUpdateAlreadyUpdatedPreference() {
Bundle bundle = new Bundle();
bundle.putString(TileUtils.META_DATA_PREFERENCE_ICON_URI, URI_GET_ICON);
bundle.putString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, URI_GET_SUMMARY);
PreferenceScreen screen = getPreferenceScreen();
when(screen.findPreference(MOCK_KEY).getSummary()).thenReturn(MOCK_SUMMARY);
when(screen.findPreference(MOCK_KEY).getIcon()).thenReturn(mMockDrawable);
DashboardCategory dashboardCategory = getDashboardCategory();
dashboardCategory.getTile(0).intent = new Intent().setPackage("package");
dashboardCategory.getTile(0).metaData = bundle;
mImpl.updatePreferencesToRunOnWorkerThread(mContext, screen, dashboardCategory);
ShadowLooper.runUiThreadTasks();
verify(screen.findPreference(MOCK_KEY), never()).setSummary(anyString());
}
use of com.android.settingslib.drawer.DashboardCategory in project android_packages_apps_Settings by omnirom.
the class SecurityFeatureProviderImplTest method updateTilesData_shouldNotProcessNonMatchingPreference.
@Test
public void updateTilesData_shouldNotProcessNonMatchingPreference() {
DashboardCategory dashboardCategory = new DashboardCategory();
dashboardCategory.addTile(new Tile());
mImpl.updatePreferencesToRunOnWorkerThread(mContext, getPreferenceScreen(), dashboardCategory);
ShadowLooper.runUiThreadTasks();
verifyNoMoreInteractions(mPackageManager);
}
use of com.android.settingslib.drawer.DashboardCategory in project android_packages_apps_Settings by omnirom.
the class SecurityFeatureProviderImplTest method updateTilesData_shouldUpdateMatchingPreference.
@Test
@Config(shadows = { ShadowTileUtils.class })
public void updateTilesData_shouldUpdateMatchingPreference() {
Bundle bundle = new Bundle();
bundle.putString(TileUtils.META_DATA_PREFERENCE_ICON_URI, URI_GET_ICON);
bundle.putString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, URI_GET_SUMMARY);
PreferenceScreen screen = getPreferenceScreen();
DashboardCategory dashboardCategory = getDashboardCategory();
dashboardCategory.getTile(0).intent = new Intent().setPackage("package");
dashboardCategory.getTile(0).metaData = bundle;
mImpl.updatePreferencesToRunOnWorkerThread(mContext, screen, dashboardCategory);
ShadowLooper.runUiThreadTasks();
verify(screen.findPreference(MOCK_KEY)).setIcon(mMockDrawable);
verify(screen.findPreference(MOCK_KEY)).setSummary(MOCK_SUMMARY);
}
use of com.android.settingslib.drawer.DashboardCategory in project android_packages_apps_Settings by omnirom.
the class SecurityFeatureProviderImplTest method initPreferences_shouldLoadDefaults.
@Test
public void initPreferences_shouldLoadDefaults() {
PreferenceScreen screen = getPreferenceScreen();
DashboardCategory dashboardCategory = getDashboardCategory();
dashboardCategory.getTile(0).metaData = new Bundle();
mImpl.initPreferences(mContext, screen, dashboardCategory);
verify(screen.findPreference(MOCK_KEY)).setIcon(SecurityFeatureProviderImpl.DEFAULT_ICON);
verify(screen.findPreference(MOCK_KEY)).setSummary(mContext.getString(R.string.summary_placeholder));
}
use of com.android.settingslib.drawer.DashboardCategory in project android_packages_apps_Settings by omnirom.
the class DashboardSummary method updateCategoryAndSuggestion.
@VisibleForTesting
void updateCategoryAndSuggestion(List<Tile> suggestions) {
final Activity activity = getActivity();
if (activity == null) {
return;
}
final DashboardCategory category = mDashboardFeatureProvider.getTilesForCategory(CategoryKey.CATEGORY_HOMEPAGE);
mSummaryLoader.updateSummaryToCache(category);
if (suggestions != null) {
mAdapter.setCategoriesAndSuggestions(category, suggestions);
} else {
mAdapter.setCategory(category);
}
}
Aggregations