1 |
211b48f2
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
|
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
1f9772f3
|
Leszek Koltunski
|
package org.distorted.states;
|
21 |
211b48f2
|
Leszek Koltunski
|
|
22 |
4c0cd600
|
Leszek Koltunski
|
import android.content.Context;
|
23 |
211b48f2
|
Leszek Koltunski
|
import android.content.SharedPreferences;
|
24 |
4c0cd600
|
Leszek Koltunski
|
import android.graphics.drawable.BitmapDrawable;
|
25 |
e03e0352
|
Leszek Koltunski
|
import android.os.Bundle;
|
26 |
e3c74c0f
|
Leszek Koltunski
|
import android.util.TypedValue;
|
27 |
211b48f2
|
Leszek Koltunski
|
import android.view.LayoutInflater;
|
28 |
|
|
import android.view.View;
|
29 |
|
|
import android.widget.Button;
|
30 |
e07c48a2
|
Leszek Koltunski
|
import android.widget.GridLayout;
|
31 |
211b48f2
|
Leszek Koltunski
|
import android.widget.ImageButton;
|
32 |
|
|
import android.widget.LinearLayout;
|
33 |
4c0cd600
|
Leszek Koltunski
|
import android.widget.PopupWindow;
|
34 |
211b48f2
|
Leszek Koltunski
|
|
35 |
e03e0352
|
Leszek Koltunski
|
import org.distorted.dialogs.RubikDialogAbout;
|
36 |
|
|
import org.distorted.dialogs.RubikDialogScores;
|
37 |
1f9772f3
|
Leszek Koltunski
|
import org.distorted.main.R;
|
38 |
|
|
import org.distorted.main.RubikActivity;
|
39 |
15846fe4
|
Leszek Koltunski
|
import org.distorted.main.RubikPreRender;
|
40 |
9c2f0c91
|
Leszek Koltunski
|
import org.distorted.objects.TwistyObject;
|
41 |
|
|
import org.distorted.objects.ObjectList;
|
42 |
d7e539d0
|
Leszek Koltunski
|
import org.distorted.scores.RubikScores;
|
43 |
211b48f2
|
Leszek Koltunski
|
|
44 |
15846fe4
|
Leszek Koltunski
|
import java.util.ArrayList;
|
45 |
|
|
|
46 |
211b48f2
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
47 |
|
|
|
48 |
0254cfd7
|
Leszek Koltunski
|
public class RubikStatePlay extends RubikStateAbstract implements RubikPreRender.ActionFinishedListener
|
49 |
211b48f2
|
Leszek Koltunski
|
{
|
50 |
15846fe4
|
Leszek Koltunski
|
private static final int DURATION_MILLIS = 750;
|
51 |
0254cfd7
|
Leszek Koltunski
|
private static final int LEVELS_SHOWN = 10;
|
52 |
9c2f0c91
|
Leszek Koltunski
|
public static final int DEF_OBJECT= ObjectList.CUBE.ordinal();
|
53 |
85b09df4
|
Leszek Koltunski
|
public static final int DEF_SIZE = 3;
|
54 |
211b48f2
|
Leszek Koltunski
|
|
55 |
e03e0352
|
Leszek Koltunski
|
private static int[] BUTTON_LABELS = { R.string.scores, R.string.patterns, R.string.solver, R.string.about };
|
56 |
|
|
private static final int NUM_BUTTONS = BUTTON_LABELS.length;
|
57 |
|
|
|
58 |
46405bb4
|
Leszek Koltunski
|
private ImageButton mObjButton, mMenuButton, mPrevButton, mSolveButton, mLockButton;
|
59 |
15846fe4
|
Leszek Koltunski
|
private Button mPlayButton;
|
60 |
0254cfd7
|
Leszek Koltunski
|
private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup;
|
61 |
4888e97c
|
Leszek Koltunski
|
private int mObject = DEF_OBJECT;
|
62 |
|
|
private int mSize = DEF_SIZE;
|
63 |
0254cfd7
|
Leszek Koltunski
|
private int mObjectSize, mMenuLayoutWidth, mMenuLayoutHeight, mPlayLayoutWidth;
|
64 |
85b09df4
|
Leszek Koltunski
|
private int mLevelValue;
|
65 |
e07c48a2
|
Leszek Koltunski
|
private float mButtonSize, mMenuItemSize, mMenuTextSize;
|
66 |
|
|
private int mColCount, mRowCount;
|
67 |
0254cfd7
|
Leszek Koltunski
|
private LinearLayout mPlayLayout;
|
68 |
211b48f2
|
Leszek Koltunski
|
|
69 |
15846fe4
|
Leszek Koltunski
|
private ArrayList<Move> mMoves;
|
70 |
|
|
private boolean mCanPrevMove;
|
71 |
|
|
|
72 |
|
|
private static class Move
|
73 |
|
|
{
|
74 |
|
|
private int mAxis, mRow, mAngle;
|
75 |
|
|
|
76 |
|
|
Move(int axis, int row, int angle)
|
77 |
|
|
{
|
78 |
|
|
mAxis = axis;
|
79 |
|
|
mRow = row;
|
80 |
|
|
mAngle= angle;
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
|
84 |
211b48f2
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
85 |
|
|
|
86 |
329c0aeb
|
Leszek Koltunski
|
void leaveState(RubikActivity act)
|
87 |
211b48f2
|
Leszek Koltunski
|
{
|
88 |
85b09df4
|
Leszek Koltunski
|
|
89 |
211b48f2
|
Leszek Koltunski
|
}
|
90 |
|
|
|
91 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
92 |
|
|
|
93 |
a6d3b158
|
Leszek Koltunski
|
void enterState(final RubikActivity act)
|
94 |
211b48f2
|
Leszek Koltunski
|
{
|
95 |
e3c74c0f
|
Leszek Koltunski
|
float width = act.getScreenWidthInPixels();
|
96 |
eb376d3a
|
Leszek Koltunski
|
mMenuTextSize = width*RubikActivity.MENU_MED_TEXT_SIZE;
|
97 |
88fb92ba
|
Leszek Koltunski
|
mButtonSize = width*RubikActivity.BUTTON_TEXT_SIZE;
|
98 |
|
|
mMenuItemSize = width*RubikActivity.MENU_ITEM_SIZE;
|
99 |
e3c74c0f
|
Leszek Koltunski
|
|
100 |
15846fe4
|
Leszek Koltunski
|
mCanPrevMove = true;
|
101 |
|
|
|
102 |
|
|
if( mMoves==null ) mMoves = new ArrayList<>();
|
103 |
|
|
else mMoves.clear();
|
104 |
|
|
|
105 |
9c2f0c91
|
Leszek Koltunski
|
mRowCount = ObjectList.getRowCount();
|
106 |
|
|
mColCount = ObjectList.getColumnCount();
|
107 |
e07c48a2
|
Leszek Koltunski
|
|
108 |
211b48f2
|
Leszek Koltunski
|
// TOP ////////////////////////////
|
109 |
7289fd6c
|
Leszek Koltunski
|
LinearLayout layoutTop = act.findViewById(R.id.upperBar);
|
110 |
211b48f2
|
Leszek Koltunski
|
layoutTop.removeAllViews();
|
111 |
85b09df4
|
Leszek Koltunski
|
|
112 |
b376bfd7
|
Leszek Koltunski
|
setupObjectWindow(act,width);
|
113 |
ad0c8e0e
|
Leszek Koltunski
|
setupObjectButton(act,width);
|
114 |
85b09df4
|
Leszek Koltunski
|
layoutTop.addView(mObjButton);
|
115 |
0254cfd7
|
Leszek Koltunski
|
|
116 |
|
|
setupMenuWindow(act,width);
|
117 |
|
|
setupMenuButton(act,width);
|
118 |
|
|
layoutTop.addView(mMenuButton);
|
119 |
|
|
|
120 |
|
|
setupPlayWindow(act,width);
|
121 |
ad0c8e0e
|
Leszek Koltunski
|
setupPlayButton(act,width);
|
122 |
85b09df4
|
Leszek Koltunski
|
layoutTop.addView(mPlayButton);
|
123 |
211b48f2
|
Leszek Koltunski
|
|
124 |
|
|
// BOT ////////////////////////////
|
125 |
92843d3b
|
Leszek Koltunski
|
LinearLayout layoutBot = act.findViewById(R.id.lowerBar);
|
126 |
|
|
layoutBot.removeAllViews();
|
127 |
4888e97c
|
Leszek Koltunski
|
|
128 |
4fb1fc0d
|
Leszek Koltunski
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
|
129 |
|
|
|
130 |
|
|
LinearLayout layoutLeft = new LinearLayout(act);
|
131 |
|
|
layoutLeft.setLayoutParams(params);
|
132 |
|
|
LinearLayout layoutMid = new LinearLayout(act);
|
133 |
|
|
layoutMid.setLayoutParams(params);
|
134 |
|
|
LinearLayout layoutRight = new LinearLayout(act);
|
135 |
|
|
layoutRight.setLayoutParams(params);
|
136 |
|
|
|
137 |
ad0c8e0e
|
Leszek Koltunski
|
setupPrevButton(act,width);
|
138 |
4fb1fc0d
|
Leszek Koltunski
|
layoutLeft.addView(mPrevButton);
|
139 |
46405bb4
|
Leszek Koltunski
|
setupLockButton(act,width);
|
140 |
|
|
layoutMid.addView(mLockButton);
|
141 |
ad0c8e0e
|
Leszek Koltunski
|
setupSolveButton(act,width);
|
142 |
4fb1fc0d
|
Leszek Koltunski
|
layoutRight.addView(mSolveButton);
|
143 |
|
|
|
144 |
|
|
layoutBot.addView(layoutLeft);
|
145 |
|
|
layoutBot.addView(layoutMid);
|
146 |
|
|
layoutBot.addView(layoutRight);
|
147 |
769d7b9f
|
Leszek Koltunski
|
}
|
148 |
211b48f2
|
Leszek Koltunski
|
|
149 |
769d7b9f
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
150 |
4c0cd600
|
Leszek Koltunski
|
|
151 |
ad0c8e0e
|
Leszek Koltunski
|
private void setupObjectButton(final RubikActivity act, final float width)
|
152 |
769d7b9f
|
Leszek Koltunski
|
{
|
153 |
e07c48a2
|
Leszek Koltunski
|
final int margin = (int)(width*RubikActivity.MARGIN);
|
154 |
|
|
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_menu,R.drawable.ui_medium_cube_menu, R.drawable.ui_big_cube_menu, R.drawable.ui_huge_cube_menu);
|
155 |
da768c35
|
Leszek Koltunski
|
mObjButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
|
156 |
769d7b9f
|
Leszek Koltunski
|
|
157 |
|
|
mObjButton.setOnClickListener( new View.OnClickListener()
|
158 |
|
|
{
|
159 |
|
|
@Override
|
160 |
|
|
public void onClick(View view)
|
161 |
4c0cd600
|
Leszek Koltunski
|
{
|
162 |
5a4d4fba
|
Leszek Koltunski
|
if( act.getPreRender().canPlay() )
|
163 |
a42e25a6
|
Leszek Koltunski
|
{
|
164 |
456780f1
|
Leszek Koltunski
|
if( mObjectPopup==null )
|
165 |
|
|
{
|
166 |
|
|
// I completely don't understand it, but Firebase says occasionally mObjectPopup is null here. Recreate.
|
167 |
|
|
float width = act.getScreenWidthInPixels();
|
168 |
|
|
setupObjectWindow(act,width);
|
169 |
|
|
}
|
170 |
|
|
|
171 |
466b2ffc
|
Leszek Koltunski
|
mObjectPopup.setFocusable(false);
|
172 |
|
|
mObjectPopup.update();
|
173 |
|
|
|
174 |
|
|
View popupView = mObjectPopup.getContentView();
|
175 |
|
|
popupView.setSystemUiVisibility(RubikActivity.FLAGS);
|
176 |
|
|
|
177 |
e8f6670f
|
Leszek Koltunski
|
mObjectPopup.showAsDropDown(view, margin, margin);
|
178 |
466b2ffc
|
Leszek Koltunski
|
mObjectPopup.update(view, mObjectSize*mColCount, mObjectSize*mRowCount);
|
179 |
|
|
|
180 |
|
|
mObjectPopup.setFocusable(true);
|
181 |
|
|
mObjectPopup.update();
|
182 |
a42e25a6
|
Leszek Koltunski
|
}
|
183 |
769d7b9f
|
Leszek Koltunski
|
}
|
184 |
|
|
});
|
185 |
|
|
}
|
186 |
4c0cd600
|
Leszek Koltunski
|
|
187 |
85b09df4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
188 |
|
|
|
189 |
ad0c8e0e
|
Leszek Koltunski
|
private void setupPlayButton(final RubikActivity act, final float width)
|
190 |
85b09df4
|
Leszek Koltunski
|
{
|
191 |
0254cfd7
|
Leszek Koltunski
|
final int margin = (int)(width*RubikActivity.MARGIN);
|
192 |
da768c35
|
Leszek Koltunski
|
mPlayButton = new TransparentButton(act, R.string.play, mButtonSize, width);
|
193 |
85b09df4
|
Leszek Koltunski
|
|
194 |
|
|
mPlayButton.setOnClickListener( new View.OnClickListener()
|
195 |
|
|
{
|
196 |
|
|
@Override
|
197 |
0254cfd7
|
Leszek Koltunski
|
public void onClick(View view)
|
198 |
85b09df4
|
Leszek Koltunski
|
{
|
199 |
6a76f80a
|
Leszek Koltunski
|
if( act.getPreRender().canPlay() )
|
200 |
6e194411
|
Leszek Koltunski
|
{
|
201 |
6a76f80a
|
Leszek Koltunski
|
if( mPlayPopup==null )
|
202 |
|
|
{
|
203 |
|
|
// I completely don't understand it, but Firebase says occasionally mPlayPopup is null here. Recreate.
|
204 |
|
|
float width = act.getScreenWidthInPixels();
|
205 |
|
|
setupPlayWindow(act,width);
|
206 |
|
|
}
|
207 |
6e194411
|
Leszek Koltunski
|
|
208 |
6a76f80a
|
Leszek Koltunski
|
mPlayPopup.setFocusable(false);
|
209 |
|
|
mPlayPopup.update();
|
210 |
466b2ffc
|
Leszek Koltunski
|
|
211 |
6a76f80a
|
Leszek Koltunski
|
View popupView = mPlayPopup.getContentView();
|
212 |
|
|
popupView.setSystemUiVisibility(RubikActivity.FLAGS);
|
213 |
466b2ffc
|
Leszek Koltunski
|
|
214 |
6a76f80a
|
Leszek Koltunski
|
final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
|
215 |
|
|
final int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex);
|
216 |
|
|
final int levelsShown = Math.min(maxLevel,LEVELS_SHOWN);
|
217 |
eaee1ddc
|
Leszek Koltunski
|
|
218 |
6a76f80a
|
Leszek Koltunski
|
mPlayPopup.showAsDropDown(view, margin, margin);
|
219 |
|
|
mPlayPopup.update(view, mPlayLayoutWidth, (int)(levelsShown*(mMenuItemSize+margin)+2*margin));
|
220 |
466b2ffc
|
Leszek Koltunski
|
|
221 |
6a76f80a
|
Leszek Koltunski
|
mPlayPopup.setFocusable(true);
|
222 |
|
|
mPlayPopup.update();
|
223 |
|
|
}
|
224 |
85b09df4
|
Leszek Koltunski
|
}
|
225 |
|
|
});
|
226 |
|
|
}
|
227 |
|
|
|
228 |
e31abc1e
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
229 |
|
|
|
230 |
ad0c8e0e
|
Leszek Koltunski
|
private void setupMenuButton(final RubikActivity act, final float width)
|
231 |
e31abc1e
|
Leszek Koltunski
|
{
|
232 |
0254cfd7
|
Leszek Koltunski
|
final int margin = (int)(width*RubikActivity.MARGIN);
|
233 |
|
|
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_menu,R.drawable.ui_medium_menu, R.drawable.ui_big_menu, R.drawable.ui_huge_menu);
|
234 |
da768c35
|
Leszek Koltunski
|
mMenuButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
|
235 |
e31abc1e
|
Leszek Koltunski
|
|
236 |
e03e0352
|
Leszek Koltunski
|
mMenuButton.setOnClickListener( new View.OnClickListener()
|
237 |
e31abc1e
|
Leszek Koltunski
|
{
|
238 |
|
|
@Override
|
239 |
|
|
public void onClick(View view)
|
240 |
|
|
{
|
241 |
e03e0352
|
Leszek Koltunski
|
if( act.getPreRender().canPlay() )
|
242 |
|
|
{
|
243 |
456780f1
|
Leszek Koltunski
|
if( mMenuPopup==null )
|
244 |
|
|
{
|
245 |
|
|
// I completely don't understand it, but Firebase says occasionally mMenuPopup is null here. Recreate.
|
246 |
|
|
float width = act.getScreenWidthInPixels();
|
247 |
|
|
setupMenuWindow(act,width);
|
248 |
|
|
}
|
249 |
|
|
|
250 |
466b2ffc
|
Leszek Koltunski
|
mMenuPopup.setFocusable(false);
|
251 |
|
|
mMenuPopup.update();
|
252 |
|
|
|
253 |
|
|
View popupView = mMenuPopup.getContentView();
|
254 |
|
|
popupView.setSystemUiVisibility(RubikActivity.FLAGS);
|
255 |
|
|
|
256 |
e8f6670f
|
Leszek Koltunski
|
mMenuPopup.showAsDropDown(view, (int)(-width/12), margin);
|
257 |
74b08185
|
Leszek Koltunski
|
mMenuPopup.update(view, mMenuLayoutWidth, mMenuLayoutHeight);
|
258 |
466b2ffc
|
Leszek Koltunski
|
|
259 |
|
|
mMenuPopup.setFocusable(true);
|
260 |
|
|
mMenuPopup.update();
|
261 |
e03e0352
|
Leszek Koltunski
|
}
|
262 |
e31abc1e
|
Leszek Koltunski
|
}
|
263 |
|
|
});
|
264 |
|
|
}
|
265 |
|
|
|
266 |
85b09df4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
267 |
|
|
|
268 |
ad0c8e0e
|
Leszek Koltunski
|
private void setupSolveButton(final RubikActivity act, final float width)
|
269 |
85b09df4
|
Leszek Koltunski
|
{
|
270 |
31a9f38d
|
Leszek Koltunski
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve,R.drawable.ui_medium_cube_solve, R.drawable.ui_big_cube_solve, R.drawable.ui_huge_cube_solve);
|
271 |
da768c35
|
Leszek Koltunski
|
mSolveButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
|
272 |
85b09df4
|
Leszek Koltunski
|
|
273 |
|
|
mSolveButton.setOnClickListener( new View.OnClickListener()
|
274 |
|
|
{
|
275 |
|
|
@Override
|
276 |
|
|
public void onClick(View v)
|
277 |
|
|
{
|
278 |
5a4d4fba
|
Leszek Koltunski
|
act.getPreRender().solveObject();
|
279 |
5b893eee
|
Leszek Koltunski
|
mMoves.clear();
|
280 |
85b09df4
|
Leszek Koltunski
|
}
|
281 |
|
|
});
|
282 |
|
|
}
|
283 |
|
|
|
284 |
46405bb4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
285 |
|
|
|
286 |
|
|
private void setupLockButton(final RubikActivity act, final float width)
|
287 |
|
|
{
|
288 |
da768c35
|
Leszek Koltunski
|
final int icon = getLockIcon(act);
|
289 |
|
|
mLockButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
|
290 |
46405bb4
|
Leszek Koltunski
|
|
291 |
|
|
mLockButton.setOnClickListener( new View.OnClickListener()
|
292 |
|
|
{
|
293 |
|
|
@Override
|
294 |
|
|
public void onClick(View v)
|
295 |
|
|
{
|
296 |
|
|
toggleLock(act);
|
297 |
|
|
}
|
298 |
|
|
});
|
299 |
|
|
}
|
300 |
|
|
|
301 |
769d7b9f
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
302 |
4c0cd600
|
Leszek Koltunski
|
|
303 |
ad0c8e0e
|
Leszek Koltunski
|
private void setupPrevButton(final RubikActivity act, final float width)
|
304 |
769d7b9f
|
Leszek Koltunski
|
{
|
305 |
31a9f38d
|
Leszek Koltunski
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_back,R.drawable.ui_medium_cube_back, R.drawable.ui_big_cube_back, R.drawable.ui_huge_cube_back);
|
306 |
da768c35
|
Leszek Koltunski
|
mPrevButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
|
307 |
15846fe4
|
Leszek Koltunski
|
|
308 |
|
|
mPrevButton.setOnClickListener( new View.OnClickListener()
|
309 |
a6d3b158
|
Leszek Koltunski
|
{
|
310 |
|
|
@Override
|
311 |
|
|
public void onClick(View v)
|
312 |
|
|
{
|
313 |
15846fe4
|
Leszek Koltunski
|
RubikPreRender pre = act.getPreRender();
|
314 |
|
|
backMove(pre);
|
315 |
a6d3b158
|
Leszek Koltunski
|
}
|
316 |
|
|
});
|
317 |
211b48f2
|
Leszek Koltunski
|
}
|
318 |
|
|
|
319 |
4c0cd600
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
320 |
|
|
|
321 |
ad0c8e0e
|
Leszek Koltunski
|
private void setupObjectWindow(final RubikActivity act, final float width)
|
322 |
4c0cd600
|
Leszek Koltunski
|
{
|
323 |
769d7b9f
|
Leszek Koltunski
|
LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
324 |
|
|
final View layout = layoutInflater.inflate(R.layout.popup_objects, null);
|
325 |
92843d3b
|
Leszek Koltunski
|
GridLayout objectGrid = layout.findViewById(R.id.objectGrid);
|
326 |
e07c48a2
|
Leszek Koltunski
|
|
327 |
9c2f0c91
|
Leszek Koltunski
|
int[] indices = ObjectList.getIndices();
|
328 |
e07c48a2
|
Leszek Koltunski
|
|
329 |
|
|
GridLayout.Spec[] rowSpecs = new GridLayout.Spec[mRowCount];
|
330 |
|
|
GridLayout.Spec[] colSpecs = new GridLayout.Spec[mColCount];
|
331 |
|
|
|
332 |
92843d3b
|
Leszek Koltunski
|
objectGrid.setColumnCount(mColCount);
|
333 |
|
|
objectGrid.setRowCount(mRowCount);
|
334 |
e07c48a2
|
Leszek Koltunski
|
|
335 |
fa679111
|
Leszek Koltunski
|
int[] nextInColumn = new int[mColCount];
|
336 |
|
|
|
337 |
e07c48a2
|
Leszek Koltunski
|
for(int row=0; row<mRowCount; row++)
|
338 |
|
|
{
|
339 |
|
|
rowSpecs[row] = GridLayout.spec(row);
|
340 |
|
|
}
|
341 |
|
|
for(int col=0; col<mColCount; col++)
|
342 |
|
|
{
|
343 |
|
|
colSpecs[col] = GridLayout.spec(col);
|
344 |
fa679111
|
Leszek Koltunski
|
nextInColumn[col] =0;
|
345 |
e07c48a2
|
Leszek Koltunski
|
}
|
346 |
769d7b9f
|
Leszek Koltunski
|
|
347 |
e03e0352
|
Leszek Koltunski
|
mObjectPopup = new PopupWindow(act);
|
348 |
|
|
mObjectPopup.setContentView(layout);
|
349 |
|
|
mObjectPopup.setFocusable(true);
|
350 |
31a9f38d
|
Leszek Koltunski
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube2,R.drawable.ui_medium_cube2, R.drawable.ui_big_cube2, R.drawable.ui_huge_cube2);
|
351 |
769d7b9f
|
Leszek Koltunski
|
|
352 |
f6a9c538
|
Leszek Koltunski
|
BitmapDrawable bd = (BitmapDrawable) act.getResources().getDrawable(icon);
|
353 |
e07c48a2
|
Leszek Koltunski
|
int cubeWidth = bd.getIntrinsicWidth();
|
354 |
|
|
int margin = (int)(width*RubikActivity.LARGE_MARGIN);
|
355 |
|
|
mObjectSize = (int)(cubeWidth + 2*margin + 0.5f);
|
356 |
f6a9c538
|
Leszek Koltunski
|
|
357 |
9c2f0c91
|
Leszek Koltunski
|
for(int object = 0; object< ObjectList.NUM_OBJECTS; object++)
|
358 |
769d7b9f
|
Leszek Koltunski
|
{
|
359 |
9c2f0c91
|
Leszek Koltunski
|
final ObjectList list = ObjectList.getObject(object);
|
360 |
53f23b64
|
Leszek Koltunski
|
final int[] sizes = list.getSizes();
|
361 |
769d7b9f
|
Leszek Koltunski
|
int[] icons = list.getIconIDs();
|
362 |
|
|
int len = sizes.length;
|
363 |
|
|
final int obj = object;
|
364 |
fa679111
|
Leszek Koltunski
|
int col = indices[object];
|
365 |
769d7b9f
|
Leszek Koltunski
|
|
366 |
|
|
for(int i=0; i<len; i++)
|
367 |
|
|
{
|
368 |
e07c48a2
|
Leszek Koltunski
|
final int index = i;
|
369 |
769d7b9f
|
Leszek Koltunski
|
|
370 |
|
|
ImageButton button = new ImageButton(act);
|
371 |
|
|
button.setBackgroundResource(icons[i]);
|
372 |
|
|
button.setOnClickListener( new View.OnClickListener()
|
373 |
|
|
{
|
374 |
|
|
@Override
|
375 |
|
|
public void onClick(View v)
|
376 |
|
|
{
|
377 |
be576d14
|
Leszek Koltunski
|
if( act.getPreRender().canPlay() && StateList.getCurrentState()== StateList.PLAY )
|
378 |
a42e25a6
|
Leszek Koltunski
|
{
|
379 |
|
|
mObject = obj;
|
380 |
e07c48a2
|
Leszek Koltunski
|
mSize = sizes[index];
|
381 |
|
|
act.changeObject(list,sizes[index], true);
|
382 |
0254cfd7
|
Leszek Koltunski
|
adjustLevels(act);
|
383 |
40c8c5fa
|
Leszek Koltunski
|
mMoves.clear();
|
384 |
a42e25a6
|
Leszek Koltunski
|
}
|
385 |
8e3898c8
|
Leszek Koltunski
|
|
386 |
e03e0352
|
Leszek Koltunski
|
mObjectPopup.dismiss();
|
387 |
769d7b9f
|
Leszek Koltunski
|
}
|
388 |
|
|
});
|
389 |
|
|
|
390 |
fa679111
|
Leszek Koltunski
|
GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[nextInColumn[col]],colSpecs[col]);
|
391 |
e07c48a2
|
Leszek Koltunski
|
params.bottomMargin = margin;
|
392 |
|
|
params.topMargin = margin;
|
393 |
|
|
params.leftMargin = margin;
|
394 |
|
|
params.rightMargin = margin;
|
395 |
|
|
|
396 |
fa679111
|
Leszek Koltunski
|
nextInColumn[col]++;
|
397 |
|
|
|
398 |
92843d3b
|
Leszek Koltunski
|
objectGrid.addView(button, params);
|
399 |
769d7b9f
|
Leszek Koltunski
|
}
|
400 |
|
|
}
|
401 |
4c0cd600
|
Leszek Koltunski
|
}
|
402 |
|
|
|
403 |
e03e0352
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
404 |
|
|
|
405 |
ad0c8e0e
|
Leszek Koltunski
|
private void setupMenuWindow(final RubikActivity act, final float width)
|
406 |
e03e0352
|
Leszek Koltunski
|
{
|
407 |
|
|
LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
408 |
e07c48a2
|
Leszek Koltunski
|
final View layout = layoutInflater.inflate(R.layout.popup_menu, null);
|
409 |
|
|
LinearLayout menuLayout = layout.findViewById(R.id.menuGrid);
|
410 |
e03e0352
|
Leszek Koltunski
|
|
411 |
|
|
mMenuPopup = new PopupWindow(act);
|
412 |
|
|
mMenuPopup.setContentView(layout);
|
413 |
|
|
mMenuPopup.setFocusable(true);
|
414 |
ad0c8e0e
|
Leszek Koltunski
|
int margin = (int)(width*RubikActivity.MARGIN);
|
415 |
|
|
int padding = (int)(width*RubikActivity.PADDING);
|
416 |
e03e0352
|
Leszek Koltunski
|
|
417 |
0254cfd7
|
Leszek Koltunski
|
mMenuLayoutWidth = (int)(width/2);
|
418 |
|
|
mMenuLayoutHeight= (int)(2*margin + NUM_BUTTONS*(mMenuItemSize+margin));
|
419 |
|
|
|
420 |
|
|
LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
|
421 |
|
|
pT.setMargins(margin, 0, margin, margin);
|
422 |
|
|
LinearLayout.LayoutParams pM = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
|
423 |
|
|
pM.setMargins(margin, margin, margin, margin);
|
424 |
|
|
LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
|
425 |
|
|
pB.setMargins(margin, margin, margin, 2*margin);
|
426 |
e03e0352
|
Leszek Koltunski
|
|
427 |
|
|
for(int i=0; i<NUM_BUTTONS; i++)
|
428 |
|
|
{
|
429 |
|
|
final int but = i;
|
430 |
|
|
Button button = new Button(act);
|
431 |
0254cfd7
|
Leszek Koltunski
|
button.setLayoutParams(pT);//i==0 ? pT : (i==NUM_BUTTONS-1 ? pB : pM));
|
432 |
e03e0352
|
Leszek Koltunski
|
button.setText(BUTTON_LABELS[i]);
|
433 |
88fb92ba
|
Leszek Koltunski
|
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
|
434 |
e03e0352
|
Leszek Koltunski
|
|
435 |
|
|
button.setOnClickListener( new View.OnClickListener()
|
436 |
|
|
{
|
437 |
|
|
@Override
|
438 |
|
|
public void onClick(View v)
|
439 |
|
|
{
|
440 |
|
|
mMenuPopup.dismiss();
|
441 |
0254cfd7
|
Leszek Koltunski
|
MenuAction(act,but);
|
442 |
e03e0352
|
Leszek Koltunski
|
}
|
443 |
|
|
});
|
444 |
|
|
|
445 |
e07c48a2
|
Leszek Koltunski
|
menuLayout.addView(button);
|
446 |
e03e0352
|
Leszek Koltunski
|
}
|
447 |
0254cfd7
|
Leszek Koltunski
|
}
|
448 |
e03e0352
|
Leszek Koltunski
|
|
449 |
0254cfd7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
450 |
|
|
|
451 |
|
|
private void setupPlayWindow(final RubikActivity act, final float width)
|
452 |
|
|
{
|
453 |
|
|
LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
454 |
|
|
final View layout = layoutInflater.inflate(R.layout.popup_play, null);
|
455 |
|
|
mPlayLayout = layout.findViewById(R.id.playGrid);
|
456 |
|
|
|
457 |
|
|
mPlayLayoutWidth = (int)(width*0.4f);
|
458 |
|
|
|
459 |
|
|
mPlayPopup = new PopupWindow(act);
|
460 |
|
|
mPlayPopup.setContentView(layout);
|
461 |
|
|
mPlayPopup.setFocusable(true);
|
462 |
|
|
|
463 |
|
|
adjustLevels(act);
|
464 |
e03e0352
|
Leszek Koltunski
|
}
|
465 |
|
|
|
466 |
15846fe4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
467 |
|
|
|
468 |
|
|
private void backMove(RubikPreRender pre)
|
469 |
|
|
{
|
470 |
|
|
if( mCanPrevMove )
|
471 |
|
|
{
|
472 |
|
|
int numMoves = mMoves.size();
|
473 |
|
|
|
474 |
|
|
if( numMoves>0 )
|
475 |
|
|
{
|
476 |
|
|
Move move = mMoves.remove(numMoves-1);
|
477 |
9c2f0c91
|
Leszek Koltunski
|
TwistyObject object = pre.getObject();
|
478 |
15846fe4
|
Leszek Koltunski
|
|
479 |
|
|
int axis = move.mAxis;
|
480 |
|
|
int row = (1<<move.mRow);
|
481 |
|
|
int angle = move.mAngle;
|
482 |
|
|
int numRot= Math.abs(angle*object.getBasicAngle()/360);
|
483 |
|
|
|
484 |
|
|
if( angle!=0 )
|
485 |
|
|
{
|
486 |
|
|
mCanPrevMove = false;
|
487 |
|
|
pre.addRotation(this, axis, row, -angle, numRot*DURATION_MILLIS);
|
488 |
|
|
}
|
489 |
|
|
else
|
490 |
|
|
{
|
491 |
|
|
android.util.Log.e("solution", "error: trying to back move of angle 0");
|
492 |
|
|
}
|
493 |
|
|
}
|
494 |
|
|
}
|
495 |
|
|
}
|
496 |
0254cfd7
|
Leszek Koltunski
|
|
497 |
e03e0352
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
498 |
|
|
|
499 |
0254cfd7
|
Leszek Koltunski
|
private void MenuAction(RubikActivity act, int button)
|
500 |
e03e0352
|
Leszek Koltunski
|
{
|
501 |
|
|
switch(button)
|
502 |
|
|
{
|
503 |
be576d14
|
Leszek Koltunski
|
case 0: RubikStatePlay play = (RubikStatePlay) StateList.PLAY.getStateClass();
|
504 |
e03e0352
|
Leszek Koltunski
|
int object = play.getObject();
|
505 |
|
|
int size = play.getSize();
|
506 |
9c2f0c91
|
Leszek Koltunski
|
int sizeIndex = ObjectList.getSizeIndex(object,size);
|
507 |
e03e0352
|
Leszek Koltunski
|
|
508 |
|
|
Bundle bundle = new Bundle();
|
509 |
9c2f0c91
|
Leszek Koltunski
|
bundle.putInt("tab", ObjectList.pack(object,sizeIndex) );
|
510 |
e03e0352
|
Leszek Koltunski
|
bundle.putBoolean("submitting", false);
|
511 |
|
|
|
512 |
|
|
RubikDialogScores scores = new RubikDialogScores();
|
513 |
|
|
scores.setArguments(bundle);
|
514 |
|
|
scores.show(act.getSupportFragmentManager(), null);
|
515 |
|
|
break;
|
516 |
be576d14
|
Leszek Koltunski
|
case 1: StateList.switchState(act, StateList.PATT);
|
517 |
e03e0352
|
Leszek Koltunski
|
break;
|
518 |
be576d14
|
Leszek Koltunski
|
case 2: StateList.switchState(act, StateList.SVER);
|
519 |
e03e0352
|
Leszek Koltunski
|
break;
|
520 |
|
|
case 3: RubikDialogAbout diag = new RubikDialogAbout();
|
521 |
|
|
diag.show(act.getSupportFragmentManager(), null);
|
522 |
|
|
break;
|
523 |
|
|
}
|
524 |
|
|
}
|
525 |
|
|
|
526 |
46405bb4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
527 |
|
|
|
528 |
|
|
private void toggleLock(RubikActivity act)
|
529 |
|
|
{
|
530 |
|
|
act.toggleLock();
|
531 |
|
|
mLockButton.setImageResource(getLockIcon(act));
|
532 |
|
|
}
|
533 |
|
|
|
534 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
535 |
|
|
|
536 |
|
|
private int getLockIcon(RubikActivity act)
|
537 |
|
|
{
|
538 |
|
|
if( act.retLocked() )
|
539 |
|
|
{
|
540 |
|
|
return RubikActivity.getDrawable(R.drawable.ui_small_locked,R.drawable.ui_medium_locked, R.drawable.ui_big_locked, R.drawable.ui_huge_locked);
|
541 |
|
|
}
|
542 |
|
|
else
|
543 |
|
|
{
|
544 |
|
|
return RubikActivity.getDrawable(R.drawable.ui_small_unlocked,R.drawable.ui_medium_unlocked, R.drawable.ui_big_unlocked, R.drawable.ui_huge_unlocked);
|
545 |
|
|
}
|
546 |
|
|
}
|
547 |
|
|
|
548 |
211b48f2
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
549 |
|
|
|
550 |
|
|
public void savePreferences(SharedPreferences.Editor editor)
|
551 |
|
|
{
|
552 |
4888e97c
|
Leszek Koltunski
|
editor.putInt("statePlay_object", mObject);
|
553 |
|
|
editor.putInt("statePlay_size" , mSize);
|
554 |
4c0cd600
|
Leszek Koltunski
|
|
555 |
e03e0352
|
Leszek Koltunski
|
if( mObjectPopup!=null )
|
556 |
|
|
{
|
557 |
|
|
mObjectPopup.dismiss();
|
558 |
|
|
mObjectPopup = null;
|
559 |
|
|
}
|
560 |
|
|
|
561 |
|
|
if( mMenuPopup!=null )
|
562 |
4c0cd600
|
Leszek Koltunski
|
{
|
563 |
e03e0352
|
Leszek Koltunski
|
mMenuPopup.dismiss();
|
564 |
|
|
mMenuPopup = null;
|
565 |
4c0cd600
|
Leszek Koltunski
|
}
|
566 |
0254cfd7
|
Leszek Koltunski
|
|
567 |
|
|
if( mPlayPopup!=null )
|
568 |
|
|
{
|
569 |
|
|
mPlayPopup.dismiss();
|
570 |
|
|
mPlayPopup = null;
|
571 |
|
|
}
|
572 |
211b48f2
|
Leszek Koltunski
|
}
|
573 |
|
|
|
574 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
575 |
|
|
|
576 |
|
|
public void restorePreferences(SharedPreferences preferences)
|
577 |
|
|
{
|
578 |
eb389a97
|
Leszek Koltunski
|
mObject= preferences.getInt("statePlay_object", DEF_OBJECT);
|
579 |
|
|
mSize = preferences.getInt("statePlay_size" , DEF_SIZE );
|
580 |
211b48f2
|
Leszek Koltunski
|
}
|
581 |
|
|
|
582 |
53f23b64
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
583 |
|
|
|
584 |
9c2f0c91
|
Leszek Koltunski
|
public boolean setObjectAndSize(RubikActivity act, ObjectList obj, int size)
|
585 |
53f23b64
|
Leszek Koltunski
|
{
|
586 |
7b7d65ce
|
Leszek Koltunski
|
if( mObject!=obj.ordinal() || mSize != size )
|
587 |
|
|
{
|
588 |
|
|
boolean success = false;
|
589 |
53f23b64
|
Leszek Koltunski
|
|
590 |
7b7d65ce
|
Leszek Koltunski
|
for( int s: obj.getSizes() )
|
591 |
|
|
if( s==size )
|
592 |
|
|
{
|
593 |
|
|
success = true;
|
594 |
|
|
break;
|
595 |
|
|
}
|
596 |
|
|
|
597 |
|
|
if( success )
|
598 |
53f23b64
|
Leszek Koltunski
|
{
|
599 |
7b7d65ce
|
Leszek Koltunski
|
mObject = obj.ordinal();
|
600 |
|
|
mSize = size;
|
601 |
5f8c532e
|
Leszek Koltunski
|
|
602 |
0254cfd7
|
Leszek Koltunski
|
if( mPlayLayout!=null ) adjustLevels(act);
|
603 |
53f23b64
|
Leszek Koltunski
|
}
|
604 |
|
|
|
605 |
7b7d65ce
|
Leszek Koltunski
|
return success;
|
606 |
|
|
}
|
607 |
|
|
|
608 |
|
|
return true;
|
609 |
|
|
}
|
610 |
|
|
|
611 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
612 |
|
|
|
613 |
0254cfd7
|
Leszek Koltunski
|
private void adjustLevels(final RubikActivity act)
|
614 |
7b7d65ce
|
Leszek Koltunski
|
{
|
615 |
9c2f0c91
|
Leszek Koltunski
|
int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
|
616 |
|
|
int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex);
|
617 |
7b7d65ce
|
Leszek Koltunski
|
String[] levels = new String[maxLevel];
|
618 |
|
|
|
619 |
|
|
for(int i=0; i<maxLevel; i++)
|
620 |
53f23b64
|
Leszek Koltunski
|
{
|
621 |
7b7d65ce
|
Leszek Koltunski
|
levels[i] = act.getString(R.string.lv_placeholder,i+1);
|
622 |
53f23b64
|
Leszek Koltunski
|
}
|
623 |
|
|
|
624 |
0254cfd7
|
Leszek Koltunski
|
if( mLevelValue>maxLevel ) mLevelValue=1;
|
625 |
|
|
|
626 |
|
|
float width = act.getScreenWidthInPixels();
|
627 |
|
|
int margin = (int)(width*RubikActivity.MARGIN);
|
628 |
|
|
int padding = (int)(width*RubikActivity.PADDING);
|
629 |
|
|
|
630 |
|
|
LinearLayout.LayoutParams pM = new LinearLayout.LayoutParams( mPlayLayoutWidth - 2*padding, (int)mMenuItemSize);
|
631 |
|
|
pM.setMargins(margin, 0, margin, margin);
|
632 |
|
|
LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( mPlayLayoutWidth - 2*padding, (int)mMenuItemSize);
|
633 |
|
|
pT.setMargins(margin, margin, margin, margin);
|
634 |
|
|
LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( mPlayLayoutWidth - 2*padding, (int)mMenuItemSize);
|
635 |
|
|
pB.setMargins(margin, margin, margin, 2*margin);
|
636 |
|
|
|
637 |
|
|
mPlayLayout.removeAllViews();
|
638 |
|
|
|
639 |
d7e539d0
|
Leszek Koltunski
|
RubikScores scores = RubikScores.getInstance();
|
640 |
|
|
|
641 |
0254cfd7
|
Leszek Koltunski
|
for(int i=0; i<maxLevel; i++)
|
642 |
011fcfe0
|
Leszek Koltunski
|
{
|
643 |
0254cfd7
|
Leszek Koltunski
|
final int but = i;
|
644 |
|
|
Button button = new Button(act);
|
645 |
|
|
button.setLayoutParams(i==0 ? pT : (i==maxLevel-1 ? pB : pM));
|
646 |
|
|
button.setText(levels[i]);
|
647 |
|
|
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
|
648 |
|
|
|
649 |
68f6046c
|
Leszek Koltunski
|
int icon = scores.isSolved(mObject, sizeIndex, i) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
|
650 |
d7e539d0
|
Leszek Koltunski
|
button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
|
651 |
|
|
|
652 |
0254cfd7
|
Leszek Koltunski
|
button.setOnClickListener( new View.OnClickListener()
|
653 |
011fcfe0
|
Leszek Koltunski
|
{
|
654 |
0254cfd7
|
Leszek Koltunski
|
@Override
|
655 |
|
|
public void onClick(View v)
|
656 |
|
|
{
|
657 |
|
|
mPlayPopup.dismiss();
|
658 |
|
|
mLevelValue = but+1;
|
659 |
|
|
act.getPreRender().scrambleObject(mLevelValue);
|
660 |
|
|
}
|
661 |
|
|
});
|
662 |
011fcfe0
|
Leszek Koltunski
|
|
663 |
0254cfd7
|
Leszek Koltunski
|
mPlayLayout.addView(button);
|
664 |
|
|
}
|
665 |
53f23b64
|
Leszek Koltunski
|
}
|
666 |
|
|
|
667 |
211b48f2
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
668 |
|
|
|
669 |
dca3888a
|
Leszek Koltunski
|
public int getLevel()
|
670 |
211b48f2
|
Leszek Koltunski
|
{
|
671 |
85b09df4
|
Leszek Koltunski
|
return mLevelValue;
|
672 |
211b48f2
|
Leszek Koltunski
|
}
|
673 |
|
|
|
674 |
15846fe4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
675 |
|
|
|
676 |
|
|
public void addMove(int axis, int row, int angle)
|
677 |
|
|
{
|
678 |
|
|
mMoves.add(new Move(axis,row,angle));
|
679 |
|
|
}
|
680 |
|
|
|
681 |
211b48f2
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
682 |
|
|
|
683 |
4888e97c
|
Leszek Koltunski
|
public int getObject()
|
684 |
211b48f2
|
Leszek Koltunski
|
{
|
685 |
4888e97c
|
Leszek Koltunski
|
return mObject;
|
686 |
211b48f2
|
Leszek Koltunski
|
}
|
687 |
|
|
|
688 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
689 |
|
|
|
690 |
4888e97c
|
Leszek Koltunski
|
public int getSize()
|
691 |
211b48f2
|
Leszek Koltunski
|
{
|
692 |
4888e97c
|
Leszek Koltunski
|
return mSize;
|
693 |
|
|
}
|
694 |
85b09df4
|
Leszek Koltunski
|
|
695 |
15846fe4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
696 |
|
|
|
697 |
|
|
public void onActionFinished(final long effectID)
|
698 |
|
|
{
|
699 |
|
|
mCanPrevMove = true;
|
700 |
|
|
}
|
701 |
211b48f2
|
Leszek Koltunski
|
}
|