зеркало из https://github.com/mozilla/gecko-dev.git
Bug 906088 - part 1b - add ArrayList getPrefs method to PrefsHelper; r=bnicholson
Related to the last patch, this is the lone place where we transfer an ArrayList. Just move the code into PrefsHelper in case anybody ever wants to do something similar.
This commit is contained in:
Родитель
0b3cb176d8
Коммит
0d5414e952
|
@ -676,9 +676,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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче