|
|
|
|
@ -8,7 +8,9 @@ import com.orhanobut.hawk.Hawk; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Iterator; |
|
|
|
|
|
|
|
|
|
public class SearchHelper { |
|
|
|
|
|
|
|
|
|
@ -22,7 +24,26 @@ public class SearchHelper { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
if (mCheckSources == null || mCheckSources.isEmpty()) mCheckSources = getSources(); |
|
|
|
|
if (mCheckSources == null || mCheckSources.isEmpty()) { |
|
|
|
|
mCheckSources = getSources(); |
|
|
|
|
} else { |
|
|
|
|
HashMap<String, String> newSources = getSources(); |
|
|
|
|
for (Map.Entry<String, String> entry : newSources.entrySet()) { |
|
|
|
|
String newKey = entry.getKey(); |
|
|
|
|
String newValue = entry.getValue(); |
|
|
|
|
if (!mCheckSources.containsKey(newKey)) { |
|
|
|
|
mCheckSources.put(newKey, newValue); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Iterator<Map.Entry<String, String>> iterator = mCheckSources.entrySet().iterator(); |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
Map.Entry<String, String> oldEntry = iterator.next(); |
|
|
|
|
String oldKey = oldEntry.getKey(); |
|
|
|
|
if (!newSources.containsKey(oldKey)) { |
|
|
|
|
iterator.remove(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return mCheckSources; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|