예제 #1
0
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View v = inflater.inflate(R.layout.main_drawer_group, container, false);
   mList = Utility.findViewById(v, R.id.drawer_group_list);
   return v;
 }
예제 #2
0
    @Override
    protected void onPostExecute(Void result) {
      super.onPostExecute(result);
      if (mGroups != null && mGroups.getSize() > 0) {
        // Get the name list
        String[] names = new String[mGroups.getSize() + 2];

        names[0] = getResources().getString(R.string.group_all);
        names[1] = getString(R.string.group_bilateral);
        for (int i = 0; i < mGroups.getSize(); i++) {
          names[i + 2] = mGroups.get(i).name;
        }

        if (DEBUG) {
          Log.d(TAG, "Setting adapter");
        }

        if (!isAdded()) {
          return;
        }
        mAdapter =
            new SelectionArrayAdapter<String>(
                getActivity(),
                R.layout.main_drawer_group_item,
                R.id.group_title,
                Utility.getSelectorGrey(getActivity()),
                names);
        mList.setAdapter(mAdapter);
        mList.setOnItemClickListener(GroupFragment.this);

        // Search for current
        int current = 0;

        if (mCurrentGroup == null) {
          current = 0;
        } else if (mCurrentGroup.equals(BILATERAL)) {
          current = 1;
        } else {
          for (int i = 0; i < mGroups.getSize(); i++) {
            if (mGroups.get(i).idstr.equals(mCurrentGroup)) {
              current = i + 2;
              break;
            }
          }
        }

        if (DEBUG) {
          Log.d(TAG, "selection = " + current);
        }

        mAdapter.setSelection(current);
      }
    }