Bug 906088 - part 1b - add ArrayList getPrefs method to PrefsHelper; r=bnicholson

This commit is contained in:
Nathan Froyd 2013-08-16 10:42:27 -04:00
parent 064e6210e6
commit 303238ab30
2 changed files with 10 additions and 3 deletions

View File

@ -664,9 +664,7 @@ public class GeckoPreferences
// Initialize preferences by requesting the preference values from Gecko
private int getGeckoPreferences(final PreferenceGroup screen, ArrayList<String> prefs) {
JSONArray jsonPrefs = new JSONArray(prefs);
return PrefsHelper.getPrefs(jsonPrefs, new PrefsHelper.PrefHandlerBase() {
return PrefsHelper.getPrefs(prefs, new PrefsHelper.PrefHandlerBase() {
private Preference getField(String prefName) {
return screen.findPreference(prefName);
}

View File

@ -13,6 +13,7 @@ import org.json.JSONObject;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@ -40,6 +41,14 @@ public final class PrefsHelper {
return getPrefs(prefs, callback);
}
public static int getPrefs(ArrayList<String> prefNames, PrefHandler callback) {
JSONArray prefs = new JSONArray();
for (String p : prefNames) {
prefs.put(p);
}
return getPrefs(prefs, callback);
}
public static int getPrefs(JSONArray prefNames, PrefHandler callback) {
int requestId;
synchronized (PrefsHelper.class) {