Projects >> cgeo >>b1b4dbadd4a166b1131d57a4ddf1b38d8ee0f9e6

Chunk
Conflicting content
    private static final String EXTRAS_MAP_TITLE = "mapTitle";

    private static final String BUNDLE_MAP_SOURCE = "mapSource";
<<<<<<< HEAD
    private static final String BUNDLE_MAP_STATE = "mapState";
=======
>>>>>>> 28e3eea115e7dea23cb130a0cd927a6f17c6fcbf

    private Resources res = null;
    private MapProvider mapProvider = null;
Solution content
    private static final String EXTRAS_MAP_TITLE = "mapTitle";

    private static final String BUNDLE_MAP_SOURCE = "mapSource";
    private static final String BUNDLE_MAP_STATE = "mapState";

    private Resources res = null;
    private MapProvider mapProvider = null;
File
CGeoMap.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
    @Override
    public void onSaveInstanceState(final Bundle outState) {
        outState.putInt(BUNDLE_MAP_SOURCE, currentSourceId);
<<<<<<< HEAD
        outState.putIntArray(BUNDLE_MAP_STATE, currentMapState());
=======
>>>>>>> 28e3eea115e7dea23cb130a0cd927a6f17c6fcbf
    }

    @Override
Solution content
    @Override
    public void onSaveInstanceState(final Bundle outState) {
        outState.putInt(BUNDLE_MAP_SOURCE, currentSourceId);
        outState.putIntArray(BUNDLE_MAP_STATE, currentMapState());
    }

    @Override
File
CGeoMap.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        app = (cgeoapplication) activity.getApplication();
        mapProvider = Settings.getMapProvider();

<<<<<<< HEAD

        // Get parameters from the intent
        final Bundle extras = activity.getIntent().getExtras();
        if (extras != null) {
            searchIntent = (SearchResult) extras.getParcelable(EXTRAS_SEARCH);
            geocodeIntent = extras.getString(EXTRAS_GEOCODE);
            coordsIntent = (Geopoint) extras.getParcelable(EXTRAS_COORDS);
            waypointTypeIntent = WaypointType.findById(extras.getString(EXTRAS_WPTTYPE));
            mapStateIntent = extras.getIntArray(EXTRAS_MAPSTATE);
            mapTitle = extras.getString(EXTRAS_MAP_TITLE);
        }
=======
        // Restore previously saved map source if any
        if (savedInstanceState != null) {
            currentSourceId = savedInstanceState.getInt(BUNDLE_MAP_SOURCE, Settings.getMapSource());
        } else {
            currentSourceId = Settings.getMapSource();
        }

        // get parameters
        Bundle extras = activity.getIntent().getExtras();
        if (extras != null) {
            searchIntent = (SearchResult) extras.getParcelable(EXTRAS_SEARCH);
            geocodeIntent = extras.getString(EXTRAS_GEOCODE);
            final double latitudeIntent = extras.getDouble(EXTRAS_LATITUDE);
            final double longitudeIntent = extras.getDouble(EXTRAS_LONGITUDE);
            coordsIntent = new Geopoint(latitudeIntent, longitudeIntent);
            waypointTypeIntent = WaypointType.findById(extras.getString(EXTRAS_WPTTYPE));
            mapStateIntent = extras.getIntArray(EXTRAS_MAPSTATE);
            mapTitle = extras.getString(EXTRAS_MAP_TITLE);

            if (coordsIntent.getLatitude() == 0.0 || coordsIntent.getLongitude() == 0.0) {
                coordsIntent = null;
            }
        }

>>>>>>> 28e3eea115e7dea23cb130a0cd927a6f17c6fcbf
        if (StringUtils.isBlank(mapTitle)) {
            mapTitle = res.getString(R.string.map_map);
        }
Solution content
        app = (cgeoapplication) activity.getApplication();
        mapProvider = Settings.getMapProvider();


        // Get parameters from the intent
        final Bundle extras = activity.getIntent().getExtras();
        if (extras != null) {
            searchIntent = (SearchResult) extras.getParcelable(EXTRAS_SEARCH);
            geocodeIntent = extras.getString(EXTRAS_GEOCODE);
            coordsIntent = (Geopoint) extras.getParcelable(EXTRAS_COORDS);
            waypointTypeIntent = WaypointType.findById(extras.getString(EXTRAS_WPTTYPE));
            mapStateIntent = extras.getIntArray(EXTRAS_MAPSTATE);
            mapTitle = extras.getString(EXTRAS_MAP_TITLE);
        }
        if (StringUtils.isBlank(mapTitle)) {
            mapTitle = res.getString(R.string.map_map);
        }
File
CGeoMap.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
            mapTitle = res.getString(R.string.map_map);
        }

<<<<<<< HEAD
        // Get fresh map information from the bundle if any
        if (savedInstanceState != null) {
            currentSourceId = savedInstanceState.getInt(BUNDLE_MAP_SOURCE, Settings.getMapSource());
            mapStateIntent = savedInstanceState.getIntArray(BUNDLE_MAP_STATE);
        } else {
            currentSourceId = Settings.getMapSource();
        }

