Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80513838 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow switch preferences to span lines."

parents 1f1be36a 762a733a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ public class AppNotificationSettings extends NotificationSettingsBase {
                    channelPref.setKey(channel.getId());
                    channelPref.setTitle(channel.getName());
                    channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE);
                    channelPref.setMultiLine(true);

                    if (channel.isDeleted()) {
                        channelPref.setTitle(
+16 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;

import com.android.settings.R;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
@@ -34,6 +35,7 @@ public class MasterSwitchPreference extends Preference {

    private Switch mSwitch;
    private boolean mChecked;
    private boolean mMultiLine;

    public MasterSwitchPreference(Context context, AttributeSet attrs,
            int defStyleAttr, int defStyleRes) {
@@ -74,6 +76,12 @@ public class MasterSwitchPreference extends Preference {
                }
            });
        }
        if (mMultiLine) {
            TextView textView = (TextView)holder.findViewById(android.R.id.title);
            if (textView != null) {
                textView.setSingleLine(false);
            }
        }
    }

    public boolean isChecked() {
@@ -97,6 +105,14 @@ public class MasterSwitchPreference extends Preference {
        }
    }

    public boolean isMultiLine() {
        return mMultiLine;
    }

    public void setMultiLine(boolean multiLine) {
        mMultiLine = multiLine;
    }

    /**
     * If admin is not null, disables the switch.
     * Otherwise, keep it enabled.