Revision f895e77a
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/dialog/RubikDialogNewRecord.java | ||
---|---|---|
35 | 35 |
import org.distorted.magic.R; |
36 | 36 |
import org.distorted.magic.RubikActivity; |
37 | 37 |
import org.distorted.object.RubikObjectList; |
38 |
import org.distorted.scores.RubikScores; |
|
38 | 39 |
import org.distorted.uistate.RubikState; |
39 | 40 |
import org.distorted.uistate.RubikStatePlay; |
40 | 41 |
|
... | ... | |
66 | 67 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
67 | 68 |
tv.setText(R.string.new_record); |
68 | 69 |
builder.setCustomTitle(tv); |
69 |
|
|
70 | 70 |
builder.setCancelable(true); |
71 |
|
|
71 | 72 |
builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener() |
72 | 73 |
{ |
73 | 74 |
@Override |
74 | 75 |
public void onClick(DialogInterface dialog, int which) |
75 | 76 |
{ |
76 | 77 |
RubikActivity act = (RubikActivity)getActivity(); |
77 |
RubikState.switchState(act,RubikState.PLAY); |
|
78 |
|
|
79 |
RubikStatePlay play = (RubikStatePlay) RubikState.PLAY.getStateClass(); |
|
80 |
int object = play.getObject(); |
|
81 |
int size = play.getSize(); |
|
82 |
|
|
78 |
RubikScores scores = RubikScores.getInstance(); |
|
79 |
String name = scores.getName(); |
|
83 | 80 |
Bundle bundle = new Bundle(); |
84 |
bundle.putInt("tab", RubikObjectList.pack(object,size) ); |
|
85 |
bundle.putBoolean("submitting", true); |
|
81 |
RubikState.switchState(act,RubikState.PLAY); |
|
86 | 82 |
|
87 |
RubikDialogScores scores = new RubikDialogScores(); |
|
88 |
scores.setArguments(bundle); |
|
89 |
scores.show(act.getSupportFragmentManager(), null); |
|
83 |
if( name.length()>0 ) |
|
84 |
{ |
|
85 |
RubikStatePlay play = (RubikStatePlay) RubikState.PLAY.getStateClass(); |
|
86 |
int object = play.getObject(); |
|
87 |
int size = play.getSize(); |
|
88 |
|
|
89 |
bundle.putInt("tab", RubikObjectList.pack(object,size) ); |
|
90 |
bundle.putBoolean("submitting", true); |
|
91 |
|
|
92 |
RubikDialogScores scoresDiag = new RubikDialogScores(); |
|
93 |
scoresDiag.setArguments(bundle); |
|
94 |
scoresDiag.show(act.getSupportFragmentManager(), null); |
|
95 |
} |
|
96 |
else |
|
97 |
{ |
|
98 |
bundle.putString("name", name ); |
|
99 |
|
|
100 |
RubikDialogSetName nameDiag = new RubikDialogSetName(); |
|
101 |
nameDiag.setArguments(bundle); |
|
102 |
nameDiag.show(act.getSupportFragmentManager(), null); |
|
103 |
} |
|
90 | 104 |
} |
91 | 105 |
}); |
106 |
|
|
92 | 107 |
builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() |
93 | 108 |
{ |
94 | 109 |
@Override |
Also available in: Unified diff
Implement a new Dialog, SetName.