void saveSettingsToBundle(Bundle outState) { super.saveSettingsToBundle(outState); outState.putInt(RADIUS_IN_METERS_BUNDLE_KEY, radiusInMeters); outState.putInt(RESULTS_LIMIT_BUNDLE_KEY, resultsLimit); outState.putString(SEARCH_TEXT_BUNDLE_KEY, searchText); outState.putParcelable(LOCATION_BUNDLE_KEY, location); outState.putBoolean(SHOW_SEARCH_BOX_BUNDLE_KEY, showSearchBox); }
private void showPickerFragment(PickerFragment<?> fragment) { fragment.setOnErrorListener( new PickerFragment.OnErrorListener() { public void onError(PickerFragment<?> pickerFragment, FacebookException error) { showAlert("error", error.getMessage()); } }); FragmentManager fm = getSupportFragmentManager(); fm.beginTransaction().replace(R.id.fragment_container, fragment).addToBackStack(null).commit(); controlsContainer.setVisibility(View.GONE); // We want the fragment fully created so we can use it immediately. fm.executePendingTransactions(); fragment.loadData(false); }
@Override public void onDetach() { super.onDetach(); if (searchBox != null) { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(searchBox.getWindowToken(), 0); } }
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (searchBox != null) { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(searchBox, InputMethodManager.SHOW_IMPLICIT); } }
@Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.com_facebook_place_picker_fragment); setRadiusInMeters( a.getInt(R.styleable.com_facebook_place_picker_fragment_radius_in_meters, radiusInMeters)); setResultsLimit( a.getInt(R.styleable.com_facebook_place_picker_fragment_results_limit, resultsLimit)); if (a.hasValue(R.styleable.com_facebook_place_picker_fragment_results_limit)) { setSearchText(a.getString(R.styleable.com_facebook_place_picker_fragment_search_text)); } showSearchBox = a.getBoolean(R.styleable.com_facebook_place_picker_fragment_show_search_box, showSearchBox); a.recycle(); }
public void setSettingsFromBundle(Bundle inState) { super.setSettingsFromBundle(inState); setPlacePickerSettingsFromBundle(inState); }