Project

General

Profile

Download (21.9 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / screens / RubikScreenPlay.java @ 255492a0

1
///////////////////////////////////////////////////////////////////////////////////////////////////
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
package org.distorted.screens;
21

    
22
import android.content.Context;
23
import android.content.SharedPreferences;
24
import android.graphics.drawable.BitmapDrawable;
25
import android.os.Build;
26
import android.os.Bundle;
27
import android.util.TypedValue;
28
import android.view.Gravity;
29
import android.view.LayoutInflater;
30
import android.view.View;
31
import android.widget.Button;
32
import android.widget.GridLayout;
33
import android.widget.ImageButton;
34
import android.widget.LinearLayout;
35
import android.widget.PopupWindow;
36
import android.widget.ScrollView;
37

    
38
import org.distorted.dialogs.RubikDialogAbout;
39
import org.distorted.dialogs.RubikDialogPattern;
40
import org.distorted.dialogs.RubikDialogScores;
41
import org.distorted.dialogs.RubikDialogTutorial;
42
import org.distorted.helpers.TransparentButton;
43
import org.distorted.helpers.TransparentImageButton;
44
import org.distorted.main.R;
45
import org.distorted.main.RubikActivity;
46
import org.distorted.main.RubikPreRender;
47
import org.distorted.objects.ObjectList;
48
import org.distorted.network.RubikScores;
49

    
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51

    
52
public class RubikScreenPlay extends RubikScreenBase
53
  {
54
  public static final int LEVELS_SHOWN = 10;
55
  public static final int DEF_OBJECT= ObjectList.CUBE.ordinal();
56
  public static final int DEF_SIZE  =  3;
57

    
58
  private static final int[] BUTTON_LABELS = { R.string.scores,
59
                                               R.string.patterns,
60
                                            //   R.string.control,
61
                                               R.string.solver,
62
                                               R.string.tutorials,
63
                                               R.string.about };
64

    
65
  private static final int NUM_BUTTONS = BUTTON_LABELS.length;
66
  private static final float LAST_BUTTON = 1.5f;
67
  private static final int[] mLocation = new int[2];
68

    
69
  private ImageButton mObjButton, mMenuButton, mSolveButton;
70
  private Button mPlayButton;
71
  private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup;
72
  private int mObject = DEF_OBJECT;
73
  private int mSize   = DEF_SIZE;
74
  private int mObjectSize, mMenuLayoutWidth, mMenuLayoutHeight, mPlayLayoutWidth;
75
  private int mLevelValue;
76
  private float mButtonSize, mMenuItemSize, mMenuTextSize;
77
  private int mColCount, mRowCount, mMaxRowCount;
78
  private LinearLayout mPlayLayout;
79
  private int mUpperBarHeight;
80

    
81
  private boolean mIsFullScreen;
82

    
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

    
85
  void leaveScreen(RubikActivity act)
86
    {
87

    
88
    }
89

    
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91

    
92
  void enterScreen(final RubikActivity act)
93
    {
94
    float width = act.getScreenWidthInPixels();
95
    float height= act.getScreenHeightInPixels();
96
    mUpperBarHeight = act.getHeightUpperBar();
97

    
98
    mMenuTextSize = width*RubikActivity.MENU_MED_TEXT_SIZE;
99
    mButtonSize   = width*RubikActivity.BUTTON_TEXT_SIZE;
100
    mMenuItemSize = width*RubikActivity.MENU_ITEM_SIZE;
101

    
102
    mRowCount = ObjectList.getRowCount();
103
    mColCount = ObjectList.getColumnCount();
104

    
105
    // TOP ////////////////////////////
106
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
107
    layoutTop.removeAllViews();
108

    
109
    setupObjectWindow(act,width,height);
110
    setupObjectButton(act,width);
111
    layoutTop.addView(mObjButton);
112

    
113
    setupMenuWindow(act,width);
114
    setupMenuButton(act,width);
115
    layoutTop.addView(mMenuButton);
116

    
117
    setupPlayWindow(act,width);
118
    setupPlayButton(act,width,height);
119
    layoutTop.addView(mPlayButton);
120

    
121
    setupSolveButton(act,width);
122
    createBottomPane(act,width,mSolveButton);
123
    }
124

    
125
///////////////////////////////////////////////////////////////////////////////////////////////////
126

    
127
  private void setupObjectButton(final RubikActivity act, final float width)
128
    {
129
    final int margin  = (int)(width*RubikActivity.MARGIN);
130
    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);
131

    
132
    mObjButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
133

    
134
    mObjButton.setOnClickListener( new View.OnClickListener()
135
      {
136
      @Override
137
      public void onClick(View view)
138
        {
139
        if( mObjectPopup!=null && act.getPreRender().isUINotBlocked())
140
          {
141
          int rowCount = Math.min(mMaxRowCount,mRowCount);
142
          View popupView = mObjectPopup.getContentView();
143
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
144
          displayPopup(act,view,mObjectPopup,mObjectSize*mColCount,mObjectSize*rowCount,margin,margin);
145
          }
146
        }
147
      });
148
    }
149

    
150
///////////////////////////////////////////////////////////////////////////////////////////////////
151

    
152
  private void setupPlayButton(final RubikActivity act, final float width, final float height)
153
    {
154
    final int margin   = (int)(width*RubikActivity.MARGIN);
155
    final int maxHeight= (int)(0.9f*(height-mUpperBarHeight) );
156

    
157
    mPlayButton = new TransparentButton(act, R.string.play, mButtonSize, width);
158

    
159
    mPlayButton.setOnClickListener( new View.OnClickListener()
160
      {
161
      @Override
162
      public void onClick(View view)
163
        {
164
        if( mPlayPopup!=null && act.getPreRender().isUINotBlocked())
165
          {
166
          View popupView = mPlayPopup.getContentView();
167
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
168
          final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
169
          final int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
170
          final int levelsShown = Math.min(dbLevel,LEVELS_SHOWN);
171
          final int popupHeight = (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f));
172
          final int realHeight = Math.min(popupHeight,maxHeight);
173
          displayPopup(act,view,mPlayPopup,mPlayLayoutWidth,realHeight,margin,margin);
174
          }
175
        }
176
      });
177
    }
