use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class ImportanceResetPreferenceControllerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mPreference = new LayoutPreference(mContext, R.layout.reset_importance_button);
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
mController = new ImportanceResetPreferenceController(mContext, KEY);
mController.displayPreference(mScreen);
ReflectionHelpers.setField(mController, "mBackend", mBackend);
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceController method getClearAll.
LayoutPreference getClearAll(PreferenceGroup parent) {
LayoutPreference pref = new LayoutPreference(mContext, R.layout.conversations_clear_recents);
pref.setOrder(1);
Button button = pref.findViewById(R.id.conversation_settings_clear_recents);
button.setOnClickListener(v -> {
try {
mPs.removeAllRecentConversations();
for (int i = parent.getPreferenceCount() - 1; i >= 0; i--) {
Preference p = parent.getPreference(i);
if (p instanceof RecentConversationPreference) {
if (((RecentConversationPreference) p).hasClearListener()) {
parent.removePreference(p);
}
}
}
button.announceForAccessibility(mContext.getString(R.string.recent_convos_removed));
} catch (RemoteException e) {
Slog.w(TAG, "Could not clear recents", e);
}
});
return pref;
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class HeaderPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
if (mAppRow != null && mFragment != null) {
Activity activity = null;
if (mStarted) {
// don't call done on an activity if it hasn't started yet
activity = mFragment.getActivity();
}
if (activity == null) {
return;
}
LayoutPreference pref = (LayoutPreference) preference;
mHeaderController = EntityHeaderController.newInstance(activity, mFragment, pref.findViewById(R.id.entity_header));
pref = mHeaderController.setIcon(mAppRow.icon).setLabel(getLabel()).setSummary(getSummary()).setSecondSummary(getSecondSummary()).setPackageName(mAppRow.pkg).setUid(mAppRow.uid).setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE, EntityHeaderController.ActionType.ACTION_NONE).setHasAppInfoLink(true).setRecyclerView(mFragment.getListView(), mFragment.getSettingsLifecycle()).done(activity, mContext);
pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE);
pref.findViewById(R.id.entity_header).setBackground(null);
}
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class BluetoothDetailsHeaderController method init.
@Override
protected void init(PreferenceScreen screen) {
final LayoutPreference headerPreference = screen.findPreference(KEY_DEVICE_HEADER);
mHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPreference.findViewById(R.id.entity_header));
screen.addPreference(headerPreference);
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class ColorModePreferenceFragment method addStaticPreferences.
@Override
protected void addStaticPreferences(PreferenceScreen screen) {
final LayoutPreference preview = new LayoutPreference(screen.getContext(), R.layout.color_mode_preview);
configureAndInstallPreview(preview, screen);
addViewPager(preview);
}
Aggregations