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);
}
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);
}
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);
}
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);
}
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));
}
Aggregations