Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to select directories #6

Closed
sky-nie opened this issue Sep 25, 2021 · 2 comments
Closed

I want to select directories #6

sky-nie opened this issue Sep 25, 2021 · 2 comments

Comments

@sky-nie
Copy link

sky-nie commented Sep 25, 2021

I need a fuction:
select a directory,and return the information of the files and directories those included by the directory.

@zippo88888888
Copy link
Owner

zippo88888888 commented Sep 26, 2021

This function is temporarily not supported, but you can modify part of the code to achieve it
in ZFileListActivity,
you can do that ↓↓↓

private fun initListRecyclerView() {
       fileListAdapter = ZFileListAdapter(this).run {
           itemClickByAnim = { v, _, item ->
               if (item.isFile) {
                   ZFileUtil.openFile(item.filePath, v)
               } else {
                   // ZFileLog.i("进入 ${item.filePath}")
                   // backList.add(item.filePath)
                   // filePathAdapter.addItem(filePathAdapter.itemCount, item.toPathBean())
                   // zfile_list_pathRecyclerView.scrollToPosition(filePathAdapter.itemCount - 1)
                   // getData(item.filePath)
                   // nowPath = item.filePath
                  
                  getData(item.filePath)
               }
           }

           ...

       }
   }

  private fun getData(filePath: String?) {

       ...

       ZFileUtil.getList(this) {
           if (isNullOrEmpty()) {
               fileListAdapter?.clear()
               zfile_list_emptyLayout.visibility = View.VISIBLE
           } else {
               // fileListAdapter?.setDatas(this)
             ZFileLog.i("rootPath:$rootPath")
             ZFileLog.i("nowPath:$nowPath")
             if (rootPath == SD_ROOT && nowPath.isNull()) {
                  fileListAdapter?.setDatas(this)
                  zfile_list_emptyLayout.visibility = View.GONE
              } else {
                  setResult(ZFILE_RESULT_CODE, Intent().apply {
                       putParcelableArrayListExtra(
                           ZFILE_SELECT_DATA_KEY,
                           this@getList as java.util.ArrayList<out Parcelable>
                       )
                   })
                   finish()
               }
           }
           zfile_list_refreshLayout.isRefreshing = false
       }
   }

@zippo88888888
Copy link
Owner

After this modification, there will be many problems, such as unable to enter the secondary directory. Better not to do this !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants