spotbugs: Method does not presize the allocation of a collection

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2020-10-02 22:17:10 +02:00
parent 9a730d8c0b
commit 33d26c6322
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 12 additions and 7 deletions

View file

@ -109,11 +109,12 @@ public class SendFilesDialog extends BottomSheetDialogFragment {
@NonNull
private List<SendButtonData> setupSendButtonData(Intent sendIntent) {
List<SendButtonData> sendButtonDataList = new ArrayList<>();
Drawable icon;
SendButtonData sendButtonData;
CharSequence label;
for (ResolveInfo match : requireActivity().getPackageManager().queryIntentActivities(sendIntent, 0)) {
List<ResolveInfo> matches = requireActivity().getPackageManager().queryIntentActivities(sendIntent, 0);
List<SendButtonData> sendButtonDataList = new ArrayList<>(matches.size());
for (ResolveInfo match : matches) {
icon = match.loadIcon(requireActivity().getPackageManager());
label = match.loadLabel(requireActivity().getPackageManager());
sendButtonData = new SendButtonData(icon, label,

View file

@ -241,11 +241,15 @@ public class SendShareDialog extends BottomSheetDialogFragment {
@NonNull
private List<SendButtonData> setupSendButtonData(Intent sendIntent) {
List<SendButtonData> sendButtonDataList = new ArrayList<>();
for (ResolveInfo match : getActivity().getPackageManager().queryIntentActivities(sendIntent, 0)) {
Drawable icon = match.loadIcon(getActivity().getPackageManager());
CharSequence label = match.loadLabel(getActivity().getPackageManager());
SendButtonData sendButtonData = new SendButtonData(icon, label,
Drawable icon;
SendButtonData sendButtonData;
CharSequence label;
List<ResolveInfo> matches = requireActivity().getPackageManager().queryIntentActivities(sendIntent, 0);
List<SendButtonData> sendButtonDataList = new ArrayList<>(matches.size());
for (ResolveInfo match : matches) {
icon = match.loadIcon(requireActivity().getPackageManager());
label = match.loadLabel(requireActivity().getPackageManager());
sendButtonData = new SendButtonData(icon, label,
match.activityInfo.packageName,
match.activityInfo.name);