project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/MapFragment.java
changeset 7572 4e223b05be7c
parent 7560 e7ab89ab86f6
child 7582 714310efad8f
equal deleted inserted replaced
7570:54c400a5c209 7572:4e223b05be7c
    79 		try {
    79 		try {
    80 			mapFiles = FrontendDataUtils.getMaps(getActivity());
    80 			mapFiles = FrontendDataUtils.getMaps(getActivity());
    81 		} catch (IOException e) {
    81 		} catch (IOException e) {
    82 			Toast.makeText(getActivity().getApplicationContext(), R.string.error_missing_sdcard_or_files, Toast.LENGTH_LONG).show();
    82 			Toast.makeText(getActivity().getApplicationContext(), R.string.error_missing_sdcard_or_files, Toast.LENGTH_LONG).show();
    83 			getActivity().finish();
    83 			getActivity().finish();
       
    84 			return null;
    84 		}
    85 		}
    85 		Collections.sort(mapFiles, MapFile.MISSIONS_FIRST_NAME_ORDER);
    86 		Collections.sort(mapFiles, MapFile.MISSIONS_FIRST_NAME_ORDER);
    86 		
    87 		
    87 		List<String> mapNames = MapFile.toDisplayNameList(mapFiles, getResources());
    88 		List<String> mapNames = MapFile.toDisplayNameList(mapFiles, getResources());
    88 		mapTypeSpinner = prepareSpinner(v, R.id.spinMapType, Arrays.asList(getResources().getStringArray(R.array.map_types)), mapTypeSelectedListener);
    89 		mapTypeSpinner = prepareSpinner(v, R.id.spinMapType, Arrays.asList(getResources().getStringArray(R.array.map_types)), mapTypeSelectedListener);
   198 	};
   199 	};
   199 	
   200 	
   200 	private final OnClickListener mapClickListener = new OnClickListener() {
   201 	private final OnClickListener mapClickListener = new OnClickListener() {
   201 		public void onClick(View v) {
   202 		public void onClick(View v) {
   202 			stateManager.changeMapSeed(MapRecipe.makeRandomSeed());
   203 			stateManager.changeMapSeed(MapRecipe.makeRandomSeed());
   203 			switch(mapTypeSpinner.getSelectedItemPosition()) {
   204 			if(mapTypeSpinner.getSelectedItemPosition() == Frontlib.MAPGEN_NAMED) {
   204 			case Frontlib.MAPGEN_NAMED:
       
   205 				mapNameSpinner.setSelection(random.nextInt(mapNameSpinner.getCount()));
   205 				mapNameSpinner.setSelection(random.nextInt(mapNameSpinner.getCount()));
   206 				break;
       
   207 			case Frontlib.MAPGEN_REGULAR:
       
   208 				templateSpinner.setSelection(Frontlib.TEMPLATEFILTER_ALL);
       
   209 				break;
       
   210 			case Frontlib.MAPGEN_MAZE:
       
   211 				mazeSizeSpinner.setSelection(random.nextInt(mazeSizeSpinner.getCount()));
       
   212 				break;
       
   213 			}
   206 			}
   214 		}
   207 		}
   215 	};
   208 	};
   216 	
   209 	
   217 	public void onChiefStatusChanged(boolean isChief) {
   210 	public void onChiefStatusChanged(boolean isChief) {