From b448e089850156ea07dc36258777dcc20631ca2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Sep 2022 01:16:42 +0000 Subject: [PATCH 1/6] Bump gradle from 7.1.3 to 7.3.0 Bumps gradle from 7.1.3 to 7.3.0. --- updated-dependencies: - dependency-name: com.android.tools.build:gradle dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 2256d7ed75..d95617132d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,7 @@ import org.gradle.internal.jvm.Jvm buildscript { dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' + classpath 'com.android.tools.build:gradle:7.3.0' classpath 'com.hiya:jacoco-android:0.2' classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.11' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" From eb7d10fb508aa1974719d1dd38ed702733e49eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Fri, 16 Sep 2022 09:30:46 +0200 Subject: [PATCH 2/6] Update Gradle distribution to 7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Required by AGP 7.3.0 Signed-off-by: Álvaro Brey --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e5897b5..b1159fc54f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 07aedfd888cbcb4b54f0adae9026109de7904411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Fri, 16 Sep 2022 10:52:35 +0200 Subject: [PATCH 3/6] Solve new lint warnings with AGP 7.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Brey --- .../owncloud/android/utils/FileExportUtils.kt | 38 +++++++++---------- .../utils/svg/SvgSoftwareLayerSetter.java | 4 +- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/utils/FileExportUtils.kt b/app/src/main/java/com/owncloud/android/utils/FileExportUtils.kt index 5efac03e5c..0999322bc5 100644 --- a/app/src/main/java/com/owncloud/android/utils/FileExportUtils.kt +++ b/app/src/main/java/com/owncloud/android/utils/FileExportUtils.kt @@ -22,6 +22,7 @@ package com.owncloud.android.utils +import android.annotation.SuppressLint import android.content.ContentResolver import android.content.ContentValues import android.os.Build @@ -64,6 +65,7 @@ class FileExportUtils { } } + @SuppressLint("Recycle") // handled inside copy method @RequiresApi(Build.VERSION_CODES.Q) private fun exportFileAndroid10AndAbove( fileName: String, @@ -139,30 +141,28 @@ class FileExportUtils { @Throws(IllegalStateException::class) private fun copy(ocFile: OCFile?, file: File?, contentResolver: ContentResolver, outputStream: FileOutputStream) { - try { - val inputStream = if (ocFile != null) { - contentResolver.openInputStream(ocFile.storageUri) - } else if (file != null) { - FileInputStream(file) - } else { - error("ocFile and file both may not be null") - } + outputStream.use { fos -> + try { + val inputStream = when { + ocFile != null -> contentResolver.openInputStream(ocFile.storageUri) + file != null -> FileInputStream(file) + else -> error("ocFile and file both may not be null") + }!! - copyStream(inputStream!!, outputStream) - } catch (e: IOException) { - Log_OC.e(this, "Cannot write file", e) + inputStream.use { fis -> + copyStream(fis, fos) + } + } catch (e: IOException) { + Log_OC.e(this, "Cannot write file", e) + } } } private fun copyStream(inputStream: InputStream, outputStream: FileOutputStream) { - inputStream.use { input -> - outputStream.use { output -> - val buffer = ByteArray(COPY_BUFFER_SIZE) - var len: Int - while (input.read(buffer).also { len = it } != -1) { - output.write(buffer, 0, len) - } - } + val buffer = ByteArray(COPY_BUFFER_SIZE) + var len: Int + while (inputStream.read(buffer).also { len = it } != -1) { + outputStream.write(buffer, 0, len) } } diff --git a/app/src/main/java/com/owncloud/android/utils/svg/SvgSoftwareLayerSetter.java b/app/src/main/java/com/owncloud/android/utils/svg/SvgSoftwareLayerSetter.java index ab6f05d323..12bf2541a8 100644 --- a/app/src/main/java/com/owncloud/android/utils/svg/SvgSoftwareLayerSetter.java +++ b/app/src/main/java/com/owncloud/android/utils/svg/SvgSoftwareLayerSetter.java @@ -10,7 +10,6 @@ */ package com.owncloud.android.utils.svg; -import android.annotation.TargetApi; import android.graphics.drawable.PictureDrawable; import android.os.Build; import android.widget.ImageView; @@ -19,7 +18,6 @@ import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.ImageViewTarget; import com.bumptech.glide.request.target.Target; -@TargetApi(Build.VERSION_CODES.HONEYCOMB) public class SvgSoftwareLayerSetter implements RequestListener { @Override @@ -40,4 +38,4 @@ public class SvgSoftwareLayerSetter implements RequestListener Date: Fri, 16 Sep 2022 11:00:39 +0200 Subject: [PATCH 4/6] Move package declarations to build.gradle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requested by AGP upgrade and also is crashing test builds Signed-off-by: Álvaro Brey --- app/build.gradle | 5 +++++ app/src/androidTest/AndroidManifest.xml | 1 - app/src/gplay/AndroidManifest.xml | 3 +-- app/src/huawei/AndroidManifest.xml | 3 +-- app/src/main/AndroidManifest.xml | 3 +-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d95617132d..f13b1fe5c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -73,6 +73,11 @@ android { // install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed ndkVersion "${ndkEnv.get("NDK_VERSION")}" + + namespace 'com.owncloud.android' + testNamespace "${namespace}.test" + + defaultConfig { minSdkVersion 23 targetSdkVersion 30 diff --git a/app/src/androidTest/AndroidManifest.xml b/app/src/androidTest/AndroidManifest.xml index 6fd72cdb19..449453a43d 100644 --- a/app/src/androidTest/AndroidManifest.xml +++ b/app/src/androidTest/AndroidManifest.xml @@ -26,7 +26,6 @@ --> diff --git a/app/src/gplay/AndroidManifest.xml b/app/src/gplay/AndroidManifest.xml index a16b6be576..fc1db47e1b 100644 --- a/app/src/gplay/AndroidManifest.xml +++ b/app/src/gplay/AndroidManifest.xml @@ -17,8 +17,7 @@ along with this program. If not, see . --> + xmlns:tools="http://schemas.android.com/tools"> . --> + xmlns:tools="http://schemas.android.com/tools"> . --> + xmlns:tools="http://schemas.android.com/tools"> From 2203dd089c32fc1390dc240cd8d6355b6f0b2228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Fri, 16 Sep 2022 13:50:06 +0200 Subject: [PATCH 5/6] Use gradle 7.4.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Brey --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b1159fc54f..92f06b50fd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 25234fdb851d583a0609a52d3569b991bc651d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Fri, 16 Sep 2022 16:36:52 +0200 Subject: [PATCH 6/6] Rollback emoji-google to 0.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New version is not compatible with Jacoco for some reason Signed-off-by: Álvaro Brey --- app/build.gradle | 2 +- .../com/nextcloud/ui/SetStatusDialogFragment.kt | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f13b1fe5c6..c2f0a92bd6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -252,7 +252,7 @@ dependencies { } implementation 'com.caverock:androidsvg:1.4' implementation 'androidx.annotation:annotation:1.4.0' - implementation 'com.vanniktech:emoji-google:0.15.0' + implementation 'com.vanniktech:emoji-google:0.9.0' implementation "com.github.cotechde.hwsecurity:hwsecurity-fido:$fidoVersion" implementation "com.github.cotechde.hwsecurity:hwsecurity-fido2:$fidoVersion" diff --git a/app/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt b/app/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt index 4ea88ee52f..8caa2d0da0 100644 --- a/app/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt +++ b/app/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt @@ -59,8 +59,6 @@ import com.owncloud.android.utils.theme.ThemeTextInputUtils import com.vanniktech.emoji.EmojiManager import com.vanniktech.emoji.EmojiPopup import com.vanniktech.emoji.google.GoogleEmojiProvider -import com.vanniktech.emoji.installDisableKeyboardInput -import com.vanniktech.emoji.installForceSingleEmoji import java.util.Calendar import java.util.Locale import javax.inject.Inject @@ -171,18 +169,18 @@ class SetStatusDialogFragment : binding.setStatus.setOnClickListener { setStatusMessage() } binding.emoji.setOnClickListener { popup.show() } - popup = EmojiPopup( - view, binding.emoji, - onEmojiClickListener = { + popup = EmojiPopup.Builder + .fromRootView(view) + .setOnEmojiClickListener { _, _ -> popup.dismiss() binding.emoji.clearFocus() val imm: InputMethodManager = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager imm.hideSoftInputFromWindow(binding.emoji.windowToken, 0) } - ) - binding.emoji.installDisableKeyboardInput(popup) - binding.emoji.installForceSingleEmoji() + .build(binding.emoji) + binding.emoji.disableKeyboardInput(popup) + binding.emoji.forceSingleEmoji() val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item) adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)