Revision 6fad862b
Added by Leszek Koltunski over 4 years ago
| src/main/java/org/distorted/states/RubikStatePlay.java | ||
|---|---|---|
| 38 | 38 |
import org.distorted.dialogs.RubikDialogTutorial; |
| 39 | 39 |
import org.distorted.main.R; |
| 40 | 40 |
import org.distorted.main.RubikActivity; |
| 41 |
import org.distorted.main.RubikRenderer;
|
|
| 41 |
import org.distorted.main.RubikPreRender;
|
|
| 42 | 42 |
import org.distorted.objects.ObjectList; |
| 43 | 43 |
import org.distorted.scores.RubikScores; |
| 44 | 44 |
|
| ... | ... | |
| 118 | 118 |
@Override |
| 119 | 119 |
public void onClick(View view) |
| 120 | 120 |
{
|
| 121 |
if( act.getPreRender().canPlay() )
|
|
| 121 |
if( mObjectPopup==null )
|
|
| 122 | 122 |
{
|
| 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 |
} |
|
| 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 |
} |
|
| 129 | 127 |
|
| 130 |
mObjectPopup.setFocusable(false);
|
|
| 131 |
mObjectPopup.update();
|
|
| 128 |
mObjectPopup.setFocusable(false); |
|
| 129 |
mObjectPopup.update(); |
|
| 132 | 130 |
|
| 133 |
View popupView = mObjectPopup.getContentView();
|
|
| 134 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS);
|
|
| 131 |
View popupView = mObjectPopup.getContentView(); |
|
| 132 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
|
| 135 | 133 |
|
| 136 |
mObjectPopup.showAsDropDown(view, margin, margin);
|
|
| 137 |
mObjectPopup.update(view, mObjectSize*mColCount, mObjectSize*mRowCount);
|
|
| 134 |
mObjectPopup.showAsDropDown(view, margin, margin); |
|
| 135 |
mObjectPopup.update(view, mObjectSize*mColCount, mObjectSize*mRowCount); |
|
| 138 | 136 |
|
| 139 |
mObjectPopup.setFocusable(true); |
|
| 140 |
mObjectPopup.update(); |
|
| 141 |
} |
|
| 137 |
mObjectPopup.setFocusable(true); |
|
| 138 |
mObjectPopup.update(); |
|
| 142 | 139 |
} |
| 143 | 140 |
}); |
| 144 | 141 |
} |
| ... | ... | |
| 155 | 152 |
@Override |
| 156 | 153 |
public void onClick(View view) |
| 157 | 154 |
{
|
| 158 |
if( act.getPreRender().canPlay() )
|
|
| 155 |
if( mPlayPopup==null )
|
|
| 159 | 156 |
{
|
| 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 |
} |
|
| 166 |
|
|
| 167 |
mPlayPopup.setFocusable(false); |
|
| 168 |
mPlayPopup.update(); |
|
| 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 |
} |
|
| 169 | 161 |
|
| 170 |
View popupView = mPlayPopup.getContentView();
|
|
| 171 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS);
|
|
| 162 |
mPlayPopup.setFocusable(false);
|
|
| 163 |
mPlayPopup.update();
|
|
| 172 | 164 |
|
| 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); |
|
| 165 |
View popupView = mPlayPopup.getContentView(); |
|
| 166 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
|
| 176 | 167 |
|
| 177 |
mPlayPopup.showAsDropDown(view, margin, margin); |
|
| 178 |
mPlayPopup.update(view, mPlayLayoutWidth, (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f))); |
|
| 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); |
|
| 179 | 171 |
|
| 180 |
mPlayPopup.setFocusable(true); |
|
| 181 |
mPlayPopup.update(); |
|
| 182 |
} |
|
| 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(); |
|
| 183 | 176 |
} |
| 184 | 177 |
}); |
| 185 | 178 |
} |
| ... | ... | |
| 197 | 190 |
@Override |
| 198 | 191 |
public void onClick(View view) |
| 199 | 192 |
{
|
| 200 |
if( act.getPreRender().canPlay() )
|
|
| 193 |
if( mMenuPopup==null )
|
|
| 201 | 194 |
{
|
| 202 |
if( mMenuPopup==null ) |
|
| 203 |
{
|
|
| 204 |
// I completely don't understand it, but Firebase says occasionally mMenuPopup is null here. Recreate. |
|
| 205 |
float width = act.getScreenWidthInPixels(); |
|
| 206 |
setupMenuWindow(act,width); |
|
| 207 |
} |
|
| 208 |
|
|
| 209 |
mMenuPopup.setFocusable(false); |
|
| 210 |
mMenuPopup.update(); |
|
| 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 |
} |
|
| 211 | 199 |
|
| 212 |
View popupView = mMenuPopup.getContentView();
|
|
| 213 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS);
|
|
| 200 |
mMenuPopup.setFocusable(false);
|
|
| 201 |
mMenuPopup.update();
|
|
| 214 | 202 |
|
| 215 |
mMenuPopup.showAsDropDown(view, (int)(-width/12), margin);
|
|
| 216 |
mMenuPopup.update(view, mMenuLayoutWidth, mMenuLayoutHeight);
|
|
| 203 |
View popupView = mMenuPopup.getContentView();
|
|
| 204 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS);
|
|
| 217 | 205 |
|
| 218 |
mMenuPopup.setFocusable(true); |
|
| 219 |
mMenuPopup.update(); |
|
| 220 |
} |
|
| 206 |
mMenuPopup.showAsDropDown(view, (int)(-width/12), margin); |
|
| 207 |
mMenuPopup.update(view, mMenuLayoutWidth, mMenuLayoutHeight); |
|
| 208 |
mMenuPopup.setFocusable(true); |
|
| 209 |
mMenuPopup.update(); |
|
| 221 | 210 |
} |
| 222 | 211 |
}); |
| 223 | 212 |
} |
| ... | ... | |
| 542 | 531 |
@Override |
| 543 | 532 |
public void onClick(View v) |
| 544 | 533 |
{
|
| 545 |
mPlayPopup.dismiss(); |
|
| 546 |
mLevelValue = scrambles; |
|
| 547 |
act.getPreRender().scrambleObject(mLevelValue); |
|
| 534 |
RubikPreRender pre = act.getPreRender(); |
|
| 535 |
|
|
| 536 |
if( pre.canPlay() ) |
|
| 537 |
{
|
|
| 538 |
mPlayPopup.dismiss(); |
|
| 539 |
mLevelValue = scrambles; |
|
| 540 |
pre.scrambleObject(mLevelValue); |
|
| 541 |
} |
|
| 548 | 542 |
} |
| 549 | 543 |
}); |
| 550 | 544 |
|
Also available in: Unified diff
Remove some of the UI blocks:
No need to block the three top dialogs - the Object, Menu and Play popups.