aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgeohelpers.java
blob: 560ab84ccc401227d2510d442b3af2988dfb9d16 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package cgeo.geocaching;

import cgeo.geocaching.activity.AbstractActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

import java.util.Locale;

public class cgeohelpers extends AbstractActivity {

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

        // init
        setTheme();
        setContentView(R.layout.helpers);
        setTitle(res.getString(R.string.helpers));
    }

    @Override
    public void onResume() {
        super.onResume();

    }

    private void installFromMarket(String marketId) {
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + marketId)));
        } catch (Exception e) {
            // market not available in standard emulator
        }

        finish();
    }

    /**
     * @param view
     *            unused here but needed since this method is referenced from XML layout
     */
    public void installManual(View view) {
        final Locale loc = Locale.getDefault();
        final String language = loc.getLanguage();

        if ("de".equalsIgnoreCase(language)) {
            installFromMarket("gnu.android.app.cgeomanual.de");
        }
        else {
            installFromMarket("gnu.android.app.cgeomanual.en");
        }
    }

    /**
     * @param view
     *            unused here but needed since this method is referenced from XML layout
     */
    public void installLocus(View view) {
        installFromMarket("menion.android.locus");
    }

    /**
     * @param view
     *            unused here but needed since this method is referenced from XML layout
     */
    public void installGpsStatus(View view) {
        installFromMarket("com.eclipsim.gpsstatus2");
    }

    /**
     * @param view
     *            unused here but needed since this method is referenced from XML layout
     */
    public void installBluetoothGps(View view) {
        installFromMarket("googoo.android.btgps");
    }
}