Merge remote-tracking branch 'upstream/120210_as_warnings_and_log_polish' into 4.0

pull/14/head
Sam Bosley 13 years ago
commit 704577f750

@ -699,6 +699,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList
catch (Exception e){ catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
return;
} }
} }
else { else {
@ -709,6 +710,8 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList
} }
} }
} }
loadLocation();
setupListView();
} }
@Override @Override
@ -799,7 +802,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList
private void setupListView() { private void setupListView() {
String[] keys = getResources().getStringArray(R.array.tr_preset_types); String[] keys = getResources().getStringArray(R.array.tr_preset_types);
boolean locationEnabled = getIntent().getBooleanExtra(TaskRabbitControlSet.LOCATION_ENABLED, false); boolean locationEnabled = getIntent().getBooleanExtra(TaskRabbitControlSet.LOCATION_ENABLED, false);
if (!locationEnabled) { if (!locationEnabled && !TaskRabbitControlSet.supportsCurrentLocation(currentLocation)) {
keys = new String[]{ getResources().getString(R.string.tr_type_virtual)}; keys = new String[]{ getResources().getString(R.string.tr_type_virtual)};
} }
adapter = new ArrayAdapter<String>(this, R.layout.task_rabbit_menu_row, keys); adapter = new ArrayAdapter<String>(this, R.layout.task_rabbit_menu_row, keys);

@ -58,7 +58,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
public boolean isEnabledForTRLocation = false; public boolean isEnabledForTRLocation = false;
public static final String LOCATION_ENABLED = "location_enabled"; //$NON-NLS-1$ public static final String LOCATION_ENABLED = "location_enabled"; //$NON-NLS-1$
private final GeoPoint[] supportedLocations = { private static final GeoPoint[] supportedLocations = {
new GeoPoint(42358430, -71059770), // new GeoPoint(42358430, -71059770), //
new GeoPoint(37739230, -122439880), new GeoPoint(37739230, -122439880),
new GeoPoint(40714350, -74005970), new GeoPoint(40714350, -74005970),
@ -266,17 +266,17 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
} }
else { else {
isEnabledForTRLocation = supportsCurrentLocation(); isEnabledForTRLocation = supportsCurrentLocation(currentLocation);
} }
} }
public boolean supportsCurrentLocation() { public static boolean supportsCurrentLocation(Location location) {
if (currentLocation == null) return false; if (location == null) return false;
for (GeoPoint point : supportedLocations){ for (GeoPoint point : supportedLocations){
Location city = new Location(""); //$NON-NLS-1$ Location city = new Location(""); //$NON-NLS-1$
city.setLatitude(point.getLatitudeE6()/1E6); city.setLatitude(point.getLatitudeE6()/1E6);
city.setLongitude(point.getLongitudeE6()/1E6); city.setLongitude(point.getLongitudeE6()/1E6);
float distance = currentLocation.distanceTo(city); float distance = location.distanceTo(city);
if (distance < RADIUS_250_MILES) { if (distance < RADIUS_250_MILES) {
return true; return true;
} }
@ -290,7 +290,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
@Override @Override
public void onLocationChanged(Location location) { public void onLocationChanged(Location location) {
currentLocation = location; currentLocation = location;
isEnabledForTRLocation = supportsCurrentLocation(); isEnabledForTRLocation = supportsCurrentLocation(currentLocation);
locationManager.removeUpdates(this); locationManager.removeUpdates(this);
locationManager = null; locationManager = null;

@ -69,7 +69,7 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements
layout.setOrientation(LinearLayout.VERTICAL); layout.setOrientation(LinearLayout.VERTICAL);
LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT); LayoutParams.WRAP_CONTENT);
final String[] fields = new String[] { "Address", "City", "State", "Zip" }; final String[] fields = new String[] { "Name","Address", "City", "State", "Zip" };
final HashMap<String, EditText> views = new HashMap<String, EditText>(); final HashMap<String, EditText> views = new HashMap<String, EditText>();
for(String field : fields) { for(String field : fields) {
EditText et = new EditText(activity); EditText et = new EditText(activity);

@ -385,13 +385,15 @@
<style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator"> <style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:background">?attr/asEditTabBackground</item> <item name="android:background">?attr/asEditTabBackground</item>
<item name="android:paddingLeft">0dip</item>
<item name="android:paddingRight">0dip</item>
</style> </style>
<style name="CustomTabPageIndicator.Text" parent="Widget.TabPageIndicator.Text"> <style name="CustomTabPageIndicator.Text" parent="Widget.TabPageIndicator.Text">
<item name="android:textColor">?attr/asTextColor</item> <item name="android:textColor">?attr/asTextColor</item>
<item name="android:textSize">15sp</item> <item name="android:textSize">15sp</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
<item name="android:layout_marginLeft">5dip</item> <item name="android:layout_marginLeft">0dip</item>
<item name="android:layout_marginRight">5dip</item> <item name="android:layout_marginRight">0dip</item>
</style> </style>
</resources> </resources>

Loading…
Cancel
Save