mirror of
https://github.com/izzy2lost/Starship.git
synced 2026-07-05 15:19:42 -07:00
update sdk and ndk make immersive view
This commit is contained in:
@@ -31,14 +31,14 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
ndkVersion "26.0.10792818"
|
||||
compileSdkVersion 33
|
||||
ndkVersion "28.2.12604990"
|
||||
compileSdkVersion 36
|
||||
defaultConfig {
|
||||
if (buildAsApplication) {
|
||||
applicationId "com.starship.android"
|
||||
}
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 33
|
||||
targetSdkVersion 36
|
||||
versionCode 6
|
||||
versionName "1.0.1"
|
||||
externalNativeBuild {
|
||||
@@ -145,7 +145,7 @@ dependencies {
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '8.3.2'
|
||||
gradleVersion = '8.9'
|
||||
}
|
||||
|
||||
task prepareKotlinBuildScriptModel {
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:allowBackup="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:theme="@style/AppTheme"
|
||||
android:hardwareAccelerated="true"
|
||||
android:appCategory="game"
|
||||
android:requestLegacyExternalStorage="true" >
|
||||
|
||||
@@ -30,7 +30,9 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.view.KeyEvent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.view.KeyEvent;
|
||||
import android.os.Build;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsController;
|
||||
|
||||
public class MainActivity extends SDLActivity {
|
||||
static {
|
||||
@@ -183,6 +185,9 @@ protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Enable immersive mode (edge-to-edge)
|
||||
enableImmersiveMode();
|
||||
|
||||
setupControllerOverlay();
|
||||
attachController();
|
||||
|
||||
@@ -809,6 +814,35 @@ private void setupControllerOverlay() {
|
||||
setupToggleButton(buttonToggle, buttonGroup);
|
||||
}
|
||||
|
||||
private void enableImmersiveMode() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// Android 11+ (API 30+)
|
||||
WindowInsetsController controller = getWindow().getInsetsController();
|
||||
if (controller != null) {
|
||||
controller.hide(WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars());
|
||||
controller.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||
}
|
||||
} else {
|
||||
// Android 10 and below
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus) {
|
||||
enableImmersiveMode();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMenuButton(Button button) {
|
||||
button.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<!-- Base application theme with edge-to-edge support -->
|
||||
<style name="AppTheme" parent="android:Theme.Black.NoTitleBar.Fullscreen">
|
||||
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges</item>
|
||||
<item name="android:windowTranslucentStatus">false</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:enforceNavigationBarContrast" tools:targetApi="q">false</item>
|
||||
<item name="android:enforceStatusBarContrast" tools:targetApi="q">false</item>
|
||||
</style>
|
||||
|
||||
<style name="RoundedDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
|
||||
|
||||
@@ -6,7 +6,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.10.1'
|
||||
classpath 'com.android.tools.build:gradle:8.12.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#Fri Dec 27 18:25:48 PST 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
Reference in New Issue
Block a user