@Override public void onClick(View v) { int viewId = v.getId(); if (viewId == R.id.opendrawer_or_back) { if (isBackBtnAsDrawer) { ((IDrawerView) mMapsFragment).openDrawer(); return; } if (getOnlySearchBox()) { showOnlySearchBox(); } else { finish(); } } else if (viewId == R.id.edit_text_clear) { // 只有mSearchResultContainer不可见时允许回调 if (!isResultContainerVisible()) { mMapsFragment.onClearSearchText(); } mSearchEditText.setText(""); } else if (viewId == R.id.search_edittext) { if (isResultContainerVisible()) return; mSearchEditText.setCursorVisible(true); mMapsFragment.setMapViewVisibility(View.INVISIBLE); setResultContainerVisible(true); isBackBtnAsDrawer = false; mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_arrow_back)); } else if (viewId == R.id.search_choose_on_map) { ChooseOnMap chooseOnMap = new ChooseOnMap(mMapsFragment); startLiteFragmentForResult(SEARCHBOX_REQUEST_CODE, chooseOnMap, null); } else if (viewId == R.id.choose_from_favorites) { Favorites favorites = new Favorites(mMapsFragment); startLiteFragmentForResult(SEARCHBOX_REQUEST_CODE, favorites, null); } }
@Override protected void onStop() { super.onStop(); CommonUtils.hideKeyboard(mSearchEditText); setResultContainerVisible(false); setSearchBoxVisible(false); ((IDrawerView) mMapsFragment).enableDrawer(true); }
@Override protected void onStart() { super.onStart(); if (hasResult()) { finish(); return; } hidePoiWithoutLoc = getHidePoiWithoutLoc(); if (getOnlySearchBox()) { setSearchBoxVisible(true); mSearchEditText.setCursorVisible(false); mMapsFragment.setMapViewVisibility(View.VISIBLE); } else { mMapsFragment.setMapViewVisibility(View.INVISIBLE); setSearchBoxVisible(true); setResultContainerVisible(true); mSearchEditText.setCursorVisible(true); ((IDrawerView) mMapsFragment).enableDrawer(false); } if (getBackBtnAsDrawer()) { isBackBtnAsDrawer = true; mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_menu)); } else { isBackBtnAsDrawer = false; mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_arrow_back)); } if (getChooseOnMap()) { mChooseOnMapBtn.setVisibility(View.VISIBLE); } else { mChooseOnMapBtn.setVisibility(View.GONE); } if (getChooseFromFav()) { mChooseFromFavBtn.setVisibility(View.VISIBLE); } else { mChooseFromFavBtn.setVisibility(View.GONE); } }