Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE-247 Fix all linter warnings #5020

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
567 changes: 0 additions & 567 deletions catroid/config/lint-baseline.xml

This file was deleted.

4 changes: 2 additions & 2 deletions catroid/config/lint.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-2022 The Catrobat Team
~ Copyright (C) 2010-2024 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -53,5 +53,5 @@
</issue>

<issue id="ContentDescription" severity="ignore" />

<issue id="NotifyDataSetChanged" severity="ignore" />
</lint >
5 changes: 4 additions & 1 deletion catroid/src/debug/AndroidManifest.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-2022 The Catrobat Team
~ Copyright (C) 2010-2024 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -59,6 +59,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />

<!-- gps -->
<uses-feature
Expand All @@ -82,6 +83,8 @@
<application
android:name=".CatroidApplication"
android:allowBackup="false"
android:fullBackupContent="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:icon="${appIcon}"
android:label="${appName}"
android:theme="@style/Catroid"
Expand Down
5 changes: 3 additions & 2 deletions catroid/src/main/AndroidManifest.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-2022 The Catrobat Team
~ Copyright (C) 2010-2024 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -63,6 +63,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />

<!-- gps -->
<uses-feature
Expand Down Expand Up @@ -91,7 +92,7 @@
android:theme="@style/Catroid"
android:supportsRtl="true"
android:requestLegacyExternalStorage="false"
tools:ignore="UnusedAttribute"
tools:ignore="UnusedAttribute,LockedOrientationActivity"
tools:replace="android:label,android:allowBackup,android:name"
android:usesCleartextTraffic="true">

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-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -349,7 +349,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
case android.R.id.home:
onBackPressed();
break;
case R.id.skip_bluetooth:
case (R.id.skip_bluetooth):
setResult(AppCompatActivity.RESULT_OK);
finish();
break;
Expand Down
29 changes: 11 additions & 18 deletions catroid/src/main/java/org/catrobat/catroid/cast/CastManager.java
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-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -26,9 +26,9 @@
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -242,29 +242,29 @@ private synchronized void handleGamepadTouch(ImageButton button, MotionEvent eve
Sensors buttonPressed;
String buttonPressedName;
switch (button.getId()) {
case R.id.gamepadButtonA:
case (R.id.gamepadButtonA):
button.setImageResource(isActionDown ? R.drawable.gamepad_button_a_pressed : R.drawable.gamepad_button_a);
buttonPressedName = gamepadActivity.getString(R.string.cast_gamepad_A);
buttonPressed = Sensors.GAMEPAD_A_PRESSED;
break;
case R.id.gamepadButtonB:
case (R.id.gamepadButtonB):
button.setImageResource(isActionDown ? R.drawable.gamepad_button_b_pressed : R.drawable.gamepad_button_b);
buttonPressedName = gamepadActivity.getString(R.string.cast_gamepad_B);
buttonPressed = Sensors.GAMEPAD_B_PRESSED;
break;
case R.id.gamepadButtonUp:
case (R.id.gamepadButtonUp):
buttonPressedName = gamepadActivity.getString(R.string.cast_gamepad_up);
buttonPressed = Sensors.GAMEPAD_UP_PRESSED;
break;
case R.id.gamepadButtonDown:
case (R.id.gamepadButtonDown):
buttonPressedName = gamepadActivity.getString(R.string.cast_gamepad_down);
buttonPressed = Sensors.GAMEPAD_DOWN_PRESSED;
break;
case R.id.gamepadButtonLeft:
case (R.id.gamepadButtonLeft):
buttonPressedName = gamepadActivity.getString(R.string.cast_gamepad_left);
buttonPressed = Sensors.GAMEPAD_LEFT_PRESSED;
break;
case R.id.gamepadButtonRight:
case (R.id.gamepadButtonRight):
buttonPressedName = gamepadActivity.getString(R.string.cast_gamepad_right);
buttonPressed = Sensors.GAMEPAD_RIGHT_PRESSED;
break;
Expand All @@ -285,7 +285,8 @@ public synchronized void addStageViewToLayout(GLSurfaceView20 stageView) {
remoteLayout.removeAllViews();
remoteLayout.addView(stageViewDisplayedOnCast);
Project project = ProjectManager.getInstance().getCurrentProject();
stageView.surfaceChanged(stageView.getHolder(), 0, project.getXmlHeader().getVirtualScreenWidth(),
stageView.surfaceChanged(stageView.getHolder(), PixelFormat.RGBA_8888,
project.getXmlHeader().getVirtualScreenWidth(),
project.getXmlHeader().getVirtualScreenHeight());
}

Expand Down Expand Up @@ -440,18 +441,10 @@ public synchronized void onCastStop() {
}

public void startCastService(final AppCompatActivity activity) {

Intent intent = new Intent(activity, activity.getClass());
PendingIntent notificationPendingIntent;
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
notificationPendingIntent = PendingIntent.getActivity(activity, 0,
intent,PendingIntent.FLAG_IMMUTABLE);
} else {
notificationPendingIntent = PendingIntent.getActivity(activity, 0,
intent, 0);
}

notificationPendingIntent = PendingIntent.getActivity(activity, 0, intent, PendingIntent.FLAG_IMMUTABLE);

CastRemoteDisplayLocalService.NotificationSettings settings = new CastRemoteDisplayLocalService
.NotificationSettings.Builder()
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-2022 The Catrobat Team
* Copyright (C) 2010-2024 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,7 +93,7 @@ public void onStringOptionSelected(Integer spinnerId, String string) {

@Override
public void onItemSelected(Integer spinnerId, @Nullable RotationStyleOption item) {
selection = item != null ? item.getRotationStyle() : 0;
selection = item != null ? item.getRotationStyle() : Look.ROTATION_STYLE_LEFT_RIGHT_ONLY;
}

class RotationStyleOption implements Nameable {
Expand Down
Loading