diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java b/app/src/main/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java index 54f81487d..dcf628ac2 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java @@ -21,6 +21,7 @@ import com.topjohnwu.magisk.utils.Utils; import java.util.HashSet; import java.util.List; +import java.util.Set; import butterknife.BindView; import butterknife.ButterKnife; @@ -30,7 +31,7 @@ public class PolicyAdapter extends RecyclerView.Adapter policyList; private SuDatabaseHelper dbHelper; private PackageManager pm; - private HashSet expandList = new HashSet<>(); + private Set expandList = new HashSet<>(); public PolicyAdapter(List list, SuDatabaseHelper db, PackageManager pm) { policyList = list; diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java b/app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java index c384fbce4..3f6a9f370 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java @@ -24,6 +24,7 @@ import com.topjohnwu.magisk.utils.WebWindow; import java.util.HashSet; import java.util.List; +import java.util.Set; import butterknife.BindView; import butterknife.ButterKnife; @@ -31,7 +32,7 @@ import butterknife.ButterKnife; public class ReposAdapter extends RecyclerView.Adapter { private List mUpdateRepos, mInstalledRepos, mOthersRepos; - private HashSet expandList = new HashSet<>(); + private Set expandList = new HashSet<>(); public ReposAdapter(List update, List installed, List others) { mUpdateRepos = update; diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java b/app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java index c10d7adad..4a8219872 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java @@ -22,10 +22,11 @@ import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.superuser.SuLogEntry; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; +import java.util.Set; import butterknife.BindView; import butterknife.ButterKnife; @@ -33,13 +34,13 @@ import butterknife.ButterKnife; public class SuLogAdapter { private ExpandableAdapter adapter; - private HashSet expandList = new HashSet<>(); + private Set expandList = new HashSet<>(); public SuLogAdapter(List list) { // Separate the logs with date - LinkedHashMap> logEntryMap = new LinkedHashMap<>(); - ArrayList group; + Map> logEntryMap = new LinkedHashMap<>(); + List group; for (SuLogEntry log : list) { String date = log.getDateString(); group = logEntryMap.get(date); @@ -51,8 +52,8 @@ public class SuLogAdapter { } // Then format them into expandable groups - ArrayList logEntryGroups = new ArrayList<>(); - for (HashMap.Entry> entry : logEntryMap.entrySet()) { + List logEntryGroups = new ArrayList<>(); + for (Map.Entry> entry : logEntryMap.entrySet()) { logEntryGroups.add(new LogGroup(entry.getKey(), entry.getValue())); } adapter = new ExpandableAdapter(logEntryGroups); diff --git a/app/src/main/java/com/topjohnwu/magisk/module/ModuleHelper.java b/app/src/main/java/com/topjohnwu/magisk/module/ModuleHelper.java index e1b4faafa..e303da0dc 100644 --- a/app/src/main/java/com/topjohnwu/magisk/module/ModuleHelper.java +++ b/app/src/main/java/com/topjohnwu/magisk/module/ModuleHelper.java @@ -24,6 +24,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; public class ModuleHelper { @@ -70,7 +71,7 @@ public class ModuleHelper { jsonString = prefs.getString(REPO_KEY, null); } - ValueSortedMap cached = null; + Map cached = null; if (jsonString != null) { cached = gson.fromJson(jsonString, new TypeToken>(){}.getType()); @@ -82,7 +83,7 @@ public class ModuleHelper { // Get cached ETag to add in the request header String etag = prefs.getString(ETAG_KEY, ""); - HashMap header = new HashMap<>(); + Map header = new HashMap<>(); header.put("If-None-Match", etag); // Making a request to main URL for repo info diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/CallbackHandler.java b/app/src/main/java/com/topjohnwu/magisk/utils/CallbackHandler.java index cfc5a3e57..3218a3b55 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/CallbackHandler.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/CallbackHandler.java @@ -2,13 +2,15 @@ package com.topjohnwu.magisk.utils; import java.util.HashMap; import java.util.HashSet; +import java.util.Map; +import java.util.Set; public class CallbackHandler { - private static HashMap> listeners = new HashMap<>(); + private static Map> listeners = new HashMap<>(); public static void register(Event event, EventListener listener) { - HashSet list = listeners.get(event); + Set list = listeners.get(event); if (list == null) { list = new HashSet<>(); listeners.put(event, list); @@ -17,21 +19,21 @@ public class CallbackHandler { } public static void unRegister(Event event) { - HashSet list = listeners.remove(event); + Set list = listeners.remove(event); if (list != null) { list.clear(); } } public static void unRegister(Event event, EventListener listener) { - HashSet list = listeners.get(event); + Set list = listeners.get(event); if (list != null) { list.remove(listener); } } private static void triggerCallback(Event event) { - HashSet list = listeners.get(event); + Set list = listeners.get(event); if (list != null) { for (EventListener listener : list) { listener.onTrigger(event);