Project

General

Profile

« Previous | Next » 

Revision aa622165

Added by Leszek Koltunski almost 2 years ago

Finally fix the 'impossible records' bug!

Thanks for a bug report from Jacob Powell - if one, during scrambling, minimized the app and re-entered it, the UI lock got removed (by a call to 'unblockEverything' from RubikActivity's onResume) and one could then keep solving the object mid-scramble.

Simply remove the 'unblockEverything' call from onResume.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
326 326

  
327 327
    public static int getDrawableSize()
328 328
      {
329
      if( mScreenHeight<1000 )
330
        {
331
        return 0;
332
        }
333
      if( mScreenHeight<1600 )
334
        {
335
        return 1;
336
        }
337
      if( mScreenHeight<1900 )
338
        {
339
        return 2;
340
        }
341

  
329
      if( mScreenHeight<1000 ) return 0;
330
      if( mScreenHeight<1600 ) return 1;
331
      if( mScreenHeight<1900 ) return 2;
342 332
      return 3;
343 333
      }
344 334

  
src/main/java/org/distorted/bandaged/BandagedPlayActivity.java
39 39
    private static final float RATIO_BAR  = 0.10f;
40 40
    private static final float RATIO_INSET= 0.09f;
41 41

  
42
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
43
    public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
44

  
45 42
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
46 43
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
47 44
                                   | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
......
52 49
    private int mCurrentApiVersion;
53 50
    private BandagedPlayScreen mScreen;
54 51
    private String mObjectName;
55
    private int mHeightLowerBar, mHeightUpperBar;
52
    private int mHeightUpperBar;
56 53

  
57 54
///////////////////////////////////////////////////////////////////////////////////////////////////
58 55

  
......
83 80
    private void computeBarHeights()
84 81
      {
85 82
      int barHeight = (int)(mScreenHeight*RATIO_BAR);
86
      mHeightLowerBar = barHeight;
87 83
      mHeightUpperBar = barHeight;
88 84

  
89 85
      LinearLayout layoutTop = findViewById(R.id.upperBar);
......
93 89
      paramsTop.height = mHeightUpperBar;
94 90
      layoutTop.setLayoutParams(paramsTop);
95 91
      ViewGroup.LayoutParams paramsBot = layoutBot.getLayoutParams();
96
      paramsBot.height = mHeightLowerBar;
92
      paramsBot.height = barHeight;
97 93
      layoutBot.setLayoutParams(paramsBot);
98 94
      }
99 95

  
......
252 248

  
253 249
///////////////////////////////////////////////////////////////////////////////////////////////////
254 250
// PUBLIC API
255
///////////////////////////////////////////////////////////////////////////////////////////////////
256

  
257
    public void changeObject(String name)
258
      {
259
      mObjectName = name;
260
      BandagedPlayView view = findViewById(R.id.bandagedPlayView);
261
      ObjectControl control = view.getObjectControl();
262
      changeIfDifferent(name,control);
263
      }
264

  
265
///////////////////////////////////////////////////////////////////////////////////////////////////
266

  
267
    public int getHeightBar()
268
      {
269
      return mHeightLowerBar;
270
      }
271

  
272 251
///////////////////////////////////////////////////////////////////////////////////////////////////
273 252

  
274 253
    public int getScreenWidthInPixels()
......
302 281

  
303 282
    public static int getDrawableSize()
304 283
      {
305
      if( mScreenHeight<1000 )
306
        {
307
        return 0;
308
        }
309
      if( mScreenHeight<1600 )
310
        {
311
        return 1;
312
        }
313
      if( mScreenHeight<1900 )
314
        {
315
        return 2;
316
        }
317

  
284
      if( mScreenHeight<1000 ) return 0;
285
      if( mScreenHeight<1600 ) return 1;
286
      if( mScreenHeight<1900 ) return 2;
318 287
      return 3;
319 288
      }
320 289

  
src/main/java/org/distorted/bandaged/BandagedPlayScreen.java
53 53
      @Override
54 54
      public void onClick(View v)
55 55
        {
56
        ObjectControl control = act.getControl();
57
        if( control!=null ) control.unblockEverything();
58 56
        act.finish();
59 57
        }
60 58
      });
