这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
android:label="@string/application_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:resizeableActivity="true"
android:supportsRtl="false"
android:theme="@style/Theme.TermuxApp.DayNight.DarkActionBar"
tools:targetApi="m">
Expand Down Expand Up @@ -74,6 +75,14 @@
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />

<meta-data
android:name="com.samsung.android.dex.transient_bar_delay"
android:value="2000" />

<meta-data android:name="WindowManagerPreference:SuppressWindowControlNavigationButton"
android:value="true" />

</activity>

<activity-alias
Expand All @@ -88,6 +97,14 @@
<category android:name="android.intent.category.IOT_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<meta-data
android:name="com.samsung.android.dex.transient_bar_delay"
android:value="2000" />

<meta-data android:name="WindowManagerPreference:SuppressWindowControlNavigationButton"
android:value="true" />

</activity-alias>

<activity
Expand Down
71 changes: 71 additions & 0 deletions app/src/main/java/com/termux/app/TermuxActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.autofill.AutofillManager;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
Expand Down Expand Up @@ -1010,4 +1011,74 @@ public static Intent newInstance(@NonNull final Context context) {
return intent;
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
if (mProperties.isUsingFullScreen()) {
enableImmersiveMode();
} else {
disableImmersiveMode();
}
}
}

@SuppressWarnings("deprecation")
private void enableImmersiveMode() {
// if (Build.VERSION.SDK_INT >= 30) {
// getWindow().setDecorFitsSystemWindows(false);
// WindowInsetsController insetsController = getWindow().getInsetsController();
// if (insetsController != null) {
// insetsController.hide(WindowInsets.Type.navigationBars() | WindowInsets.Type.statusBars());
// insetsController.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
// }
// } else {
View decorView = getWindow().getDecorView();
int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(flags);
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(flags);
}
}
});
// }
}

@SuppressWarnings("deprecation")
private void disableImmersiveMode() {
// if (Build.VERSION.SDK_INT >= 30) {
// getWindow().setDecorFitsSystemWindows(true);
// WindowInsetsController insetsController = getWindow().getInsetsController();
// if (insetsController != null) {
// insetsController.show(WindowInsets.Type.navigationBars() | WindowInsets.Type.statusBars());
// insetsController.setSystemBarsBehavior(
// Build.VERSION.SDK_INT >= 31
// ? WindowInsetsController.BEHAVIOR_DEFAULT
// : WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE
// );
// }
// } else {
View decorView = getWindow().getDecorView();
int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
decorView.setSystemUiVisibility(flags);
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(flags);
}
}
});
// }
}
}