Skip to content

Commit

Permalink
Add style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adelq committed Dec 4, 2015
1 parent a847c1b commit 713e6b6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

/**
* Created by Lily on 11/13/2015.
* Fragment for Dining information (hours, map)
*/
public class DiningInfoFragment extends Fragment {

Expand Down Expand Up @@ -94,22 +95,21 @@ public void onResume() {
}
private void drawMap() {
String buildingCode = mDiningHall.getName();
final String location = mDiningHall.getName();
if (!buildingCode.equals("")) {
mLabs.buildings(buildingCode)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<List<Building>>() {
@Override
public void call(List<Building> buildings) {
if (!buildings.isEmpty()) {
drawMarker(buildings.get(0).getLatLng(), location);
drawMarker(buildings.get(0).getLatLng());
}
}
});
}
}

private void drawMarker(LatLng courseLatLng, String meetingLocation) {
private void drawMarker(LatLng courseLatLng) {
if (map != null && courseLatLng != null && mapFrame != null) {
mapFrame.setVisibility(View.VISIBLE);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(courseLatLng, 17));
Expand All @@ -131,7 +131,8 @@ public LinkedList<TextView> addDiningHour(VenueInterval day, LinkedList<TextView
TextView textView = new TextView(mActivity);
DateTimeFormatter intervalFormatter = DateTimeFormat.forPattern("yyyy-MM-dd");
DateTime dateTime = intervalFormatter.parseDateTime(day.date);
textView.setText(dateTime.dayOfWeek().getAsText() + ", " + dateTime.monthOfYear().getAsString() + "/" + dateTime.dayOfMonth().getAsShortText());
String dateString = dateTime.dayOfWeek().getAsText() + ", " + dateTime.monthOfYear().getAsString() + "/" + dateTime.dayOfMonth().getAsShortText();
textView.setText(dateString);
textView.setTextAppearance(mActivity, R.style.DiningInfoDate);
textView.setPadding(0, 10, 0, 10);
if (vertical.isEmpty()){
Expand Down Expand Up @@ -165,7 +166,8 @@ public LinkedList<TextView> addDiningHour(VenueInterval day, LinkedList<TextView
layparamtimes.addRule(RelativeLayout.ALIGN_BOTTOM, vertical.getLast().getId());
layparamtimes.setMargins(0, 10, 0, 0);
TextView mealInt = new TextView(mActivity);
mealInt.setText(meal.getFormattedHour(meal.open) + " - " + meal.getFormattedHour(meal.close));
String hoursString = meal.getFormattedHour(meal.open) + " - " + meal.getFormattedHour(meal.close);
mealInt.setText(hoursString);
mealInt.setTextAppearance(mActivity, R.style.DiningInfoHours);
mealInt.setId(vertical.getLast().getId() + 1);
menuParent.addView(mealInt, layparamtimes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,14 @@ public boolean hasMenu() {
return menus.size() > 0;
}

public String getLocation(){ return location;}
public String getLocation() {
return location;
}

public Venue getVenue(){
return venue;
}

public String closingTime() {
for (Interval openInterval : openHours.values()) {
if (openInterval.containsNow()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public HashMap<String, Interval> getHours() {

return intervals;
}

public List<VenueInterval> allHours(){
return hours;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,18 @@ public Interval getInterval(String date) {

return new Interval(openInstant, closeInstant);
}
public String getFormattedHour(String hours){
String newHours = hours.substring(0,5);

public String getFormattedHour(String hours) {
String newHours = hours.substring(0, 5);
int hour = Integer.parseInt(hours.substring(0, 2));
if (hour>12){
newHours = ""+(hour-12) + hours.substring(2,5);
if (hour > 12) {
newHours = "" + (hour - 12) + hours.substring(2, 5);
}
if (hour>=12){
newHours+="pm";
if (hour >= 12) {
newHours += "pm";
}
else{
newHours+="am";
else {
newHours += "am";
}
return newHours;
}
Expand Down
11 changes: 5 additions & 6 deletions PennMobile/src/main/res/layout/fragment_dining_info.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:id="@+id/dining_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
android:orientation="vertical">

<FrameLayout
android:id="@+id/dining_map_frame"
android:visibility="gone"
Expand All @@ -31,12 +30,12 @@
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:textSize="12pt"
android:id="@+id/info_hours"
></TextView>
android:id="@+id/info_hours" />

<RelativeLayout
android:id="@+id/dining_hours"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:paddingBottom="20dip"
Expand Down

0 comments on commit 713e6b6

Please sign in to comment.