Пример #1
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   hideSearchView();
   fragmentManager = getSupportFragmentManager();
   fragmentManager
       .beginTransaction()
       .replace(R.id.container, ResultListFragment.newInstance("", suggestions.get(position)))
       .commit();
   navigationDepth = 4;
   searchQueryTitle = suggestions.get(position);
 }
Пример #2
0
 @Override
 public boolean onQueryTextSubmit(String query) {
   mSearchView.clearFocus();
   hideSearchView();
   UtilMethods.hideSoftKeyboard(this);
   fragmentManager = getSupportFragmentManager();
   fragmentManager
       .beginTransaction()
       .replace(R.id.container, ResultListFragment.newInstance("", query))
       .commit();
   navigationDepth = 4;
   searchQueryTitle = query;
   return false;
 }
Пример #3
0
  @Override
  public void onBackPressed() {

    if (isSearchFilerShowing()) {
      findViewById(R.id.blankLayout).setVisibility(View.GONE);
      filterLayout.setVisibility(View.GONE);
      return;
    }

    if (mSearchView.getVisibility() == View.VISIBLE) {
      hideSearchView();
      return;
    }

    switch (navigationDepth) {
      case 1:
        fragmentManager = getSupportFragmentManager();
        fragmentManager
            .beginTransaction()
            .replace(R.id.container, HomeFragment.newInstance(0))
            .commit();
        if (navigationDepth > 0) {
          navigationDepth--;
        }
        isResultListFragmentOpened = false;
        break;
      case 2:
        //                if (TextUtils.isEmpty(SubCategoryFragment.catId)) {
        //                    SubCategoryFragment.catId = "1";
        //                }
        //                fragmentManager = getSupportFragmentManager();
        //                fragmentManager.beginTransaction()
        //                        .replace(R.id.container,
        // SubCategoryFragment.newInstance(SubCategoryFragment.catId))
        //                        .commit();
        //                if (navigationDepth > 0)
        //                    navigationDepth--;
        //                if (subCategoryTitle != null)
        //                    getSupportActionBar().setTitle(subCategoryTitle);
        break;
      case 3:
        if (TextUtils.isEmpty(ResultListFragment.catId)) {
          ResultListFragment.catId = "1";
        }
        fragmentManager = getSupportFragmentManager();
        fragmentManager
            .beginTransaction()
            .replace(R.id.container, ResultListFragment.newInstance(ResultListFragment.catId))
            .commit();
        if (navigationDepth > 0) navigationDepth--;
        if (resultListTitle != null) break;
      case 4:
        fragmentManager = getSupportFragmentManager();
        fragmentManager
            .beginTransaction()
            .replace(R.id.container, HomeFragment.newInstance(0))
            .commit();
        navigationDepth = 0;
        isResultListFragmentOpened = false;
        break;
      case 5:
        fragmentManager = getSupportFragmentManager();
        fragmentManager
            .beginTransaction()
            .replace(
                R.id.container, ResultListFragment.newInstance("", ResultListFragment.searchTerm))
            .commit();
        if (navigationDepth > 0) navigationDepth--;
        break;

      default:
        super.onBackPressed();
    }
  }