package com.upmoon.alexanderbean.barcrawlr.fragments;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.upmoon.alexanderbean.barcrawlr.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class PlaceListFragment extends Fragment {


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


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_place_list, container, false);
    }

}

@@ -49,16 +49,47 @@
 ents;%0A%0A%0A
+import android.content.Intent;%0A
 import a
@@ -243,515 +243,2543 @@
 up;%0A
-%0Aimport com.upmoon.alexanderbean.barcrawlr.R;%0A%0A/**%0A * A simple %7B@link Fragment%7D subclass.%0A */%0Apublic class PlaceListFragment extends Fragment %7B%0A%0A%0A    public PlaceListFragment() %7B%0A        // Required empty public constructor%0A    %7D%0A%0A%0A    @Override%0A    public View onCreateView(LayoutInflater inflater, ViewGroup container,%0A                             Bundle savedInstanceState) %7B%0A        // Inflate the layout for this fragment%0A        return inflater.inflate(R.layout.fragment_place_list, container, false);
+import android.widget.Button;%0Aimport android.widget.Toast;%0A%0Aimport com.google.android.gms.common.GooglePlayServicesNotAvailableException;%0Aimport com.google.android.gms.common.GooglePlayServicesRepairableException;%0Aimport com.google.android.gms.location.places.Place;%0Aimport com.google.android.gms.location.places.ui.PlacePicker;%0Aimport com.upmoon.alexanderbean.barcrawlr.R;%0A%0Aimport static android.app.Activity.RESULT_OK;%0A%0A/**%0A * A simple %7B@link Fragment%7D subclass.%0A */%0Apublic class PlaceListFragment extends Fragment %7B%0A    private static final int PLACE_PICKER_REQUEST = 2;%0A%0A    /*%0A    *   Update: added place picker button%0A    *   TODO: add places list to aggregate all places for the plan%0A    */%0A    public PlaceListFragment() %7B%0A        // Required empty public constructor%0A    %7D%0A%0A%0A    @Override%0A    public View onCreateView(LayoutInflater inflater, ViewGroup container,%0A                             Bundle savedInstanceState) %7B%0A        // Inflate the layout for this fragment%0A        return inflater.inflate(R.layout.fragment_place_list, container, false);%0A    %7D%0A%0A    @Override%0A    public void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A%0A        final Button addPlaceButton = (Button) getActivity().findViewById(R.id.add_place_button);%0A        addPlaceButton.setOnClickListener(new View.OnClickListener() %7B%0A            public void onClick(View v) %7B%0A                onPickButtonClick(v);%0A            %7D%0A        %7D);%0A    %7D%0A%0A    @Override%0A    public void onActivityResult(int requestCode, int resultCode, Intent data) %7B%0A        if (requestCode == PLACE_PICKER_REQUEST) %7B%0A            if (resultCode == RESULT_OK) %7B%0A                Place place = PlacePicker.getPlace(data, getActivity());%0A                String toastMsg = String.format(%22Place: %25s%22, place.getName());%0A                Toast.makeText(getActivity(), toastMsg, Toast.LENGTH_LONG).show();%0A            %7D%0A        %7D%0A    %7D%0A%0A    public void onPickButtonClick(View v) %7B%0A        // Construct an intent for the place picker%0A        try %7B%0A            PlacePicker.IntentBuilder intentBuilder =%0A                    new PlacePicker.IntentBuilder();%0A            Intent intent = intentBuilder.build(getActivity());%0A            // Start the intent by requesting a result,%0A            // identified by a request code.%0A            startActivityForResult(intent, PLACE_PICKER_REQUEST);%0A%0A        %7D catch (GooglePlayServicesRepairableException e) %7B%0A            // ...%0A        %7D catch (GooglePlayServicesNotAvailableException e) %7B%0A            // ...%0A        %7D
 %0A   

Update PlaceListFragment.java