Project

General

Profile

« Previous | Next » 

Revision 4f36e418

Added by Leszek Koltunski almost 4 years ago

Hopefully get rid of the most common crash in the field right now by changing the States to always create all their Views from scratch.

View differences:

src/main/java/org/distorted/states/RubikStatePlay.java
76 76
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
77 77
    layoutTop.removeAllViews();
78 78

  
79
    if( mObjButton   ==null ) setupObjectButton(act,scale);
79
    setupObjectButton(act,scale);
80 80
    layoutTop.addView(mObjButton);
81
    if( mLevelSpinner==null ) setupLevelSpinner(act,scale);
81
    setupLevelSpinner(act,scale);
82 82
    layoutTop.addView(mLevelSpinner);
83
    if( mPlayButton  ==null ) setupPlayButton(act,scale);
83
    setupPlayButton(act,scale);
84 84
    layoutTop.addView(mPlayButton);
85 85

  
86 86
    // BOT ////////////////////////////
87 87

  
88
    if( mSolveButton==null ) setupSolveButton(act,scale);
88
    setupSolveButton(act,scale);
89 89

  
90 90
    LinearLayout layoutLeft = act.findViewById(R.id.mainBarLeft);
91 91
    layoutLeft.removeAllViews();
92 92
    layoutLeft.addView(mSolveButton);
93 93

  
94
    if( mBackButton==null ) setupBackButton(act,scale);
94
    setupBackButton(act,scale);
95 95

  
96 96
    LinearLayout layoutRight = act.findViewById(R.id.mainBarRight);
97 97
    layoutRight.removeAllViews();
98 98
    layoutRight.addView(mBackButton);
99 99

  
100
    if( mPopup==null ) setupPopupWindow(act, scale);
100
    setupPopupWindow(act, scale);
101 101
    }
102 102

  
103 103
///////////////////////////////////////////////////////////////////////////////////////////////////
......
303 303
    editor.putInt("statePlay_object", mObject);
304 304
    editor.putInt("statePlay_size"  , mSize);
305 305

  
306
    mObjButton   = null;
307
    mBackButton  = null;
308
    mSolveButton = null;
309
    mPlayButton  = null;
310
    mLevelSpinner= null;
311

  
312 306
    if( mPopup!=null )
313 307
      {
314 308
      mPopup.dismiss();

Also available in: Unified diff