Skip to content

Commit

Permalink
CATROID-810 Fix some linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
l-ilma committed May 22, 2022
1 parent 4355e67 commit dfa8632
Show file tree
Hide file tree
Showing 27 changed files with 111 additions and 775 deletions.
742 changes: 52 additions & 690 deletions catroid/config/lint-baseline.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -262,7 +266,7 @@ public static File copyDir(File sourceDir, File destinationDir) throws IOExcepti
throw new IOException("Cannot create directory: " + destinationDir.getAbsolutePath());
}

for (File file : sourceDir.listFiles()) {
for (File file : Objects.requireNonNull(sourceDir.listFiles())) {
if (file.isDirectory()) {
copyDir(file, new File(destinationDir, file.getName()));
} else {
Expand Down Expand Up @@ -328,7 +332,7 @@ public static void deleteDir(File dir) throws IOException {
throw new FileNotFoundException(dir.getAbsolutePath() + " is not a directory.");
}

for (File file : dir.listFiles()) {
for (File file : Objects.requireNonNull(dir.listFiles())) {
if (file.isDirectory()) {
deleteDir(file);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -108,6 +108,10 @@ class SpeechRecognitionHolder : SpeechRecognitionHolderInterface {
// in case the chosen language is not downloaded or outdated
showDialog(stageActivity, stageResourceHolder)
}
else -> {
speechRecognizer.cancel()
startListening()
}
}
Log.d(TAG, "SpeechRecognizer restarted!")
}
Expand Down
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/icon_brick_category_legonxt.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
android:src="?attr/icon_legonxt"
style="@style/CategoryIconStyle">
style="@style/CategoryIconStyle"
android:contentDescription="@string/category_lego_nxt">
</ImageView >
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/icon_brick_category_look.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
android:src="?attr/icon_look"
style="@style/CategoryIconStyle">
style="@style/CategoryIconStyle"
android:contentDescription="@string/category_looks">
</ImageView >
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/icon_brick_category_motion.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
android:src="?attr/icon_motion"
style="@style/CategoryIconStyle">
style="@style/CategoryIconStyle"
android:contentDescription="@string/category_motion">
</ImageView >
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/icon_brick_category_pen.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
android:src="?attr/icon_pen"
style="@style/CategoryIconStyle">
style="@style/CategoryIconStyle"
android:contentDescription="@string/category_pen">
</ImageView >
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/icon_brick_category_phiro.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
android:src="?attr/icon_phiro"
style="@style/CategoryIconStyle">
style="@style/CategoryIconStyle"
android:contentDescription="@string/category_phiro">
</ImageView >
</LinearLayout>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
android:src="?attr/icon_raspberrypi"
style="@style/CategoryIconStyle">
style="@style/CategoryIconStyle"
android:contentDescription="@string/category_raspi">
</ImageView >
</LinearLayout>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2021 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
android:src="?attr/icon_recently_used"
style="@style/CategoryIconStyle">
style="@style/CategoryIconStyle"
android:contentDescription="@string/category_recently_used">
</ImageView >
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/icon_brick_category_sound.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -27,6 +27,7 @@
android:layout_height="wrap_content">
<ImageView
style="@style/CategoryIconStyle"
android:src="?attr/icon_sound">
android:src="?attr/icon_sound"
android:contentDescription="@string/category_sound">
</ImageView >
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/icon_brick_category_userbrick.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2021 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -28,6 +28,7 @@
<ImageView
android:src="?attr/icon_userbrick"
style="@style/CategoryIconStyle"
android:background="#395cab">
android:background="#395cab"
android:contentDescription="@string/category_user_bricks">
</ImageView >
</LinearLayout>
4 changes: 2 additions & 2 deletions catroid/src/main/res/layout/view_holder_file.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2021 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -24,7 +24,7 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:contentDescription="checkbox"
android:contentDescription="@string/checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/element_spacing"
Expand Down
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/view_holder_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_weight="0"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
Expand Down Expand Up @@ -75,7 +75,8 @@
android:layout_weight="0"
android:gravity="center_vertical"
android:backgroundTint="@color/accent"
android:background="@drawable/ic_more_vert" />
android:background="@drawable/ic_more_vert"
android:contentDescription="@string/settings"/>

</LinearLayout>
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/view_holder_sprite_group_item.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -93,6 +93,7 @@
android:layout_weight="0"
android:gravity="center_vertical"
android:backgroundTint="@color/accent"
android:background="@drawable/ic_more_vert" />
android:background="@drawable/ic_more_vert"
android:contentDescription="@string/settings"/>
</LinearLayout>
</LinearLayout>
5 changes: 3 additions & 2 deletions catroid/src/main/res/layout/view_holder_variable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_gravity="center_vertical"
Expand Down Expand Up @@ -78,7 +78,8 @@
android:layout_weight="0"
android:gravity="center_vertical"
android:backgroundTint="@color/accent"
android:background="@drawable/ic_more_vert" />
android:background="@drawable/ic_more_vert"
android:contentDescription="@string/settings"/>

</LinearLayout>
</LinearLayout>
6 changes: 4 additions & 2 deletions catroid/src/main/res/layout/view_holder_with_checkbox.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2018 The Catrobat Team
~ Copyright (C) 2010-2022 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand All @@ -25,6 +25,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/view_holder_with_checkbox"
android:contentDescription="@string/checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/view_holder_height"
Expand Down Expand Up @@ -97,7 +98,8 @@
android:gravity="center_vertical"
android:backgroundTint="@color/accent"
android:background="@drawable/ic_more_vert"
android:visibility="visible" />
android:visibility="visible"
android:contentDescription="@string/settings"/>

</LinearLayout>
</LinearLayout>
1 change: 1 addition & 0 deletions catroid/src/main/res/layout/view_script_finder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
android:layout_weight="1"
android:hint="@string/keyword_label"
android:inputType="text"
android:importantForAutofill="no"
android:imeOptions="actionSearch"
android:textColor="@color/solid_white" />

Expand Down
28 changes: 0 additions & 28 deletions catroid/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 1 addition & 12 deletions catroid/src/main/res/values-v25/styles.xml
Original file line number Diff line number Diff line change
@@ -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
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -510,19 +510,8 @@
<item name="android:background">@drawable/brick_orange_2h_control</item>
</style>

<style name="BrickContainer.Event.Medium">
<item name="android:minHeight">@dimen/brick_height_medium</item>
<item name="android:background">@drawable/brick_orange_2h</item>
</style>

<style name="BrickContainer.Script" />

<style name="BrickContainer.Script.Small">
<item name="android:minHeight">@dimen/brick_height_small</item>
<item name="android:paddingTop">@dimen/brick_top_space_padding_control</item>
<item name="android:background">@drawable/brick_lightorange_1h_control</item>
</style>

<style name="BrickContainer.Script.Medium">
<item name="android:minHeight">@dimen/brick_height_medium</item>
<item name="android:paddingTop">@dimen/brick_top_space_padding_control</item>
Expand Down
Loading

0 comments on commit dfa8632

Please sign in to comment.