-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathPrivacyPolicyActivity.java
More file actions
87 lines (67 loc) · 2.94 KB
/
Copy pathPrivacyPolicyActivity.java
File metadata and controls
87 lines (67 loc) · 2.94 KB
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
package website.julianrosser.birthdays.activities;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import website.julianrosser.birthdays.R;
import website.julianrosser.birthdays.Utils;
public class PrivacyPolicyActivity extends BaseActivity {
private Tracker mTracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_privacy_policy);
TextView textPrivacySummary = (TextView) findViewById(R.id.textPrivacySummary);
setPrivacyTitleColour(textPrivacySummary);
TextView textPrivacyFull = (TextView) findViewById(R.id.textPrivacyFull);
setPrivacyTitleColour(textPrivacyFull);
// Set up toolbar reference
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Show home button on toolbar
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
// Obtain the shared Tracker instance.
mTracker = getDefaultTracker();
mTracker.send(new HitBuilders.EventBuilder()
.setCategory("Action")
.setAction("Privacy Policy Activity")
.build());
}
private void setPrivacyTitleColour(TextView textPrivacySummary) {
int textColor = Utils.getHighlightColor(getApplicationContext());
textPrivacySummary.setTextColor(getResources().getColor(textColor));
}
synchronized public Tracker getDefaultTracker() {
if (mTracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
// mTracker = analytics.newTracker(R.xml.global_tracker);
}
return mTracker;
}
@Override
protected void onResume() {
super.onResume();
mTracker.setScreenName("Privacy Policy");
mTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
// Set Activity theme depending on user preference
public void setTheme() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
if (prefs.getString(getResources().getString(R.string.pref_theme_key), "0").equals("0")) {
setTheme(R.style.BlueTheme);
} else if (prefs.getString(getResources().getString(R.string.pref_theme_key), "0").equals("1")) {
setTheme(R.style.PinkTheme);
} else if (prefs.getString(getResources().getString(R.string.pref_theme_key), "0").equals("2")) {
setTheme(R.style.GreenTheme);
} else {
setTheme(R.style.BlueTheme);
}
}
}