Project

General

Profile

« Previous | Next » 

Revision c5b4af4a

Added by Leszek Koltunski about 3 years ago

Fix the 6fad862b commit and remove the UI block in a proper way (i.e. the problem was that popping up the Object, Play or Menu windows was impossible while the 'WIN' glow was active)

View differences:

src/main/java/org/distorted/main/RubikPreRender.java
189 189
        }
190 190

  
191 191
      mCanRotate = true;
192
      mCanPlay   = true;
192 193
      doEffectNow( BaseEffect.Type.WIN );
193 194
      }
194 195
    else
195 196
      {
196 197
      mCanRotate = true;
197
      mCanPlay = true;
198
      mCanPlay   = true;
198 199
      }
199 200

  
200 201
    mIsSolved = solved;
src/main/java/org/distorted/states/RubikStatePlay.java
118 118
      @Override
119 119
      public void onClick(View view)
120 120
        {
121
        if( mObjectPopup==null )
121
        if( act.getPreRender().canPlay() )
122 122
          {
123
          // I completely don't understand it, but Firebase says occasionally mObjectPopup is null here. Recreate.
124
          float width = act.getScreenWidthInPixels();
125
          setupObjectWindow(act,width);
126
          }
123
          if( mObjectPopup==null )
124
            {
125
            // I completely don't understand it, but Firebase says occasionally mObjectPopup is null here. Recreate.
126
            float width = act.getScreenWidthInPixels();
127
            setupObjectWindow(act,width);
128
            }
127 129

  
128
        mObjectPopup.setFocusable(false);
129
        mObjectPopup.update();
130
          mObjectPopup.setFocusable(false);
131
          mObjectPopup.update();
130 132

  
131
        View popupView = mObjectPopup.getContentView();
132
        popupView.setSystemUiVisibility(RubikActivity.FLAGS);
133
          View popupView = mObjectPopup.getContentView();
134
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
133 135

  
134
        mObjectPopup.showAsDropDown(view, margin, margin);
135
        mObjectPopup.update(view, mObjectSize*mColCount, mObjectSize*mRowCount);
136
          mObjectPopup.showAsDropDown(view, margin, margin);
137
          mObjectPopup.update(view, mObjectSize*mColCount, mObjectSize*mRowCount);
136 138

  
137
        mObjectPopup.setFocusable(true);
138
        mObjectPopup.update();
139
          mObjectPopup.setFocusable(true);
140
          mObjectPopup.update();
141
          }
139 142
        }
140 143
      });
141 144
    }
......
152 155
      @Override
153 156
      public void onClick(View view)
154 157
        {
155
        if( mPlayPopup==null )
158
        if( act.getPreRender().canPlay() )
156 159
          {
157
          // I completely don't understand it, but Firebase says occasionally mPlayPopup is null here. Recreate.
158
          float width = act.getScreenWidthInPixels();
159
          setupPlayWindow(act,width);
160
          }
160
          if( mPlayPopup==null )
161
            {
162
            // I completely don't understand it, but Firebase says occasionally mPlayPopup is null here. Recreate.
163
            float width = act.getScreenWidthInPixels();
164
            setupPlayWindow(act,width);
165
            }
161 166

  
162
        mPlayPopup.setFocusable(false);
163
        mPlayPopup.update();
167
          mPlayPopup.setFocusable(false);
168
          mPlayPopup.update();
164 169

  
165
        View popupView = mPlayPopup.getContentView();
166
        popupView.setSystemUiVisibility(RubikActivity.FLAGS);
170
          View popupView = mPlayPopup.getContentView();
171
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
167 172

  
168
        final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
169
        final int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex);
170
        final int levelsShown = Math.min(maxLevel,LEVELS_SHOWN);
173
          final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
174
          final int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex);
175
          final int levelsShown = Math.min(maxLevel,LEVELS_SHOWN);
171 176

  
172
        mPlayPopup.showAsDropDown(view, margin, margin);
173
        mPlayPopup.update(view, mPlayLayoutWidth, (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f)));
174
        mPlayPopup.setFocusable(true);
175
        mPlayPopup.update();
177
          mPlayPopup.showAsDropDown(view, margin, margin);
178
          mPlayPopup.update(view, mPlayLayoutWidth, (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f)));
179
          mPlayPopup.setFocusable(true);
180
          mPlayPopup.update();
181
          }
176 182
        }
177 183
      });
178 184
    }
......
190 196
      @Override
191 197
      public void onClick(View view)
192 198
        {
193
        if( mMenuPopup==null )
199
        if( act.getPreRender().canPlay() )
194 200
          {
195
          // I completely don't understand it, but Firebase says occasionally mMenuPopup is null here. Recreate.
196
          float width = act.getScreenWidthInPixels();
197
          setupMenuWindow(act,width);
198
          }
201
          if( mMenuPopup==null )
202
            {
203
            // I completely don't understand it, but Firebase says occasionally mMenuPopup is null here. Recreate.
204
            float width = act.getScreenWidthInPixels();
205
            setupMenuWindow(act,width);
206
            }
199 207

  
200
        mMenuPopup.setFocusable(false);
201
        mMenuPopup.update();
208
          mMenuPopup.setFocusable(false);
209
          mMenuPopup.update();
202 210

  
203
        View popupView = mMenuPopup.getContentView();
204
        popupView.setSystemUiVisibility(RubikActivity.FLAGS);
211
          View popupView = mMenuPopup.getContentView();
212
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
205 213

  
206
        mMenuPopup.showAsDropDown(view, (int)(-width/12), margin);
207
        mMenuPopup.update(view, mMenuLayoutWidth, mMenuLayoutHeight);
208
        mMenuPopup.setFocusable(true);
209
        mMenuPopup.update();
214
          mMenuPopup.showAsDropDown(view, (int)(-width/12), margin);
215
          mMenuPopup.update(view, mMenuLayoutWidth, mMenuLayoutHeight);
216
          mMenuPopup.setFocusable(true);
217
          mMenuPopup.update();
218
          }
210 219
        }
211 220
      });
212 221
    }

Also available in: Unified diff