Skip to content

Commit 74094f1

Browse files
committed
Removed support for Volvo
1 parent 61e6c0a commit 74094f1

15 files changed

+30664
-199
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
Thumbs.db
33
Browse.plb
44
*.swp
5-
/proguard/

AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.jvanier.android.sendtocar"
5-
android:versionCode="30"
6-
android:versionName="4.1" >
5+
android:versionCode="32"
6+
android:versionName="4.2" >
77

88
<uses-permission android:name="android.permission.INTERNET" />
99
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

proguard/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dump.txt

proguard/mapping.txt

+17,319
Large diffs are not rendered by default.

proguard/seeds.txt

+4,883
Large diffs are not rendered by default.

proguard/usage.txt

+8,415
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.jvanier.android.sendtocar.common;
2+
3+
import org.apache.http.client.methods.HttpUriRequest;
4+
5+
import android.annotation.SuppressLint;
6+
7+
@SuppressLint("NewApi")
8+
public class AbortHttpRequest {
9+
public static void abortRequests(final HttpUriRequest... requests) {
10+
new Thread(new Runnable() {
11+
public void run() {
12+
doAbort(requests);
13+
}
14+
}).start();
15+
}
16+
17+
private static void doAbort(HttpUriRequest... requests) {
18+
for(HttpUriRequest request : requests) {
19+
if(request != null) {
20+
request.abort();
21+
}
22+
}
23+
}
24+
}

src/com/jvanier/android/sendtocar/controllers/SendToCarFragment.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import com.jvanier.android.sendtocar.uploaders.BaseUploader;
5252
import com.jvanier.android.sendtocar.uploaders.BaseUploader.BaseUploaderHandler;
5353
import com.jvanier.android.sendtocar.uploaders.GoogleMapsUploader;
54-
import com.jvanier.android.sendtocar.uploaders.HereComUploader;
5554
import com.jvanier.android.sendtocar.uploaders.MapquestUploader;
5655
import com.jvanier.android.sendtocar.uploaders.OnStarUploader;
5756

@@ -507,7 +506,7 @@ public void onClick(DialogInterface dialog, int which) {
507506
props.put("AddressOrigin", addressOrigin);
508507
props.put("Make", uploader.getProvider().makeId);
509508
props.put("AnonymizedAccount", Mixpanel.anonymizeAccount(uploader.getAccount()));
510-
props.put("Result", success ? "Success" : "Failed");
509+
props.put("Success", success ? "Y" : "N");
511510
if(!success) {
512511
props.put("Message", message);
513512
}
@@ -534,10 +533,6 @@ private void doAddressSend() {
534533
if(Log.isEnabled()) Log.d(TAG, "Sending address to OnStar");
535534
uploader = new OnStarUploader(getActivity(), handler);
536535
break;
537-
case CarProvider.PROVIDER_HERE_COM:
538-
if(Log.isEnabled()) Log.d(TAG, "Sending address to Here.com");
539-
uploader = new HereComUploader(getActivity(), handler);
540-
break;
541536
}
542537

543538
String account = accountText.getText().toString();

src/com/jvanier/android/sendtocar/downloaders/CarListManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private String downloadCarList() throws BackgroundTaskAbort {
165165
if(Log.isEnabled()) Log.d(TAG, "Response: " + carsJson);
166166

167167
} catch(Exception e) {
168-
if(Log.isEnabled()) Log.e(TAG, "Exception while downloading cars: " + e.toString());
168+
if(Log.isEnabled()) Log.e(TAG, "Exception while downloading cars", e);
169169
throw new BackgroundTaskAbort();
170170
}
171171

@@ -210,7 +210,7 @@ private void parseCarsData(String carsJson) throws BackgroundTaskAbort {
210210
if(Log.isEnabled()) Log.d(TAG, "Cars JSON parsed OK.");
211211

212212
} catch(JSONException e) {
213-
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing cars JSON: " + e.toString());
213+
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing cars JSON", e);
214214
throw new BackgroundTaskAbort();
215215
}
216216
}

src/com/jvanier/android/sendtocar/downloaders/GoogleMapsAddressLoader.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.os.AsyncTask;
2525

2626
import com.jvanier.android.sendtocar.R;
27+
import com.jvanier.android.sendtocar.common.AbortHttpRequest;
2728
import com.jvanier.android.sendtocar.common.BackgroundTaskAbort;
2829
import com.jvanier.android.sendtocar.common.Log;
2930
import com.jvanier.android.sendtocar.common.SniHttpClient;
@@ -77,7 +78,7 @@ protected void onPostExecute(Result result) {
7778

7879
public void cancelDownload() {
7980
cancel(false);
80-
httpGet.abort();
81+
AbortHttpRequest.abortRequests(httpGet);
8182
}
8283

8384
@Override
@@ -154,11 +155,11 @@ private String downloadMap(String url) throws BackgroundTaskAbort {
154155
if(Log.isEnabled()) Log.d(TAG, "Google Maps host: " + mapHost.getHostName());
155156

156157
} catch(URISyntaxException e) {
157-
if(Log.isEnabled()) Log.e(TAG, "Exception while downloading address: " + e.toString());
158+
if(Log.isEnabled()) Log.e(TAG, "Exception while downloading address", e);
158159
throw new BackgroundTaskAbort(R.string.errorDownload);
159160

160161
} catch(IOException e) {
161-
if(Log.isEnabled()) Log.d(TAG, "Exception while downloading address: " + e.toString());
162+
if(Log.isEnabled()) Log.d(TAG, "Exception while downloading address", e);
162163
throw new BackgroundTaskAbort(R.string.errorDownload);
163164
}
164165

@@ -263,7 +264,7 @@ private void parseAddressData(String mapHtml) throws BackgroundTaskAbort {
263264
throw new BackgroundTaskAbort(R.string.errorDownload);
264265
}
265266
} catch(JSONException e) {
266-
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing address JSON: " + e.toString());
267+
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing address JSON", e);
267268
throw new BackgroundTaskAbort(R.string.errorDownload);
268269
}
269270
} else {
@@ -303,7 +304,7 @@ private void downloadGeocodedAddress(Address address) throws BackgroundTaskAbort
303304
if(Log.isEnabled()) Log.d(TAG, "Response: " + Utils.htmlSnippet(geoHtml));
304305

305306
} catch(IOException | URISyntaxException e) {
306-
if(Log.isEnabled()) Log.d(TAG, "Exception while geocoding address: " + e.toString());
307+
if(Log.isEnabled()) Log.d(TAG, "Exception while geocoding address", e);
307308
}
308309

