private void openFolderPicker() {
    mGalleryQueryParameter.mUseLatLon = false;

    int dirQueryID = this.mGalleryQueryParameter.getDirQueryID();

    /** if wrong datatype was saved: gallery is not allowed for dirPicker */
    if (FotoSql.QUERY_TYPE_GALLERY == dirQueryID) {
      dirQueryID = FotoSql.QUERY_TYPE_GROUP_ALBUM;
    }

    if (mDirectoryRoot == null) {
      // not loaded yet. load directoryRoot in background
      final QueryParameterParcelable currentDirContentQuery =
          new QueryParameterParcelable(FotoSql.getQuery(dirQueryID));
      FotoSql.setWhereFilter(currentDirContentQuery, this.mGalleryQueryParameter.mFilter);

      this.mGalleryQueryParameter.mDirQueryID =
          (currentDirContentQuery != null)
              ? currentDirContentQuery.getID()
              : FotoSql.QUERY_TYPE_UNDEFINED;

      if (currentDirContentQuery != null) {
        this.mMustShowNavigator = true;
        DirectoryLoaderTask loader =
            new DirectoryLoaderTask(this, debugPrefix) {
              @Override
              protected void onPostExecute(IDirectory directoryRoot) {
                onDirectoryDataLoadComplete(directoryRoot);
              }
            };
        loader.execute(currentDirContentQuery);
      } else {
        Log.e(
            Global.LOG_CONTEXT,
            debugPrefix + " this.mDirQueryID undefined " + this.mGalleryQueryParameter.mDirQueryID);
      }
    } else {
      this.mMustShowNavigator = false;
      final FragmentManager manager = getFragmentManager();
      DirectoryPickerFragment dirDialog =
          new DirectoryPickerFragment(); // (DirectoryPickerFragment)
                                         // manager.findFragmentByTag(DLG_NAVIGATOR_TAG);
      dirDialog.defineDirectoryNavigation(
          mDirectoryRoot, dirQueryID, this.mGalleryQueryParameter.mCurrentPath);

      dirDialog.show(manager, DLG_NAVIGATOR_TAG);
    }
  }
Пример #2
0
  private void onDirectoryDataLoadComplete(IDirectory directoryRoot, int queryId) {
    if (directoryRoot != null) {
      Global.debugMemory(mDebugPrefix, "onDirectoryDataLoadComplete");

      DirInfo dirInfo = getOrCreateDirInfo(queryId);
      dirInfo.directoryRoot = directoryRoot;
      final FragmentManager manager = getFragmentManager();
      DirectoryPickerFragment dirDialog = new DirectoryPickerFragment();
      dirDialog.setContextMenuId(R.menu.menu_context_dirpicker);

      dirDialog.defineDirectoryNavigation(
          dirInfo.directoryRoot, dirInfo.queryId, dirInfo.currentPath);

      dirDialog.show(manager, DLG_NAVIGATOR_TAG);
    }
  }