Ejemplo n.º 1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == R.id.action_settings) {
      return true;
    }

    if (id == R.id.action_search) {
      Intent intent = new Intent(this, SearchActivity.class);
      startActivity(intent);

      tabs.animate().translationY(-tabs.getHeight());
      viewPager.animate().translationY(-tabs.getHeight());
      isPageViewWithOffset = Boolean.TRUE;

      // this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
      // View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

      View contactFragmentRootView = ((ContactsFragment) viewPagerAdapter.getItem(1)).getRootView();
      contactFragmentRootView.invalidate();

      return true;
    }

    return super.onOptionsItemSelected(item);
  }
Ejemplo n.º 2
0
  private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
      String query = intent.getStringExtra(SearchManager.QUERY);
      Toast.makeText(this, "typed: " + query, Toast.LENGTH_SHORT).show();
    } else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
      Bundle bundle = this.getIntent().getExtras();

      assert (bundle != null);

      if (bundle != null) {
        ResultItem receivedItem =
            bundle.getParcelable(CustomSearchableConstants.CLICKED_RESULT_ITEM);
        ((ContactsFragment) viewPagerAdapter.getItem(1))
            .updateRecyclerViewFromSearchSelection(receivedItem.getHeader());
      }
    }
  }