diff --git a/app/build.gradle b/app/build.gradle index 3df93fef10..2cf53e0f5e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,7 +13,9 @@ ext { } android { - compileSdkVersion project.properties.compileSdkVersion.toInteger() + namespace "com.termux" + compileSdk 36 + ndkVersion = System.getenv("JITPACK_NDK_VERSION") ?: project.properties.ndkVersion def appVersionName = System.getenv("TERMUX_APP_VERSION_NAME") ?: "" def apkVersionTag = System.getenv("TERMUX_APK_VERSION_TAG") ?: "" @@ -37,6 +39,10 @@ android { implementation project(":termux-shared") } + buildFeatures { + buildConfig = true + } + defaultConfig { applicationId "com.termux" minSdkVersion project.properties.minSdkVersion.toInteger() @@ -110,9 +116,6 @@ android { } } - lintOptions { - disable 'ProtectedPermissions' - } testOptions { unitTests { @@ -125,6 +128,9 @@ android { useLegacyPackaging true } } + lint { + disable 'ProtectedPermissions' + } applicationVariants.all { variant -> variant.outputs.all { output -> @@ -143,7 +149,7 @@ android { dependencies { testImplementation "junit:junit:4.13.2" testImplementation "org.robolectric:robolectric:4.10" - coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5" } task versionName { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7c566c8f0d..1d0dfe1948 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ @@ -42,7 +41,6 @@ android:name=".app.TermuxApplication" android:allowBackup="false" android:banner="@drawable/banner" - android:extractNativeLibs="true" android:icon="@mipmap/ic_launcher" android:label="@string/application_name" android:requestLegacyExternalStorage="true" diff --git a/app/src/main/java/com/termux/app/activities/HelpActivity.java b/app/src/main/java/com/termux/app/activities/HelpActivity.java index a2e4d6a985..7609659e3b 100644 --- a/app/src/main/java/com/termux/app/activities/HelpActivity.java +++ b/app/src/main/java/com/termux/app/activities/HelpActivity.java @@ -35,7 +35,6 @@ protected void onCreate(Bundle savedInstanceState) { mWebView = new WebView(this); WebSettings settings = mWebView.getSettings(); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); - settings.setAppCacheEnabled(false); setContentView(progressLayout); mWebView.clearCache(true); diff --git a/app/src/main/res/raw/bell.ogg b/app/src/main/res/raw/bell.ogg new file mode 100644 index 0000000000..674f25d026 Binary files /dev/null and b/app/src/main/res/raw/bell.ogg differ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cbd2992ba1..442f549614 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -235,4 +235,7 @@ Donate + Yes + No + diff --git a/build.gradle b/build.gradle index 80ddd4bde1..6246829172 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath "com.android.tools.build:gradle:4.2.2" + classpath 'com.android.tools.build:gradle:8.13.0' } } diff --git a/gradle.properties b/gradle.properties index 90de122196..666b080f8b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,10 +20,10 @@ org.gradle.jvmargs=-Xmx2048M \ --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED android.useAndroidX=true -minSdkVersion=21 +minSdkVersion=23 targetSdkVersion=28 -ndkVersion=22.1.7171670 -compileSdkVersion=30 +ndkVersion=26.3.11579264 +compileSdkVersion=36 markwonVersion=4.6.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a0f7639f7d..09ca4a8cfd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sat Oct 18 13:41:24 CEST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/jitpack.yml b/jitpack.yml index 900c8ffd65..19652ee3bd 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,4 +1,4 @@ jdk: - openjdk11 env: - JITPACK_NDK_VERSION: "21.1.6352462" + JITPACK_NDK_VERSION: "26.3.11579264" diff --git a/terminal-emulator/build.gradle b/terminal-emulator/build.gradle index afc57e9f7e..c1c0b705dd 100644 --- a/terminal-emulator/build.gradle +++ b/terminal-emulator/build.gradle @@ -2,6 +2,8 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' android { + namespace "com.termux.terminal" + compileSdkVersion project.properties.compileSdkVersion.toInteger() ndkVersion = System.getenv("JITPACK_NDK_VERSION") ?: project.properties.ndkVersion @@ -41,6 +43,12 @@ android { testOptions { unitTests.returnDefaultValues = true } + + publishing { + singleVariant("release") { + withSourcesJar() + } + } } tasks.withType(Test) { @@ -54,21 +62,14 @@ dependencies { testImplementation "junit:junit:4.13.2" } -task sourceJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier "sources" -} - afterEvaluate { publishing { publications { - // Creates a Maven publication called "release". - release(MavenPublication) { + create("release", MavenPublication) { from components.release groupId = 'com.termux' artifactId = 'terminal-emulator' version = '0.118.0' - artifact(sourceJar) } } } diff --git a/terminal-emulator/src/main/AndroidManifest.xml b/terminal-emulator/src/main/AndroidManifest.xml index a293cb643b..0fd6dadeb8 100644 --- a/terminal-emulator/src/main/AndroidManifest.xml +++ b/terminal-emulator/src/main/AndroidManifest.xml @@ -1,2 +1,3 @@ - + + diff --git a/terminal-view/build.gradle b/terminal-view/build.gradle index d603da2880..b2c95fc219 100644 --- a/terminal-view/build.gradle +++ b/terminal-view/build.gradle @@ -2,13 +2,9 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' android { + namespace "com.termux.view" compileSdkVersion project.properties.compileSdkVersion.toInteger() - dependencies { - implementation "androidx.annotation:annotation:1.3.0" - api project(":terminal-emulator") - } - defaultConfig { minSdkVersion project.properties.minSdkVersion.toInteger() targetSdkVersion project.properties.targetSdkVersion.toInteger() @@ -26,28 +22,29 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + publishing { + singleVariant("release") { + withSourcesJar() + } + } } dependencies { + implementation "androidx.annotation:annotation:1.3.0" + api project(":terminal-emulator") testImplementation "junit:junit:4.13.2" } -task sourceJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier "sources" -} - -afterEvaluate { - publishing { - publications { - // Creates a Maven publication called "release". - release(MavenPublication) { +publishing { + publications { + create("release", MavenPublication) { + afterEvaluate { from components.release - groupId = 'com.termux' - artifactId = 'terminal-view' - version = '0.118.0' - artifact(sourceJar) } + groupId = 'com.termux' + artifactId = 'terminal-view' + version = '0.118.0' } } } diff --git a/terminal-view/src/main/AndroidManifest.xml b/terminal-view/src/main/AndroidManifest.xml index f2b0725df4..0fd6dadeb8 100644 --- a/terminal-view/src/main/AndroidManifest.xml +++ b/terminal-view/src/main/AndroidManifest.xml @@ -1,2 +1,3 @@ - + + diff --git a/termux-shared/build.gradle b/termux-shared/build.gradle index 30e9536282..345cb415c8 100644 --- a/termux-shared/build.gradle +++ b/termux-shared/build.gradle @@ -2,43 +2,16 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' android { + namespace "com.termux.shared" compileSdkVersion project.properties.compileSdkVersion.toInteger() ndkVersion = System.getenv("JITPACK_NDK_VERSION") ?: project.properties.ndkVersion - dependencies { - implementation "androidx.appcompat:appcompat:1.3.1" - implementation "androidx.annotation:annotation:1.3.0" - implementation "androidx.core:core:1.6.0" - implementation "com.google.android.material:material:1.4.0" - implementation "com.google.guava:guava:24.1-jre" - implementation "io.noties.markwon:core:$markwonVersion" - implementation "io.noties.markwon:ext-strikethrough:$markwonVersion" - implementation "io.noties.markwon:linkify:$markwonVersion" - implementation "io.noties.markwon:recycler:$markwonVersion" - implementation "org.lsposed.hiddenapibypass:hiddenapibypass:6.1" - - // Do not increment version higher than 1.0.0-alpha09 since it will break ViewUtils and needs to be looked into - // noinspection GradleDependency - implementation "androidx.window:window:1.0.0-alpha09" - - // Do not increment version higher than 2.5 or there - // will be runtime exceptions on android < 8 - // due to missing classes like java.nio.file.Path. - implementation "commons-io:commons-io:2.5" - - implementation project(":terminal-view") - - implementation "com.termux:termux-am-library:v2.0.0" - } - defaultConfig { minSdkVersion project.properties.minSdkVersion.toInteger() targetSdkVersion project.properties.targetSdkVersion.toInteger() testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { - ndkBuild { - cppFlags '' - } + ndkBuild { cppFlags '' } } } @@ -50,41 +23,52 @@ android { } compileOptions { - // Flag to enable support for the new language APIs coreLibraryDesugaringEnabled true - - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } + externalNativeBuild { - ndkBuild { - path file('src/main/cpp/Android.mk') + ndkBuild { path file('src/main/cpp/Android.mk') } + } + + publishing { + singleVariant("release") { + withSourcesJar() } } } dependencies { - testImplementation "junit:junit:4.13.2" - androidTestImplementation "androidx.test.ext:junit:1.1.3" - androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0" - coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" -} + implementation "androidx.appcompat:appcompat:1.7.1" + implementation "androidx.annotation:annotation:1.9.1" + implementation "androidx.core:core:1.17.0" + implementation "com.google.android.material:material:1.13.0" + implementation "com.google.guava:guava:33.5.0-jre" + implementation "io.noties.markwon:core:$markwonVersion" + implementation "io.noties.markwon:ext-strikethrough:$markwonVersion" + implementation "io.noties.markwon:linkify:$markwonVersion" + implementation "io.noties.markwon:recycler:$markwonVersion" + implementation "org.lsposed.hiddenapibypass:hiddenapibypass:6.1" + implementation "androidx.window:window:1.5.0" + implementation "commons-io:commons-io:2.20.0" + implementation project(":terminal-view") + implementation "com.termux:termux-am-library:v2.0.0" -task sourceJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier "sources" + testImplementation "junit:junit:4.13.2" + androidTestImplementation "androidx.test.ext:junit:1.3.0" + androidTestImplementation "androidx.test.espresso:espresso-core:3.7.0" + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5" } afterEvaluate { publishing { publications { - // Creates a Maven publication called "release". - release(MavenPublication) { + create("release", MavenPublication) { from components.release groupId = 'com.termux' artifactId = 'termux-shared' version = '0.118.0' - artifact(sourceJar) } } } diff --git a/termux-shared/src/main/AndroidManifest.xml b/termux-shared/src/main/AndroidManifest.xml index 81789f3904..042e61a707 100644 --- a/termux-shared/src/main/AndroidManifest.xml +++ b/termux-shared/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/termux-shared/src/main/java/com/termux/shared/interact/MessageDialogUtils.java b/termux-shared/src/main/java/com/termux/shared/interact/MessageDialogUtils.java index d7543fc7c9..f3a0422fa9 100644 --- a/termux-shared/src/main/java/com/termux/shared/interact/MessageDialogUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/interact/MessageDialogUtils.java @@ -51,7 +51,7 @@ public static void showMessage(Context context, String titleText, String message final DialogInterface.OnClickListener onNegativeButton, final DialogInterface.OnDismissListener onDismiss) { - AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.Theme_AppCompat_Light_Dialog); + AlertDialog.Builder builder = new AlertDialog.Builder(context, androidx.appcompat.R.style.Theme_AppCompat_Light_Dialog_Alert); LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); View view = inflater.inflate(R.layout.dialog_show_message, null); diff --git a/termux-shared/src/main/java/com/termux/shared/interact/ShareUtils.java b/termux-shared/src/main/java/com/termux/shared/interact/ShareUtils.java index 969502447c..fa5d21c46a 100644 --- a/termux-shared/src/main/java/com/termux/shared/interact/ShareUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/interact/ShareUtils.java @@ -23,7 +23,7 @@ import java.nio.charset.Charset; -import javax.annotation.Nullable; +import androidx.annotation.Nullable; public class ShareUtils { diff --git a/termux-shared/src/main/java/com/termux/shared/view/ViewUtils.java b/termux-shared/src/main/java/com/termux/shared/view/ViewUtils.java index 2f62d74d3c..1b4780ca53 100644 --- a/termux-shared/src/main/java/com/termux/shared/view/ViewUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/view/ViewUtils.java @@ -182,16 +182,22 @@ public static int getDisplayOrientation(@NonNull Context context) { * and can be smaller than physical display size in multi-window mode. * @return Returns the display size as {@link Point}. */ - public static Point getDisplaySize( @NonNull Context context, boolean activitySize) { - // android.view.WindowManager.getDefaultDisplay() and Display.getSize() are deprecated in - // API 30 and give wrong values in API 30 for activitySize=false in multi-window - androidx.window.WindowManager windowManager = new androidx.window.WindowManager(context); - androidx.window.WindowMetrics windowMetrics; - if (activitySize) - windowMetrics = windowManager.getCurrentWindowMetrics(); - else - windowMetrics = windowManager.getMaximumWindowMetrics(); - return new Point(windowMetrics.getBounds().width(), windowMetrics.getBounds().height()); + public static Point getDisplaySize(@NonNull Context context, boolean activitySize) { + Activity activity = getActivity(context); + Rect bounds; + if (activity != null) { + androidx.window.layout.WindowMetricsCalculator calculator = + androidx.window.layout.WindowMetricsCalculator.getOrCreate(); + androidx.window.layout.WindowMetrics metrics = activitySize + ? calculator.computeCurrentWindowMetrics(activity) + : calculator.computeMaximumWindowMetrics(activity); + bounds = metrics.getBounds(); + } else { + // Fallback if a non-visual Context was passed. + android.util.DisplayMetrics dm = context.getResources().getDisplayMetrics(); + bounds = new Rect(0, 0, dm.widthPixels, dm.heightPixels); + } + return new Point(bounds.width(), bounds.height()); } /** Convert {@link Rect} to {@link String}. */