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){
e.printStackTrace();
}
return;
}
}
else {
@ -709,6 +710,8 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList
}
}
}
loadLocation();
setupListView();
}
@Override
@ -799,7 +802,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList
private void setupListView() {
String[] keys = getResources().getStringArray(R.array.tr_preset_types);
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)};
}
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 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(37739230, -122439880),
new GeoPoint(40714350, -74005970),
@ -266,17 +266,17 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
}
else {
isEnabledForTRLocation = supportsCurrentLocation();
isEnabledForTRLocation = supportsCurrentLocation(currentLocation);
}
}
public boolean supportsCurrentLocation() {
if (currentLocation == null) return false;
public static boolean supportsCurrentLocation(Location location) {
if (location == null) return false;
for (GeoPoint point : supportedLocations){
Location city = new Location(""); //$NON-NLS-1$
city.setLatitude(point.getLatitudeE6()/1E6);
city.setLongitude(point.getLongitudeE6()/1E6);
float distance = currentLocation.distanceTo(city);
float distance = location.distanceTo(city);
if (distance < RADIUS_250_MILES) {
return true;
}
@ -290,7 +290,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
@Override
public void onLocationChanged(Location location) {
currentLocation = location;
isEnabledForTRLocation = supportsCurrentLocation();
isEnabledForTRLocation = supportsCurrentLocation(currentLocation);
locationManager.removeUpdates(this);
locationManager = null;

@ -69,7 +69,7 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements
layout.setOrientation(LinearLayout.VERTICAL);
LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
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>();
for(String field : fields) {
EditText et = new EditText(activity);

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

Loading…
Cancel
Save