Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Sorted whitelist entries
Browse files Browse the repository at this point in the history
Refs #1375
  • Loading branch information
M66B committed Feb 21, 2014
1 parent 675c7d3 commit 3a9dbfd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Changelog

**Next release**

* Localized whitelist names ([issue](/../../issues/1375))
* Sorted whitelist entries ([issue](/../../issues/1375))
* Updated Dutch translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
6 changes: 3 additions & 3 deletions src/biz/bokhorst/xprivacy/ActivityApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ public void onClick(DialogInterface dialog, int which) {

private class WhitelistsTask extends AsyncTask<Object, Object, Object> {
private WhitelistAdapter mWhitelistAdapter;
private Map<String, Map<String, Boolean>> mListWhitelist;
private Map<String, TreeMap<String, Boolean>> mListWhitelist;

@Override
protected Object doInBackground(Object... params) {
Expand Down Expand Up @@ -929,10 +929,10 @@ public void onClick(DialogInterface dialog, int which) {
@SuppressLint("DefaultLocale")
private class WhitelistAdapter extends ArrayAdapter<String> {
private String mSelectedType;
private Map<String, Map<String, Boolean>> mMapWhitelists;
private Map<String, TreeMap<String, Boolean>> mMapWhitelists;
private LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

public WhitelistAdapter(Context context, int resource, Map<String, Map<String, Boolean>> mapWhitelists) {
public WhitelistAdapter(Context context, int resource, Map<String, TreeMap<String, Boolean>> mapWhitelists) {
super(context, resource, new ArrayList<String>());
mMapWhitelists = mapWhitelists;
}
Expand Down
6 changes: 3 additions & 3 deletions src/biz/bokhorst/xprivacy/PrivacyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ public static void setWhitelisted(int uid, String type, String name, Boolean whi
PrivacyManager.setSetting(uid, type + "." + name, value);
}

public static HashMap<String, Map<String, Boolean>> listWhitelisted(int uid) {
HashMap<String, Map<String, Boolean>> mapWhitelisted = new HashMap<String, Map<String, Boolean>>();
public static Map<String, TreeMap<String, Boolean>> listWhitelisted(int uid) {
Map<String, TreeMap<String, Boolean>> mapWhitelisted = new HashMap<String, TreeMap<String, Boolean>>();
for (PSetting setting : getSettingList(uid)) {
// Grok the setting to see if it fits the bill
if (setting.name.startsWith("Whitelist")) {
Expand All @@ -458,7 +458,7 @@ public static HashMap<String, Map<String, Boolean>> listWhitelisted(int uid) {

// If we get here, add it to the list
if (!mapWhitelisted.containsKey(type))
mapWhitelisted.put(type, new HashMap<String, Boolean>());
mapWhitelisted.put(type, new TreeMap<String, Boolean>());
mapWhitelisted.get(type).put(name, Boolean.parseBoolean(setting.value));
}
}
Expand Down

0 comments on commit 3a9dbfd

Please sign in to comment.