From 19b57c41b79f3f62e586753b9589b28fbac53863 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 12 Jul 2018 01:20:38 +0530 Subject: Address lint issues in TunnelListFragment Signed-off-by: Harsh Shandilya --- .../com/wireguard/android/fragment/TunnelListFragment.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'app/src/main/java/com') diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java index 5969aa9a..5dda6cfe 100644 --- a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java +++ b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java @@ -45,7 +45,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -289,7 +288,7 @@ public class TunnelListFragment extends BaseFragment { } private final class ActionModeListener implements ActionMode.Callback { - private final Set checkedItems = new HashSet<>(); + private final Collection checkedItems = new HashSet<>(); private Resources resources; @@ -297,8 +296,8 @@ public class TunnelListFragment extends BaseFragment { public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) { switch (item.getItemId()) { case R.id.menu_action_delete: - List tunnelsToDelete = new ArrayList<>(); - for (Integer position : checkedItems) { + final Collection tunnelsToDelete = new ArrayList<>(); + for (final Integer position : checkedItems) { tunnelsToDelete.add(Application.getTunnelManager().getTunnels().get(position)); } @@ -341,11 +340,11 @@ public class TunnelListFragment extends BaseFragment { binding.tunnelList.getAdapter().notifyDataSetChanged(); } - void toggleItemChecked(int position) { + void toggleItemChecked(final int position) { setItemChecked(position, !checkedItems.contains(position)); } - void setItemChecked(int position, boolean checked) { + void setItemChecked(final int position, final boolean checked) { if (checked) { checkedItems.add(position); } else { -- cgit v1.2.3