......
156 154
    layoutUpper.addView(layoutRightU);
157 155
    }
158 156

  
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160

  
161
  public void setLockState(final BandagedPlayActivity act)
162
    {
163
    boolean locked = act.getControl().retLocked();
164
    mLockController.setState(act,locked);
165
    }
166

  
167 157
///////////////////////////////////////////////////////////////////////////////////////////////////
168 158

  
169 159
  public void reddenLock(final BandagedPlayActivity act)
src/main/java/org/distorted/config/ConfigActivity.java
35 35
    private static final int ACTIVITY_NUMBER = 2;
36 36
    private static final float RATIO_BAR  = 0.10f;
37 37

  
38
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
39
    public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
40

  
41 38
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
42 39
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
43 40
                                   | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
src/main/java/org/distorted/config/ConfigScreen.java
21 21
import android.widget.TextView;
22 22

  
23 23
import org.distorted.helpers.PopupCreator;
24
import org.distorted.objectlib.main.ObjectControl;
25 24

  
26 25
import org.distorted.helpers.TransparentImageButton;
27 26
import org.distorted.main.R;
......
113 112
      @Override
114 113
      public void onClick(View v)
115 114
        {
116
        ObjectControl control = act.getControl();
117
        if( control!=null ) control.unblockEverything();
118 115
        act.finish();
119 116
        }
120 117
      });
src/main/java/org/distorted/main/RubikActivity.java
76 76
    public static final float PATTERN_CHILD_TEXT  = 0.02f;
77 77
    public static final float SCORES_LEVEL_TEXT   = 0.035f;
78 78
    public static final float SCORES_ITEM_TEXT    = 0.030f;
79
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
80
    public static final float BIG_TEXT_SIZE       = 0.05f;
81
    public static final float SMALL_TEXT_SIZE     = 0.035f;
82 79
    public static final float TAB_WIDTH           = 0.066f;
83 80
    public static final float TAB_HEIGHT          = 0.066f;
84
    public static final float TAB_TEXT_SIZE       = 0.033f;
85
    public static final float TAB_BUTTON_SIZE     = 0.040f;
86 81
    public static final float POPUP_PADDING       = 0.028f;
87 82
    public static final float POPUP_MARGIN        = 0.016f;
88 83

  
......
262 257
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
263 258
      restorePreferences(preferences,mJustStarted);
264 259
      ScreenList.setScreen(this);
265
      unblockEverything();
266 260
      restoreMoves(preferences);
267 261

  
268 262
      if( mJustStarted )
......
621 615

  
622 616
    public static int getDrawableSize()
623 617
      {
624
      if( mScreenHeight<1000 )
625
        {
626
        return 0;
627
        }
628
      if( mScreenHeight<1600 )
629
        {
630
        return 1;
631
        }
632
      if( mScreenHeight<1900 )
633
        {
634
        return 2;
635
        }
636

  
618
      if( mScreenHeight<1000 ) return 0;
619
      if( mScreenHeight<1600 ) return 1;
620
      if( mScreenHeight<1900 ) return 2;
637 621
      return 3;
638 622
      }
639 623

  
......
692 676
      return view.isVertical();
693 677
      }
694 678

  
695
///////////////////////////////////////////////////////////////////////////////////////////////////
696

  
697
    public void blockEverything(int place)
698
      {
699
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
700
      ObjectControl control = view.getObjectControl();
701
      control.blockEverything(place);
702

  
703
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
704
      play.setLockState(this);
705
      }
706

  
707
///////////////////////////////////////////////////////////////////////////////////////////////////
708

  
709
    public void unblockEverything()
710
      {
711
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
712
      ObjectControl control = view.getObjectControl();
713
      control.unblockEverything();
714

  
715
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
716
      play.setLockState(this);
717
      }
718

  
719 679
///////////////////////////////////////////////////////////////////////////////////////////////////
720 680

  
721 681
    public void switchTutorial(String url, int objectOrdinal)
src/main/java/org/distorted/overlays/OverlayStars.java
249 249
      MeshQuad mesh = new MeshQuad();
