// Intent request codes
public static final int REQUEST_CONNECT_DEVICE = 1;
public static final int REQUEST_ENABLE_BT = 2;
+ public static final int REQUEST_PRELOAD_MAPS = 3;
+ public static final int REQUEST_MAP_TYPE = 4;
+
+ public int map_type = AltosMap.maptype_hybrid;
public static FragmentManager fm;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ AltosDebug.init(this);
AltosDebug.debug("+++ ON CREATE +++");
fm = getSupportFragmentManager();
finish();
}
break;
+ case REQUEST_MAP_TYPE:
+ if (resultCode == Activity.RESULT_OK)
+ set_map_type(data);
+ break;
}
}
}
}
+ private void set_map_type(Intent data) {
+ int type = data.getIntExtra(MapTypeActivity.EXTRA_MAP_TYPE, -1);
+
+ AltosDebug.debug("intent set_map_type %d\n", type);
+ if (type != -1) {
+ map_type = type;
+ for (AltosDroidTab mTab : mTabs)
+ mTab.set_map_type(map_type);
+ }
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
boolean imperial = AltosPreferences.imperial_units();
AltosPreferences.set_imperial_units(!imperial);
return true;
+ case R.id.preload_maps:
+ serverIntent = new Intent(this, PreloadMapActivity.class);
+ startActivityForResult(serverIntent, REQUEST_PRELOAD_MAPS);
+ return true;
+ case R.id.map_type:
+ serverIntent = new Intent(this, MapTypeActivity.class);
+ startActivityForResult(serverIntent, REQUEST_MAP_TYPE);
+ return true;
}
return false;
}