Allow switch preferences to span lines.
Test: manual Change-Id: Ifcc801873ed143c4d9ceb6fb928c276808a95f81
This commit is contained in:
@@ -184,6 +184,7 @@ public class AppNotificationSettings extends NotificationSettingsBase {
|
|||||||
channelPref.setKey(channel.getId());
|
channelPref.setKey(channel.getId());
|
||||||
channelPref.setTitle(channel.getName());
|
channelPref.setTitle(channel.getName());
|
||||||
channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE);
|
channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE);
|
||||||
|
channelPref.setMultiLine(true);
|
||||||
|
|
||||||
if (channel.isDeleted()) {
|
if (channel.isDeleted()) {
|
||||||
channelPref.setTitle(
|
channelPref.setTitle(
|
||||||
|
@@ -22,6 +22,7 @@ import android.support.v7.preference.PreferenceViewHolder;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||||
@@ -34,6 +35,7 @@ public class MasterSwitchPreference extends Preference {
|
|||||||
|
|
||||||
private Switch mSwitch;
|
private Switch mSwitch;
|
||||||
private boolean mChecked;
|
private boolean mChecked;
|
||||||
|
private boolean mMultiLine;
|
||||||
|
|
||||||
public MasterSwitchPreference(Context context, AttributeSet attrs,
|
public MasterSwitchPreference(Context context, AttributeSet attrs,
|
||||||
int defStyleAttr, int defStyleRes) {
|
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() {
|
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.
|
* If admin is not null, disables the switch.
|
||||||
* Otherwise, keep it enabled.
|
* Otherwise, keep it enabled.
|
||||||
|
Reference in New Issue
Block a user