-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSelectTransportation.java
More file actions
129 lines (116 loc) · 4.42 KB
/
SelectTransportation.java
File metadata and controls
129 lines (116 loc) · 4.42 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
package com.sfu.aqua.carbontracker;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
public class SelectTransportation extends AppCompatActivity {
int flag;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_tranportation);
Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/bold.ttf");
TextView next_tip=(TextView) findViewById(R.id.textView9);
next_tip.setTypeface(custom_font);
setupByCarBtn();
setupByBusBtn();
setupBySkytrainBtn();
setupWalkBtn();
extractFlag();
}
private void extractFlag() {
Intent intent = getIntent();
flag = intent.getIntExtra("unitFlag",flag);
Log.i("IN SELECT transport", " " + flag);
}
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.footprint_graph, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.back:
super.onBackPressed();
break;
case R.id.home:
Intent intent = new Intent(SelectTransportation.this, MainActivity.class);
startActivity(intent);
finish();
break;
}
return super.onOptionsItemSelected(item);
}
private void setupWalkBtn() {
FloatingActionButton button=(FloatingActionButton)findViewById(R.id.walk);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=SelectRouteActivity.makeIntent(SelectTransportation.this);
intent.putExtra("TRANSPORTATION",3);
intent.putExtra("flag",flag);
startActivity(intent);
}
});
}
private void setupBySkytrainBtn() {
FloatingActionButton button=(FloatingActionButton)findViewById(R.id.bySkytrain);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=SelectRouteActivity.makeIntent(SelectTransportation.this);
intent.putExtra("TRANSPORTATION",2);
intent.putExtra("flag",flag);
startActivity(intent);
}
});
}
private void setupByBusBtn() {
FloatingActionButton button=(FloatingActionButton)findViewById(R.id.byBus);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=SelectRouteActivity.makeIntent(SelectTransportation.this);
intent.putExtra("TRANSPORTATION",1);
intent.putExtra("flag",flag);
startActivity(intent);
}
});
}
private void setupByCarBtn() {
FloatingActionButton button=(FloatingActionButton)findViewById(R.id.byCar);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.putExtra("TRANSPORTATION",0);
//intent.putExtra("flag",flag);
Intent intent1= SelectCarActivity.makeIntent(SelectTransportation.this);
intent1.putExtra("flag",flag);
startActivity(intent1);
}
});
}
private void changeFont(TextView tv) {
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/bold.ttf");
tv.setTypeface(typeface);
}
public static Intent makeIntent(Context context) {
return new Intent(context, SelectTransportation.class);
}
}