=======
>>>>>>> 28e3eea115e7dea23cb130a0cd927a6f17c6fcbf
        // If recreating from an obsolete map source, we may need a restart
        if (changeMapSource(Settings.getMapSource())) {
            return;
Solution content
            mapTitle = res.getString(R.string.map_map);
        }

        // Get fresh map information from the bundle if any
        if (savedInstanceState != null) {
            currentSourceId = savedInstanceState.getInt(BUNDLE_MAP_SOURCE, Settings.getMapSource());
            mapStateIntent = savedInstanceState.getIntArray(BUNDLE_MAP_STATE);
        } else {
            currentSourceId = Settings.getMapSource();
        }

        // If recreating from an obsolete map source, we may need a restart
        if (changeMapSource(Settings.getMapSource())) {
            return;
File
CGeoMap.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Chunk
Conflicting content
        mapIntent.putExtra(EXTRAS_SEARCH, searchIntent);
        mapIntent.putExtra(EXTRAS_GEOCODE, geocodeIntent);
        if (coordsIntent != null) {
<<<<<<< HEAD
            mapIntent.putExtra(EXTRAS_COORDS, coordsIntent);
=======
            mapIntent.putExtra(EXTRAS_LATITUDE, coordsIntent.getLatitude());
            mapIntent.putExtra(EXTRAS_LONGITUDE, coordsIntent.getLongitude());
>>>>>>> 28e3eea115e7dea23cb130a0cd927a6f17c6fcbf
        }
        mapIntent.putExtra(EXTRAS_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null);
        mapIntent.putExtra(EXTRAS_MAP_TITLE, mapTitle);
Solution content
        mapIntent.putExtra(EXTRAS_SEARCH, searchIntent);
        mapIntent.putExtra(EXTRAS_GEOCODE, geocodeIntent);
        if (coordsIntent != null) {
            mapIntent.putExtra(EXTRAS_COORDS, coordsIntent);
        }
        mapIntent.putExtra(EXTRAS_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null);
        mapIntent.putExtra(EXTRAS_MAP_TITLE, mapTitle);
File
CGeoMap.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        mapIntent.putExtra(EXTRAS_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null);
        mapIntent.putExtra(EXTRAS_MAP_TITLE, mapTitle);

<<<<<<< HEAD
        final int[] mapState = currentMapState();
        if (mapState != null) {
=======
        if (mapView != null) {
            int[] mapState = new int[4];
            GeoPointImpl mapCenter = mapView.getMapViewCenter();
            mapState[0] = mapCenter.getLatitudeE6();
            mapState[1] = mapCenter.getLongitudeE6();
            mapState[2] = mapView.getMapZoomLevel();
            mapState[3] = followMyLocation ? 1 : 0;
>>>>>>> 28e3eea115e7dea23cb130a0cd927a6f17c6fcbf
            mapIntent.putExtra(EXTRAS_MAPSTATE, mapState);
        }
Solution content
        mapIntent.putExtra(EXTRAS_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null);
        mapIntent.putExtra(EXTRAS_MAP_TITLE, mapTitle);

        final int[] mapState = currentMapState();
        if (mapState != null) {
            mapIntent.putExtra(EXTRAS_MAPSTATE, mapState);
        }
File
CGeoMap.java
Developer's decision
Version 1
Kind of conflict
Array access
Attribute
If statement
Method invocation
Variable
Chunk
Conflicting content
        // start the new map
        activity.startActivity(mapIntent);
<<<<<<< HEAD
    }

    /**
     * Get the current map state from the map view if it exists or from the mapStateIntent field otherwise.
     *
     * @return the current map state as an array of int, or null if no map state is available
     */
    private int[] currentMapState() {
        if (mapView == null) {
            return mapStateIntent;
        }

        final GeoPointImpl mapCenter = mapView.getMapViewCenter();
        return new int[] {
                mapCenter.getLatitudeE6(),
                mapCenter.getLongitudeE6(),
                mapView.getMapZoomLevel(),
                followMyLocation ? 1 : 0
        };
=======
>>>>>>> 28e3eea115e7dea23cb130a0cd927a6f17c6fcbf
    }

    private void savePrefs() {
Solution content
        // start the new map
        activity.startActivity(mapIntent);
    }

    /**
     * Get the current map state from the map view if it exists or from the mapStateIntent field otherwise.
     *
     * @return the current map state as an array of int, or null if no map state is available
     */
    private int[] currentMapState() {
        if (mapView == null) {
            return mapStateIntent;
        }

        final GeoPointImpl mapCenter = mapView.getMapViewCenter();
        return new int[] {
                mapCenter.getLatitudeE6(),
                mapCenter.getLongitudeE6(),
                mapView.getMapZoomLevel(),
                followMyLocation ? 1 : 0
        };
    }

    private void savePrefs() {
File
CGeoMap.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Method signature
Return statement
Variable