use of seemoo.fitbit.https.HttpsClient in project fitness-app by seemoo-lab.
the class WorkActivity method initialize.
/**
* Initializes several objects.
*/
private void initialize() {
device = (BluetoothDevice) getIntent().getExtras().get("device");
buttonHandler = new ButtonHandler(activity);
buttonHandler.addButton(R.id.button_WorkActivity_1);
buttonHandler.addButton(R.id.button_WorkActivity_2);
buttonHandler.addButton(R.id.button_WorkActivity_3);
buttonHandler.addButton(R.id.button_WorkActivity_4);
buttonHandler.addButton(R.id.button_WorkActivity_5);
buttonHandler.addButton(R.id.button_WorkActivity_6);
clearAlarmsButton = (FloatingActionButton) findViewById(R.id.button_WorkActivity_7);
clearAlarmsButton.setVisibility(View.GONE);
buttonHandler.addSpecialButton(R.id.button_WorkActivity_8);
buttonHandler.addSpecialButton(R.id.button_WorkActivity_9);
saveButton = (FloatingActionButton) findViewById(R.id.button_WorkActivity_10);
saveButton.setVisibility(View.GONE);
ArrayAdapter<Information> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, informationToDisplay.getList());
mListView = (ListView) findViewById(R.id.WorkActivityList);
mListView.setAdapter(arrayAdapter);
toast_short = Toast.makeText(activity, "", Toast.LENGTH_SHORT);
toast_long = Toast.makeText(activity, "", Toast.LENGTH_LONG);
settings.put(R.id.settings_workactivity_1, false);
settings.put(R.id.settings_workactivity_2, false);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.setVisibility(View.GONE);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onLoadResource(WebView view, String url) {
if (url.equals("https://www.fitbit.com/oauth") || url.equals("https://www.fitbit.com/oauth/oauth_login_allow")) {
toast_long.setText("Please copy the PIN.");
toast_long.show();
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
buttonHandler.setVisible(R.id.button_WorkActivity_8);
}
});
}
}, 3000);
}
}
});
editText = (EditText) findViewById(R.id.editText);
editText.setVisibility(View.GONE);
textView = (TextView) findViewById(R.id.textView);
textView.setText(ConstantValues.ASK_AUTH_PIN);
textView.setVisibility(View.GONE);
client = new HttpsClient(toast_short, this);
}
Aggregations