309310
try {
@@ -343,11 +344,11 @@ private void downloadGeocodedAddress(Address address) throws BackgroundTaskAbort
343344
}
344345

345346
} catch(JSONException e) {
346-
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing geocoding JSON: " + e.toString());
347+
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing geocoding JSON", e);
347348
} catch(IllegalAccessException e) {
348-
if(Log.isEnabled()) Log.e(TAG, "Exception while updating address: " + e.toString());
349+
if(Log.isEnabled()) Log.e(TAG, "Exception while updating address", e);
349350
} catch(NoSuchFieldException e) {
350-
if(Log.isEnabled()) Log.e(TAG, "Exception while updating address: " + e.toString());
351+
if(Log.isEnabled()) Log.e(TAG, "Exception while updating address", e);
351352
}
352353
}
353354

src/com/jvanier/android/sendtocar/downloaders/GoogleMapsGeocoder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import android.os.AsyncTask;
1818

19+
import com.jvanier.android.sendtocar.common.AbortHttpRequest;
1920
import com.jvanier.android.sendtocar.common.BackgroundTaskAbort;
2021
import com.jvanier.android.sendtocar.common.Log;
2122
import com.jvanier.android.sendtocar.common.SniHttpClient;
@@ -48,7 +49,7 @@ public void setUpdateLatLngOnly(boolean updateLatLngOnly) {
4849

4950
public void cancelGeocode() {
5051
cancel(false);
51-
httpGet.abort();
52+
AbortHttpRequest.abortRequests(httpGet);
5253
}
5354

5455
@Override

src/com/jvanier/android/sendtocar/downloaders/IssueLoader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private String downloadJsonData() throws BackgroundTaskAbort {
9494
if(Log.isEnabled()) Log.d(TAG, "Response: " + jsonData);
9595

9696
} catch(Exception e) {
97-
if(Log.isEnabled()) Log.e(TAG, "Exception while downloading issue: " + e.toString());
97+
if(Log.isEnabled()) Log.e(TAG, "Exception while downloading issue", e);
9898
throw new BackgroundTaskAbort();
9999
}
100100

@@ -112,7 +112,7 @@ private void parseJsonDataToIssue(String jsonData) throws BackgroundTaskAbort {
112112
if(Log.isEnabled()) Log.d(TAG, "Issue JSON parsed OK.");
113113

114114
} catch(JSONException e) {
115-
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing issue JSON: " + e.toString());
115+
if(Log.isEnabled()) Log.e(TAG, "Exception while parsing issue JSON", e);
116116
throw new BackgroundTaskAbort();
117117
}
118118
}

src/com/jvanier/android/sendtocar/uploaders/BaseUploader.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import android.os.AsyncTask;
1212

1313
import com.jvanier.android.sendtocar.R;
14+
import com.jvanier.android.sendtocar.common.AbortHttpRequest;
1415
import com.jvanier.android.sendtocar.common.BackgroundTaskAbort;
1516
import com.jvanier.android.sendtocar.common.SniHttpClient;
1617
import com.jvanier.android.sendtocar.downloaders.GoogleMapsGeocoder;
@@ -92,12 +93,7 @@ public String getNotes() {
9293

9394
public void cancelUpload() {
9495
cancel(false);
95-
if(httpPost != null) {
96-
httpPost.abort();
97-
}
98-
if(httpGet != null) {
99-
httpGet.abort();
100-
}
96+
AbortHttpRequest.abortRequests(httpPost, httpGet);
10197

10298
if(geocoder != null) {
10399
geocoder.cancelGeocode();

src/com/jvanier/android/sendtocar/uploaders/HereComUploader.java

-165
This file was deleted.

src/com/jvanier/android/sendtocar/uploaders/OnStarUploader.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,10 @@ private String preparePostDataOnStar() throws BackgroundTaskAbort {
7070
return post;
7171

7272
} catch(UnsupportedEncodingException e) {
73-
if(Log.isEnabled())
74-
Log.d(TAG, "<span style=\"color: red;\">Unsupported encoding exception while preparing MapQuest post data: " + e.toString()
75-
+ "</span>");
73+
if(Log.isEnabled()) Log.e(TAG, "Unsupported encoding exception while preparing OnStar post data", e);
7674
throw new BackgroundTaskAbort(R.string.errorSendToCar);
7775
} catch(NullPointerException e) {
78-
if(Log.isEnabled())
79-
Log.d(TAG, "<span style=\"color: red;\">Null pointer exception while preparing MapQuest post data: " + e.toString()
80-
+ "</span>");
76+
if(Log.isEnabled()) Log.e(TAG, "Null pointer exception while preparing OnStar post data", e);
8177
throw new BackgroundTaskAbort(R.string.errorSendToCar);
8278
}
8379
}

0 commit comments

Comments
 (0)