@Override public void detailFragmentClick(int position) { Log.d(thisClass, position + " is choose"); ArrayList<UIFileInfo> children = UIFileInfo.addFileFrom(currentSelectedDir()); if (children != null) { if (position >= children.size()) { throw new RuntimeException("position < childrenCache.get(fatherIndex).size()"); } } else { throw new RuntimeException(""); } UIFileInfo UIFileInfo = children.get(position); if (UIFileInfo.isDir()) { folderFragment.clearListView(); folderFragment.addListView(children).notifyDataSetChanged(); updateDetailFileInfo(UIFileInfo.toFile()); } else { // decrypt file and show it FileEncryption fileEncryption; try { fileEncryption = new FileEncryption(UIFileInfo.toFile(), password); } catch (IOException e) { Log.e(thisClass, "can't read file" + e); return; } DecryptedFile decryptedFile; try { if (fileEncryption.largeLinkedSize()) { decryptedFile = fileEncryption.decryptPart(); } else { fileEncryption.decryptAll(true); } } catch (InvalidAlgorithmParameterException | InvalidKeyException | NoSuchAlgorithmException | IOException | UnrecoverableEntryException e) { Log.e(thisClass, " failed: " + e.toString()); } // add file path of to be deleted file delPaths.add(fileEncryption.getEncryptedFilePath()); // start app to view different file // Intent intent = getMyImgIntent(this, fileEncryption); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType( Uri.parse(fileEncryption.getFileUri()), FileUtility.getMimeType(fileEncryption.getLinkedFilePath())); if (IntentUtil.intentSafe(intent, this)) { startActivity(intent); } } }
@Override public void detailFragmentLongPress(int position) { Log.d(thisClass, position + " is choose"); UIFileInfo UIFileInfo = currentSelectedChildren(position); if (UIFileInfo.isDir()) { } else { FileEncryption fileEncryption; try { fileEncryption = new FileEncryption(UIFileInfo.toFile(), password); } catch (IOException e) { Log.e(thisClass, "can't read file" + e); return; } showMenuDialog(fileEncryption); } }