178

    
179
///////////////////////////////////////////////////////////////////////////////////////////////////
180

    
181
  private void setupMenuButton(final RubikActivity act, final float width)
182
    {
183
    final int margin  = (int)(width*RubikActivity.MARGIN);
184
    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);
185

    
186
    mMenuButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
187

    
188
    mMenuButton.setOnClickListener( new View.OnClickListener()
189
      {
190
      @Override
191
      public void onClick(View view)
192
        {
193
        if( mMenuPopup!=null && act.getPreRender().isUINotBlocked())
194
          {
195
          View popupView = mMenuPopup.getContentView();
196
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
197
          displayPopup(act,view,mMenuPopup,mMenuLayoutWidth,mMenuLayoutHeight,(int)(-width/12),margin);
198
          }
199
        }
200
      });
201
    }
202

    
203
///////////////////////////////////////////////////////////////////////////////////////////////////
204

    
205
  private void setupObjectWindow(final RubikActivity act, final float width, final float height)
206
    {
207
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube2,R.drawable.ui_medium_cube2, R.drawable.ui_big_cube2, R.drawable.ui_huge_cube2);
208

    
209
    BitmapDrawable bd = (BitmapDrawable) act.getResources().getDrawable(icon);
210
    int cubeWidth = bd.getIntrinsicWidth();
211
    int margin = (int)(width*RubikActivity.LARGE_MARGIN);
212
    mObjectSize = (int)(cubeWidth + 2*margin + 0.5f);
213
    mMaxRowCount = (int)(0.9f*(height-mUpperBarHeight)/mObjectSize);
214
    GridLayout objectGrid = new GridLayout(act);
215
    mObjectPopup = new PopupWindow(act);
216
    mObjectPopup.setFocusable(true);
217

    
218
    if( mMaxRowCount<mRowCount )
219
      {
220
      ScrollView scrollView = new ScrollView(act);
221
      scrollView.addView(objectGrid);
222
      mObjectPopup.setContentView(scrollView);
223
      }
224
    else
225
      {
226
      mObjectPopup.setContentView(objectGrid);
227
      }
228

    
229
    int[] indices = ObjectList.getIndices();
230

    
231
    GridLayout.Spec[] rowSpecs = new GridLayout.Spec[mRowCount];
232
    GridLayout.Spec[] colSpecs = new GridLayout.Spec[mColCount];
233

    
234
    objectGrid.setColumnCount(mColCount);
235
    objectGrid.setRowCount(mRowCount);
236

    
237
    int[] nextInRow = new int[mRowCount];
238

    
239
    for(int row=0; row<mRowCount; row++)
