Fix backup agent crash

This commit is contained in:
vshcherb 2014-03-31 00:12:37 +02:00
parent 4ba932bb6e
commit 86ed84b531
4 changed files with 5 additions and 5 deletions

View file

@ -176,7 +176,7 @@ public class ApplicationMode {
return cachedFilteredValues; return cachedFilteredValues;
} }
public static List<ApplicationMode> allPossibleValues(OsmandSettings settings) { public static List<ApplicationMode> allPossibleValues() {
return new ArrayList<ApplicationMode>(values); return new ArrayList<ApplicationMode>(values);
} }

View file

@ -13,8 +13,8 @@ public class OsmandBackupAgent extends BackupAgentHelper {
@Override @Override
public void onCreate() { public void onCreate() {
OsmandApplication app = (OsmandApplication) getApplicationContext(); // can't cast to OsmAnd Application
List<ApplicationMode> all = ApplicationMode.allPossibleValues(app.getSettings()); List<ApplicationMode> all = ApplicationMode.allPossibleValues();
String[] prefs = new String[all.size() + 1]; String[] prefs = new String[all.size() + 1];
prefs[0] = OsmandSettings.getSharedPreferencesName(null); prefs[0] = OsmandSettings.getSharedPreferencesName(null);
int i = 1; int i = 1;

View file

@ -106,7 +106,7 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
protected void availableProfileDialog() { protected void availableProfileDialog() {
Builder b = new AlertDialog.Builder(this); Builder b = new AlertDialog.Builder(this);
final List<ApplicationMode> modes = ApplicationMode.allPossibleValues(settings); final List<ApplicationMode> modes = ApplicationMode.allPossibleValues();
modes.remove(ApplicationMode.DEFAULT); modes.remove(ApplicationMode.DEFAULT);
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>(ApplicationMode.values(settings)); final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>(ApplicationMode.values(settings));
selected.remove(ApplicationMode.DEFAULT); selected.remove(ApplicationMode.DEFAULT);

View file

@ -32,7 +32,7 @@ public class SRTMPlugin extends OsmandPlugin {
OsmandSettings settings = app.getSettings(); OsmandSettings settings = app.getSettings();
CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines"); CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines");
if(pref.get().equals("")) { if(pref.get().equals("")) {
for(ApplicationMode m : ApplicationMode.allPossibleValues(settings)) { for(ApplicationMode m : ApplicationMode.allPossibleValues()) {
if(pref.getModeValue(m).equals("")) { if(pref.getModeValue(m).equals("")) {
pref.setModeValue(m, "13"); pref.setModeValue(m, "13");
} }