Revision 1cb36646
Added by Leszek Koltunski about 5 years ago
| src/main/java/org/distorted/main/RubikActivity.java | ||
|---|---|---|
| 28 | 28 |
|
| 29 | 29 |
import android.util.DisplayMetrics; |
| 30 | 30 |
import android.view.View; |
| 31 |
import android.view.ViewGroup; |
|
| 31 | 32 |
import android.view.WindowManager; |
| 33 |
import android.widget.LinearLayout; |
|
| 32 | 34 |
|
| 33 | 35 |
import com.google.firebase.analytics.FirebaseAnalytics; |
| 34 | 36 |
|
| ... | ... | |
| 135 | 137 |
} |
| 136 | 138 |
} |
| 137 | 139 |
|
| 140 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 141 |
|
|
| 142 |
@Override |
|
| 143 |
public void onAttachedToWindow() |
|
| 144 |
{
|
|
| 145 |
final float RATIO = 0.10f; |
|
| 146 |
float height = getScreenHeightInPixels(); |
|
| 147 |
|
|
| 148 |
LinearLayout layoutTop = findViewById(R.id.upperBar); |
|
| 149 |
LinearLayout layoutBot = findViewById(R.id.lowerBar); |
|
| 150 |
|
|
| 151 |
ViewGroup.LayoutParams paramsTop = layoutTop.getLayoutParams(); |
|
| 152 |
paramsTop.height = (int)(height*RATIO); |
|
| 153 |
layoutTop.setLayoutParams(paramsTop); |
|
| 154 |
ViewGroup.LayoutParams paramsBot = layoutBot.getLayoutParams(); |
|
| 155 |
paramsBot.height = (int)(height*RATIO); |
|
| 156 |
layoutBot.setLayoutParams(paramsBot); |
|
| 157 |
} |
|
| 158 |
|
|
| 138 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 139 | 160 |
// on some Huawei devices ( P40, P40 Pro, Mate 30 Pro, Mate 30, Nova 5T, P30 ) this has to be called |
| 140 | 161 |
// so that the App enters fullscreen mode. Otherwise there's a black bar at the top. See |
| src/main/java/org/distorted/states/RubikStateDone.java | ||
|---|---|---|
| 44 | 44 |
void enterState(final RubikActivity act) |
| 45 | 45 |
{
|
| 46 | 46 |
float width = act.getScreenWidthInPixels(); |
| 47 |
float buttonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
|
| 48 | 47 |
float titleSize = width*RubikActivity.TITLE_TEXT_SIZE; |
| 49 | 48 |
|
| 50 | 49 |
LayoutInflater inflater = act.getLayoutInflater(); |
| src/main/res/layout/main.xml | ||
|---|---|---|
| 1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 2 |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 3 |
android:id="@+id/relativeLayout" |
|
| 3 | 4 |
android:layout_width="fill_parent" |
| 4 |
android:layout_height="fill_parent" |
|
| 5 |
android:orientation="vertical" > |
|
| 5 |
android:layout_height="fill_parent" > |
|
| 6 |
|
|
| 7 |
<org.distorted.main.RubikSurfaceView |
|
| 8 |
android:id="@+id/rubikSurfaceView" |
|
| 9 |
android:layout_width="fill_parent" |
|
| 10 |
android:layout_height="fill_parent" |
|
| 11 |
android:layout_alignParentStart="true" |
|
| 12 |
android:layout_alignParentTop="true"/> |
|
| 6 | 13 |
|
| 7 | 14 |
<LinearLayout |
| 8 | 15 |
android:id="@+id/upperBar" |
| 16 |
android:layout_alignParentTop="true" |
|
| 9 | 17 |
android:layout_width="fill_parent" |
| 10 | 18 |
android:layout_height="0dp" |
| 11 |
android:layout_weight="0.12" |
|
| 12 | 19 |
android:gravity="center" |
| 13 | 20 |
android:orientation="horizontal" |
| 14 | 21 |
android:background="@android:color/transparent"> |
| 15 | 22 |
</LinearLayout> |
| 16 | 23 |
|
| 17 |
<org.distorted.main.RubikSurfaceView |
|
| 18 |
android:id="@+id/rubikSurfaceView" |
|
| 19 |
android:layout_width="fill_parent" |
|
| 20 |
android:layout_height="0dp" |
|
| 21 |
android:layout_weight="1" /> |
|
| 22 |
|
|
| 23 | 24 |
<LinearLayout |
| 24 | 25 |
android:id="@+id/lowerBar" |
| 26 |
android:layout_alignParentBottom="true" |
|
| 25 | 27 |
android:layout_width="match_parent" |
| 26 | 28 |
android:layout_height="0dp" |
| 27 |
android:layout_weight="0.12" |
|
| 28 | 29 |
android:orientation="horizontal" |
| 29 | 30 |
android:background="@android:color/transparent"> |
| 30 | 31 |
</LinearLayout> |
| 31 | 32 |
|
| 32 |
</LinearLayout> |
|
| 33 |
</RelativeLayout> |
|
Also available in: Unified diff
Make the top and bottom bars transparent, above the GLSurfaceView.