Search in sources :

Example 81 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project platform_packages_apps_Settings by BlissRoms.

the class AccountHeaderPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    FakeFeatureFactory.setupForTest(mContext);
    mHeaderPreference = new LayoutPreference(RuntimeEnvironment.application, R.layout.settings_entity_header);
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference) Before(org.junit.Before)

Example 82 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project platform_packages_apps_Settings by BlissRoms.

the class StartNowPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    LayoutPreference pref = (LayoutPreference) screen.findPreference(getPreferenceKey());
    Button startButton = (Button) pref.findViewById(R.id.dream_start_now_button);
    startButton.setOnClickListener(v -> mBackend.startDreaming());
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference) Button(android.widget.Button)

Example 83 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project platform_packages_apps_Settings by BlissRoms.

the class WifiDetailPreferenceController method setupEntityHeader.

private void setupEntityHeader(PreferenceScreen screen) {
    LayoutPreference headerPref = (LayoutPreference) screen.findPreference(KEY_HEADER);
    mEntityHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPref.findViewById(R.id.entity_header));
    ImageView iconView = headerPref.findViewById(R.id.entity_header_icon);
    iconView.setBackground(mContext.getDrawable(R.drawable.ic_settings_widget_background));
    iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    mEntityHeaderController.setLabel(mAccessPoint.getSsidStr());
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference) ImageView(android.widget.ImageView)

Example 84 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project platform_packages_apps_Settings by BlissRoms.

the class BatteryHeaderPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycle = new Lifecycle();
    mContext = spy(RuntimeEnvironment.application);
    mBatteryMeterView = new BatteryMeterView(mContext);
    mBatteryPercentText = new TextView(mContext);
    mSummary = new TextView(mContext);
    ShadowEntityHeaderController.setUseMock(mEntityHeaderController);
    mSummary2 = new TextView(mContext);
    mBatteryIntent = new Intent();
    mBatteryIntent.putExtra(BatteryManager.EXTRA_LEVEL, BATTERY_LEVEL);
    mBatteryIntent.putExtra(BatteryManager.EXTRA_SCALE, 100);
    mBatteryIntent.putExtra(BatteryManager.EXTRA_PLUGGED, 1);
    doReturn(mBatteryIntent).when(mContext).registerReceiver(any(), any());
    mBatteryLayoutPref = new LayoutPreference(mContext, R.layout.battery_header);
    doReturn(mBatteryLayoutPref).when(mPreferenceScreen).findPreference(BatteryHeaderPreferenceController.KEY_BATTERY_HEADER);
    mBatteryInfo.batteryLevel = BATTERY_LEVEL;
    mController = new BatteryHeaderPreferenceController(mContext, mActivity, mPreferenceFragment, mLifecycle);
    mController.mBatteryMeterView = mBatteryMeterView;
    mController.mBatteryPercentText = mBatteryPercentText;
    mController.mSummary1 = mSummary;
    mController.mSummary2 = mSummary2;
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) TextView(android.widget.TextView) Intent(android.content.Intent) Before(org.junit.Before)

Example 85 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project platform_packages_apps_Settings by BlissRoms.

the class SettingsPreferenceFragment method setHeaderView.

protected void setHeaderView(View view) {
    mHeader = new LayoutPreference(getPrefContext(), view);
    addPreferenceToTop(mHeader);
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference)

Aggregations

LayoutPreference (com.android.settings.applications.LayoutPreference)85 Button (android.widget.Button)18 View (android.view.View)12 Switch (android.widget.Switch)12 SwitchBar (com.android.settings.widget.SwitchBar)12 Before (org.junit.Before)12 Preference (android.support.v7.preference.Preference)7 Intent (android.content.Intent)6 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)6 Test (org.junit.Test)6 Context (android.content.Context)1 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 Bundle (android.os.Bundle)1 OnPreferenceClickListener (android.support.v7.preference.Preference.OnPreferenceClickListener)1 BatterySipper (com.android.internal.os.BatterySipper)1