From d19cd6a52b1c27cdcfcf0db17961a975ac3fdd4b Mon Sep 17 00:00:00 2001 From: Adrian Frajham Date: Thu, 28 Nov 2024 00:59:52 +0100 Subject: [PATCH] IDE-271 Fix copyright and warnings --- .../main/java/org/catrobat/catroid/ui/UiUtils.java | 11 ++++++----- .../backpack/BackpackRecyclerViewFragment.java | 10 ++++++---- .../recyclerview/fragment/RecyclerViewFragment.java | 10 ++++++---- .../ui/recyclerview/fragment/ScriptFragment.java | 10 ++++++---- catroid/src/main/res/values/colors.xml | 2 +- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/catroid/src/main/java/org/catrobat/catroid/ui/UiUtils.java b/catroid/src/main/java/org/catrobat/catroid/ui/UiUtils.java index cef0c6fb69b..6f595c517d0 100644 --- a/catroid/src/main/java/org/catrobat/catroid/ui/UiUtils.java +++ b/catroid/src/main/java/org/catrobat/catroid/ui/UiUtils.java @@ -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 * () * * This program is free software: you can redistribute it and/or modify @@ -166,7 +166,7 @@ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup }; } - public static ArrayAdapter getAlertDialogAdapterForTextWithIcons(Activity activity, Context context, Pair[] items) { + public static ArrayAdapter getAlertDialogAdapterForTextWithIcons(Activity activity, Context context, List> items) { return new ArrayAdapter>(context, android.R.layout.simple_list_item_1, items) { TextView item; @@ -183,12 +183,13 @@ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup item = (TextView) convertView.getTag(); } - item.setText(items[position].first); + item.setText(items.get(position).first); if (activity.getWindow().getDecorView().getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) { - item.setCompoundDrawablesWithIntrinsicBounds(items[position].second, 0, 0, 0); + item.setCompoundDrawablesWithIntrinsicBounds(items.get(position).second, 0, 0, + 0); } else { - item.setCompoundDrawablesWithIntrinsicBounds(0, 0, items[position].second, 0); + item.setCompoundDrawablesWithIntrinsicBounds(0, 0, items.get(position).second, 0); } return convertView; diff --git a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/backpack/BackpackRecyclerViewFragment.java b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/backpack/BackpackRecyclerViewFragment.java index 57992dad5e6..a79bd9c944c 100644 --- a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/backpack/BackpackRecyclerViewFragment.java +++ b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/backpack/BackpackRecyclerViewFragment.java @@ -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 * () * * This program is free software: you can redistribute it and/or modify @@ -50,6 +50,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -298,9 +299,10 @@ public void onItemClick(final T item, MultiSelectionManager selectionManager) { return; } - Pair[] items = new Pair[] { - new Pair(getString(R.string.unpack), R.drawable.ic_logout), - new Pair(getString(R.string.delete), R.drawable.ic_delete)}; + List> items = Arrays.asList( + new Pair<>(getString(R.string.unpack), R.drawable.ic_logout), + new Pair<>(getString(R.string.delete), R.drawable.ic_delete) + ); LayoutInflater inflater = LayoutInflater.from(requireContext()); View customDialogView = inflater.inflate(R.layout.dialog_backpack_custom_alert, null); diff --git a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/RecyclerViewFragment.java b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/RecyclerViewFragment.java index c2435d9f8b1..d83ff2a7bfa 100644 --- a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/RecyclerViewFragment.java +++ b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/RecyclerViewFragment.java @@ -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 * () * * This program is free software: you can redistribute it and/or modify @@ -57,6 +57,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -482,9 +483,10 @@ public void notifyDataSetChanged() { } protected void showBackpackModeChooser() { - Pair[] items = new Pair[] { - new Pair(getString(R.string.pack), R.drawable.ic_login), - new Pair(getString(R.string.unpack), R.drawable.ic_logout)}; + List> items = Arrays.asList( + new Pair<>(getString(R.string.pack), R.drawable.ic_login), + new Pair<>(getString(R.string.unpack), R.drawable.ic_logout) + ); LayoutInflater inflater = LayoutInflater.from(requireContext()); View customDialogView = inflater.inflate(R.layout.dialog_backpack_custom_alert, null); diff --git a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/ScriptFragment.java b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/ScriptFragment.java index 6327350efd9..73932239e03 100644 --- a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/ScriptFragment.java +++ b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/ScriptFragment.java @@ -1,6 +1,6 @@ /* * Catroid: An on-device visual programming system for Android devices - * Copyright (C) 2010-2023 The Catrobat Team + * Copyright (C) 2010-2024 The Catrobat Team * () * * This program is free software: you can redistribute it and/or modify @@ -96,6 +96,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.UUID; @@ -853,9 +854,10 @@ public boolean onBrickLongClick(Brick brick, int position) { } private void showBackpackModeChooser() { - Pair[] items = new Pair[] { - new Pair(getString(R.string.pack), R.drawable.ic_login), - new Pair(getString(R.string.unpack), R.drawable.ic_logout)}; + List> items = Arrays.asList( + new Pair<>(getString(R.string.pack), R.drawable.ic_login), + new Pair<>(getString(R.string.unpack), R.drawable.ic_logout) + ); LayoutInflater inflater = LayoutInflater.from(requireContext()); View customDialogView = inflater.inflate(R.layout.dialog_backpack_custom_alert, null); diff --git a/catroid/src/main/res/values/colors.xml b/catroid/src/main/res/values/colors.xml index d8729245c7f..668c9c243f7 100644 --- a/catroid/src/main/res/values/colors.xml +++ b/catroid/src/main/res/values/colors.xml @@ -1,7 +1,7 @@