Пример #1
0
  @Override
  public void onResume() {
    super.onResume();
    mListRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    List my_temp = todoDao.getAllLists();

    if (my_temp.size() > 0) {
      ListExpandableAdaptor listExpandableAdapter =
          new ListExpandableAdaptor(getActivity(), mLists);
      ArrayList<TaskList> temp = todoDao.getAllLists();
      // listExpandableAdapter.onRestoreInstanceState(savedInstanceState);
      listExpandableAdapter.expandParent((int) taskList_id);
      listExpandableAdapter.expandAllParents();
      mListRecyclerView.setAdapter(listExpandableAdapter);
      // listExpandableAdapter.expandAllParents();
      // listExpandableAdapter.expandParent(6);
      // listExpandableAdapter.expandParent(temp.get(6));
      int position = (int) taskList_id - 1;
      if (taskList_id > -1) {

        listExpandableAdapter.expandParent(position);
      }

      // listExpandableAdapter.expandAllParents();
    }
    Log.e("here", "called onsume");
  }
Пример #2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View view = inflater.inflate(R.layout.fragment_task_list, container, false);
    Log.e("here", "called ron create");
    Intent intent = getActivity().getIntent();
    taskList_id = intent.getLongExtra("taskListid", -1);
    mListRecyclerView = (RecyclerView) view.findViewById(R.id.task_list_recycler_view);
    todoDao = new TodoDao(view.getContext());
    mListRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
    mToolbar.setTitle("SimpleTodo");
    mLists = todoDao.getAllLists();
    ArrayList<TaskList> temp = todoDao.getAllLists();
    childLayout = LayoutInflater.from(this.getContext()).inflate(R.layout.list_child, null);
    //  remove =(ImageButton) view.findViewById( R.id.parent_list_item_remove);
    //  mListRecyclerView.addView(remove);
    if (mLists.size() > 0) {
      final ListExpandableAdaptor listExpandableAdapter =
          new ListExpandableAdaptor(getActivity(), mLists);
      if (taskList_id > -1) {
        listExpandableAdapter.mTaskListId = taskList_id;
        int position = (int) taskList_id - 1;
        listExpandableAdapter.expandParent(position);
      }

      mListRecyclerView.setAdapter(listExpandableAdapter);

      listExpandableAdapter.onRestoreInstanceState(savedInstanceState);
      mListRecyclerView.setAdapter(listExpandableAdapter);
      ////  final int parentPosition = i;
      // List<Task> list= temp.get(i).getChildItemList();

    }
    mAdd = (ImageButton) view.findViewById(R.id.add);
    mAdd.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            addNewList();
          }
        });
    return view;
  }