コード例 #1
0
  private void showPage(ViewPage p) {
    if (curViewPage == p) return;

    curViewPage = p;

    showView(R.id.file_path_list, false);
    mFavoriteList.show(false);
    showEmptyView(false);

    switch (p) {
      case Favorite:
        mFavoriteList.show(true);
        showEmptyView(mFavoriteList.getCount() == 0);
        break;
      case Category:
        showView(R.id.file_path_list, true);
        showEmptyView(mAdapter.getCount() == 0);
        break;
    }
  }
コード例 #2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    mActivity = (MainActivity) getActivity();
    mActivity.setFileCategoryFragment(this);

    setHasOptionsMenu(true);
    mRootView = inflater.inflate(R.layout.file_explorer_category, container, false);

    mFilePathListView = (ListView) mRootView.findViewById(R.id.file_path_list);

    mEmptyView = (LinearLayout) mRootView.findViewById(R.id.empty_view);

    mFileInteractionHub = new FileInteractionHub(this);
    mFileInteractionHub.setMode(Mode.View);
    mFileInteractionHub.setRootPath("/");

    mMenuUtils = new MenuUtils(mActivity, mFileInteractionHub);

    mFileCagetoryHelper = new FileCategoryHelper(mActivity);
    mFileIconHelper = new FileIconHelper(mActivity);

    mFavoriteList =
        new FavoriteList(
            mActivity,
            (ListView) mRootView.findViewById(R.id.favorite_list),
            this,
            mFileInteractionHub,
            mFileIconHelper);
    mFavoriteList.initList();

    mAdapter = new FileListCursorAdapter(mActivity, null, mFileInteractionHub, mFileIconHelper);
    mFilePathListView.setAdapter(mAdapter);
    registerScannerReceiver();

    return mRootView;
  }