use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class SuggestionAdapterTest method makeSuggestions.
private List<Tile> makeSuggestions(String... pkgNames) {
final List<Tile> suggestions = new ArrayList<>();
for (String pkgName : pkgNames) {
Tile suggestion = new Tile();
suggestion.intent = new Intent("action");
suggestion.intent.setComponent(new ComponentName(pkgName, "cls"));
suggestions.add(suggestion);
suggestion.icon = mock(Icon.class);
}
return suggestions;
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class SuggestionAdapterTest method onBindViewHolder_viewsShouldClearOnRebind.
@Test
public void onBindViewHolder_viewsShouldClearOnRebind() {
Context context = new ContextThemeWrapper(RuntimeEnvironment.application, R.style.Theme_Settings);
List<Tile> packages = makeSuggestions("pkg1");
RemoteViews remoteViews = mock(RemoteViews.class);
FrameLayout layout = new FrameLayout(context);
Button primary = new Button(context);
primary.setId(android.R.id.primary);
layout.addView(primary);
doReturn(layout).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
packages.get(0).remoteViews = remoteViews;
setupSuggestions(mActivity, packages);
mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
ViewGroup itemView = (ViewGroup) mSuggestionHolder.itemView;
assertThat(itemView.getChildCount()).isEqualTo(1);
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class SuggestionFeatureProviderImplTest method getSuggestionIdentifier_nullContext_shouldNotCrash.
@Test
public void getSuggestionIdentifier_nullContext_shouldNotCrash() {
final Tile suggestion = new Tile();
suggestion.intent = new Intent().setClassName(RuntimeEnvironment.application.getPackageName(), "123");
assertThat(mProvider.getSuggestionIdentifier(null, suggestion)).isNotEmpty();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class SuggestionFeatureProviderImplTest method getSuggestionIdentifier_samePackage_returnClassName.
@Test
public void getSuggestionIdentifier_samePackage_returnClassName() {
final Tile suggestion = new Tile();
suggestion.intent = new Intent().setClassName(RuntimeEnvironment.application.getPackageName(), "123");
assertThat(mProvider.getSuggestionIdentifier(RuntimeEnvironment.application, suggestion)).isEqualTo("123");
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class SuggestionsChecksTest method testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintNotSupported.
@Test
public void testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintNotSupported() {
stubFingerprintSupported(false);
Tile tile = createFingerprintTile();
assertThat(mSuggestionsChecks.isSuggestionComplete(tile)).isTrue();
}
Aggregations