Revision f4ee4d70
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/dialogs/RubikDialogSetName.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
public class RubikDialogSetName extends AppCompatDialogFragment |
49 | 49 |
{ |
50 |
private static final int MAX_NAME_LEN = 15; |
|
50 | 51 |
private EditText mEdit; |
51 | 52 |
|
52 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
119 | 120 |
public void onClick(DialogInterface dialog, int which) |
120 | 121 |
{ |
121 | 122 |
String name = mEdit.getText().toString(); |
123 |
int len = name.length(); |
|
122 | 124 |
|
123 |
if( name.length()>0 )
|
|
125 |
if( len>0 )
|
|
124 | 126 |
{ |
127 |
if( len>MAX_NAME_LEN ) |
|
128 |
{ |
|
129 |
name = name.substring(0,MAX_NAME_LEN); |
|
130 |
} |
|
131 |
|
|
125 | 132 |
RubikActivity act = (RubikActivity)getActivity(); |
126 | 133 |
RubikState.switchState(act,RubikState.PLAY); |
127 | 134 |
RubikScores.getInstance().setName(name); |
Also available in: Unified diff
Do not allow more than 15 characters in the NAME.