# HG changeset patch # User Medo # Date 1345289964 -7200 # Node ID e7ab89ab86f6bfeafdab2c08f082cc7187e22a66 # Parent 983ff426f91e0484a6ce499b2e1cecd94539ceba Hedgeroid: Don't update the map preview just for a theme change diff -r 983ff426f91e -r e7ab89ab86f6 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/MapFragment.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/MapFragment.java Sat Aug 18 13:39:05 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/MapFragment.java Sat Aug 18 13:39:24 2012 +0200 @@ -50,6 +50,7 @@ */ private boolean previewGenerationInProgress; private MapRecipe newPreviewRequest; + private MapRecipe currentMap; // kept for reference on every change to find out what changed @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -90,9 +91,9 @@ mazeSizeSpinner = prepareSpinner(v, R.id.spinMazeSize, Arrays.asList(getResources().getStringArray(R.array.map_maze_sizes)), mazeSizeSelectedListener); stateManager.registerObserver(this); - MapRecipe map = stateManager.getMapRecipe(); - if(map != null) { - updateDisplay(map); + currentMap = stateManager.getMapRecipe(); + if(currentMap != null) { + updateDisplay(currentMap); } setChiefState(stateManager.getChiefStatus()); mapPreviewHandler.activity(); @@ -218,8 +219,17 @@ } public void onMapChanged(MapRecipe recipe) { + if(currentMap==null + || currentMap.mapgen != recipe.mapgen + || currentMap.mazeSize != recipe.mazeSize + || !currentMap.name.equals(recipe.name) + || !currentMap.seed.equals(recipe.seed) + || currentMap.templateFilter != recipe.templateFilter + || !Arrays.equals(currentMap.getDrawData(), recipe.getDrawData())) { + mapPreviewHandler.activity(); + } updateDisplay(recipe); - mapPreviewHandler.activity(); + currentMap = recipe; } public void onGameStyleChanged(String gameStyle) { }