mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 949174/964375/952311 - Don't return an unmodifiable list on HomeConfig.load() (r=liuche)
This commit is contained in:
parent
e4856e4adf
commit
f6ed121134
@ -27,7 +27,6 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
@ -114,7 +113,7 @@ class HomeConfigPrefsBackend implements HomeConfigBackend {
|
||||
panelConfigs = loadConfigFromString(jsonString);
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(panelConfigs);
|
||||
return panelConfigs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ public class PanelsPreferenceCategory extends CustomListCategory {
|
||||
public static final String LOGTAG = "PanelsPrefCategory";
|
||||
|
||||
protected HomeConfig mHomeConfig;
|
||||
protected final List<PanelConfig> mPanelConfigs = new ArrayList<PanelConfig>();
|
||||
protected List<PanelConfig> mPanelConfigs;
|
||||
|
||||
protected UiAsyncTask<Void, Void, List<PanelConfig>> mLoadTask;
|
||||
protected UiAsyncTask<Void, Void, Void> mSaveTask;
|
||||
@ -67,17 +67,15 @@ public class PanelsPreferenceCategory extends CustomListCategory {
|
||||
|
||||
@Override
|
||||
public void onPostExecute(List<PanelConfig> panelConfigs) {
|
||||
displayPanelConfig(panelConfigs);
|
||||
mPanelConfigs = panelConfigs;
|
||||
displayPanelConfig();
|
||||
}
|
||||
};
|
||||
mLoadTask.execute();
|
||||
}
|
||||
|
||||
private void displayPanelConfig(List<PanelConfig> panelConfigs) {
|
||||
for (PanelConfig panelConfig: panelConfigs) {
|
||||
// Populate our local copy of the panels.
|
||||
mPanelConfigs.add(panelConfig);
|
||||
|
||||
private void displayPanelConfig() {
|
||||
for (PanelConfig panelConfig : mPanelConfigs) {
|
||||
// Create and add the pref.
|
||||
final PanelsPreference pref = new PanelsPreference(getContext(), PanelsPreferenceCategory.this);
|
||||
pref.setTitle(panelConfig.getTitle());
|
||||
@ -102,6 +100,10 @@ public class PanelsPreferenceCategory extends CustomListCategory {
|
||||
* @param panelConfigs Configuration to be saved
|
||||
*/
|
||||
private void saveHomeConfig() {
|
||||
if (mPanelConfigs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<PanelConfig> panelConfigs = makeConfigListDeepCopy();
|
||||
mSaveTask = new UiAsyncTask<Void, Void, Void>(ThreadUtils.getBackgroundHandler()) {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user