Ejemplo n.º 1
0
 @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);
   }
 }
Ejemplo n.º 2
0
 private void showOnlySearchBox() {
   setResultContainerVisible(false);
   CommonUtils.hideKeyboard(mSearchEditText);
   mMapsFragment.setMapViewVisibility(View.VISIBLE);
   if (getBackBtnAsDrawer()) {
     isBackBtnAsDrawer = true;
     mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_menu));
   } else {
     isBackBtnAsDrawer = false;
     mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_arrow_back));
   }
   mSearchEditText.setCursorVisible(false);
 }
Ejemplo n.º 3
0
  @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);
    }
  }
Ejemplo n.º 4
0
 @Override
 protected void onCreate() {
   super.onCreate();
   mSearchBoxPresenter = new SearchBoxPresenter(getContext(), this, mMapsFragment.getMapsModule());
 }