Revision e41e7dc3
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/uistate/RubikStateSolving.java | ||
---|---|---|
42 | 42 |
private long mStartTime; |
43 | 43 |
private boolean mRunning; |
44 | 44 |
private RubikScores mScores; |
45 |
private Button mBack; |
|
45 | 46 |
|
46 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 48 |
|
... | ... | |
54 | 55 |
|
55 | 56 |
void leaveState(RubikActivity act) |
56 | 57 |
{ |
57 |
stopCounting(); |
|
58 |
stopCounting(act);
|
|
58 | 59 |
} |
59 | 60 |
|
60 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
88 | 89 |
buttonL.setOnClickListener(act); |
89 | 90 |
layoutBot.addView(buttonL); |
90 | 91 |
|
91 |
Button buttonR = new Button(act);
|
|
92 |
buttonR.setLayoutParams(params);
|
|
93 |
buttonR.setId(BUTTON_ID_BACK);
|
|
94 |
buttonR.setPadding(padding,0,padding,0);
|
|
95 |
buttonR.setText(R.string.back);
|
|
96 |
buttonR.setOnClickListener(act);
|
|
97 |
layoutBot.addView(buttonR);
|
|
92 |
mBack = new Button(act);
|
|
93 |
mBack.setLayoutParams(params);
|
|
94 |
mBack.setId(BUTTON_ID_BACK);
|
|
95 |
mBack.setPadding(padding,0,padding,0);
|
|
96 |
mBack.setText(R.string.back);
|
|
97 |
mBack.setOnClickListener(act);
|
|
98 |
layoutBot.addView(mBack);
|
|
98 | 99 |
|
99 | 100 |
buttonL.setVisibility(android.view.View.INVISIBLE); |
100 | 101 |
} |
... | ... | |
144 | 145 |
|
145 | 146 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
146 | 147 |
|
147 |
public long stopCounting() |
|
148 |
public long stopCounting(RubikActivity act)
|
|
148 | 149 |
{ |
149 | 150 |
if( mRunning ) |
150 | 151 |
{ |
152 |
act.runOnUiThread(new Runnable() |
|
153 |
{ |
|
154 |
@Override |
|
155 |
public void run() |
|
156 |
{ |
|
157 |
mTime.setText(R.string.solved); |
|
158 |
mBack.setClickable(false); |
|
159 |
} |
|
160 |
}); |
|
161 |
|
|
151 | 162 |
if( mTimer!=null ) |
152 | 163 |
{ |
153 | 164 |
mTimer.cancel(); |
... | ... | |
162 | 173 |
int size = play.getSize(); |
163 | 174 |
int scramble= play.getPicker(); |
164 | 175 |
|
165 |
mScores.setRecord(object, size, scramble, timeTaken); |
|
166 |
return timeTaken; |
|
176 |
boolean isNew = mScores.setRecord(object, size, scramble, timeTaken); |
|
177 |
|
|
178 |
return isNew ? timeTaken : -timeTaken; |
|
167 | 179 |
} |
168 | 180 |
|
169 | 181 |
return 0; |
Also available in: Unified diff
Add the 'Solved' dialog.