multiline support for checkbox preferences (see #358)
This commit is contained in:
34
mobile/src/com/cradle/iitc_mobile/IITC_PluginPreference.java
Normal file
34
mobile/src/com/cradle/iitc_mobile/IITC_PluginPreference.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.cradle.iitc_mobile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
// multiline checkbox preference
|
||||
public class IITC_PluginPreference extends CheckBoxPreference {
|
||||
|
||||
public IITC_PluginPreference(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
protected void onBindView( View view) {
|
||||
super.onBindView(view);
|
||||
makeMultiline(view);
|
||||
}
|
||||
|
||||
protected void makeMultiline( View view) {
|
||||
if ( view instanceof ViewGroup) {
|
||||
ViewGroup grp=(ViewGroup)view;
|
||||
for ( int index = 0; index < grp.getChildCount(); index++) {
|
||||
makeMultiline(grp.getChildAt(index));
|
||||
}
|
||||
} else if (view instanceof TextView) {
|
||||
TextView t = (TextView)view;
|
||||
t.setSingleLine(false);
|
||||
t.setEllipsize(null);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user