250 250

  
251 251
      DistortedEffects effects = new DistortedEffects();
252
      float scaleM  = mHeight*0.24f;
252
      float scaleM  = mHeight*0.22f;
253 253
      Static3D moveM= new Static3D(0,0,1);
254 254
      MatrixEffectMove move  = new MatrixEffectMove(moveM);
255 255
      MatrixEffectScale scale= new MatrixEffectScale(scaleM);
src/main/java/org/distorted/purchase/PurchaseActivity.java
40 40
    private static final float RATIO_LBAR = 0.10f;
41 41
    private static final float RATIO_VIEW = 0.50f;
42 42

  
43
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
44
    public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
45

  
46 43
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
47 44
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
48 45
                                   | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
......
283 280

  
284 281
    public static int getDrawableSize()
285 282
      {
286
      if( mScreenHeight<1000 )
287
        {
288
        return 0;
289
        }
290
      if( mScreenHeight<1600 )
291
        {
292
        return 1;
293
        }
294
      if( mScreenHeight<1900 )
295
        {
296
        return 2;
297
        }
298

  
283
      if( mScreenHeight<1000 ) return 0;
284
      if( mScreenHeight<1600 ) return 1;
285
      if( mScreenHeight<1900 ) return 2;
299 286
      return 3;
300 287
      }
301 288

  
src/main/java/org/distorted/purchase/PurchaseScreen.java
15 15
import org.distorted.helpers.TransparentImageButton;
16 16
import org.distorted.main.R;
17 17
import org.distorted.main.RubikActivity;
18
import org.distorted.objectlib.main.ObjectControl;
19 18

  
20 19
///////////////////////////////////////////////////////////////////////////////////////////////////
21 20

  
......
44 43
      @Override
45 44
      public void onClick(View v)
46 45
        {
47
        if( !mBlocked )
48
          {
49
          ObjectControl control = act.getControl();
50
          if( control!=null ) control.unblockEverything();
51
          act.finish();
52
          }
46
        if( !mBlocked ) act.finish();
53 47
        }
54 48
      });
55 49
    }
src/main/java/org/distorted/purchase/PurchaseScreenPane.java
24 24
import org.distorted.library.main.DistortedScreen;
25 25
import org.distorted.main.R;
26 26
import org.distorted.objectlib.json.JsonReader;
27
import org.distorted.objectlib.main.ObjectControl;
28 27
import org.distorted.objects.RubikObject;
29 28
import org.distorted.objects.RubikObjectList;
30 29
import org.distorted.overlays.DataStars;
......
281 280
      String upperName = mObject.getUpperName();
282 281
      int ordinal = RubikObjectList.getOrdinal(upperName);
283 282
      RubikObjectList.setCurrObject(ordinal);
284
      ObjectControl control = act.getControl();
285
      if( control!=null ) control.unblockEverything();
286 283
      act.finish();
287 284
      }
288 285
    }
src/main/java/org/distorted/tutorials/TutorialActivity.java
44 44

  
45 45
    private static final int ACTIVITY_NUMBER = 1;
46 46
    public static final float BAR_RATIO = 0.17f;
47
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
48 47

  
49 48
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
50 49
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
......
281 280

  
282 281
    public static int getDrawableSize()
283 282
      {
284
      if( mScreenHeight<1000 )
285
        {
286
        return 0;
287
        }
288
      if( mScreenHeight<1600 )
289
        {
290
        return 1;
291
        }
292
      if( mScreenHeight<1900 )
293
        {
294
        return 2;
295
        }
296

  
283
      if( mScreenHeight<1000 ) return 0;
284
      if( mScreenHeight<1600 ) return 1;
285
      if( mScreenHeight<1900 ) return 2;
297 286
      return 3;
298 287
      }
299 288

  
src/main/java/org/distorted/tutorials/TutorialScreen.java
127 127
      @Override
128 128
      public void onClick(View v)
129 129
        {
130
        ObjectControl control = act.getControl();
131
        if( control!=null ) control.unblockEverything();
132 130
        act.finish();
133 131
        }
134 132
      });

Also available in: Unified diff