Ejemplo n.º 1
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   if (!Utils.isTablet(getActivity())) {
     getActivity().getMenuInflater().inflate(R.menu.udobra_list, menu);
     MenuItem item = menu.findItem(R.id.action_fix_udobra);
     item.setVisible(false);
     UdobraList_fragment.item = item;
   }
   super.onCreateOptionsMenu(menu, inflater);
 }
Ejemplo n.º 2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (!Utils.isTablet(getActivity())) setHasOptionsMenu(true);

    this.inflate = inflater;
    v = inflater.inflate(R.layout.udobra_list, null);
    listView = (ExpandableListView) v.findViewById(R.id.expandableListView);
    listView.setGroupIndicator(null);
    if (Utils.LOCALE.equals("ru")) {
      AssetsHelper assetsHelper = new AssetsHelper(getActivity());
      db = assetsHelper.getReadableDatabase();
    } else {
      DBHelper dbHelper = new DBHelper(getActivity());
      db = dbHelper.getReadableDatabase();
    }
    searchView = (android.support.v7.widget.SearchView) v.findViewById(R.id.searchV);
    searchView.setIconifiedByDefault(false);
    searchView.setOnQueryTextListener(this);
    searchView.setSubmitButtonEnabled(false);
    searchView.setQueryHint(getResources().getString(R.string.Search));

    MultiSpinner multiSpinner = (MultiSpinner) v.findViewById(R.id.filterSpinner);
    Map<Integer, String> filter = new HashMap<Integer, String>();
    filter.put(1, getResources().getString(R.string.Favorites));
    filter.put(2, getResources().getString(R.string.Added));
    multiSpinner.setItems(getResources().getString(R.string.Filter), this, filter, 1);
    fillData(0);
    listView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            if (lastExpandedPosition != -1 && groupPosition != lastExpandedPosition) {
              listView.collapseGroup(lastExpandedPosition);
            }
            lastExpandedPosition = groupPosition;
          }
        });
    return v;
  }