Project

General

Profile

« Previous | Next » 

Revision d90c55cc

Added by Leszek Koltunski over 3 years ago

Make the 'Play' popup always fit within the window height.

View differences:

src/main/java/org/distorted/objects/TwistyCube.java
62 62

  
63 63
///////////////////////////////////////////////////////////////////////////////////////////////////
64 64

  
65
  TwistyCube(int size, Static4D quat, DistortedTexture texture,
66
             MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
65
  TwistyCube(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
66
             DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
67 67
    {
68 68
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.CUBE, res, scrWidth);
69 69

  
......
186 186

  
187 187
    int[][] vert_indices = new int[][]
188 188
          {
189
              {2,3,1,0},   // counterclockwise!
189
              {2,3,1,0},
190 190
              {7,6,4,5},
191 191
              {4,0,1,5},
192 192
              {7,3,2,6},
......
364 364

  
365 365
  public int[] getBasicAngle()
366 366
    {
367
    if( mBasicAngle ==null ) mBasicAngle = new int[] { 4,4,4 };
367
    if( mBasicAngle==null ) mBasicAngle = new int[] { 4,4,4 };
368 368
    return mBasicAngle;
369 369
    }
370 370

  
src/main/java/org/distorted/screens/RubikScreenPlay.java
110 110
    layoutTop.addView(mMenuButton);
111 111

  
112 112
    setupPlayWindow(act,width);
113
    setupPlayButton(act,width);
113
    setupPlayButton(act,width,height);
114 114
    layoutTop.addView(mPlayButton);
115 115

  
116 116
    setupSolveButton(act,width);
......
148 148

  
149 149
///////////////////////////////////////////////////////////////////////////////////////////////////
150 150

  
151
  private void setupPlayButton(final RubikActivity act, final float width)
151
  private void setupPlayButton(final RubikActivity act, final float width, final float height)
152 152
    {
153
    final int margin  = (int)(width*RubikActivity.MARGIN);
153
    final int margin   = (int)(width*RubikActivity.MARGIN);
154
    int upperBarHeight = act.getHeightUpperBar();
155
    final int maxHeight= (int)(0.9f*(height-upperBarHeight) );
156

  
154 157
    mPlayButton = new TransparentButton(act, R.string.play, mButtonSize, width);
155 158

  
156 159
    mPlayButton.setOnClickListener( new View.OnClickListener()
......
166 169
          final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
167 170
          final int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
168 171
          final int levelsShown = Math.min(dbLevel,LEVELS_SHOWN);
172
          final int popupHeight = (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f));
169 173

  
170 174
          mPlayPopup.showAsDropDown(view, margin, margin);
171
          mPlayPopup.update(view, mPlayLayoutWidth, (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f)));
175
          mPlayPopup.update(view, mPlayLayoutWidth, Math.min(popupHeight,maxHeight));
172 176
          mPlayPopup.setFocusable(true);
173 177
          mPlayPopup.update();
174 178
          }

Also available in: Unified diff