My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 30 attachment: issue30.patch (7.8 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
Index: src/org/mixare/DownloadManager.java
===================================================================
--- src/org/mixare/DownloadManager.java (Revision 32)
+++ src/org/mixare/DownloadManager.java (Arbeitskopie)
@@ -131,27 +131,31 @@
root = new JSONObject(tmp);
Json layer = new Json();
JSONArray results = new JSONArray();
- //extra launcher
- if(root.has("copyright")) {
- Log.d("----source----------------------", "get source = südtirolerland");
- results = root.getJSONArray("results");
- layer.load(results);
- result.obj = layer;
- }
- //Wikipedia
- else if(root.has("geonames")|| MixListView.getDataSource()=="Wikipedia"){
- Log.d("----source----------------------", "get source = WIKI");
- results = root.getJSONArray("geonames");
- layer.load(results);
- result.obj = layer;
- }
- //Twitter
- else{
- Log.d("----source----------------------", "get source = TWITTER ");
- results = root.getJSONArray("results");
- layer.load(results);
- result.obj = layer;
- }
+ //extra launcher
+ if(root.has("copyright")) {
+ Log.d("----source----------------------", "get source = südtirolerland");
+ results = root.getJSONArray("results");
+ }
+ //Wikipedia
+ else if(root.has("geonames")|| MixListView.getDataSource()=="Wikipedia"){
+ Log.d("----source----------------------", "get source = WIKI");
+ results = root.getJSONArray("geonames");
+ }
+ //Twitter
+ else if(MixListView.getDataSource()=="Twitter"){
+ Log.d("----source----------------------", "get source = TWITTER ");
+ results = root.getJSONArray("results");
+ }
+ //Buzz
+ else if(MixListView.getDataSource()=="Buzz"){
+ Log.d("----source----------------------", "get source = Buzz ");
+ results = root.getJSONObject("data").getJSONArray("items");
+ }
+ else
+ Log.e("----source----------------------", "invalid source");
+
+ layer.load(results);
+ result.obj = layer;



Index: src/org/mixare/MixListView.java
===================================================================
--- src/org/mixare/MixListView.java (Revision 32)
+++ src/org/mixare/MixListView.java (Arbeitskopie)
@@ -49,6 +49,7 @@
Vector<String> dataSourceMenu = new Vector();
dataSourceMenu.add("Wikipedia");
dataSourceMenu.add("Twitter");
+ dataSourceMenu.add("Buzz");
// dataSourceMenu.add("own URL");
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,dataSourceMenu));
getListView().setTextFilterEnabled(true);
@@ -99,6 +100,10 @@
setDataSource("Twitter");
Toast.makeText( this ,"Changed to Twitter as data source", Toast.LENGTH_LONG ).show();
break;
+ /*BUZZ*/
+ case 2:
+ setDataSource("Buzz");
+ Toast.makeText( this ,"Changed to Google Buzz as data source", Toast.LENGTH_LONG).show();
/*Own URL*/
// case 2:
// setDataSource("OwnURL");
Index: src/org/mixare/DataView.java
===================================================================
--- src/org/mixare/DataView.java (Revision 32)
+++ src/org/mixare/DataView.java (Arbeitskopie)
@@ -66,7 +66,7 @@
/** default URL */
String WIKI_HOME_URL = "http://ws.geonames.org/findNearbyWikipediaJSON";
String TWITTER_HOME_URL = "http://search.twitter.com/search.json";
- String BUZZ_HOME_URL = "https://www.googleapis.com/buzz/v1/activities/search?alt=json";
+ String BUZZ_HOME_URL = "https://www.googleapis.com/buzz/v1/activities/search?alt=json&max-results=20";

private Location curFix;
private String startUrl = "";
@@ -175,10 +175,9 @@
request.url = WIKI_HOME_URL + "?lat="+curFix.getLatitude()+"&lng=" + curFix.getLongitude() + "&radius="+ radius +"&maxRows=50&lang=" + Locale.getDefault().getLanguage();
else if(MixListView.getDataSource()=="Twitter")
request.url = TWITTER_HOME_URL +"?geocode="+curFix.getLatitude() + "%2C" + curFix.getLongitude()+"%2C" + radius + "km" ;
-
- /*buzz*/
- //request.url = BUZZ_HOME_URL + "&lat="+curFix.getLatitude()+"&lon=" + curFix.getLongitude() + "&radius="+ radius*1000;
- //https://www.googleapis.com/buzz/v1/activities/search?alt=json&lat=46.47122383117541&lon=11.260278224944742&radius=20000
+ else if(MixListView.getDataSource()=="Buzz")
+ request.url = BUZZ_HOME_URL + "&lat="+curFix.getLatitude()+"&lon=" + curFix.getLongitude() + "&radius="+ radius*1000;
+ //https://www.googleapis.com/buzz/v1/activities/search?alt=json&lat=46.47122383117541&lon=11.260278224944742&radius=20000
}
Log.d("---URL------------------",""+request.url);
startUrl = ctx.getStartUrl();
Index: src/org/mixare/data/Json.java
===================================================================
--- src/org/mixare/data/Json.java (Revision 32)
+++ src/org/mixare/data/Json.java (Arbeitskopie)
@@ -24,6 +24,7 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.mixare.Marker;
+import org.mixare.MixListView;
import org.mixare.reality.PhysicalPlace;

import android.util.Log;
@@ -58,7 +59,7 @@
jo = root.getJSONObject(i);

//südtirolerland
- if (jo.has("id")&& jo.has("title")) {
+ if (jo.has("id")&& jo.has("title")&& jo.has("lat")) {
//Our own schema
if (jo.getInt("has_detail_page") != 0) {
ma.mOnPress = "webpage:" + java.net.URLDecoder.decode(jo.getString("webpage"));
@@ -80,7 +81,7 @@

}
//wikipedia
- else if(!jo.has("id")&& jo.has("title")){
+ else if(MixListView.getDataSource()=="Wikipedia"){
ma.mOnPress = "webpage:http://" + java.net.URLDecoder.decode(jo.getString("wikipediaUrl"));
listOnPress.add("webpage:http://" + java.net.URLDecoder.decode(jo.getString("wikipediaUrl")));

@@ -99,7 +100,7 @@
}
//twitter
else
- if(!jo.isNull("geo")) {
+ if(MixListView.getDataSource()=="Twitter") {
ma.mOnPress = "";
listOnPress.add("");

@@ -124,6 +125,23 @@
listData.add(title);

}
+ // Buzz
+ else if (MixListView.getDataSource()=="Buzz") {
+ String webpage = jo.getJSONObject("links").getJSONArray("alternate").getJSONObject(0).getString("href");
+ ma.mOnPress = "webpage:" + java.net.URLDecoder.decode(webpage);
+ listOnPress.add("webpage:" + java.net.URLDecoder.decode(webpage));
+
+ ma.mText = jo.getString("title");
+ refpt.setLatitude(Double.valueOf(jo.getString("geocode").split(" ")[0]));
+ refpt.setLongitude(Double.valueOf(jo.getString("geocode").split(" ")[1]));
+ refpt.setAltitude(0);
+
+ ma.mGeoLoc.setTo(refpt);
+ markers.add(ma);
+
+ String title = jo.getString("title");
+ listData.add(title);
+ }


} catch (JSONException e) {
Powered by Google Project Hosting