Пример #1
0
  private void onClickPickPlace() {
    final PlacePickerFragment fragment = new PlacePickerFragment();
    fragment.setLocation(SEATTLE_LOCATION);
    fragment.setTitleText("place");

    setPlacePickerListeners(fragment);

    showPickerFragment(fragment);
  }
Пример #2
0
 private void setPlacePickerListeners(final PlacePickerFragment fragment) {
   fragment.setOnDoneButtonClickedListener(
       new PlacePickerFragment.OnDoneButtonClickedListener() {
         public void onDoneButtonClicked(PickerFragment<?> pickerFragment) {
           onPlacePickerDone(fragment);
         }
       });
   fragment.setOnSelectionChangedListener(
       new PlacePickerFragment.OnSelectionChangedListener() {
         public void onSelectionChanged(PickerFragment<?> pickerFragment) {
           if (fragment.getSelection() != null) {
             onPlacePickerDone(fragment);
           }
         }
       });
 }
Пример #3
0
  private void onPlacePickerDone(PlacePickerFragment fragment) {
    FragmentManager fm = getSupportFragmentManager();
    fm.popBackStack();

    String result = "";

    GraphPlace selection = fragment.getSelection();
    if (selection != null) {
      result = selection.getName();
    } else {
      result = "no place";
    }

    showAlert("picked", result);
  }