Skip to content

Commit

Permalink
fixing indentation, reverting usage of generics feature not available…
Browse files Browse the repository at this point in the history
… in java 1.6
  • Loading branch information
lucky-bai committed Aug 8, 2014
1 parent cf37858 commit b82c7ad
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 48 deletions.
3 changes: 2 additions & 1 deletion workspace/WATisRain/gen/com/lucky/watisrain/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static final class menu {
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int hello_world=0x7f050002;
public static final int select_destination_instruction=0x7f050003;
public static final int select_start_instruction=0x7f050002;
}
public static final class style {
/**
Expand Down
50 changes: 25 additions & 25 deletions workspace/WATisRain/src/com/lucky/watisrain/map/DirectionsView.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ public DirectionsView(Context context, AttributeSet attrs) {
setOnClickListener(this);
}

public void selectDestination(String destinationName) {
String selectionHtml = "Selected: <b>" + destinationName + "</b>";
textview.setText(Html.fromHtml(selectionHtml +
"<br>" + getResources().getString(R.string.select_destination_instruction)));
current_state = STATE_NONE;
}
public void selectDestination(String destinationName) {
String selectionHtml = "Selected: <b>" + destinationName + "</b>";
textview.setText(Html.fromHtml(selectionHtml +
"<br>" + getResources().getString(R.string.select_destination_instruction)));
current_state = STATE_NONE;
}

public void unselectDestination() {
textview.setText(getResources().getString(R.string.select_start_instruction));
current_state = STATE_NONE;
}
public void unselectDestination() {
textview.setText(getResources().getString(R.string.select_start_instruction));
current_state = STATE_NONE;
}


@Override
Expand Down Expand Up @@ -87,10 +87,10 @@ public void generateDirectionsFromRoute(Route route){
String overall_building2 = route.getEnd().getBuildingName();
int overall_floor2 = route.getEnd().getFloorNumber();
sb.append("Route found: <b>");
sb.append(overall_building1);
sb.append("</b> to <b>");
sb.append(overall_building2);
sb.append("</b>");
sb.append(overall_building1);
sb.append("</b> to <b>");
sb.append(overall_building2);
sb.append("</b>");


// Cutoff point for collapsed directions
Expand All @@ -101,10 +101,10 @@ public void generateDirectionsFromRoute(Route route){

// Start
sb.append("Start at <b>");
sb.append(overall_building1);
sb.append(" (floor ");
sb.append(overall_floor1);
sb.append(")</b>");
sb.append(overall_building1);
sb.append(" (floor ");
sb.append(overall_floor1);
sb.append(")</b>");
sb.append("<br><br>");

List<RouteStep> steps = route.getRouteSteps();
Expand Down Expand Up @@ -162,18 +162,18 @@ else if(step.getPathType() == Path.TYPE_STAIR){
}

sb.append(" ");
sb.append(i+1);
sb.append(". ");
sb.append(instr);
sb.append(i+1);
sb.append(". ");
sb.append(instr);
sb.append("<br>");
}

sb.append("<br>");
sb.append("Arrive at <b>");
sb.append(overall_building2);
sb.append(" (floor ");
sb.append(overall_floor2);
sb.append(")</b>");
sb.append(overall_building2);
sb.append(" (floor ");
sb.append(overall_floor2);
sb.append(")</b>");

// Long directions
directions_long = Html.fromHtml("[<tt>-</tt>] " + sb.toString());
Expand Down
44 changes: 22 additions & 22 deletions workspace/WATisRain/src/com/lucky/watisrain/map/MapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@ public class MapView extends PhotoView {
public MapView(Context context, AttributeSet attrs) {
super(context, attrs);

AssetManager assetManager = context.getAssets();
AssetManager assetManager = context.getAssets();

if(assetManager != null) {
// Handle reading map file
try {
InputStream in = assetManager.open("locations.txt");
map = MapFactory.readMapFromStream(in);
} catch (IOException e) {
Global.println(e);
}
} else {
map = new Map();
}
if(assetManager != null) {
// Handle reading map file
try {
InputStream in = assetManager.open("locations.txt");
map = MapFactory.readMapFromStream(in);
} catch (IOException e) {
Global.println(e);
}
} else {
map = new Map();
}

routefinder = new RouteFinder(map);

// Read bitmaps
imgs = new HashMap<>();
imgs = new HashMap<String, Bitmap>();
imgs.put("default_location.png", BitmapFactory.decodeResource(getResources(), R.drawable.default_location));
imgs.put("active_location.png", BitmapFactory.decodeResource(getResources(), R.drawable.active_location));
imgs.put("stairs_up.png", BitmapFactory.decodeResource(getResources(), R.drawable.stairs_up));
Expand All @@ -88,13 +88,13 @@ protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();

RectF displayRect = new RectF();
RectF displayRect = new RectF();

if(attacher != null) {
displayRect = attacher.getDisplayRect();
}
if(attacher != null) {
displayRect = attacher.getDisplayRect();
}

MapDraw mapdraw = new MapDraw(canvas, displayRect);
MapDraw mapdraw = new MapDraw(canvas, displayRect);

// Draw all locations
for(Building building : map.getBuildings()){
Expand Down Expand Up @@ -132,7 +132,7 @@ protected void onDraw(Canvas canvas) {
List<RouteStep> all_steps = route.getRouteSteps();

// Get list of buildings we go through
ArrayList<String> throughBuildings = new ArrayList<>();
ArrayList<String> throughBuildings = new ArrayList<String>();
throughBuildings.add(all_steps.get(0).getStart().getBuildingName());
for(RouteStep step : all_steps) {
String next_build = step.getEnd().getBuildingName();
Expand All @@ -141,12 +141,12 @@ protected void onDraw(Canvas canvas) {
}

// All waypoints that we go through
ArrayList<Waypoint> throughWaypoints = new ArrayList<>();
ArrayList<Waypoint> throughWaypoints = new ArrayList<Waypoint>();
for(RouteStep step : all_steps){
throughWaypoints.addAll(step.getWaypoints());
}
// Filter duplicates
throughWaypoints = new ArrayList<>(new LinkedHashSet<>(throughWaypoints));
throughWaypoints = new ArrayList<Waypoint>(new LinkedHashSet<Waypoint>(throughWaypoints));

for(String buildingName : throughBuildings){
int ix = throughWaypoints.indexOf(map.getBuildingByID(buildingName).getPosition());
Expand Down Expand Up @@ -228,7 +228,7 @@ public void handleUserTap(float x, float y){
}
else if(selectedBuilding1 == null){
selectedBuilding1 = closestBuilding.getName();
directionsView.selectDestination(selectedBuilding1);
directionsView.selectDestination(selectedBuilding1);
}else{
selectedBuilding2 = closestBuilding.getName();

Expand Down

0 comments on commit b82c7ad

Please sign in to comment.