aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/LiveMapInfo.java
blob: 2fee940723cae779d6d2af5ac4d41f1b9f4a803a (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
package cgeo.geocaching;

import cgeo.geocaching.activity.AbstractActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;

public class LiveMapInfo extends AbstractActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.livemapinfo);

        final int showCount = Settings.getLiveMapHintShowCount();

        if (showCount > 2) {
            final CheckBox cb = (CheckBox) findViewById(R.id.live_map_hint_hide);
            cb.setVisibility(View.VISIBLE);
        }

        final Button closeButton = (Button) findViewById(R.id.live_map_hint_ok);
        closeButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                final CheckBox cb = (CheckBox) findViewById(R.id.live_map_hint_hide);
                if (cb.isChecked()) {
                    Settings.setHideLiveHint(true);
                }
                finish();
            }
        });

        Settings.setLiveMapHintShowCount(showCount + 1);
    }

    @Override
    protected void onStop() {

        final CheckBox cb = (CheckBox) findViewById(R.id.live_map_hint_hide);
        if (cb.isChecked()) {
            Settings.setHideLiveHint(true);
        }

        super.onStop();
    }

}