don't allow duplicate group names

If group already exists, warn rather than create another with the same
name.
This commit is contained in:
Eric House 2017-11-12 22:50:45 -08:00
parent c2eff7d3f2
commit 607567cd35
2 changed files with 14 additions and 3 deletions

View file

@ -755,9 +755,18 @@ public class GamesListDelegate extends ListDelegateBase
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
String name = namer.getName();
DBUtils.addGroup( m_activity, name );
mkListAdapter();
showNewGroupIf();
long hasName = DBUtils.getGroup( m_activity, name );
if ( DBUtils.GROUPID_UNSPEC == hasName ) {
DBUtils.addGroup( m_activity, name );
mkListAdapter();
showNewGroupIf();
} else {
String msg = LocUtils
.getString( m_activity,
R.string.duplicate_group_name_fmt,
name );
makeOkOnlyBuilder( msg ).show();
}
}
};
lstnr2 = new OnClickListener() {

View file

@ -2161,6 +2161,8 @@
<string name="button_archive">Archive\u200C</string>
<string name="group_name_archive">Archive</string>
<string name="duplicate_group_name_fmt">The group \"%1$s\" already exists.</string>
<string name="button_reconnect">Reconnect</string>
<string name="square_tiles">Square rack tiles</string>