mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.gecko.preferences;
|
|
|
|
import android.content.Context;
|
|
import android.preference.CheckBoxPreference;
|
|
import android.util.AttributeSet;
|
|
import android.view.View;
|
|
import android.widget.TextView;
|
|
|
|
/**
|
|
* Represents a Checkbox element in a preference menu.
|
|
* The title of the Checkbox can be larger than the view.
|
|
* In this case, it will be displayed in 2 or more lines.
|
|
* The default behavior of the class CheckBoxPreference
|
|
* doesn't wrap the title.
|
|
*/
|
|
|
|
public class CustomCheckBoxPreference extends CheckBoxPreference {
|
|
|
|
public CustomCheckBoxPreference(Context context) {
|
|
super(context);
|
|
}
|
|
|
|
public CustomCheckBoxPreference(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
}
|
|
public CustomCheckBoxPreference(Context context, AttributeSet attrs, int defStyle) {
|
|
super(context, attrs, defStyle);
|
|
}
|
|
|
|
@Override
|
|
protected void onBindView(View view) {
|
|
super.onBindView(view);
|
|
final TextView title = (TextView) view.findViewById(android.R.id.title);
|
|
if (title != null) {
|
|
title.setSingleLine(false);
|
|
title.setEllipsize(null);
|
|
}
|
|
}
|
|
|
|
}
|