diff --git a/app/build.gradle b/app/build.gradle index eed6413e..7c4be00b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,6 +4,8 @@ plugins { apply from: '../dependencies.gradle' apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +/* TODO disabling Jacoco due to incompatibility with AGP >= 8.0 + * https://github.com/arturdm/jacoco-android-gradle-plugin/issues/102 apply plugin: 'com.dicedmelon.gradle.jacoco-android' jacoco { @@ -15,6 +17,7 @@ jacocoAndroidUnitTestReport { html.enabled true xml.enabled true } +*/ repositories { google() @@ -29,7 +32,8 @@ spotless { } android { - compileSdkVersion COMPILE_SDK_VERSION + compileSdk COMPILE_SDK_VERSION + namespace "com.farmerbb.taskbar" defaultConfig { applicationId "com.farmerbb.taskbar" @@ -50,13 +54,18 @@ android { buildConfigField "long", "TIMESTAMP", "${System.currentTimeMillis()}L" } + buildFeatures { + buildConfig true + } + compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + coreLibraryDesugaringEnabled true + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } signingConfigs { @@ -122,10 +131,13 @@ android { showStandardStreams = false exceptionFormat = 'full' + /* TODO disabling Jacoco due to incompatibility with AGP >= 8.0 + * https://github.com/arturdm/jacoco-android-gradle-plugin/issues/102 jacoco { includeNoLocationClasses = true excludes = ['jdk.internal.*'] } + */ } } @@ -158,4 +170,6 @@ dependencies { testImplementation "org.powermock:powermock-api-mockito2:$POWERMOCK_VERSION" testImplementation "org.powermock:powermock-classloading-xstream:$POWERMOCK_VERSION" testImplementation 'org.apache.commons:commons-lang3:3.12.0' + + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2" } diff --git a/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java new file mode 100644 index 00000000..347e0c03 --- /dev/null +++ b/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -0,0 +1,34 @@ +/* Copyright 2020 Braden Farmer + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.farmerbb.taskbar.util; + +// Utility class meant for compatibility between the Android-x86 version of Taskbar (compiled with SDK 28) +// and the Play Store version of Taskbar (compiled with SDK 30). +// TODO Do not make changes to this file without making corresponding changes to the Android-x86 version. + +import android.os.Build; +import android.view.View; +import android.view.WindowInsets; + +public class CompatUtils { + + private CompatUtils() {} + + public static boolean isImeVisible(View view) { + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R + && view.getRootWindowInsets().isVisible(WindowInsets.Type.ime()); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java b/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java index 630363fe..00031aea 100644 --- a/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java +++ b/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java @@ -182,7 +182,7 @@ private void proceedWithAppLaunch(Bundle savedInstanceState) { try { setContentView(R.layout.tb_main); } catch (IllegalStateException e) { - setTheme(R.style.Theme_AppCompat_Light); + setTheme(com.google.android.material.R.style.Theme_AppCompat_Light); setContentView(R.layout.tb_main); } diff --git a/app/src/main/java/com/farmerbb/taskbar/fragment/FreeformModeFragment.java b/app/src/main/java/com/farmerbb/taskbar/fragment/FreeformModeFragment.java index 103d9700..4f1cc367 100644 --- a/app/src/main/java/com/farmerbb/taskbar/fragment/FreeformModeFragment.java +++ b/app/src/main/java/com/farmerbb/taskbar/fragment/FreeformModeFragment.java @@ -157,7 +157,9 @@ public boolean onPreferenceClick(final Preference p) { .setMessage(R.string.tb_freeform_dialog_message_alt) .setPositiveButton(R.string.tb_action_continue, (dialogInterface, i) -> freeformSetupComplete()); } else { - String settingName = getString(R.string.tb_force_activities_resizable); + String settingName = Build.VERSION.SDK_INT > Build.VERSION_CODES.P + ? getString(R.string.tb_enable_freeform_windows) + : getString(R.string.tb_force_activities_resizable); builder.setTitle(R.string.tb_freeform_dialog_title) .setMessage(getString(R.string.tb_freeform_dialog_message, settingName)) diff --git a/app/src/main/java/com/farmerbb/taskbar/ui/StartMenuController.java b/app/src/main/java/com/farmerbb/taskbar/ui/StartMenuController.java index 8df418fe..1b5cac9b 100644 --- a/app/src/main/java/com/farmerbb/taskbar/ui/StartMenuController.java +++ b/app/src/main/java/com/farmerbb/taskbar/ui/StartMenuController.java @@ -277,14 +277,14 @@ public boolean onQueryTextSubmit(String query) { public boolean onQueryTextChange(String newText) { searchView.setIconified(false); - View closeButton = searchView.findViewById(R.id.search_close_btn); + View closeButton = searchView.findViewById(com.google.android.material.R.id.search_close_btn); if(closeButton != null) closeButton.setVisibility(View.GONE); refreshApps(newText, false); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) { U.newHandler().postDelayed(() -> { - EditText editText = searchView.findViewById(R.id.search_src_text); + EditText editText = searchView.findViewById(com.google.android.material.R.id.search_src_text); if(editText != null) { editText.requestFocus(); editText.setSelection(editText.getText().length()); @@ -647,7 +647,7 @@ else if(clazz.equals(InvisibleActivityAlt.class)) context.startActivity(intent); } - EditText editText = searchView.findViewById(R.id.search_src_text); + EditText editText = searchView.findViewById(com.google.android.material.R.id.search_src_text); if(searchView.getVisibility() == View.VISIBLE) { if(hasHardwareKeyboard) { searchView.setIconifiedByDefault(true); diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 3e1e71b8..e213f9e1 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -369,6 +369,7 @@ Dashboard umschalten Größenänderung von Apps erzwingen + Freiform-Fenster aktivieren Wählen Sie eine Bilddatei aus Fehler bei der Bild-Auswahl diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index fc337124..0ce159b1 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -369,6 +369,7 @@ Cambiar Dashboard Forzar actividades para ser redimensionadas + Enable freeform windows Seleccione un archivo de imagen Error al seleccionar la imagen diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 4065fdcb..1454cc6f 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -369,6 +369,7 @@ Toggle Dashboard 強制的にアクティビティをリサイズ可能にする + Enable freeform windows Select an image file Error selecting image diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index c86acc59..7cfee4cc 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -369,6 +369,7 @@ Widgetoverzicht tonen/verbergen Formaat activiteiten geforceerd aanpasbaar maken + Enable freeform windows Select an image file Error selecting image diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 8e6ff631..d40f08a5 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -89,6 +89,7 @@ Taskbar jest i zawsze będzie w 100%% darmowy, open source, bez reklam. Jednak w Włącz opcje programisty, stukając wersję 7 razy Włączyć dwukrotne stuknięcie w tryb uśpienia? Przewiń do dołu i włącz \"%s\" +Włącz okienka freeform "Na pasku zadań można opcjonalnie wyświetlać ikony ostatnio używanych aplikacji wzdłuż krawędzi ekranu. W tym celu %1$s wymaga uprawnień dostępu do użytkowania. " diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 74a3afee..d15e42c9 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -369,6 +369,7 @@ Toggle Dashboard Изменение размера в многооконном режиме + Enable freeform windows Select an image file Error selecting image diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 352c46de..4ece5e0f 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -361,6 +361,7 @@ Bu durumda, bu cihazdaki serbest biçimli modu kullanmak için özel bir ROM fla Toggle Dashboard Yeniden boyutlandırılacak etkinlikleri zorla + Enable freeform windows Select an image file Error selecting image diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 44b5ec73..58c82fc2 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -369,6 +369,7 @@ 切换面板 强制将活动设为可调整大小 + 开启自由式窗口 选择一张图片 请安装一个文件管理器。 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 03773af2..acf11302 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -369,6 +369,7 @@ Toggle Dashboard Force activities to be resizable + Enable freeform windows Select an image file Error selecting image diff --git a/app/src/playstore/AndroidManifest.xml b/app/src/playstore/AndroidManifest.xml index 2beae94b..b75a2dde 100644 --- a/app/src/playstore/AndroidManifest.xml +++ b/app/src/playstore/AndroidManifest.xml @@ -49,6 +49,7 @@ + @@ -393,8 +394,15 @@ - + + + + /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +217,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f9..9b42019c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal