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
|
package cgeo.geocaching.activity;
import cgeo.geocaching.Settings;
import cgeo.geocaching.cgBase;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.compatibility.Compatibility;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
public abstract class AbstractActivity extends Activity implements IAbstractActivity {
private String helpTopic;
protected cgeoapplication app = null;
protected Resources res = null;
private boolean keepScreenOn = false;
protected AbstractActivity() {
this(null);
}
protected AbstractActivity(final String helpTopic) {
this.helpTopic = helpTopic;
}
protected AbstractActivity(final String helpTopic, final boolean keepScreenOn) {
this(helpTopic);
this.keepScreenOn = keepScreenOn;
}
final public void goHome(final View view) {
ActivityMixin.goHome(this);
}
public void goManual(final View view) {
ActivityMixin.goManual(this, helpTopic);
}
final public void setTitle(final String title) {
ActivityMixin.setTitle(this, title);
}
final public void showProgress(final boolean show) {
ActivityMixin.showProgress(this, show);
}
final public void setTheme() {
ActivityMixin.setTheme(this);
}
public final void showToast(String text) {
ActivityMixin.showToast(this, text);
}
public final void showShortToast(String text) {
ActivityMixin.showShortToast(this, text);
}
public final void helpDialog(final String title, final String message) {
ActivityMixin.helpDialog(this, title, message);
}
public final void helpDialog(final String title, final String message, final Drawable icon) {
ActivityMixin.helpDialog(this, title, message, icon);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// init
res = this.getResources();
app = (cgeoapplication) this.getApplication();
cgBase.initialize(app);
// Restore cookie store if needed
cgBase.restoreCookieStore(Settings.getCookieStore());
ActivityMixin.keepScreenOn(this, keepScreenOn);
}
public void addVisitMenu(Menu menu, cgCache cache) {
ActivityMixin.addVisitMenu(this, menu, cache);
}
protected static void disableSuggestions(final EditText edit) {
Compatibility.disableSuggestions(edit);
}
protected void restartActivity() {
Compatibility.restartActivity(this);
}
public void invalidateOptionsMenuCompatible() {
ActivityMixin.invalidateOptionsMenu(this);
}
}
|