Skip to content

Commit

Permalink
Week 6 Exercise 2a: Display the map
Browse files Browse the repository at this point in the history
  • Loading branch information
Mary-Anne Cosgrove committed May 3, 2014
1 parent ac29230 commit d5976f1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.click;
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.typeText;
import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions.matches;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.Visibility.VISIBLE;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.containsString;
Expand Down Expand Up @@ -61,7 +63,7 @@ public void testMap() throws InterruptedException {

When.iOpenTheMenuAndSelectItem("Map");

onView(withId(R.id.section_label)).check(matches(withText(containsString("Map:"))));
onView(withId(R.id.map)).check(matches(withEffectiveVisibility(VISIBLE)));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import com.thoughtworks.androidbootcamp.R;
import com.thoughtworks.androidbootcamp.controller.fragment.HighScoresFragment;
import com.thoughtworks.androidbootcamp.controller.fragment.MapFragment;
import com.thoughtworks.androidbootcamp.controller.fragment.TreasureMapFragment;
import com.thoughtworks.androidbootcamp.controller.fragment.TreasureListFragment;
import com.thoughtworks.androidbootcamp.model.Game;
import com.thoughtworks.androidbootcamp.model.Treasure;
Expand Down Expand Up @@ -145,7 +145,7 @@ public boolean onNavigationItemSelected(int position, long id) {

protected void showMap() {
getFragmentManager().beginTransaction()
.replace(R.id.container, new MapFragment())
.replace(R.id.container, new TreasureMapFragment())
.commit();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.thoughtworks.androidbootcamp.controller.fragment;



import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
Expand All @@ -11,17 +10,7 @@
import com.thoughtworks.androidbootcamp.R;


/**
* A simple {@link android.support.v4.app.Fragment} subclass.
*
*/
public class MapFragment extends Fragment {


public MapFragment() {
// Required empty public constructor
}

public class TreasureMapFragment extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Expand All @@ -30,5 +19,4 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
return inflater.inflate(R.layout.fragment_map, container, false);
}


}
16 changes: 8 additions & 8 deletions AndroidBootcamp/src/main/res/layout/fragment_map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.thoughtworks.androidbootcamp.controller.fragment.MapFragment">

<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/map_heading"
style="@style/SectionHeading"/>
tools:context="com.thoughtworks.androidbootcamp.controller.fragment.TreasureMapFragment">

<fragment xmlns:android="http:https://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="Map showing location of attempts"
android:tag="The Map"
android:name="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>

0 comments on commit d5976f1

Please sign in to comment.