Project

General

Profile

« Previous | Next » 

Revision 598de3ee

Added by Leszek Koltunski almost 3 years ago

add possible scrolling to the 'object' popup in case the grid of objects does not fit on the screen.

View differences:

src/main/java/org/distorted/main/RubikActivity.java
86 86
    public static final int FLAGS2=  View.SYSTEM_UI_FLAG_LAYOUT_STABLE
87 87
                                   | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
88 88

  
89
    private static final float RATIO_BAR  = 0.10f;
90
    private static final float RATIO_INSET= 0.08f;
91

  
89 92
    private boolean mJustStarted;
90 93
    private FirebaseAnalytics mFirebaseAnalytics;
91 94
    private static int mScreenWidth, mScreenHeight;
92 95
    private boolean mPolicyAccepted, mIsChinese;
93 96
    private int mCurrentApiVersion;
97
    private int mHeightUpperBar, mHeightLowerBar;
94 98

  
95 99
///////////////////////////////////////////////////////////////////////////////////////////////////
96 100

  
......
116 120

  
117 121
      hideNavigationBar();
118 122
      cutoutHack();
123
      computeBarHeights();
119 124
      // askForPermissions();
120 125
      }
121 126

  
127
///////////////////////////////////////////////////////////////////////////////////////////////////
128
// this does not include possible insets
129

  
130
    private void computeBarHeights()
131
      {
132
      float height = getScreenHeightInPixels();
133
      int barHeight = (int)(height*RATIO_BAR);
134
      mHeightLowerBar = barHeight;
135
      mHeightUpperBar = barHeight;
136
      }
137

  
122 138
///////////////////////////////////////////////////////////////////////////////////////////////////
123 139

  
124 140
    private void hideNavigationBar()
......
159 175

  
160 176
        LinearLayout layoutHid = findViewById(R.id.hiddenBar);
161 177
        ViewGroup.LayoutParams paramsHid = layoutHid.getLayoutParams();
162
        paramsHid.height = (int)(0.8f*insetHeight);
178
        paramsHid.height = (int)(insetHeight*RATIO_INSET);
163 179
        layoutHid.setLayoutParams(paramsHid);
180
        mHeightUpperBar += paramsHid.height;
164 181
        }
165 182

  
166
      final float RATIO = 0.10f;
167 183
      float height = getScreenHeightInPixels();
168 184

  
169 185
      LinearLayout layoutTop = findViewById(R.id.upperBar);
170 186
      LinearLayout layoutBot = findViewById(R.id.lowerBar);
171 187

  
172 188
      ViewGroup.LayoutParams paramsTop = layoutTop.getLayoutParams();
173
      paramsTop.height = (int)(height*RATIO);
189
      paramsTop.height = (int)(height*RATIO_BAR);
174 190
      layoutTop.setLayoutParams(paramsTop);
175 191
      ViewGroup.LayoutParams paramsBot = layoutBot.getLayoutParams();
176
      paramsBot.height = (int)(height*RATIO);
192
      paramsBot.height = (int)(height*RATIO_BAR);
177 193
      layoutBot.setLayoutParams(paramsBot);
178 194
      }
179 195

  
......
380 396
      return mFirebaseAnalytics;
381 397
      }
382 398

  
399
///////////////////////////////////////////////////////////////////////////////////////////////////
400

  
401
    public int getHeightUpperBar()
402
      {
403
      return mHeightUpperBar;
404
      }
405

  
406
///////////////////////////////////////////////////////////////////////////////////////////////////
407

  
408
    public int getHeightLowerBar()
409
      {
410
      return mHeightLowerBar;
411
      }
412

  
383 413
///////////////////////////////////////////////////////////////////////////////////////////////////
384 414

  
385 415
    public TwistyObject getObject()

Also available in: Unified diff