include the list of currently selected conn types as pref summary

This commit is contained in:
Eric House 2014-11-14 07:24:24 -08:00
parent 2e8f4097d9
commit 76fe26a057
2 changed files with 16 additions and 2 deletions

View file

@ -57,6 +57,9 @@ public class XWConnAddrPreference extends DialogPreference {
setDialogLayoutResource( R.layout.conn_types_display ); setDialogLayoutResource( R.layout.conn_types_display );
setNegativeButtonText( LocUtils.getString( context, R.string.button_cancel ) ); setNegativeButtonText( LocUtils.getString( context, R.string.button_cancel ) );
m_curSet = XWPrefs.getAddrTypes( m_context );
setSummary( m_curSet.toString() );
} }
@Override @Override
@ -65,7 +68,6 @@ public class XWConnAddrPreference extends DialogPreference {
LocUtils.xlateView( m_context, view ); LocUtils.xlateView( m_context, view );
LinearLayout list = (LinearLayout)view.findViewById( R.id.conn_types ); LinearLayout list = (LinearLayout)view.findViewById( R.id.conn_types );
m_curSet = XWPrefs.getAddrTypes( m_context );
for ( CommsConnType typ : s_supported.getTypes() ) { for ( CommsConnType typ : s_supported.getTypes() ) {
CheckBox box = (CheckBox)LocUtils.inflate( m_context, R.layout.btinviter_item ); CheckBox box = (CheckBox)LocUtils.inflate( m_context, R.layout.btinviter_item );
box.setText( typ.longName() ); box.setText( typ.longName() );
@ -82,6 +84,7 @@ public class XWConnAddrPreference extends DialogPreference {
} else { } else {
m_curSet.remove( typf ); m_curSet.remove( typf );
} }
setSummary( m_curSet.toString() );
} }
} ); } );
} }

View file

@ -20,8 +20,8 @@
package org.eehouse.android.xw4.jni; package org.eehouse.android.xw4.jni;
import android.text.TextUtils;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -62,6 +62,17 @@ public class CommsAddrRec {
return result; return result;
} }
@Override
public String toString()
{
CommsConnType[] types = getTypes();
String[] strs = new String[types.length];
for ( int ii = 0; ii < types.length; ++ii ) {
strs[ii] = types[ii].longName();
}
return TextUtils.join( " + ", strs );
}
private static final CommsConnType[] s_hint = new CommsConnType[0]; private static final CommsConnType[] s_hint = new CommsConnType[0];
} }