240
      {
241
      rowSpecs[row] = GridLayout.spec(row);
242
      nextInRow[row]= 0;
243
      }
244
    for(int col=0; col<mColCount; col++)
245
      {
246
      colSpecs[col] = GridLayout.spec(col);
247
      }
248

    
249
    for(int object=0; object< ObjectList.NUM_OBJECTS; object++)
250
      {
251
      final ObjectList list = ObjectList.getObject(object);
252
      final int[] sizes = list.getSizes();
253
      int[] icons = list.getIconIDs();
254
      int len = sizes.length;
255
      final int obj = object;
256
      int row = indices[object];
257

    
258
      for(int i=0; i<len; i++)
259
        {
260
        final int index = i;
261

    
262
        ImageButton button = new ImageButton(act);
263
        button.setBackgroundResource(icons[i]);
264
        button.setOnClickListener( new View.OnClickListener()
265
          {
266
          @Override
267
          public void onClick(View v)
268
            {
269
            if( act.getPreRender().isUINotBlocked() && ScreenList.getCurrentScreen()== ScreenList.PLAY )
270
              {
271
              mObject = obj;
272
              mSize   = sizes[index];
273
              act.changeObject(list,sizes[index], true);
274
              adjustLevels(act);
275
              mController.clearMoves(act);
276
              }
277

    
278
            mObjectPopup.dismiss();
279
            }
280
          });
281

    
282
        GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[row],colSpecs[nextInRow[row]]);
283
        params.bottomMargin = margin;
284
        params.topMargin    = margin;
285
        params.leftMargin   = margin;
286
        params.rightMargin  = margin;
287

    
288
        nextInRow[row]++;
289

    
290
        objectGrid.addView(button, params);
291
        }
292
      }
293
    }
294

    
295
///////////////////////////////////////////////////////////////////////////////////////////////////
296

    
297
  private void setupMenuWindow(final RubikActivity act, final float width)
298
    {
299
    LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
300
    final View layout = layoutInflater.inflate(R.layout.popup_menu, null);
301
    LinearLayout menuLayout = layout.findViewById(R.id.menuGrid);
302

    
303
    mMenuPopup = new PopupWindow(act);
304
    mMenuPopup.setContentView(layout);
305
    mMenuPopup.setFocusable(true);
306
    int margin  = (int)(width*RubikActivity.MARGIN);
307
    int padding = (int)(width*RubikActivity.PADDING);
308

    
309
    mMenuLayoutWidth = (int)(width/2);
310
    mMenuLayoutHeight= (int)(2*margin + NUM_BUTTONS*(mMenuItemSize+margin));
311

    
312
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
313

    
314
    for(int i=0; i<NUM_BUTTONS; i++)
315
      {
316
      final int but = i;
317
      Button button = new Button(act);
318
      button.setLayoutParams(p);
319
      button.setText(BUTTON_LABELS[i]);
320
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
321

    
322
      button.setOnClickListener( new View.OnClickListener()
323
        {
324
        @Override
325
        public void onClick(View v)
326
          {
327
          mMenuPopup.dismiss();
328
          MenuAction(act,but);
329
          }
330
        });
331

    
332
      menuLayout.addView(button);
333
      }
334
    }
335

    
336
///////////////////////////////////////////////////////////////////////////////////////////////////
337

    
338
  private void setupPlayWindow(final RubikActivity act, final float width)
339
    {
340
    LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
341
    final View layout = layoutInflater.inflate(R.layout.popup_play, null);
342
    mPlayLayout = layout.findViewById(R.id.playGrid);
343

    
344
    mPlayLayoutWidth = (int)(width*0.4f);
345

    
346
    mPlayPopup = new PopupWindow(act);
347
    mPlayPopup.setContentView(layout);
348
    mPlayPopup.setFocusable(true);
349

    
350
    adjustLevels(act);
351
    }
352

    
353
///////////////////////////////////////////////////////////////////////////////////////////////////
354

    
355
  private void MenuAction(RubikActivity act, int button)
