-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventInfo.java
162 lines (154 loc) · 5.13 KB
/
EventInfo.java
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
package com.example.campusfeed;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
public class EventInfo extends Activity
{
public Event currentEvent;
public ProgressBar fetching;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_info);
currentEvent = EventOrganizer.getEventById(getIntent().getExtras()
.getString("eventId"));
// fetching =(ProgressBar)findViewById(R.id.fetchPosteAndHandout);
TextView name = (TextView) findViewById(R.id.name);
// new getPosterandHandouts().execute();
name.setText(currentEvent.getName());
TextView description = (TextView) findViewById(R.id.eventInfo);
description.setText(currentEvent.getDescription());
TextView time = (TextView) findViewById(R.id.time);
time.setText(currentEvent.getTime());
TextView date = (TextView) findViewById(R.id.date);
date.setText(currentEvent.getDate());
TextView location = (TextView) findViewById(R.id.eventLocation);
location.setText(currentEvent.getLocation());
TextView locationSpecs = (TextView) findViewById(R.id.eventLocationSpecifics);
locationSpecs.setText(currentEvent.getLocationSpecifics());
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
map.addMarker(new MarkerOptions().position(currentEvent.getLatLng())
.title(currentEvent.getName()));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(
currentEvent.getLatLng(), 17));
// set onLongClick listener so once the use holds the touch for some
// seconds, it'll fire off into google maps with the lat and lng.
map.setOnMapLongClickListener(new OnMapLongClickListener()
{
public void onMapLongClick(LatLng click)
{
LatLng location = currentEvent.getLatLng();
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=" + location.latitude + ","
+ location.longitude + "(Location)"));
startActivity(intent);
}
});
}
public void onClick(View v)
{
if (v.getId() == R.id.date)
{
Intent extraListViewer = new Intent(this, TDLSortViewer.class);
extraListViewer.putExtra("sort", "date");
extraListViewer.putExtra("eventId", currentEvent.getId());
startActivity(extraListViewer);
}
if (v.getId() == R.id.time)
{
Intent extraListViewer = new Intent(this, TDLSortViewer.class);
extraListViewer.putExtra("sort", "time");
extraListViewer.putExtra("eventId", currentEvent.getId());
startActivity(extraListViewer);
}
if (v.getId() == R.id.eventLocation)
{
Intent extraListViewer = new Intent(this, TDLSortViewer.class);
extraListViewer.putExtra("sort", "location");
extraListViewer.putExtra("eventId", currentEvent.getId());
startActivity(extraListViewer);
}
}
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.activity_event_info, menu);
// SearchView
// search=(SearchView)menu.findItem(R.id.menu_search).getActionView();
// search.setQueryHint("Search an Organization or event name");
return true;
}
public boolean onMenuItemSelected(int featureId, MenuItem item)
{
switch (item.getItemId())
{
default:
return super.onMenuItemSelected(featureId, item);
}
}
/*
class getPosterandHandouts extends AsyncTask<String, Void, Bitmap>
{
protected Bitmap doInBackground(String... arg0)
{
URL url;
Bitmap bitmap = null;
try
{
url = new URL("http://ezevents.6te.net/"
+ currentEvent.posterPath);
URLConnection connection = url.openConnection();
connection.setUseCaches(true);
Object response = connection.getContent();
if (response instanceof Bitmap)
{
bitmap = (Bitmap) response;
} else
{
// get the files
// Log.d("sgdfgsdgdfsg","http://ezevents.6te.net/"+currentEvent.posterPath
// );
// InputStream pic1=new
// URL("http://ezevents.6te.net/"+currentEvent.posterPath).openStream();
// BitmapFactory.Options options=new
// BitmapFactory.Options();
// options.inJustDecodeBounds=true;
// options.inSampleSize
// bitmap=BitmapFactory.decodeStream(pic1, outPadding,
// opts);
}
} catch (Exception e)
{
Log.d("ERROR", e.getMessage());
}
return bitmap;
}
protected void onPostExecute(Bitmap poster)
{
if (poster == null)
{
fetching.setVisibility(View.GONE);
} else
{
ImageView posterimage = (ImageView) findViewById(R.id.Eventposter);
posterimage.setImageBitmap(Bitmap.createScaledBitmap(poster,
60, 60, true));
fetching.setVisibility(View.GONE);
}
}
}
*/
}