Search in sources :

Example 26 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.

the class BluetoothDetailsHeaderControllerTest method setUp.

@Override
public void setUp() {
    super.setUp();
    FakeFeatureFactory.setupForTest();
    ShadowEntityHeaderController.setUseMock(mHeaderController);
    when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager);
    when(mCachedDeviceManager.getSubDeviceSummary(mCachedDevice)).thenReturn("abc");
    mController = new BluetoothDetailsHeaderController(mContext, mFragment, mCachedDevice, mLifecycle, mBluetoothManager);
    mPreference = new LayoutPreference(mContext, R.layout.settings_entity_header);
    mPreference.setKey(mController.getPreferenceKey());
    mScreen.addPreference(mPreference);
    setupDevice(mDeviceConfig);
    when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Example 27 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.

the class SettingsPreferenceFragment method setHeaderView.

protected void setHeaderView(int resource) {
    mHeader = new LayoutPreference(getPrefContext(), resource);
    mHeader.setSelectable(false);
    addPreferenceToTop(mHeader);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Example 28 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.

the class SettingsPreferenceFragment method setHeaderView.

protected void setHeaderView(View view) {
    mHeader = new LayoutPreference(getPrefContext(), view);
    mHeader.setSelectable(false);
    addPreferenceToTop(mHeader);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Example 29 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.

the class CaptionAppearanceFragment method initializeAllPreferences.

private void initializeAllPreferences() {
    final LayoutPreference captionPreview = findPreference(PREF_CAPTION_PREVIEW);
    mPreviewText = captionPreview.findViewById(R.id.preview_text);
    mPreviewWindow = captionPreview.findViewById(R.id.preview_window);
    mPreviewViewport = captionPreview.findViewById(R.id.preview_viewport);
    mPreviewViewport.addOnLayoutChangeListener(mLayoutChangeListener);
    final Resources res = getResources();
    final int[] presetValues = res.getIntArray(R.array.captioning_preset_selector_values);
    final String[] presetTitles = res.getStringArray(R.array.captioning_preset_selector_titles);
    mPreset = (PresetPreference) findPreference(PREF_PRESET);
    mPreset.setValues(presetValues);
    mPreset.setTitles(presetTitles);
    mFontSize = (ListPreference) findPreference(PREF_FONT_SIZE);
    // Initialize the preference list
    mPreferenceList.add(mFontSize);
    mPreferenceList.add(mPreset);
    mCustom = (PreferenceCategory) findPreference(PREF_CUSTOM);
    mShowingCustom = true;
    final int[] colorValues = res.getIntArray(R.array.captioning_color_selector_values);
    final String[] colorTitles = res.getStringArray(R.array.captioning_color_selector_titles);
    mForegroundColor = (ColorPreference) mCustom.findPreference(PREF_FOREGROUND_COLOR);
    mForegroundColor.setTitles(colorTitles);
    mForegroundColor.setValues(colorValues);
    final int[] opacityValues = res.getIntArray(R.array.captioning_opacity_selector_values);
    final String[] opacityTitles = res.getStringArray(R.array.captioning_opacity_selector_titles);
    mForegroundOpacity = (ColorPreference) mCustom.findPreference(PREF_FOREGROUND_OPACITY);
    mForegroundOpacity.setTitles(opacityTitles);
    mForegroundOpacity.setValues(opacityValues);
    mEdgeColor = (ColorPreference) mCustom.findPreference(PREF_EDGE_COLOR);
    mEdgeColor.setTitles(colorTitles);
    mEdgeColor.setValues(colorValues);
    // Add "none" as an additional option for backgrounds.
    final int[] bgColorValues = new int[colorValues.length + 1];
    final String[] bgColorTitles = new String[colorTitles.length + 1];
    System.arraycopy(colorValues, 0, bgColorValues, 1, colorValues.length);
    System.arraycopy(colorTitles, 0, bgColorTitles, 1, colorTitles.length);
    bgColorValues[0] = Color.TRANSPARENT;
    bgColorTitles[0] = getString(R.string.color_none);
    mBackgroundColor = (ColorPreference) mCustom.findPreference(PREF_BACKGROUND_COLOR);
    mBackgroundColor.setTitles(bgColorTitles);
    mBackgroundColor.setValues(bgColorValues);
    mBackgroundOpacity = (ColorPreference) mCustom.findPreference(PREF_BACKGROUND_OPACITY);
    mBackgroundOpacity.setTitles(opacityTitles);
    mBackgroundOpacity.setValues(opacityValues);
    mWindowColor = (ColorPreference) mCustom.findPreference(PREF_WINDOW_COLOR);
    mWindowColor.setTitles(bgColorTitles);
    mWindowColor.setValues(bgColorValues);
    mWindowOpacity = (ColorPreference) mCustom.findPreference(PREF_WINDOW_OPACITY);
    mWindowOpacity.setTitles(opacityTitles);
    mWindowOpacity.setValues(opacityValues);
    mEdgeType = (EdgeTypePreference) mCustom.findPreference(PREF_EDGE_TYPE);
    mTypeface = (ListPreference) mCustom.findPreference(PREF_TYPEFACE);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) Resources(android.content.res.Resources)

Example 30 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.

the class UsbDetailsHeaderController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    final LayoutPreference headerPreference = screen.findPreference(KEY_DEVICE_HEADER);
    mHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPreference.findViewById(R.id.entity_header));
}
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