aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/cgSelectMapfile.java
blob: d119f265651dbfeaca054edcba64c96f3d5b1c71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package cgeo.geocaching;

import java.io.File;
import java.util.ArrayList;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;

public class cgSelectMapfile extends FileList<cgMapfileListAdapter> {

	public cgSelectMapfile() {
		super("map");
	}

	String mapFile;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		mapFile = getSettings().getMapFile();
	}

	public void close() {
		
		Intent intent = new Intent();
		intent.putExtra("mapfile", mapFile);
		
		setResult(RESULT_OK, intent);
		
		finish();
	}

	@Override
	protected cgMapfileListAdapter getAdapter(ArrayList<File> files) {
		return new cgMapfileListAdapter(this, files);
	}

	@Override
	protected String[] getBaseFolders() {
		String base = Environment.getExternalStorageDirectory().toString();
		return new String[]{base + "/mfmaps", base + "/Locus/mapsVector"};
	}

	@Override
	protected void setTitle() {
		setTitle(res.getString(R.string.map_file_select_title));
	}
	
	public String getCurrentMapfile() {
		return mapFile;
	}
	
	public void setMapfile(String newMapfile) {
		mapFile = newMapfile;
	}

}