356
    {
357
    switch(button)
358
      {
359
      case 0: RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
360
              int object = play.getObject();
361
              int size   = play.getSize();
362
              int sizeIndex = ObjectList.getSizeIndex(object,size);
363
              Bundle sBundle = new Bundle();
364
              sBundle.putInt("tab", ObjectList.pack(object,sizeIndex) );
365
              sBundle.putBoolean("submitting", false);
366
              RubikDialogScores scores = new RubikDialogScores();
367
              scores.setArguments(sBundle);
368
              scores.show(act.getSupportFragmentManager(), null);
369
              break;
370
      case 1: RubikDialogPattern pDiag = new RubikDialogPattern();
371
              Bundle pBundle = new Bundle();
372
              int pOrd = getPatternOrdinal();
373
              pBundle.putInt("tab", pOrd );
374
              pDiag.setArguments(pBundle);
375
              pDiag.show( act.getSupportFragmentManager(), RubikDialogPattern.getDialogTag() );
376
              break;
377
/*
378
      case 2: RubikControl control = RubikControl.getInstance();
379
              //control.animateAll(act);
380
              control.animateRotate(act);
381
              break;
382
 */
383
      case 2: ScreenList.switchScreen(act, ScreenList.SVER);
384
              break;
385
      case 3: RubikDialogTutorial tDiag = new RubikDialogTutorial();
386
              Bundle tBundle = new Bundle();
387
              int tOrd = getTutorialOrdinal();
388
              tBundle.putInt("tab", tOrd );
389
              tDiag.setArguments(tBundle);
390
              tDiag.show( act.getSupportFragmentManager(), RubikDialogTutorial.getDialogTag() );
391
              break;
392
      case 4: RubikDialogAbout aDiag = new RubikDialogAbout();
393
              aDiag.show(act.getSupportFragmentManager(), null);
394
              break;
395
      }
396
    }
397

    
398
///////////////////////////////////////////////////////////////////////////////////////////////////
399

    
400
  void setupSolveButton(final RubikActivity act, final float width)
401
    {
402
    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);
403
    mSolveButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
404

    
405
    mSolveButton.setOnClickListener( new View.OnClickListener()
406
      {
407
      @Override
408
      public void onClick(View v)
409
        {
410
        act.getPreRender().solveObject();
411
        mController.clearMoves(act);
412
        }
413
      });
414
    }
415

    
416
///////////////////////////////////////////////////////////////////////////////////////////////////
417

    
418
  public void savePreferences(SharedPreferences.Editor editor)
419
    {
420
    editor.putInt("statePlay_object", mObject);
421
    editor.putInt("statePlay_size"  , mSize);
422

    
423
    if( mObjectPopup!=null )
424
      {
425
      mObjectPopup.dismiss();
426
      mObjectPopup = null;
427
      }
428

    
429
    if( mMenuPopup!=null )
430
      {
431
      mMenuPopup.dismiss();
432
      mMenuPopup = null;
433
      }
434

    
435
    if( mPlayPopup!=null )
436
      {
437
      mPlayPopup.dismiss();
438
      mPlayPopup = null;
439
      }
440
    }
441

    
442
///////////////////////////////////////////////////////////////////////////////////////////////////
443

    
444
  public void restorePreferences(SharedPreferences preferences)
445
    {
446
    mObject= preferences.getInt("statePlay_object", DEF_OBJECT);
447
    mSize  = preferences.getInt("statePlay_size"  , DEF_SIZE  );
448

    
449
    int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
450
    int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
451

    
452
    // This means the app has been upgraded to a new version which swapped the
453
    // Object for a new one with larger sizeIndex and now getMaxLevel() returns
454
    // 0. Reset the object to default, otherwise we'll get a crash later on.
455

    
456
    if( dbLevel==0 )
457
      {
458
      mObject = DEF_OBJECT;
459
      mSize   = DEF_SIZE;
460
      }
461
    }
462

    
463
///////////////////////////////////////////////////////////////////////////////////////////////////
464

    
465
  public boolean setObjectAndSize(RubikActivity act, ObjectList obj, int size)
466
    {
467
    if( mObject!=obj.ordinal() || mSize != size )
468
      {
469
      boolean success = false;
470

    
471
      for( int s: obj.getSizes() )
472
        if( s==size )
473
          {
474
          success = true;
475
          break;
476
          }
477

    
478
      if( success )
479
        {
480
        mObject = obj.ordinal();
481
        mSize   = size;
482

    
483
        if( mPlayLayout!=null ) adjustLevels(act);
484
        }
485

    
486
      return success;
487
      }
488

    
489
    return true;
490
    }
491

    
492
///////////////////////////////////////////////////////////////////////////////////////////////////
493
// work around lame bugs in Android's version <= 10 pop-up and split-screen modes
494

    
495
  private void displayPopup(RubikActivity act, View view, PopupWindow window, int w, int h, int xoff, int yoff)
