List of usage examples for android.support.v4.provider DocumentFile lastModified
public abstract long lastModified();
From source file:com.amaze.carbonfilemanager.filesystem.RootHelper.java
public static BaseFile generateBaseFile(DocumentFile file, boolean showHidden) { long size = 0; if (!file.isDirectory()) size = file.length();/*from w w w . j av a 2 s . c o m*/ BaseFile baseFile = new BaseFile(file.getName(), parseDocumentFilePermission(file), file.lastModified(), size, file.isDirectory()); baseFile.setName(file.getName()); baseFile.setMode(OpenMode.OTG); return baseFile; }
From source file:com.amaze.filemanager.filesystem.RootHelper.java
public static HybridFileParcelable generateBaseFile(DocumentFile file, boolean showHidden) { long size = 0; if (!file.isDirectory()) size = file.length();//from w ww . jav a 2 s .c om HybridFileParcelable baseFile = new HybridFileParcelable(file.getName(), parseDocumentFilePermission(file), file.lastModified(), size, file.isDirectory()); baseFile.setName(file.getName()); baseFile.setMode(OpenMode.OTG); return baseFile; }
From source file:com.maskyn.fileeditorpro.dialogfragment.FileInfoDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { View view = new DialogHelper.Builder(getActivity()).setTitle(R.string.info) .setView(R.layout.dialog_fragment_file_info).createSkeletonView(); //final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_fragment_file_info, null); ListView list = (ListView) view.findViewById(android.R.id.list); DocumentFile file = DocumentFile.fromFile( new File(AccessStorageApi.getPath(getActivity(), (Uri) getArguments().getParcelable("uri")))); if (file == null && Device.hasKitKatApi()) { file = DocumentFile.fromSingleUri(getActivity(), (Uri) getArguments().getParcelable("uri")); }//from w ww . j a v a 2s.c om // Get the last modification information. Long lastModified = file.lastModified(); // Create a new date object and pass last modified information // to the date object. Date date = new Date(lastModified); String[] lines1 = { getString(R.string.name), //getString(R.string.folder), getString(R.string.size), getString(R.string.modification_date) }; String[] lines2 = { file.getName(), //file.getParent(), FileUtils.byteCountToDisplaySize(file.length()), date.toString() }; list.setAdapter(new AdapterTwoItem(getActivity(), lines1, lines2)); return new AlertDialog.Builder(getActivity()).setView(view) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).create(); }
From source file:com.frostwire.android.LollipopFileSystem.java
@Override public long lastModified(File file) { long r = file.lastModified(); if (r > 0) { return r; }//from w w w .j a v a 2s. c o m DocumentFile f = getDocument(app, file); return f != null ? f.lastModified() : 0; }
From source file:com.osama.cryptofm.tasks.EncryptTask.java
private void encryptDocumentFile(DocumentFile file) throws FileNotFoundException { Log.d(TAG, "encryptDocumentFile: encrypting document file"); if (file.isDirectory()) { rootDocumentFile = file;//from ww w . j a v a 2 s . c o m for (DocumentFile f : file.listFiles()) { encryptDocumentFile(f); } } else { //check if root document is not null if (rootDocumentFile == null) { String path = mFilePaths.get(0).substring(0, mFilePaths.get(0).lastIndexOf('/')); Log.d(TAG, "encryptDocumentFile: Getting the root document: " + path); rootDocumentFile = FileDocumentUtils.getDocumentFile(new File(path)); } DocumentFile temp = rootDocumentFile.createFile("pgp", file.getName() + ".pgp"); mCreatedDocumentFiles.add(temp); publishProgress(file.getName(), "" + ((FileUtils.getReadableSize((file.length()))))); InputStream in = CryptoFM.getContext().getContentResolver().openInputStream(file.getUri()); OutputStream out = CryptoFM.getContext().getContentResolver().openOutputStream(temp.getUri()); DocumentFileEncryption.encryptFile(in, out, pubKeyFile, true, new Date(file.lastModified()), file.getName()); } }