use of androidx.preference.Preference in project Signal-Android by WhisperSystems.
the class CorrectedPreferenceFragment method onCreateAdapter.
@Override
@SuppressLint("RestrictedApi")
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
return new PreferenceGroupAdapter(preferenceScreen) {
@Override
public void onBindViewHolder(PreferenceViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
Preference preference = getItem(position);
if (preference instanceof PreferenceCategory) {
setZeroPaddingToLayoutChildren(holder.itemView);
} else {
View iconFrame = holder.itemView.findViewById(R.id.icon_frame);
if (iconFrame != null) {
iconFrame.setVisibility(preference.getIcon() == null ? View.GONE : View.VISIBLE);
}
}
}
};
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiNetworkListFragment method onCreatePreferences.
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.wifi_dpp_network_list);
mAccessPointsPreferenceCategory = (PreferenceCategory) findPreference(PREF_KEY_ACCESS_POINTS);
mFakeNetworkPreference = new Preference(getPrefContext());
mFakeNetworkPreference.setIcon(R.drawable.ic_wifi_signal_0);
mFakeNetworkPreference.setKey("fake_key");
mFakeNetworkPreference.setTitle("fake network");
mAddPreference = new Preference(getPrefContext());
mAddPreference.setIcon(R.drawable.ic_add_24dp);
mAddPreference.setTitle(R.string.wifi_add_network);
mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager());
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppStorageSizesControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mAppPreference = new Preference(mContext);
mCachePreference = new Preference(mContext);
mDataPreference = new Preference(mContext);
mTotalPreference = new Preference(mContext);
mController = new AppStorageSizesController.Builder().setAppSizePreference(mAppPreference).setCacheSizePreference(mCachePreference).setDataSizePreference(mDataPreference).setTotalSizePreference(mTotalPreference).setErrorString(R.string.invalid_size_value).setComputingString(R.string.computing_size).build();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountSyncPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mActivity = Robolectric.setupActivity(Activity.class);
ShadowApplication.getInstance().setSystemService(Context.ACCOUNT_SERVICE, mAccountManager);
when(mAccountManager.getAuthenticatorTypesAsUser(anyInt())).thenReturn(new AuthenticatorDescription[0]);
when(mAccountManager.getAccountsAsUser(anyInt())).thenReturn(new Account[0]);
mPreference = new Preference(mActivity);
mPreference.setKey("account_sync");
mController = new AccountSyncPreferenceController(mActivity);
mController.init(new Account("acct1", "type1"), new UserHandle(3));
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppDataUsagePreferenceControllerTest method updateState_shouldUpdatePreferenceSummary.
@Test
public void updateState_shouldUpdatePreferenceSummary() {
final Preference preference = mock(Preference.class);
mController.updateState(preference);
verify(preference).setSummary(any());
}
Aggregations