496
    {
497
    View topLayout = act.findViewById(R.id.relativeLayout);
498
    topLayout.getLocationOnScreen(mLocation);
499
    mIsFullScreen = (mLocation[1]==0);
500

    
501
    // if on Android 11 or we are fullscreen
502
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || mIsFullScreen )
503
      {
504
      window.showAsDropDown(view, xoff, yoff, Gravity.CENTER);
505
      window.update(view, w, h);
506
      }
507
    else  // Android 10 or below in pop-up mode or split-screen mode
508
      {
509
      view.getLocationOnScreen(mLocation);
510
      int width  = view.getWidth();
511
      int height = view.getHeight();
512
      int x = mLocation[0]+(width-w)/2;
513
      int y = mLocation[1]+height+yoff;
514

    
515
      window.showAsDropDown(view);
516
      window.update(x,y,w,h);
517
      }
518
    }
519

    
520
///////////////////////////////////////////////////////////////////////////////////////////////////
521

    
522
  private void adjustLevels(final RubikActivity act)
523
    {
524
    int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
525
    int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
526
    int numScrambles = ObjectList.getNumScramble(mObject, sizeIndex);
527
    int numLevel = Math.min(dbLevel, LEVELS_SHOWN);
528
    String[] levels = new String[numLevel];
529

    
530
    for(int i=0; i<numLevel-1; i++)
531
      {
532
      levels[i] = act.getString(R.string.lv_placeholder,i+1);
533
      }
534

    
535
    if( numLevel>0 )
536
      {
537
      levels[numLevel-1] = act.getString(R.string.level_full);
538
      }
539

    
540
    if( mLevelValue>dbLevel || mLevelValue<1 ||
541
       (mLevelValue<dbLevel || mLevelValue>LEVELS_SHOWN ) )
542
      {
543
      mLevelValue=1;
544
      }
545

    
546
    float width  = act.getScreenWidthInPixels();
547
    int margin   = (int)(width*RubikActivity.MARGIN);
548
    int padding  = (int)(width*RubikActivity.PADDING);
549
    int butWidth = mPlayLayoutWidth - 2*padding;
550
    int butHeight= (int)mMenuItemSize;
551
    int lastButH = (int)(mMenuItemSize*LAST_BUTTON) ;
552

    
553
    LinearLayout.LayoutParams pM = new LinearLayout.LayoutParams( butWidth, butHeight );
554
    pM.setMargins(margin, 0, margin, margin);
555
    LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( butWidth, butHeight );
556
    pT.setMargins(margin, margin, margin, margin);
557
    LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( butWidth, lastButH  );
558
    pB.setMargins(margin, margin, margin, 2*margin);
559

    
560
    mPlayLayout.removeAllViews();
561

    
562
    RubikScores scores = RubikScores.getInstance();
563

    
564
    for(int i=0; i<numLevel; i++)
565
      {
566
      final int level     = i<numLevel-1 ? i+1 : dbLevel;
567
      final int scrambles = i<numLevel-1 ? i+1 : numScrambles;
568
      Button button = new Button(act);
569
      button.setLayoutParams(i==0 ? pT : (i==numLevel-1 ? pB : pM));
570
      button.setText(levels[i]);
571
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
572

    
573
      int icon = scores.isSolved(mObject, sizeIndex, level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
574
      button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
575

    
576
      button.setOnClickListener( new View.OnClickListener()
577
        {
578
        @Override
579
        public void onClick(View v)
580
          {
581
          RubikPreRender pre = act.getPreRender();
582

    
583
          if(pre.isUINotBlocked())
584
            {
585
            if( mPlayPopup!=null ) mPlayPopup.dismiss();
586
            mLevelValue = level;
587
            pre.scrambleObject(scrambles);
588
            }
589
          }
590
        });
591

    
592
      mPlayLayout.addView(button);
593
      }
594
    }
595

    
596
///////////////////////////////////////////////////////////////////////////////////////////////////
597

    
598
  public int getLevel()
599
    {
600
    return mLevelValue;
601
    }
602

    
603
///////////////////////////////////////////////////////////////////////////////////////////////////
604

    
605
  public int getObject()
606
    {
607
    return mObject;
608
    }
609

    
610
///////////////////////////////////////////////////////////////////////////////////////////////////
611

    
612
  public int getSize()
613
    {
614
    return mSize;
615
    }
616
  }
(5-5/10)