Revision fd0b901a
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/states/RubikStatePlay.java | ||
---|---|---|
24 | 24 |
import android.graphics.drawable.BitmapDrawable; |
25 | 25 |
import android.os.Bundle; |
26 | 26 |
import android.util.TypedValue; |
27 |
import android.view.Gravity; |
|
28 | 27 |
import android.view.LayoutInflater; |
29 | 28 |
import android.view.View; |
30 | 29 |
import android.widget.Button; |
... | ... | |
56 | 55 |
private static int[] BUTTON_LABELS = { R.string.scores, R.string.patterns, R.string.solver, R.string.about }; |
57 | 56 |
private static final int NUM_BUTTONS = BUTTON_LABELS.length; |
58 | 57 |
|
58 |
private static int mSafeInsetTop; |
|
59 |
|
|
59 | 60 |
private ImageButton mObjButton, mMenuButton, mPrevButton, mSolveButton, mLockButton; |
60 | 61 |
private Button mPlayButton; |
61 | 62 |
private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup; |
... | ... | |
175 | 176 |
View popupView = mObjectPopup.getContentView(); |
176 | 177 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
177 | 178 |
|
178 |
mObjectPopup.showAsDropDown(view, margin, margin, Gravity.LEFT);
|
|
179 |
mObjectPopup.showAsDropDown(view, margin, margin + mSafeInsetTop);
|
|
179 | 180 |
mObjectPopup.update(view, mObjectSize*mColCount, mObjectSize*mRowCount); |
180 | 181 |
|
181 | 182 |
mObjectPopup.setFocusable(true); |
... | ... | |
214 | 215 |
final int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex); |
215 | 216 |
final int levelsShown = Math.min(maxLevel,LEVELS_SHOWN); |
216 | 217 |
|
217 |
mPlayPopup.showAsDropDown(view, margin, margin, Gravity.RIGHT);
|
|
218 |
mPlayPopup.showAsDropDown(view, margin, margin + mSafeInsetTop);
|
|
218 | 219 |
mPlayPopup.update(view, mPlayLayoutWidth, (int)(levelsShown*(mMenuItemSize+margin)+2*margin)); |
219 | 220 |
|
220 | 221 |
mPlayPopup.setFocusable(true); |
... | ... | |
251 | 252 |
View popupView = mMenuPopup.getContentView(); |
252 | 253 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
253 | 254 |
|
254 |
mMenuPopup.showAsDropDown(view, (int)(-width/12), margin, Gravity.CENTER);
|
|
255 |
mMenuPopup.showAsDropDown(view, (int)(-width/12), margin + mSafeInsetTop);
|
|
255 | 256 |
mMenuPopup.update(view, mMenuLayoutWidth, mMenuLayoutHeight); |
256 | 257 |
|
257 | 258 |
mMenuPopup.setFocusable(true); |
... | ... | |
662 | 663 |
} |
663 | 664 |
} |
664 | 665 |
|
666 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
667 |
|
|
668 |
public static void setSafeInsetTop(int top) |
|
669 |
{ |
|
670 |
mSafeInsetTop = top; |
|
671 |
} |
|
672 |
|
|
665 | 673 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
666 | 674 |
|
667 | 675 |
public int getLevel() |
Also available in: Unified diff
Avoid the possible cutouts at the top of the screen.