fishwjy / MultiType-FilePicker

This is a light Android file picker library.
Apache License 2.0
1.4k stars 248 forks source link

Deleted file also showing #32

Open AtulSalgaonkar opened 6 years ago

AtulSalgaonkar commented 6 years ago

Deleted file also showing in the pdf selector i am using xiaomi redmi note 3 pro and just for test i deleted the pdf file and again tried, but the deleted file also getting displayed , i think main reason for this is xiaomi phones deleted file are stored in cache or hidden is there any way to fix this, because i literally checked the path by:


else if (requestCode == Constant.REQUEST_CODE_PICK_FILE && resultCode == RESULT_OK) {

mPdf = data.getParcelableArrayListExtra(Constant.RESULT_PICK_FILE);
            if (mPdf.size() != 0) {
                long sizOfFile = mPdf.get(0).getSize() / 1024;//get size of file
                // 5120
                if (sizOfFile < 50000 && sizOfFile > 50) {//MB check
                    mPath = mPdf.get(0).getPath();
                    mFileSize = mPdf.get(0).getSize();
                    showPreView(mPath);
                    dismissAlertDialed();
                } else {
                    finish();
                    HelperMethods.showToastLong(mContext, "File size should be less then 50 MB and bigger then 5kb!");
                }
            } else {
                finish();
                HelperMethods.showToastLong(mContext, "Please select valid Pdf File!");
            }
}

private void showPreView(String path) {
        if (HelperMethods.isStringNotEmpty(path)) {
            HelperMethods.showLogData("Path: " + path);
            File file = new File(mPath);
            if (file.exists()) {
                HelperMethods.showLogData("File exists");
            } else {
                HelperMethods.showLogData("File dose'nt exists");
            }
        } else {
            HelperMethods.showLogData("Path is wrong!");
            HelperMethods.showToastLong(mContext, "Selected file is not valid file!");
        }
    }

and its clearly showing log as "File dose'nt exists", please help