diff options
Diffstat (limited to 'src/net/cbaines/suma/POIView.java')
-rw-r--r-- | src/net/cbaines/suma/POIView.java | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/net/cbaines/suma/POIView.java b/src/net/cbaines/suma/POIView.java index b27b4f3..95c571c 100644 --- a/src/net/cbaines/suma/POIView.java +++ b/src/net/cbaines/suma/POIView.java @@ -20,6 +20,7 @@ package net.cbaines.suma; import android.content.Context; +import android.preference.PreferenceManager; import android.util.Log; import android.view.Display; import android.view.Gravity; @@ -27,7 +28,7 @@ import android.view.WindowManager; import android.widget.LinearLayout; import android.widget.TextView; -public class POIView extends LinearLayout { +public class POIView extends LinearLayout implements Preferences { private final static String TAG = "POIView"; @@ -37,6 +38,8 @@ public class POIView extends LinearLayout { private LayoutParams textLayoutParams; + private boolean identifiersEnabled; + final int width; public POIView(Context context, POI poi) { @@ -46,6 +49,9 @@ public class POIView extends LinearLayout { public POIView(Context context, POI poi, int distInM) { super(context); + identifiersEnabled = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SHOW_IDENTIFIERS, + SHOW_IDENTIFIERS_ENABLED_BY_DEFAULT); + Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); width = display.getWidth(); // int height = display.getHeight(); @@ -85,14 +91,22 @@ public class POIView extends LinearLayout { Building building = (Building) poi; // Log.i(TAG, "Its a building of name " + building.name); - name.setText(building.name + " (" + building.id + ")"); + if (identifiersEnabled) { + name.setText(building.name + " (" + building.id + ")"); + } else { + name.setText(building.name); + } } else if (poi.type == POI.BUS_STOP) { BusStop busStop = (BusStop) poi; // Log.i(TAG, "Its a bus stop of description " + // busStop.description); - name.setText(busStop.description + " (" + busStop.id + ")"); + if (identifiersEnabled) { + name.setText(busStop.description + " (" + busStop.id + ")"); + } else { + name.setText(busStop.description); + } routes.setRoutes(busStop.routes); @@ -100,8 +114,11 @@ public class POIView extends LinearLayout { Site site = (Site) poi; // Log.i(TAG, "Its a site of name " + site.name); - - name.setText(site.name + " (" + site.id + ")"); + if (identifiersEnabled) { + name.setText(site.name + " (" + site.id + ")"); + } else { + name.setText(site.name); + } } else { Log.w(TAG, "Cant identify " + poi.type); @@ -121,5 +138,4 @@ public class POIView extends LinearLayout { // Log.w("POIView", "No dist avalible for S" + poi.id); } } - }
\ No newline at end of file |