use of com.android.settingslib.drawer.ProviderTile in project android_packages_apps_Settings by omnirom.
the class DashboardFeatureProviderImplTest method bindPreference_onCheckedChangedError_shouldRevertCheckedState.
@Test
@Config(shadows = { ShadowTileUtils.class })
public void bindPreference_onCheckedChangedError_shouldRevertCheckedState() {
final SwitchPreference preference = new SwitchPreference(RuntimeEnvironment.application);
final Tile tile = new ProviderTile(mProviderInfo, CategoryKey.CATEGORY_HOMEPAGE, mSwitchMetaData);
final Bundle bundle = new Bundle();
bundle.putBoolean(EXTRA_SWITCH_SET_CHECKED_ERROR, true);
ShadowTileUtils.setResultBundle(bundle);
mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon, MetricsEvent.VIEW_UNKNOWN, preference, tile, null, /*key */
Preference.DEFAULT_ORDER);
preference.callChangeListener(true);
assertThat(preference.isChecked()).isFalse();
preference.callChangeListener(false);
assertThat(preference.isChecked()).isTrue();
}
use of com.android.settingslib.drawer.ProviderTile in project android_packages_apps_Settings by omnirom.
the class CategoryManagerTest method createProviderTile.
private Tile createProviderTile(String categoryKey, String packageName, String className, String authority, String key, int order) {
final ProviderInfo providerInfo = new ProviderInfo();
final Bundle metaData = new Bundle();
providerInfo.packageName = packageName;
providerInfo.name = className;
providerInfo.authority = authority;
metaData.putString(META_DATA_PREFERENCE_KEYHINT, key);
metaData.putInt(META_DATA_KEY_ORDER, order);
return new ProviderTile(providerInfo, categoryKey, metaData);
}
Aggregations