Project

General

Profile

« Previous | Next » 

Revision 2da68298

Added by Leszek Koltunski over 2 years ago

Create the 3 Popups only on first button click - this time we can have the final screen dimensions (and also it starts faster ) Before we weree getting the screen size from before hiding navigation bars, which made the height smaller, which made the number of obejcts and levels in the popups sometimes too small!

View differences:

src/main/java/org/distorted/screens/RubikScreenPlay.java
104 104
  void enterScreen(final RubikActivity act)
105 105
    {
106 106
    float width = act.getScreenWidthInPixels();
107
    float height= act.getScreenHeightInPixels();
108 107
    mUpperBarHeight = act.getHeightUpperBar();
109 108

  
110 109
    mMenuTextSize = width*RubikActivity.MENU_MED_TEXT_SIZE;
......
118 117
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
119 118
    layoutTop.removeAllViews();
120 119

  
121
    setupObjectWindow(act,width,height);
122 120
    setupObjectButton(act,width);
123 121
    layoutTop.addView(mObjButton);
124 122

  
125
    setupMenuWindow(act,width);
126 123
    setupMenuButton(act,width);
127 124
    layoutTop.addView(mMenuButton);
128 125

  
129
    setupPlayWindow(act,width);
130
    setupPlayButton(act,width,height);
126
    setupPlayButton(act,width);
131 127
    layoutTop.addView(mPlayButton);
132 128

  
133 129
    setupSolveButton(act,width);
......
148 144
      @Override
149 145
      public void onClick(View view)
150 146
        {
151
        if( mObjectPopup!=null && act.getControl().isUINotBlocked())
147
        if( mObjectPopup==null )
148
          {
149
          float width = act.getScreenWidthInPixels();
150
          float height= act.getScreenHeightInPixels();
151
          setupObjectWindow(act,width,height);
152
          }
153

  
154
        if( act.getControl().isUINotBlocked())
152 155
          {
153 156
          int rowCount = Math.min(mMaxRowCount,mRowCount);
154 157
          View popupView = mObjectPopup.getContentView();
......
161 164

  
162 165
///////////////////////////////////////////////////////////////////////////////////////////////////
163 166

  
164
  private void setupPlayButton(final RubikActivity act, final float width, final float height)
167
  private void setupPlayButton(final RubikActivity act, final float width)
165 168
    {
166
    final int margin   = (int)(width*RubikActivity.MARGIN);
167
    final int maxHeight= (int)(0.9f*(height-mUpperBarHeight) );
169
    final int margin = (int)(width*RubikActivity.MARGIN);
168 170

  
169 171
    mPlayButton = new TransparentButton(act, R.string.play, mButtonSize, width);
170 172

  
......
173 175
      @Override
174 176
      public void onClick(View view)
175 177
        {
176
        if( mPlayPopup!=null && act.getControl().isUINotBlocked())
178
         if( mPlayPopup==null )
179
          {
180
          float width = act.getScreenWidthInPixels();
181
          setupPlayWindow(act,width);
182
          }
183

  
184
        if( act.getControl().isUINotBlocked())
177 185
          {
186
          float height= act.getScreenHeightInPixels();
187
          final int maxHeight= (int)(0.9f*(height-mUpperBarHeight) );
178 188
          View popupView = mPlayPopup.getContentView();
179 189
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
180 190
          final int dbLevel = getDBLevel(mObject);
......
191 201

  
192 202
  private void setupMenuButton(final RubikActivity act, final float width)
193 203
    {
194
    final int margin  = (int)(width*RubikActivity.MARGIN);
204
    final int margin = (int)(width*RubikActivity.MARGIN);
195 205
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_menu,R.drawable.ui_medium_menu, R.drawable.ui_big_menu, R.drawable.ui_huge_menu);
196 206

  
197 207
    mMenuButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
......
201 211
      @Override
202 212
      public void onClick(View view)
203 213
        {
204
        if( mMenuPopup!=null && act.getControl().isUINotBlocked())
214
        if( mMenuPopup==null )
215
          {
216
          float width = act.getScreenWidthInPixels();
217
          setupMenuWindow(act,width);
218
          }
219

  
220
        if( act.getControl().isUINotBlocked())
205 221
          {
206 222
          View popupView = mMenuPopup.getContentView();
207 223
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);

Also available in: Unified diff