Revision 7fe59aa5
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java | ||
---|---|---|
81 | 81 |
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); |
82 | 82 |
|
83 | 83 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
84 |
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
|
84 |
getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics);
|
|
85 | 85 |
mScreenWidth =displaymetrics.widthPixels; |
86 | 86 |
mScreenHeight=displaymetrics.heightPixels; |
87 |
mScreenHeight = (int)(1.07f*mScreenHeight); // add 7% for the upper bar |
|
88 |
// which is not yet hidden. |
|
89 |
// TODO: figure this out exactly. |
|
87 |
|
|
90 | 88 |
hideNavigationBar(); |
91 | 89 |
cutoutHack(); |
92 | 90 |
computeHeights(); |
... | ... | |
101 | 99 |
int butHeight = (int)(mScreenHeight*RATIO_BUT); |
102 | 100 |
int viewHeight = (int)(mScreenHeight*RATIO_SCROLL); |
103 | 101 |
int objectHeight = (int)(mScreenHeight*(1-RATIO_SCROLL+RATIO_BAR)); |
104 |
int padding = (int)(mScreenHeight* RubikActivity.PADDING);
|
|
102 |
int padding = (int)(mScreenHeight*RubikActivity.PADDING); |
|
105 | 103 |
|
106 | 104 |
LinearLayout botLayout = findViewById(R.id.lowerBar); |
107 | 105 |
ViewGroup.LayoutParams paramsL = botLayout.getLayoutParams(); |
src/main/java/org/distorted/bandaged/BandagedPlayActivity.java | ||
---|---|---|
83 | 83 |
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); |
84 | 84 |
|
85 | 85 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
86 |
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
|
86 |
getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics);
|
|
87 | 87 |
mScreenWidth =displaymetrics.widthPixels; |
88 | 88 |
mScreenHeight=displaymetrics.heightPixels; |
89 |
mScreenHeight = (int)(1.07f*mScreenHeight); // add 7% for the upper bar |
|
90 |
// which is not yet hidden. |
|
91 |
// TODO: figure this out exactly. |
|
89 |
|
|
92 | 90 |
hideNavigationBar(); |
93 | 91 |
cutoutHack(); |
94 | 92 |
computeBarHeights(); |
... | ... | |
99 | 97 |
|
100 | 98 |
private void computeBarHeights() |
101 | 99 |
{ |
102 |
float height = mScreenHeight; |
|
103 |
int barHeight = (int)(height*RATIO_BAR); |
|
100 |
int barHeight = (int)(mScreenHeight*RATIO_BAR); |
|
104 | 101 |
mHeightLowerBar = barHeight; |
105 | 102 |
mHeightUpperBar = barHeight; |
106 | 103 |
|
src/main/java/org/distorted/config/ConfigActivity.java | ||
---|---|---|
79 | 79 |
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); |
80 | 80 |
|
81 | 81 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
82 |
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
|
82 |
getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics);
|
|
83 | 83 |
mScreenWidth =displaymetrics.widthPixels; |
84 | 84 |
mScreenHeight=displaymetrics.heightPixels; |
85 |
mScreenHeight = (int)(1.07f*mScreenHeight); // add 7% for the upper bar |
|
86 |
// which is not yet hidden. |
|
87 |
// TODO: figure this out exactly. |
|
85 |
|
|
88 | 86 |
hideNavigationBar(); |
89 | 87 |
cutoutHack(); |
90 | 88 |
computeBarHeights(); |
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
126 | 126 |
mIsChinese = localeIsChinese(); |
127 | 127 |
|
128 | 128 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
129 |
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
|
129 |
getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics);
|
|
130 | 130 |
mScreenWidth =displaymetrics.widthPixels; |
131 | 131 |
mScreenHeight=displaymetrics.heightPixels; |
132 |
mScreenHeight = (int)(1.07f*mScreenHeight); // add 7% for the upper bar |
|
133 |
// which is not yet hidden. |
|
134 |
// TODO: figure this out exactly. |
|
132 |
|
|
135 | 133 |
hideNavigationBar(); |
136 | 134 |
cutoutHack(); |
137 | 135 |
computeBarHeights(); |
... | ... | |
142 | 140 |
|
143 | 141 |
private void computeBarHeights() |
144 | 142 |
{ |
145 |
float height = mScreenHeight; |
|
146 |
int barHeight = (int)(height*RATIO_BAR); |
|
143 |
int barHeight = (int)(mScreenHeight*RATIO_BAR); |
|
147 | 144 |
mHeightLowerBar = barHeight; |
148 | 145 |
mHeightUpperBar = barHeight; |
149 | 146 |
|
... | ... | |
421 | 418 |
errDiag.show(getSupportFragmentManager(), null); |
422 | 419 |
} |
423 | 420 |
|
424 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
425 |
|
|
426 |
void setScreenSize(int width, int height) |
|
427 |
{ |
|
428 |
mScreenWidth = width; |
|
429 |
mScreenHeight= height; |
|
430 |
} |
|
431 |
|
|
432 | 421 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
433 | 422 |
// PUBLIC API |
434 | 423 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/main/RubikSurfaceView.java | ||
---|---|---|
59 | 59 |
TwistyObjectNode objectNode = mObjectController.getNode(); |
60 | 60 |
mRenderer.getScreen().attach(objectNode); |
61 | 61 |
} |
62 |
|
|
63 |
try |
|
64 |
{ |
|
65 |
RubikActivity act = (RubikActivity)getContext(); |
|
66 |
act.setScreenSize(width,height); |
|
67 |
} |
|
68 |
catch( Exception ex ) |
|
69 |
{ |
|
70 |
android.util.Log.e("D", "Failed to set screen size!"); |
|
71 |
} |
|
72 | 62 |
} |
73 | 63 |
|
74 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/tutorials/TutorialActivity.java | ||
---|---|---|
92 | 92 |
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); |
93 | 93 |
|
94 | 94 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
95 |
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
|
95 |
getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics);
|
|
96 | 96 |
mScreenWidth =displaymetrics.widthPixels; |
97 | 97 |
mScreenHeight=displaymetrics.heightPixels; |
98 | 98 |
|
Also available in: Unified diff
Correctly get the whole size fo the screen (along with thee top and bottom system bars) from the very beginning of the Activity.