aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/cgeohelpers.java
blob: cb38b6411894359579a9c4ea22e0a1c474a9f32b (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package cgeo.geocaching;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.net.Uri;
import java.util.Locale;

public class cgeohelpers extends Activity {

	private cgeoapplication app = null;
	private Resources res = null;
	private Activity activity = null;
	private cgSettings settings = null;
	private cgBase base = null;
	private cgWarning warning = null;
	private SharedPreferences prefs = null;

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

		// init
		activity = this;
		res = this.getResources();
		app = (cgeoapplication) this.getApplication();
		prefs = getSharedPreferences(cgSettings.preferences, 0);
		settings = new cgSettings(this, prefs);
		base = new cgBase(app, settings, prefs);
		warning = new cgWarning(this);

		// set layout
		if (settings.skin == 1) {
			setTheme(R.style.light);
		} else {
			setTheme(R.style.dark);
		}
		setContentView(R.layout.helpers);
		base.setTitle(activity, res.getString(R.string.helpers));

		// google analytics
		base.sendAnal(activity, "/helpers");
	}

	@Override
	public void onResume() {
		super.onResume();
		
		settings.load();
	}

	public void installManual(View view) {
		final Locale loc = Locale.getDefault();
		final String lng = loc.getLanguage();

		try {
			if (lng.equalsIgnoreCase("de")) {
				activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:gnu.android.app.cgeomanual.de")));
			} else {
				activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:gnu.android.app.cgeomanual.en")));
			}
		} catch (Exception e) {
			// market not available in standard emulator
		}


		finish();
	}

	public void installLocus(View view) {
		try {
			activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:menion.android.locus")));
		} catch (Exception e) {
			// market not available in standard emulator
		}


		finish();
	}

	public void installGpsStatus(View view) {
		try {
			activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:com.eclipsim.gpsstatus2")));
		} catch (Exception e) {
			// market not available in standard emulator
		}

		finish();
	}

	public void installBluetoothGps(View view) {
		try {
			activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:googoo.android.btgps")));
		} catch (Exception e) {
			// market not available in standard emulator
		}

		finish();
	}

	public void goHome(View view) {
		base.goHome(activity);
	}
}