-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbout.java
More file actions
203 lines (144 loc) · 5.59 KB
/
Copy pathAbout.java
File metadata and controls
203 lines (144 loc) · 5.59 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
package com.example.maxmoons.usarmy_fatcalculator.About;
/**
* Created by dan on 4/23/17.
*/
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.icu.util.Calendar;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.Spannable;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.example.maxmoons.usarmy_fatcalculator.R;
import java.net.MalformedURLException;
import java.net.URL;
import butterknife.ButterKnife;
/**
* Created by ubuntuadmin on 3/24/17.
* Edited by Anu Uprety 5/23/19
*/
public class About extends AppCompatActivity {
/// AU- Field variables declared private to this class but can be acessed within any methods below
private RecyclerView recyclerView;
private ActionBarDrawerToggle mDrawerToggle;
private DrawerLayout mDrawerLayout;
private NavigationView mNavigationView;
private Button twitterview;
private Button websitetxt;
private Button privacypolicy;
private Button termsofUse;
private TextView Lincenceagreement;
private TextView rateview;
URL websiteurl;
// AU- Website URL is declared as a field so it can be accessed below in the methods, url mal functions are also caught with
/// the catch phrase.
{
try {
websiteurl = new URL("https://www.microhealthllc.com/how-to-calculate-body-mass-index-bmi/");
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
twitterview = (Button) findViewById(R.id.followus);
websitetxt =(Button) findViewById(R.id.webaddress);
privacypolicy =(Button) findViewById(R.id.privacyp);
termsofUse = (Button) findViewById(R.id.termsofuse);
//AU: sets the movement, so the twitter link is lined with the instance
twitterview.setMovementMethod(LinkMovementMethod.getInstance());
twitterview.setText("@microhealthtalk");
twitterview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoURl("https://twitter.com/MicroHealthTalk");
}
});
websitetxt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoURl("https://www.microhealthllc.com/");
}
});
termsofUse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoURl("https://www.microhealthllc.com/about/terms-of-use/");
}
});
privacypolicy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoURl("https://www.microhealthllc.com/about/privacy-policy/");
}
});
twitterview.setClickable(true);
//websitetxt =(TextView) findViewById(R.id.websiteurl);
websitetxt.setClickable(true);
//websitetxt.setText(Html.fromHtml(website));
//twitterview.setText(Html.fromHtml(twiteracc));
Linkify.addLinks(twitterview,Linkify.ALL);
ButterKnife.bind(this);
if(getSupportActionBar()!=null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setTitle("About");
}
}
private void gotoURl(String url){
Uri uriUrl = Uri.parse(url);
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(launchBrowser);
}
/* AU- this method is never accesssed or used
private void setupToolbar() {
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
}*/
@Override
public void onBackPressed() {
super.onBackPressed();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// mDrawerToggle.syncState();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return true;
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
}