コード例 #1
0
 @Override
 public Map<String, String> getFiles() {
   if (StorageManager.getBooleanSetting(
       mApplicationContext, StorageManager.FOLDER_VIEW_ENABLED, true)) {
     if (getNavigationManager().emptyStack()) getNavigationManager().reset(NavigationManager.ROOT);
     return FileLoader.searchComicsAndFolders(
         mApplicationContext, (String) getNavigationManager().getValueFromStack());
   } else return FileLoader.searchComics(mApplicationContext);
 }
コード例 #2
0
  @Override
  public void onResume() {
    Log.d("ComicListFragment", "stack size: " + getNavigationManager().getStackSize());

    super.onResume();
    if (StorageManager.getBooleanSetting(
        mApplicationContext, StorageManager.FOLDER_VIEW_ENABLED, true)) {

      if (getNavigationManager().emptyStack()) {
        mAdapter.clearList();
        getNavigationManager().reset(NavigationManager.ROOT);
      }
    }
  }
コード例 #3
0
  @Override
  void setSearchFilters() {

    mFilters.clear();

    mFilters.add(
        new SearchFilter(
            StorageManager.getBooleanSetting(
                getActivity(), StorageManager.FOLDER_VIEW_ENABLED, true)) {
          @Override
          public boolean compare(Object object) {
            return !(object instanceof File) || mCompareSetting;
          }
        });
  }
コード例 #4
0
  @Override
  void addShowFolderViewButton(boolean enable) {
    if (enable && getActivity() != null) {
      int width = Utilities.getPixelValue(getActivity(), 48);
      int height = Utilities.getPixelValue(getActivity(), 32);
      final Toolbar.LayoutParams layoutParamsCollapsed =
          new Toolbar.LayoutParams(width, height, Gravity.RIGHT);
      final Toolbar toolbar = ((NewDrawerActivity) getActivity()).getToolbar();
      toolbar.removeView(mFolderViewToggleButton);
      mFolderViewToggleButton = new ImageView(getActivity());
      mFolderViewToggleButton.setAlpha(0.75f);
      if (StorageManager.getBooleanSetting(
          getActivity(), StorageManager.FOLDER_VIEW_ENABLED, true)) {
        mFolderViewToggleButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_list));
      } else {
        mFolderViewToggleButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_folder));
      }

      mFolderViewToggleButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (StorageManager.getBooleanSetting(
                  getActivity(), StorageManager.FOLDER_VIEW_ENABLED, true)) {
                StorageManager.setFolderEnabledSetting(getActivity(), false);
                mFolderViewToggleButton.setImageDrawable(
                    getResources().getDrawable(R.drawable.ic_folder));
              } else {
                StorageManager.setFolderEnabledSetting(getActivity(), true);
                mFolderViewToggleButton.setImageDrawable(
                    getResources().getDrawable(R.drawable.ic_list));
              }
              getNavigationManager().reset(NavigationManager.ROOT);
              refresh();
            }
          });

      toolbar.addView(mFolderViewToggleButton, layoutParamsCollapsed);
    } else {
      if (getActivity() != null) {
        final Toolbar toolbar = ((NewDrawerActivity) getActivity()).getToolbar();

        toolbar.removeView(mFolderViewToggleButton);
      }
    }
    setSearchFilters();
  }