aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgSelectMapfile.java
blob: 6210c61ec78194b740b6d0afd7e4f9f53ba4f460 (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
60
package cgeo.geocaching;

import cgeo.geocaching.files.FileList;

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

import java.io.File;
import java.util.List;

public class cgSelectMapfile extends FileList<cgMapfileListAdapter> {

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

    String mapFile;

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

    public void close() {

        Intent intent = new Intent();
        intent.putExtra("mapfile", mapFile);

        setResult(RESULT_OK, intent);

        finish();
    }

    @Override
    protected cgMapfileListAdapter getAdapter(List<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;
    }

}