@Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (mUnfoldableView.isUnfolded()) {
      inflater.inflate(R.menu.detail_bar, menu);
    } else {
      inflater.inflate(R.menu.main_bar, menu);
      SearchManager searchManager =
          (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
      SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
      searchView.setIconifiedByDefault(true);
      int id =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_close_btn", null, null);
      ((ImageView) Views.find(searchView, id)).setImageResource(R.drawable.ab_search_clear);
      int searchId =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_mag_icon", null, null);
      //            SearchView.SearchAutoComplete autoComplete =
      // (SearchView.SearchAutoComplete)ll3.getChildAt(0);
      //            Drawable drawable= getResources().getDrawable(R.drawable.ic_action_search);
      //            drawable.setBounds(0, 0, drawable.getMinimumWidth(),
      // drawable.getMinimumHeight());
      ((ImageView) Views.find(searchView, searchId)).setImageResource(R.drawable.ic_action_search);
      int searchId2 =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_button", null, null);
      ((ImageView) Views.find(searchView, searchId2))
          .setBackgroundResource(R.drawable.ic_action_search);
      searchView.setSearchableInfo(
          searchManager.getSearchableInfo(getActivity().getComponentName()));

      try {
        Field searchField = SearchView.class.getDeclaredField("mSearchButton");
        searchField.setAccessible(true);
        ImageView searchBtn = (ImageView) searchField.get(searchView);
        searchBtn.setImageResource(R.drawable.ic_action_search);
        searchField = SearchView.class.getDeclaredField("mSearchPlate");
        searchField.setAccessible(true);
        //                LinearLayout searchPlate = (LinearLayout)searchField.get(searchView);
        //                Drawable drawable=
        // getResources().getDrawable(R.drawable.ic_action_search);
        //                drawable.setBounds(0, 0, drawable.getMinimumWidth(),
        // drawable.getMinimumHeight());
        //
        // ((TextView)searchPlate.getChildAt(0)).setCompoundDrawables(drawable,null,null,null);
        //                searchPlate.setBackgroundResource(R.drawable.edit_text_bkg);
      } catch (NoSuchFieldException e) {
        Log.e(TAG, e.getMessage(), e);
      } catch (IllegalAccessException e) {
        Log.e(TAG, e.getMessage(), e);
      }
    }
  }
 public boolean onBackPressed() {
   if (mLayout != null && (mLayout.isPanelExpanded() || mLayout.isPanelDragging())) {
     mLayout.setAnchorPoint(1.0f);
     mLayout.collapsePanel();
     return true;
   } else {
     if (mUnfoldableView != null
         && (mUnfoldableView.isUnfolded() || mUnfoldableView.isUnfolding())) {
       mUnfoldableView.foldBack();
       return true;
     }
   }
   return false;
 }