diff --git a/catroid/config/lint-baseline.xml b/catroid/config/lint-baseline.xml
index 99ba72c3278..84273ba4a42 100644
--- a/catroid/config/lint-baseline.xml
+++ b/catroid/config/lint-baseline.xml
@@ -1,26 +1,4 @@
-
-
-
-
-
@@ -129,10 +96,21 @@
errorLine2=" ~~~~~~~~~~~~~~~~">
+
+
+
+
@@ -151,52 +129,74 @@
errorLine2=" ~~~~~~~~~~~~~~~~">
+ message="Missing permissions required by BluetoothDevice.getName: android.permission.BLUETOOTH_CONNECT"
+ errorLine1=" String deviceInfoBLE = "BLE" + (device.getName() != null ? " - " + device.getName() : "");"
+ errorLine2=" ~~~~~~~~~~~~~~~~">
+ line="163"
+ column="39"/>
+ errorLine1=" String deviceInfoBLE = "BLE" + (device.getName() != null ? " - " + device.getName() : "");"
+ errorLine2=" ~~~~~~~~~~~~~~~~">
+ line="163"
+ column="74"/>
+ message="Missing permissions required by intent BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE: android.permission.BLUETOOTH_ADVERTISE"
+ errorLine1=" startActivity(intent);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
+ line="401"
+ column="4"/>
+ message="Missing permissions required by BluetoothAdapter.getBondedDevices: android.permission.BLUETOOTH_CONNECT"
+ errorLine1=" Set<android.bluetooth.BluetoothDevice> pairedDevices = btManager.getBluetoothAdapter().getBondedDevices();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ line="413"
+ column="58"/>
+
+
+
+
+
+
+
+
@@ -217,19 +217,19 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ message="Missing permissions required by BluetoothAdapter.listenUsingRfcommWithServiceRecord: android.permission.BLUETOOTH_CONNECT"
+ errorLine1=" serverSocket = BluetoothAdapter.getDefaultAdapter()"
+ errorLine2=" ^">
+ line="523"
+ column="20"/>
-
-
-
-
-
-
-
-
-
-
-
-
@@ -327,7 +294,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~">
@@ -408,28 +375,6 @@
column="16"/>
-
-
-
-
-
-
-
-
@@ -452,57 +397,6 @@
file="src\main\res\drawable-xhdpi\brick_control_1h.9.png"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -517,17 +411,6 @@
file="src\main\res\drawable-xxhdpi"/>
-
-
-
-
@@ -601,7 +484,7 @@
errorLine2=" ~~~~~~~">
@@ -623,7 +506,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -634,767 +517,8 @@
errorLine2=" ~~~~~~~">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/catroid/src/main/java/org/catrobat/catroid/io/StorageOperations.java b/catroid/src/main/java/org/catrobat/catroid/io/StorageOperations.java
index 5143f49e8a5..8ba924609ca 100644
--- a/catroid/src/main/java/org/catrobat/catroid/io/StorageOperations.java
+++ b/catroid/src/main/java/org/catrobat/catroid/io/StorageOperations.java
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
- * Copyright (C) 2010-2021 The Catrobat Team
+ * Copyright (C) 2010-2022 The Catrobat Team
* ()
*
* This program is free software: you can redistribute it and/or modify
@@ -41,6 +41,7 @@
import java.io.OutputStream;
import java.nio.channels.FileChannel;
import java.nio.file.InvalidPathException;
+import java.util.Objects;
import static org.catrobat.catroid.common.Constants.BUFFER_8K;
import static org.catrobat.catroid.common.Constants.IMAGE_DIRECTORY_NAME;
@@ -105,7 +106,10 @@ public static String resolveFileName(ContentResolver contentResolver, Uri uri) {
try {
try (Cursor cursor = contentResolver.query(uri, null, null, null, null)) {
if (cursor != null && cursor.moveToFirst()) {
- result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
+ int index = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
+ if (index >= 0) {
+ result = cursor.getString(index);
+ }
}
}
} catch (Exception e) {
@@ -262,11 +266,14 @@ public static File copyDir(File sourceDir, File destinationDir) throws IOExcepti
throw new IOException("Cannot create directory: " + destinationDir.getAbsolutePath());
}
- for (File file : sourceDir.listFiles()) {
- if (file.isDirectory()) {
- copyDir(file, new File(destinationDir, file.getName()));
- } else {
- copyFileToDir(file, destinationDir);
+ File[] files = sourceDir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory()) {
+ copyDir(file, new File(destinationDir, file.getName()));
+ } else {
+ copyFileToDir(file, destinationDir);
+ }
}
}
@@ -328,14 +335,16 @@ public static void deleteDir(File dir) throws IOException {
throw new FileNotFoundException(dir.getAbsolutePath() + " is not a directory.");
}
- for (File file : dir.listFiles()) {
- if (file.isDirectory()) {
- deleteDir(file);
- } else {
- deleteFile(file);
+ File[] files = dir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory()) {
+ deleteDir(file);
+ } else {
+ deleteFile(file);
+ }
}
}
-
if (!dir.delete()) {
throw new IOException("Cannot delete directory: " + dir.getAbsolutePath());
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/stage/SpeechRecognitionHolder.kt b/catroid/src/main/java/org/catrobat/catroid/stage/SpeechRecognitionHolder.kt
index bfd20026241..cb93b502461 100644
--- a/catroid/src/main/java/org/catrobat/catroid/stage/SpeechRecognitionHolder.kt
+++ b/catroid/src/main/java/org/catrobat/catroid/stage/SpeechRecognitionHolder.kt
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
- * Copyright (C) 2010-2021 The Catrobat Team
+ * Copyright (C) 2010-2022 The Catrobat Team
* ()
*
* This program is free software: you can redistribute it and/or modify
@@ -108,6 +108,9 @@ class SpeechRecognitionHolder : SpeechRecognitionHolderInterface {
// in case the chosen language is not downloaded or outdated
showDialog(stageActivity, stageResourceHolder)
}
+ else -> {
+ // every other case
+ }
}
Log.d(TAG, "SpeechRecognizer restarted!")
}
diff --git a/catroid/src/main/res/layout/dialog_new_project.xml b/catroid/src/main/res/layout/dialog_new_project.xml
index 684be3319ed..08d45675d19 100644
--- a/catroid/src/main/res/layout/dialog_new_project.xml
+++ b/catroid/src/main/res/layout/dialog_new_project.xml
@@ -64,6 +64,7 @@
android:layout_height="match_parent"
android:layout_weight="0.33"
android:drawableStart="@drawable/ic_smartphone_dialog_orientation_portrait"
+ android:paddingEnd="@dimen/material_design_spacing_large"
android:paddingStart="@dimen/material_design_spacing_large"/>
diff --git a/catroid/src/main/res/layout/dialog_select_cast.xml b/catroid/src/main/res/layout/dialog_select_cast.xml
index 91cecb1ab7a..09cb77781ee 100644
--- a/catroid/src/main/res/layout/dialog_select_cast.xml
+++ b/catroid/src/main/res/layout/dialog_select_cast.xml
@@ -32,6 +32,7 @@
android:layout_height="80dp"
android:id="@+id/empty_view_item"
android:gravity="center_vertical"
+ android:paddingEnd="5dp"
android:paddingStart="5dp">