Search in sources :

Example 51 with LayoutPreference

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();
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Example 52 with LayoutPreference

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();
        });
    }
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Example 53 with LayoutPreference

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);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) NotificationBackend(com.android.settings.notification.NotificationBackend)

Example 54 with LayoutPreference

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);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) EntityHeaderController(com.android.settings.widget.EntityHeaderController) Bundle(android.os.Bundle) UserManager(android.os.UserManager) Activity(android.app.Activity) UserInfo(android.content.pm.UserInfo) View(android.view.View)

Example 55 with LayoutPreference

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);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Aggregations

LayoutPreference (com.android.settingslib.widget.LayoutPreference)61 Before (org.junit.Before)10 Preference (androidx.preference.Preference)8 Activity (android.app.Activity)5 View (android.view.View)5 Button (android.widget.Button)5 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)5 Test (org.junit.Test)5 ImageView (android.widget.ImageView)3 PreferenceManager (androidx.preference.PreferenceManager)3 PreferenceScreen (androidx.preference.PreferenceScreen)3 Intent (android.content.Intent)2 UserInfo (android.content.pm.UserInfo)2 Resources (android.content.res.Resources)2 Bundle (android.os.Bundle)2 RemoteException (android.os.RemoteException)2 UserManager (android.os.UserManager)2 TextView (android.widget.TextView)2 PreferenceFragmentCompat (androidx.preference.PreferenceFragmentCompat)2 WifiDataUsageSummaryPreferenceController (com.android.settings.datausage.WifiDataUsageSummaryPreferenceController)2