Search in sources :

Example 26 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project android_packages_apps_Settings by DirtyUnicorns.

the class BluetoothDetailsHeaderControllerTest method setUp.

@Override
public void setUp() {
    super.setUp();
    FakeFeatureFactory.setupForTest(spy(mContext));
    ShadowEntityHeaderController.setUseMock(mHeaderController);
    mController = new BluetoothDetailsHeaderController(mContext, mFragment, mCachedDevice, mLifecycle);
    mPreference = new LayoutPreference(mContext, R.layout.settings_entity_header);
    mPreference.setKey(mController.getPreferenceKey());
    mScreen.addPreference(mPreference);
    setupDevice(mDeviceConfig);
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference)

Example 27 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project android_packages_apps_Settings by DirtyUnicorns.

the class SettingsPreferenceFragment method setHeaderView.

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

Example 28 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project android_packages_apps_Settings by DirtyUnicorns.

the class ChannelNotificationSettings method setupBlock.

private void setupBlock() {
    View switchBarContainer = LayoutInflater.from(getPrefContext()).inflate(R.layout.styled_switch_bar, null);
    mSwitchBar = switchBarContainer.findViewById(R.id.switch_bar);
    mSwitchBar.show();
    mSwitchBar.setDisabledByAdmin(mSuspendedAppsAdmin);
    mSwitchBar.setChecked(mChannel.getImportance() != NotificationManager.IMPORTANCE_NONE);
    mSwitchBar.addOnSwitchChangeListener(new SwitchBar.OnSwitchChangeListener() {

        @Override
        public void onSwitchChanged(Switch switchView, boolean isChecked) {
            int importance = 0;
            if (mShowLegacyChannelConfig) {
                importance = isChecked ? IMPORTANCE_UNSPECIFIED : IMPORTANCE_NONE;
                mImportanceToggle.setChecked(importance == IMPORTANCE_UNSPECIFIED);
            } else {
                importance = isChecked ? IMPORTANCE_LOW : IMPORTANCE_NONE;
                mImportance.setSummary(getImportanceSummary(importance));
            }
            mChannel.setImportance(importance);
            mChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
            mBackend.updateChannel(mPkg, mUid, mChannel);
            updateDependents(mChannel.getImportance() == IMPORTANCE_NONE);
        }
    });
    mBlockBar = new LayoutPreference(getPrefContext(), switchBarContainer);
    mBlockBar.setOrder(ORDER_FIRST);
    mBlockBar.setKey(KEY_BLOCK);
    getPreferenceScreen().addPreference(mBlockBar);
    if (!isChannelBlockable(mAppRow.systemApp, mChannel)) {
        setVisible(mBlockBar, false);
    }
    setupBlockDesc(R.string.channel_notifications_off_desc);
}
Also used : SwitchBar(com.android.settings.widget.SwitchBar) LayoutPreference(com.android.settings.applications.LayoutPreference) Switch(android.widget.Switch) View(android.view.View)

Example 29 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project android_packages_apps_Settings by DirtyUnicorns.

the class EntityHeaderControllerTest method testBuildView_withContext_shouldBuildPreference.

@Test
public void testBuildView_withContext_shouldBuildPreference() {
    mController = EntityHeaderController.newInstance(mActivity, mFragment, null);
    Preference preference = mController.done(mActivity, mShadowContext);
    assertThat(preference instanceof LayoutPreference).isTrue();
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference) LayoutPreference(com.android.settings.applications.LayoutPreference) Preference(android.support.v7.preference.Preference) Test(org.junit.Test)

Example 30 with LayoutPreference

use of com.android.settings.applications.LayoutPreference in project android_packages_apps_Settings by crdroidandroid.

the class BluetoothDetailsHeaderController method init.

@Override
protected void init(PreferenceScreen screen) {
    final LayoutPreference headerPreference = (LayoutPreference) screen.findPreference(KEY_DEVICE_HEADER);
    mHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPreference.findViewById(R.id.entity_header));
    screen.addPreference(headerPreference);
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference)

Aggregations

LayoutPreference (com.android.settings.applications.LayoutPreference)76 Button (android.widget.Button)16 View (android.view.View)12 Switch (android.widget.Switch)12 SwitchBar (com.android.settings.widget.SwitchBar)12 Before (org.junit.Before)10 Preference (android.support.v7.preference.Preference)7 ImageView (android.widget.ImageView)6 Test (org.junit.Test)6 Intent (android.content.Intent)5 TextView (android.widget.TextView)5 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)5 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