Search in sources :

Example 1 with GraphPlace

use of com.facebook.model.GraphPlace in project Klyph by jonathangerbaud.

the class PlacePickerActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    destroyed = false;
    setTitle(R.string.choose_place);
    placePickerFragment = (KlyphPlacePickerFragment) getSupportFragmentManager().findFragmentById(R.id.place_picker_fragment);
    placePickerFragment.setOnSelectionChangedListener(new PickerFragment.OnSelectionChangedListener() {

        @Override
        public void onSelectionChanged(PickerFragment<?> fragment) {
            GraphPlace place = placePickerFragment.getSelection();
            if (place != null) {
                Intent intent = new Intent();
                intent.putExtra(KlyphBundleExtras.PLACE_ID, place.getId());
                intent.putExtra(KlyphBundleExtras.PLACE_NAME, place.getName());
                setResult(RESULT_OK, intent);
                finish();
            }
        }
    });
    placePickerFragment.setOnErrorListener(new PickerFragment.OnErrorListener() {

        @Override
        public void onError(PickerFragment<?> fragment, FacebookException error) {
            PlacePickerActivity.this.onError(error);
        }
    });
    placePickerFragment.setShowTitleBar(false);
}
Also used : FacebookException(com.facebook.FacebookException) KlyphPlacePickerFragment(com.facebook.widget.KlyphPlacePickerFragment) PickerFragment(com.facebook.widget.PickerFragment) Intent(android.content.Intent) GraphPlace(com.facebook.model.GraphPlace)

Aggregations

Intent (android.content.Intent)1 FacebookException (com.facebook.FacebookException)1 GraphPlace (com.facebook.model.GraphPlace)1 KlyphPlacePickerFragment (com.facebook.widget.KlyphPlacePickerFragment)1 PickerFragment (com.facebook.widget.PickerFragment)1