From 9b4374688e53695032fcc998e0f797cacac107fc Mon Sep 17 00:00:00 2001 From: Andrew Shaw Date: Fri, 10 Feb 2012 16:17:30 -0800 Subject: [PATCH 1/3] Killing nls warnings and logging --- .../astrid/taskrabbit/TaskRabbitActivity.java | 104 +++++++++--------- .../taskrabbit/TaskRabbitControlSet.java | 21 ++-- .../TaskRabbitLocationControlSet.java | 65 ++++------- .../taskrabbit/TaskRabbitMapActivity.java | 48 ++------ .../taskrabbit/TaskRabbitMapOverlayItem.java | 3 +- .../taskrabbit/TaskRabbitNameControlSet.java | 9 +- .../TaskRabbitSpinnerControlSet.java | 20 +--- astrid/res/values/keys-taskrabbit.xml | 35 +++++- 8 files changed, 133 insertions(+), 172 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java index 200a5a131..e45ecd889 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java @@ -47,7 +47,6 @@ import android.widget.ListAdapter; import android.widget.ListView; import android.widget.PopupWindow.OnDismissListener; import android.widget.TextView; -import android.widget.Toast; import com.timsu.astrid.R; import com.todoroo.andlib.service.Autowired; @@ -132,12 +131,22 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList public static final String TASK_RABBIT_TOKEN = "task_rabbit_token"; //$NON-NLS-1$ private static final String TASK_RABBIT_POPOVER_PREF = "task_rabbit_popover"; //$NON-NLS-1$ + private static final String TASK_RABBIT_PREF_CITY_NAME = "task_rabbit_city_name"; //$NON-NLS-1$ + private static final String TASK_RABBIT_PREF_CITY_ID = "task_rabbit_city_id"; //$NON-NLS-1$ + private static final String TASK_RABBIT_PREF_CITY_LAT = "task_rabbit_city_lat"; //$NON-NLS-1$ + private static final String TASK_RABBIT_PREF_CITY_LNG = "task_rabbit_city_lng"; //$NON-NLS-1$ + + + public static final String CITY_NAME = "name"; //$NON-NLS-1$ + public static final String CITY_LAT = "lat"; //$NON-NLS-1$ + public static final String CITY_LNG = "lng"; //$NON-NLS-1$ + public static final String LOCATION_CONTAINER = "other_locations_attributes"; //$NON-NLS-1$ // Non-production values public static final String TASK_RABBIT_URL = "http://rs-astrid-api.taskrabbit.com"; //$NON-NLS-1$ public static final String TASK_RABBIT_CLIENT_ID = "fDTmGeR0uNCvoxopNyqsRWae8xOvbOBqC7jmHaxv"; //$NON-NLS-1$ public static final String TASK_RABBIT_CLIENT_APPLICATION_ID = "XBpKshU8utH5eaNmhky9N8aAId5rSLTh04Hi60Co"; //$NON-NLS-1$ - public static final String CITY_NAME = "task_rabbit_city_name"; //$NON-NLS-1$ + public static final String TASK_RABBIT_ID = "id"; //$NON-NLS-1$ private TaskRabbitTaskContainer taskRabbitTask; /* From tag settings */ @@ -290,7 +299,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList TaskRabbitNameControlSet descriptionControlSet = new TaskRabbitNameControlSet(this, R.layout.control_set_notes, R.layout.task_rabbit_row_description, titleID, i); try { - descriptionControlSet.readFromModel(new JSONObject().put("description", model.getValue(Task.NOTES)), "description", currentSelectedItem); + descriptionControlSet.readFromModel(new JSONObject().put(getString(arrayID), model.getValue(Task.NOTES)), getString(arrayID), currentSelectedItem); } catch (JSONException e) { e.printStackTrace(); } @@ -301,11 +310,6 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList controls.add(set); } } - - /* - if(TextUtils.isEmpty(taskDescription.getText())){ - taskDescription.setText(model.getValue(Task.NOTES)); - }*/ if(TextUtils.isEmpty(taskTitle.getText())) { taskTitle.setText(model.getValue(Task.TITLE)); } @@ -431,7 +435,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList } if(taskRabbitTask.getTaskID() != TaskRabbitTaskContainer.NO_ID) { - taskButton.setText("Already Posted!"); + taskButton.setText(getString(R.string.tr_button_already_posted)); taskButton.setEnabled(false); } else { @@ -467,21 +471,21 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList String descriptionKey = getString(R.string.tr_set_key_description); - String category = "Category: " + menuTitle.getText().toString() + "\n"; + String category = String.format("Category: %S\n", menuTitle.getText().toString()); //$NON-NLS-1$ parameters.put(descriptionKey, category); for (int i = 0; i < controls.size(); i++) { if (presetValues[i] == -1) continue; TaskRabbitSetListener set = controls.get(i); set.postToTaskRabbit(parameters, keys[i]); } - if (parameters.optJSONArray("other_locations_attributes") == null) { - parameters.put(getString(R.string.tr_attr_city_id), Preferences.getInt("task_rabbit_city_id", 1)); + if (parameters.optJSONArray(LOCATION_CONTAINER) == null) { + parameters.put(getString(R.string.tr_attr_city_id), Preferences.getInt(TASK_RABBIT_PREF_CITY_ID, 1)); parameters.put(getString(R.string.tr_attr_city_lat), true); } parameters.put(getString(R.string.tr_set_key_name), taskTitle.getText().toString()); parameters.put(getString(R.string.tr_set_key_name), taskTitle.getText().toString()); - return new JSONObject().put("task", parameters); + return new JSONObject().put("task", parameters); //$NON-NLS-1$ } @@ -516,7 +520,10 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList return null; } + private ProgressDialog progressDialog; + + @SuppressWarnings("nls") protected void submitTaskRabbit(){ if(!Preferences.isSet(TASK_RABBIT_TOKEN)){ @@ -535,18 +542,16 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList try { String urlCall = "tasks/"; if (taskRabbitTask.getTaskID() > 0) urlCall += taskRabbitTask.getTaskID(); - urlCall +="?client_id=" + TASK_RABBIT_CLIENT_ID; - Log.d("Tasks url:", taskRabbitURL(urlCall)); - Header authorization = new BasicHeader("Authorization", "OAuth " + Preferences.getStringValue(TASK_RABBIT_TOKEN)); //$NON-NLS-1$ - Header contentType = new BasicHeader("Content-Type", //$NON-NLS-1$ - "application/json"); //$NON-NLS-1$ + urlCall += String.format("?client_id=%S&client_application=%S", TASK_RABBIT_CLIENT_ID, TASK_RABBIT_CLIENT_APPLICATION_ID); + Header authorization = new BasicHeader("Authorization", "OAuth" + Preferences.getStringValue(TASK_RABBIT_TOKEN)); + Header contentType = new BasicHeader("Content-Type", "application/json"); String response = restClient.post(taskRabbitURL(urlCall), getTaskBody(), contentType, authorization); Log.d("Task rabbit response", response); JSONObject taskResponse = new JSONObject(response); - if(taskResponse.has("id")){ + if(taskResponse.has(TASK_RABBIT_ID)){ taskRabbitTask.setRemoteTaskData(response); - taskRabbitTask.setTaskID(taskResponse.optString("id")); + taskRabbitTask.setTaskID(taskResponse.optString(TASK_RABBIT_ID)); Message successMessage = new Message(); successMessage.what = 1; handler.sendMessage(successMessage); @@ -575,7 +580,6 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList try { taskRabbitTask.setLocalTaskData(serializeToJSON().toString()); } catch (JSONException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -583,15 +587,6 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList } - /* message callbacks */ - /** - * Show toast for task edit canceling - */ - private void showSuccessToast() { - Toast.makeText(this, "Task posted to Task Rabbit successfully!", - Toast.LENGTH_SHORT).show(); - } - private final Handler handler = new Handler() { @Override @@ -600,9 +595,9 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList case -1: AlertDialog.Builder adb = new AlertDialog.Builder(TaskRabbitActivity.this); - adb.setTitle("Error posting task"); - adb.setMessage("Please try again"); - adb.setPositiveButton("Close",null); + adb.setTitle(getString(R.string.tr_alert_title_fail)); + adb.setMessage(getString(R.string.tr_alert_message_fail)); + adb.setPositiveButton(getString(R.string.tr_alert_button_fail),null); adb.show(); break; case 0: break; @@ -624,12 +619,11 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList Intent intent = new Intent(this, OAuthLoginActivity.class); try { - String url = TASK_RABBIT_URL + "/api/authorize?client_id=" + TASK_RABBIT_CLIENT_ID; + String url = TASK_RABBIT_URL + "/api/authorize?client_id=" + TASK_RABBIT_CLIENT_ID; //$NON-NLS-1$ intent.putExtra(OAuthLoginActivity.URL_TOKEN, url); this.startActivityForResult(intent, REQUEST_CODE_TASK_RABBIT_OAUTH); StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_GL_START); } catch (Exception e) { - // handleError(e); e.printStackTrace(); } } @@ -648,17 +642,18 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList } + @SuppressWarnings("nls") private void buildAlertMessageNoGps() { final AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage("GPS needs to be enabled in order to add location based tasks. Do you want to enable it?") + builder.setMessage(getString(R.string.tr_alert_gps_title)) .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { - public void onClick(@SuppressWarnings("unused") final DialogInterface dialog, @SuppressWarnings("unused") final int id) { + public void onClick(final DialogInterface dialog, final int id) { startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { - public void onClick(final DialogInterface dialog, @SuppressWarnings("unused") final int id) { + public void onClick(final DialogInterface dialog, final int id) { dialog.cancel(); } }); @@ -669,40 +664,39 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList protected void saveUserInfo(String response) throws Exception { JSONObject userObject = new JSONObject(response); - JSONObject cityObject = userObject.getJSONObject("city"); - if (cityObject.has("name")){ - Preferences.setString("task_rabbit_city_name", cityObject.getString("name")); + JSONObject cityObject = userObject.getJSONObject("city"); //$NON-NLS-1$ + if (cityObject.has(CITY_NAME)){ + Preferences.setString(TASK_RABBIT_PREF_CITY_NAME, cityObject.getString(CITY_NAME)); } - if (cityObject.has("id")){ - Preferences.setInt("task_rabbit_city_id", cityObject.getInt("id")); + if (cityObject.has(TASK_RABBIT_ID)){ + Preferences.setInt(TASK_RABBIT_PREF_CITY_ID, cityObject.getInt(TASK_RABBIT_ID)); } - if (cityObject.has("lat")){ - // currentLocation.setLatitude(cityObject.getDouble("lat")); - Preferences.setString("task_rabbit_city_lat", String.valueOf(cityObject.getDouble("lat"))); + if (cityObject.has(CITY_LAT)){ + Preferences.setString(TASK_RABBIT_PREF_CITY_LAT, String.valueOf(cityObject.getDouble(CITY_LAT))); } - if (cityObject.has("lng")){ - // currentLocation.setLongitude(cityObject.getDouble("lng")); - Preferences.setString("task_rabbit_city_lng", String.valueOf(cityObject.getDouble("lng"))); + if (cityObject.has(CITY_LNG)){ + Preferences.setString(TASK_RABBIT_PREF_CITY_LNG, String.valueOf(cityObject.getDouble(CITY_LNG))); } } private String taskRabbitURL(String method) { - return TASK_RABBIT_URL + "/api/v1/"+ method; + return TASK_RABBIT_URL + "/api/v1/"+ method; //$NON-NLS-1$ } @Override public void onActivityResult (int requestCode, int resultCode, Intent data) { - Log.d("The actiivty result request code", "Rerjwklrw" + requestCode); if (requestCode == REQUEST_CODE_TASK_RABBIT_OAUTH && resultCode == Activity.RESULT_OK){ String result = data.getStringExtra(OAuthLoginActivity.DATA_RESPONSE); - if(result.contains("access_token=")) { + + String key = "access_token"; //$NON-NLS-1$ + if(result.contains(key)) { try { - result = result.substring(result.indexOf("access_token=")+"access_token=".length()); + + result = result.substring(result.indexOf(key)+key.length()); Preferences.setString(TASK_RABBIT_TOKEN, result); - String response = restClient.get(taskRabbitURL("account")); - Log.d("Task rabbit response", response); + String response = restClient.get(taskRabbitURL("account")); //$NON-NLS-1$ saveUserInfo(response); } catch (Exception e){ diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java index 0d02db0fb..aa3f67caa 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java @@ -16,7 +16,6 @@ import android.os.Handler; import android.os.Message; import android.support.v4.app.Fragment; import android.text.TextUtils; -import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; @@ -34,7 +33,6 @@ import com.todoroo.astrid.activity.TaskEditFragment; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.helper.TaskEditControlSet; -@SuppressWarnings("nls") public class TaskRabbitControlSet extends TaskEditControlSet implements AssignedChangedListener, LocationListener { @@ -134,7 +132,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned private void updateTaskRow(TaskRabbitTaskContainer container) { - displayText.setText("Task Rabbit Status"); + displayText.setText(fragment.getActivity().getString(R.string.tr_display_status)); JSONObject remoteData = container.getRemoteTaskData(); if (remoteData != null) { updateDisplay(remoteData); @@ -147,7 +145,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned * Show toast for task edit canceling */ private void showSuccessToast() { - Toast.makeText(fragment.getActivity(), "Task posted to Task Rabbit successfully!", + Toast.makeText(fragment.getActivity(), fragment.getActivity().getString(R.string.tr_success_toast), Toast.LENGTH_SHORT).show(); } @@ -166,7 +164,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned }; private String taskRabbitURL(String method) { - return String.format("%S/api/v1/%S?client_id=%S&client_application=%S", TaskRabbitActivity.TASK_RABBIT_URL, method, TaskRabbitActivity.TASK_RABBIT_CLIENT_ID, TaskRabbitActivity.TASK_RABBIT_CLIENT_APPLICATION_ID); + return String.format("%S/api/v1/%S?client_id=%S&client_application=%S", TaskRabbitActivity.TASK_RABBIT_URL, method, TaskRabbitActivity.TASK_RABBIT_CLIENT_ID, TaskRabbitActivity.TASK_RABBIT_CLIENT_APPLICATION_ID); //$NON-NLS-1$ } /** Fire task rabbit if assigned **/ @@ -219,17 +217,17 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned protected void updateStatus(JSONObject json){ - final int taskID = json.optInt("id"); //$NON-NLS-1$ + final int taskID = json.optInt(TaskRabbitActivity.TASK_RABBIT_ID); new Thread(new Runnable() { @Override public void run() { try { - String response = restClient.get(taskRabbitURL("tasks/" + taskID)); + String response = restClient.get(taskRabbitURL("tasks/" + taskID)); //$NON-NLS-1$ JSONObject taskResponse = new JSONObject(response); - if(taskResponse.has("id")){ + if(taskResponse.has(TaskRabbitActivity.TASK_RABBIT_ID)){ taskRabbitTask.setRemoteTaskData(response); - taskRabbitTask.setTaskID(taskResponse.optString("id")); + taskRabbitTask.setTaskID(taskResponse.optString(TaskRabbitActivity.TASK_RABBIT_ID)); Message successMessage = new Message(); successMessage.what = 2; handler.sendMessage(successMessage); @@ -263,11 +261,9 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned locationManager = (LocationManager) fragment.getActivity().getSystemService(Context.LOCATION_SERVICE); currentLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (currentLocation == null) { - Log.d("TRControlSet", "Fail current location is null"); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); } else { - Log.d("TRControlSet", "loading location and checking if we suppor it"); isEnabledForTRLocation = supportsCurrentLocation(); } } @@ -275,7 +271,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned public boolean supportsCurrentLocation() { if (currentLocation == null) return false; for (GeoPoint point : supportedLocations){ - Location city = new Location(""); + Location city = new Location(""); //$NON-NLS-1$ city.setLatitude(point.getLatitudeE6()/1E6); city.setLongitude(point.getLongitudeE6()/1E6); float distance = currentLocation.distanceTo(city); @@ -291,7 +287,6 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned @Override public void onLocationChanged(Location location) { - Log.d("TRControlSet", "Location changed and found"); currentLocation = location; isEnabledForTRLocation = supportsCurrentLocation(); locationManager.removeUpdates(this); diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationControlSet.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationControlSet.java index b36a2a851..629197685 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationControlSet.java @@ -1,8 +1,6 @@ package com.todoroo.astrid.taskrabbit; import java.util.HashMap; -import java.util.List; -import java.util.Locale; import org.json.JSONArray; import org.json.JSONException; @@ -11,11 +9,8 @@ import org.json.JSONObject; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; -import android.location.Address; -import android.location.Geocoder; import android.location.Location; import android.text.TextUtils; -import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; @@ -30,7 +25,6 @@ import com.todoroo.astrid.helper.TaskEditControlSet; import com.todoroo.astrid.taskrabbit.TaskRabbitActivity.ActivityResultSetListener; import com.todoroo.astrid.taskrabbit.TaskRabbitActivity.TaskRabbitSetListener; -@SuppressWarnings("nls") public class TaskRabbitLocationControlSet extends TaskEditControlSet implements TaskRabbitSetListener, ActivityResultSetListener { private final TextView displayText; @@ -58,7 +52,7 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements @Override public void onClick(View v) { try { - Class.forName("com.google.android.maps.MapView"); + Class.forName("com.google.android.maps.MapView"); //$NON-NLS-1$ Intent mapIntent = new Intent(activity, TaskRabbitMapActivity.class); activity.startActivityForResult(mapIntent, REQUEST_CODE_TASK_RABBIT_LOCATION); } catch (Exception e) { @@ -69,6 +63,7 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements } + @SuppressWarnings("nls") protected void manualLocationEntry() { LinearLayout layout = new LinearLayout(activity); layout.setOrientation(LinearLayout.VERTICAL); @@ -102,12 +97,12 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements private void parseTaskLocation(JSONObject json) { if (json == null) return; - if (json.has("name")) - locationName = json.optString("name"); - if(json.has("lng")) { - location = new Location(""); - location.setLatitude(json.optInt("lng")); - location.setLatitude(json.optInt("lat")); + if (json.has(TaskRabbitActivity.CITY_NAME)) + locationName = json.optString(TaskRabbitActivity.CITY_NAME); + if(json.has(TaskRabbitActivity.CITY_LNG)) { + location = new Location(""); //$NON-NLS-1$ + location.setLongitude(json.optInt(TaskRabbitActivity.CITY_LNG)); + location.setLatitude(json.optInt(TaskRabbitActivity.CITY_LAT)); } } @@ -115,20 +110,19 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements if (!TextUtils.isEmpty(locationName)) return locationName; - return "Location is set"; + return activity.getString(R.string.tr_default_location_name); } public boolean activityResult (int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_TASK_RABBIT_LOCATION && resultCode == Activity.RESULT_OK) { - int lng = data.getIntExtra("lng", 0); - int lat = data.getIntExtra("lat", 0); - locationName = data.getStringExtra("name"); - location = new Location(""); + int lng = data.getIntExtra(TaskRabbitActivity.CITY_LNG, 0); + int lat = data.getIntExtra(TaskRabbitActivity.CITY_LAT, 0); + locationName = data.getStringExtra(TaskRabbitActivity.CITY_NAME); + location = new Location(""); //$NON-NLS-1$ location.setLatitude(locationToDouble(lat)); location.setLongitude(locationToDouble(lng)); displayEdit.setText(getLocationText()); manualEntry = null; - getAddressFromLocation(location); return true; } @@ -143,27 +137,6 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements return (int)(location * 1e6); } - private void getAddressFromLocation(Location newLocation){ - try { - Geocoder geocoder = new Geocoder(activity, Locale.getDefault()); - // Acquire a reference to the system Location Manager - List
addresses = geocoder.getFromLocation(newLocation.getLatitude(), - newLocation.getLongitude(), 1); - if (addresses != null){ - for (Address address : addresses){ - updateAddress(address); - } - } - } catch (Exception e) { - Log.d("Location error", e.toString()); - } - } - private void updateAddress(Address address){ - if(address.getLocality() != null && address.getPostalCode() != null){ - locationName += "\n"+ (address.getLocality() + ", " + address.getPostalCode()); - // currentAddress = address; - } - } @Override public void readFromModel(JSONObject json, String key, int mode) { @@ -184,12 +157,12 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements @Override public void postToTaskRabbit(JSONObject json, String key) throws JSONException { - JSONArray locations = json.optJSONArray("other_locations_attributes"); + JSONArray locations = json.optJSONArray(TaskRabbitActivity.LOCATION_CONTAINER); if (locations == null) { locations = new JSONArray(); } locations.put(getTaskLocation()); - json.put("other_locations_attributes", locations); + json.put(TaskRabbitActivity.LOCATION_CONTAINER, locations); } @@ -200,14 +173,14 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements try { JSONObject locationObject = new JSONObject(); if(!TextUtils.isEmpty(locationName)){ - locationObject.put("name", locationName); + locationObject.put(TaskRabbitActivity.CITY_NAME, locationName); } else { - locationObject.put("name", displayText.getText().toString()); + locationObject.put(TaskRabbitActivity.CITY_NAME, displayText.getText().toString()); } if(location != null) { - locationObject.put("lng", location.getLongitude()); - locationObject.put("lat", location.getLatitude()); + locationObject.put(TaskRabbitActivity.CITY_LNG, location.getLongitude()); + locationObject.put(TaskRabbitActivity.CITY_LAT, location.getLatitude()); } return locationObject; } diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java index f9aec207c..01bb0e49d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java @@ -5,8 +5,6 @@ import java.util.Locale; import android.app.AlertDialog; import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; import android.graphics.drawable.Drawable; import android.location.Address; import android.location.Geocoder; @@ -16,9 +14,7 @@ import android.location.LocationManager; import android.os.Bundle; import android.os.Handler; import android.os.Message; -import android.provider.Settings; import android.text.TextUtils; -import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; @@ -36,7 +32,7 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen private MapView mapView; private MapController mapController; - public Location location; + public Location currentLocation; private EditText searchText; private TaskRabbitMapOverlayItem currentOverlayItem; private String locationAddress; @@ -76,10 +72,6 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen } - if ( !locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) || !locationManager.isProviderEnabled( LocationManager.NETWORK_PROVIDER )) { - buildAlertMessageNoGps(); - } - searchText=(EditText)findViewById(R.id.search_text); @@ -104,24 +96,6 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen } } - private void buildAlertMessageNoGps() { - final AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage("GPS needs to be enabled in order to add location based tasks. Do you want to enable it?") - .setCancelable(false) - .setPositiveButton("Yes", new DialogInterface.OnClickListener() { - public void onClick(final DialogInterface dialog, final int id) { - startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)); - } - }) - .setNegativeButton("No", new DialogInterface.OnClickListener() { - public void onClick(final DialogInterface dialog, final int id) { - dialog.cancel(); - } - }); - final AlertDialog alert = builder.create(); - alert.show(); - } - private final Handler handler = new Handler() { @@ -137,8 +111,8 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen case -1: AlertDialog.Builder adb = new AlertDialog.Builder(TaskRabbitMapActivity.this); - adb.setTitle("Google Map"); - adb.setMessage("Please Provide the Proper Place"); + adb.setTitle(getString(R.string.tr_alert_location_fail_title)); + adb.setMessage(getString(R.string.tr_alert_location_fail_message)); adb.setPositiveButton("Close",null); adb.show(); } @@ -201,8 +175,8 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen } protected OverlayItem createOverlayItem(GeoPoint q) { - OverlayItem overlayitem = new OverlayItem(q, "Set this location", - "Use this location for TaskRabbit"); + OverlayItem overlayitem = new OverlayItem(q, getString(R.string.tr_alert_location_clicked_title), + getString(R.string.tr_alert_location_clicked_message)); return overlayitem; } @@ -217,14 +191,14 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen } } } catch (Exception e) { - Log.d("Location error", e.toString()); + e.printStackTrace(); } } private void updateAddress(Address address){ if(address.getLocality() != null && address.getPostalCode() != null){ - locationAddress = ""; + locationAddress = ""; //$NON-NLS-1$ for (int i = 0; i < address.getMaxAddressLineIndex(); i++){ - locationAddress += address.getAddressLine(i) + ", "; + locationAddress += address.getAddressLine(i) + ", "; //$NON-NLS-1$ } } } @@ -236,11 +210,11 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen } private void updateLocationOverlay() { - if (location == null) { return; }; + if (currentLocation == null) { return; }; List mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().getDrawable(R.drawable.icon_locale); TaskRabbitMapOverlayItem myItemizedOverlay = new TaskRabbitMapOverlayItem(drawable); - GeoPoint point = new GeoPoint((int)(location.getLatitude() * 1E6), (int)(location.getLongitude() * 1E6)); + GeoPoint point = new GeoPoint((int)(currentLocation.getLatitude() * 1E6), (int)(currentLocation.getLongitude() * 1E6)); OverlayItem overlayitem = createOverlayItem(point); myItemizedOverlay.addOverlay(overlayitem); @@ -251,7 +225,7 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen if (location != null) { double lat = location.getLatitude(); double lng = location.getLongitude(); - this.location = location; + this.currentLocation = location; GeoPoint p = new GeoPoint((int) lat * 1000000, (int) lng * 1000000); updateLocationOverlay(); mapController.animateTo(p); diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java index 0ad06a2c7..96ef93171 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java @@ -12,6 +12,7 @@ import android.widget.RelativeLayout; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.OverlayItem; +import com.timsu.astrid.R; public class TaskRabbitMapOverlayItem extends ItemizedOverlay { private final ArrayList mOverlays = new ArrayList(); @@ -64,7 +65,7 @@ public class TaskRabbitMapOverlayItem extends ItemizedOverlay { } selectedItem = mOverlays.get(index); AlertDialog.Builder dialog = new AlertDialog.Builder(mActivity); - dialog.setTitle("Set this as your location?"); + dialog.setTitle(mActivity.getString(R.string.tr_alert_location_clicked_title)); dialog.setMessage(selectedItem.getSnippet()); dialog.setIcon( android.R.drawable.ic_dialog_alert).setPositiveButton( diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java index 1f34adde9..46584f0ad 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java @@ -11,7 +11,6 @@ import android.content.Intent; import android.graphics.Bitmap; import android.text.TextUtils; import android.util.Base64; -import android.util.Log; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; @@ -38,7 +37,6 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab private final ImageButton pictureButton; private Bitmap pendingCommentPicture = null; - private int cameraButton; public TaskRabbitNameControlSet(Activity activity, int viewLayout, @@ -82,7 +80,9 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab json.put(key, editText.getText().toString()); } + @Override + @SuppressWarnings("nls") public void postToTaskRabbit(JSONObject json, String key) throws JSONException { String nameKey = activity.getString(R.string.tr_set_key_description); if (key.equals(activity.getString(R.string.tr_set_key_name)) && json.has(nameKey)) { @@ -97,7 +97,6 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab JSONObject pictureArray = new JSONObject(); pictureArray.put("image", picture); json.put("uploaded_photos_attributes", new JSONObject().put("1", pictureArray)); - Log.d("The task json", json.toString()); } } @@ -119,7 +118,7 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab editText.setHint(displayText.getText().toString()); return; } - String value = json.optString(key, ""); + String value = json.optString(key, ""); //$NON-NLS-1$ if (!TextUtils.isEmpty(value)) { editText.setTextKeepState(value); notesPreview.setText(value); @@ -134,7 +133,6 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab CameraResultCallback callback = new CameraResultCallback() { @Override public void handleCameraResult(Bitmap bitmap) { - Log.d("CAMERA CLALLBACK", "PICTURE SHOULD BE SET"); pendingCommentPicture = bitmap; pictureButton.setImageBitmap(pendingCommentPicture); } @@ -154,6 +152,7 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab @Override public void readFromTask(Task task) { + // } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitSpinnerControlSet.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitSpinnerControlSet.java index f47319864..d5ce84dbc 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitSpinnerControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitSpinnerControlSet.java @@ -6,7 +6,6 @@ import org.json.JSONObject; import android.app.Activity; import android.content.res.TypedArray; import android.text.TextUtils; -import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; @@ -23,16 +22,14 @@ import com.todoroo.astrid.taskrabbit.TaskRabbitActivity.TaskRabbitSetListener; public class TaskRabbitSpinnerControlSet extends TaskEditControlSet implements TaskRabbitSetListener{ private final Spinner spinner; - private final int setID; private final int titleID; private final TextView displayText; private final TextView displayEdit; - private ArrayAdapter adapter; + private ArrayAdapter adapter; private final Activity activity; public TaskRabbitSpinnerControlSet(final Activity activity, int viewLayout, int title, int setID) { super(activity, viewLayout); - this.setID = setID; this.titleID = title; this.activity = activity; // DependencyInjectionService.getInstance().inject(this); @@ -67,17 +64,15 @@ public class TaskRabbitSpinnerControlSet extends TaskEditControlSet implements T @Override public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { - Log.d("SELECTED ITEM", "SLECTED :" + arg2 + " ACTUAL: " + spinner.getSelectedItemPosition() + " STRING: " + spinner.getSelectedItem().toString()); displayEdit.setText(getDisplayEditText()); } @Override public void onNothingSelected(AdapterView arg0) { - + // } }); - Log.d("SELECTED ITEM", " ACTUAL: " + spinner.getSelectedItemPosition()); getView().setOnClickListener(getDisplayClickListener()); } @@ -114,14 +109,12 @@ public class TaskRabbitSpinnerControlSet extends TaskEditControlSet implements T @Override public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { - Log.d("SELECTED ITEM", "SLECTED :" + arg2 + " ACTUAL: " + spinner.getSelectedItemPosition() + " STRING: " + spinner.getSelectedItem().toString()); - displayEdit.setText(getDisplayEditText()); } @Override public void onNothingSelected(AdapterView arg0) { - + // } }); } @@ -143,12 +136,10 @@ public class TaskRabbitSpinnerControlSet extends TaskEditControlSet implements T } int intValue = json.optInt(key, 0); - Log.d("iii", "" + spinner.getCount()); if (intValue < spinner.getCount()) { spinner.setSelection(intValue); displayEdit.setText(getDisplayEditText()); } - Log.d("dfhjskhfds", ""+intValue); } private String getDisplayEditText() { @@ -169,11 +160,12 @@ public class TaskRabbitSpinnerControlSet extends TaskEditControlSet implements T int index = conversion.lastIndexOf('$'); String cents = conversion.substring(index+1); if(TextUtils.isEmpty(cents)) return 0; - Log.d("PARSING TO CHANGE", cents); return Integer.parseInt(cents); } + @Override + @SuppressWarnings("nls") public void postToTaskRabbit(JSONObject json, String key) throws JSONException { if(spinner.getSelectedItem() != null){ @@ -187,7 +179,7 @@ public class TaskRabbitSpinnerControlSet extends TaskEditControlSet implements T } else if (key.contains("description")) { String description = json.optString("description", ""); - description += String.format("\n%S %S", key, spinner.getSelectedItem().toString()); //$NON-NLS-1$ + description += String.format("\n%S %S", key, spinner.getSelectedItem().toString()); } else { json.put(key, spinnerString); diff --git a/astrid/res/values/keys-taskrabbit.xml b/astrid/res/values/keys-taskrabbit.xml index 7e82251a5..f77f5b03f 100644 --- a/astrid/res/values/keys-taskrabbit.xml +++ b/astrid/res/values/keys-taskrabbit.xml @@ -392,5 +392,38 @@ $95 - + + < $25 + < $50 + < $100 + > $100 + + + + + + Already Posted! + Error posting task + Please try again + Close + GPS needs to be enabled in order to add location based tasks. Do you want to enable it? + Yes + No + + + Current Location + + + Task posted to Task Rabbit successfully! + Task Rabbit Status + + + + No Location Found + Sorry, could not find the location for the address you entered + Set this location + Use this location for TaskRabbit + + + \ No newline at end of file From db373ba6afbd95035b8ebfd113a08519af9f6d42 Mon Sep 17 00:00:00 2001 From: Andrew Shaw Date: Fri, 10 Feb 2012 18:09:12 -0800 Subject: [PATCH 2/3] Fixing url formatting --- .../astrid/taskrabbit/TaskRabbitActivity.java | 17 +++++++---------- .../astrid/taskrabbit/TaskRabbitControlSet.java | 6 ++++-- .../taskrabbit/TaskRabbitMapOverlayItem.java | 10 +++++----- .../taskrabbit/TaskRabbitNameControlSet.java | 4 ++-- astrid/res/values/keys-taskrabbit.xml | 2 +- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java index e45ecd889..4fa2fcec5 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java @@ -31,7 +31,6 @@ import android.support.v4.app.ActionBar; import android.support.v4.app.FragmentActivity; import android.support.v4.view.MenuItem; import android.text.TextUtils; -import android.util.Log; import android.util.TypedValue; import android.view.View; import android.view.View.OnClickListener; @@ -292,12 +291,12 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList } else if(arrayID == R.string.tr_set_key_name) { TaskRabbitNameControlSet nameControlSet = new TaskRabbitNameControlSet(this, - R.layout.control_set_notes, R.layout.task_rabbit_row, titleID, i); + R.layout.control_set_notes, R.layout.task_rabbit_row, titleID); controls.add(nameControlSet); } else if(arrayID == R.string.tr_set_key_description) { TaskRabbitNameControlSet descriptionControlSet = new TaskRabbitNameControlSet(this, - R.layout.control_set_notes, R.layout.task_rabbit_row_description, titleID, i); + R.layout.control_set_notes, R.layout.task_rabbit_row_description, titleID); try { descriptionControlSet.readFromModel(new JSONObject().put(getString(arrayID), model.getValue(Task.NOTES)), getString(arrayID), currentSelectedItem); } catch (JSONException e) { @@ -336,7 +335,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList int[] presetValues = getPresetValues(mode); TypedArray keys = getResources().obtainTypedArray(R.array.tr_default_set_key); JSONObject parameters = defaultValuesToJSON(keys, presetValues); - for (int i = 1; i < controls.size(); i++) { + for (int i = 0; i < controls.size(); i++) { if (presetValues[i] == -1) continue; TaskRabbitSetListener set = controls.get(i); int arrayID = keys.getResourceId(i, 0); @@ -471,7 +470,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList String descriptionKey = getString(R.string.tr_set_key_description); - String category = String.format("Category: %S\n", menuTitle.getText().toString()); //$NON-NLS-1$ + String category = String.format("Category: %s\n", menuTitle.getText().toString()); //$NON-NLS-1$ parameters.put(descriptionKey, category); for (int i = 0; i < controls.size(); i++) { if (presetValues[i] == -1) continue; @@ -542,12 +541,11 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList try { String urlCall = "tasks/"; if (taskRabbitTask.getTaskID() > 0) urlCall += taskRabbitTask.getTaskID(); - urlCall += String.format("?client_id=%S&client_application=%S", TASK_RABBIT_CLIENT_ID, TASK_RABBIT_CLIENT_APPLICATION_ID); - Header authorization = new BasicHeader("Authorization", "OAuth" + Preferences.getStringValue(TASK_RABBIT_TOKEN)); + urlCall += String.format("?client_id=%s&client_application=%s", TASK_RABBIT_CLIENT_ID, TASK_RABBIT_CLIENT_APPLICATION_ID); + Header authorization = new BasicHeader("Authorization", "OAuth " + Preferences.getStringValue(TASK_RABBIT_TOKEN)); Header contentType = new BasicHeader("Content-Type", "application/json"); String response = restClient.post(taskRabbitURL(urlCall), getTaskBody(), contentType, authorization); - Log.d("Task rabbit response", response); JSONObject taskResponse = new JSONObject(response); if(taskResponse.has(TASK_RABBIT_ID)){ taskRabbitTask.setRemoteTaskData(response); @@ -558,7 +556,6 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList } } catch (Exception e){ - e.printStackTrace(); Message failureMessage = new Message(); failureMessage.what = -1; handler.sendMessage(failureMessage); @@ -690,7 +687,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList if (requestCode == REQUEST_CODE_TASK_RABBIT_OAUTH && resultCode == Activity.RESULT_OK){ String result = data.getStringExtra(OAuthLoginActivity.DATA_RESPONSE); - String key = "access_token"; //$NON-NLS-1$ + String key = "access_token="; //$NON-NLS-1$ if(result.contains(key)) { try { diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java index aa3f67caa..bee941402 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitControlSet.java @@ -164,7 +164,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned }; private String taskRabbitURL(String method) { - return String.format("%S/api/v1/%S?client_id=%S&client_application=%S", TaskRabbitActivity.TASK_RABBIT_URL, method, TaskRabbitActivity.TASK_RABBIT_CLIENT_ID, TaskRabbitActivity.TASK_RABBIT_CLIENT_APPLICATION_ID); //$NON-NLS-1$ + return String.format("%s/api/v1/%s?client_id=%s&client_application=%s", TaskRabbitActivity.TASK_RABBIT_URL, method, TaskRabbitActivity.TASK_RABBIT_CLIENT_ID, TaskRabbitActivity.TASK_RABBIT_CLIENT_APPLICATION_ID); //$NON-NLS-1$ } /** Fire task rabbit if assigned **/ @@ -217,12 +217,14 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned protected void updateStatus(JSONObject json){ - final int taskID = json.optInt(TaskRabbitActivity.TASK_RABBIT_ID); + final long taskID = json.optLong(TaskRabbitActivity.TASK_RABBIT_ID); + if (taskID == TaskRabbitTaskContainer.NO_ID) return; new Thread(new Runnable() { @Override public void run() { try { + String response = restClient.get(taskRabbitURL("tasks/" + taskID)); //$NON-NLS-1$ JSONObject taskResponse = new JSONObject(response); if(taskResponse.has(TaskRabbitActivity.TASK_RABBIT_ID)){ diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java index 96ef93171..d1a958c95 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapOverlayItem.java @@ -64,10 +64,10 @@ public class TaskRabbitMapOverlayItem extends ItemizedOverlay { return false; } selectedItem = mOverlays.get(index); - AlertDialog.Builder dialog = new AlertDialog.Builder(mActivity); - dialog.setTitle(mActivity.getString(R.string.tr_alert_location_clicked_title)); - dialog.setMessage(selectedItem.getSnippet()); - dialog.setIcon( + AlertDialog.Builder dialogPrompt = new AlertDialog.Builder(mActivity); + dialogPrompt.setTitle(mActivity.getString(R.string.tr_alert_location_clicked_title)); + dialogPrompt.setMessage(selectedItem.getSnippet()); + dialogPrompt.setIcon( android.R.drawable.ic_dialog_alert).setPositiveButton( android.R.string.ok, new DialogInterface.OnClickListener() { @SuppressWarnings("nls") @@ -80,7 +80,7 @@ public class TaskRabbitMapOverlayItem extends ItemizedOverlay { mActivity.finish(); } }).setNegativeButton(android.R.string.cancel, null); - dialog.show(); + dialogPrompt.show(); mActivity.setSearchTextForCurrentAddress(); return true; diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java index 46584f0ad..ad52f396b 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java @@ -40,14 +40,14 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab public TaskRabbitNameControlSet(Activity activity, int viewLayout, - int displayViewLayout, int titleID, int i) { + int displayViewLayout, int titleID) { super(activity, viewLayout, displayViewLayout, titleID); editText = (EditText) getView().findViewById(R.id.notes); notesPreview = (TextView) getDisplayView().findViewById(R.id.display_row_edit); notesBody = (LinearLayout) getDisplayView().findViewById(R.id.notes_body); dialog.getWindow() .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - displayText.setText(activity.getString(titleID));; + displayText.setText(activity.getString(titleID)); editText.setMaxLines(Integer.MAX_VALUE); diff --git a/astrid/res/values/keys-taskrabbit.xml b/astrid/res/values/keys-taskrabbit.xml index f77f5b03f..d1231624e 100644 --- a/astrid/res/values/keys-taskrabbit.xml +++ b/astrid/res/values/keys-taskrabbit.xml @@ -174,7 +174,7 @@ Type - Name + Restaurant Name Location Skill Required Duration From 878713827c9524c6b18235098f3e7378909f219d Mon Sep 17 00:00:00 2001 From: Andrew Shaw Date: Fri, 10 Feb 2012 18:14:41 -0800 Subject: [PATCH 3/3] Changing the rest of the location icons to stars --- .../com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java index 01bb0e49d..18a169032 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java @@ -143,7 +143,7 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen (int) (addresses.get(0).getLongitude() * 1E6)); Drawable drawable = TaskRabbitMapActivity.this.getResources().getDrawable( - R.drawable.icon_locale); + android.R.drawable.star_big_on); currentOverlayItem = new TaskRabbitMapOverlayItem(drawable, TaskRabbitMapActivity.this); mapController.animateTo(q); @@ -212,7 +212,7 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen private void updateLocationOverlay() { if (currentLocation == null) { return; }; List mapOverlays = mapView.getOverlays(); - Drawable drawable = this.getResources().getDrawable(R.drawable.icon_locale); + Drawable drawable = this.getResources().getDrawable(android.R.drawable.star_big_on); TaskRabbitMapOverlayItem myItemizedOverlay = new TaskRabbitMapOverlayItem(drawable); GeoPoint point = new GeoPoint((int)(currentLocation.getLatitude() * 1E6), (int)(currentLocation.getLongitude() * 1E6));