use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class AccessibilityButtonPreviewPreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final LayoutPreference preference = screen.findPreference(getPreferenceKey());
mPreview = preference.findViewById(R.id.preview_image);
updatePreviewPreference();
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class ToggleAutoclickCustomSeekbarController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final LayoutPreference preference = screen.findPreference(getPreferenceKey());
if (isAvailable()) {
int delayMillis = getSharedPreferenceForDelayValue();
// Initialize seek bar preference. Sets seek bar size to the number of possible delay
// values.
mSeekBar = preference.findViewById(R.id.autoclick_delay);
mSeekBar.setMax(delayToSeekBarProgress(MAX_AUTOCLICK_DELAY_MS));
mSeekBar.setProgress(delayToSeekBarProgress(delayMillis));
mSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);
mDelayLabel = preference.findViewById(R.id.current_label);
mDelayLabel.setText(delayTimeToString(delayMillis));
mShorter = preference.findViewById(R.id.shorter);
mShorter.setOnClickListener(v -> {
minusDelayByImageView();
});
mLonger = preference.findViewById(R.id.longer);
mLonger.setOnClickListener(v -> {
plusDelayByImageView();
});
}
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class HeaderPreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
if (mFragment == null) {
return;
}
LayoutPreference pref = screen.findPreference(getPreferenceKey());
mHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, pref.findViewById(R.id.entity_header));
pref = mHeaderController.setRecyclerView(mFragment.getListView(), mFragment.getSettingsLifecycle()).setIcon(IconDrawableFactory.newInstance(mFragment.getActivity()).getBadgedIcon(mPackageInfo.applicationInfo)).setLabel(mPackageInfo.applicationInfo.loadLabel(mPm)).setSummary(mServiceName).setSecondSummary(new NotificationBackend().getDeviceList(mCdm, mBm, mCn.getPackageName(), mUserId)).setIsInstantApp(AppUtils.isInstant(mPackageInfo.applicationInfo)).setPackageName(mPackageInfo.packageName).setUid(mPackageInfo.applicationInfo.uid).setHasAppInfoLink(true).setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, EntityHeaderController.ActionType.ACTION_NONE).done(mFragment.getActivity(), mContext);
pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE);
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class MyDeviceInfoFragment method initHeader.
private void initHeader() {
// TODO: Migrate into its own controller.
final LayoutPreference headerPreference = getPreferenceScreen().findPreference(KEY_MY_DEVICE_INFO_HEADER);
final boolean shouldDisplayHeader = getContext().getResources().getBoolean(R.bool.config_show_device_header_in_device_info);
headerPreference.setVisible(shouldDisplayHeader);
if (!shouldDisplayHeader) {
return;
}
final View headerView = headerPreference.findViewById(R.id.entity_header);
final Activity context = getActivity();
final Bundle bundle = getArguments();
final EntityHeaderController controller = EntityHeaderController.newInstance(context, this, headerView).setRecyclerView(getListView(), getSettingsLifecycle()).setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, EntityHeaderController.ActionType.ACTION_NONE);
// TODO: There may be an avatar setting action we can use here.
final int iconId = bundle.getInt("icon_id", 0);
if (iconId == 0) {
final UserManager userManager = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
final UserInfo info = Utils.getExistingUser(userManager, android.os.Process.myUserHandle());
controller.setLabel(info.name);
controller.setIcon(com.android.settingslib.Utils.getUserIcon(getActivity(), userManager, info));
}
controller.done(context, true);
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class ZenModeSendersImagePreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
LayoutPreference pref = (LayoutPreference) screen.findPreference(KEY);
mImageView = (ImageView) pref.findViewById(R.id.zen_mode_settings_senders_image);
}
Aggregations