/**
* Creates an empty details fragment.
*
- * It's necessary to keep a public constructor without parameters; the system uses it when tries to reinstantiate a fragment automatically.
+ * It's necessary to keep a public constructor without parameters; the system uses it when tries
+ * to reinstantiate a fragment automatically.
*/
public FileDetailFragment() {
super();
mLayout = R.layout.file_details_fragment;
}
- View view = null;
- view = inflater.inflate(mLayout, null);
- mView = view;
+ mView = inflater.inflate(mLayout, null);
if (mLayout == R.layout.file_details_fragment) {
mView.findViewById(R.id.fdKeepInSync).setOnClickListener(this);
mProgressListener = new ProgressListener(progressBar);
mView.findViewById(R.id.fdCancelBtn).setOnClickListener(this);
}
-
+
updateFileDetails(false, false);
- return view;
+ return mView;
}
@Override
setFilename(file.getFileName());
setFiletype(file.getMimetype(), file.getFileName());
setFilesize(file.getFileLength());
- if(ocVersionSupportsTimeCreated()){
- setTimeCreated(file.getCreationTimestamp());
- }
-
+
setTimeModified(file.getModificationTimestamp());
CheckBox cb = (CheckBox)getView().findViewById(R.id.fdKeepInSync);
/**
* Updates the MIME type in view
- * @param mimetype to set
- * @param filename
+ * @param mimetype MIME type to set
+ * @param filename Name of the file, to deduce the icon to use in case the MIME type is not precise enough
*/
private void setFiletype(String mimetype, String filename) {
TextView tv = (TextView) getView().findViewById(R.id.fdType);
}
/**
- * Updates the time that the file was created in view
- * @param milliseconds Unix time to set
- */
- private void setTimeCreated(long milliseconds){
- TextView tv = (TextView) getView().findViewById(R.id.fdCreated);
- TextView tvLabel = (TextView) getView().findViewById(R.id.fdCreatedLabel);
- if(tv != null){
- tv.setText(DisplayUtils.unixTimeToHumanReadable(milliseconds));
- tv.setVisibility(View.VISIBLE);
- tvLabel.setVisibility(View.VISIBLE);
- }
- }
-
- /**
* Updates the time that the file was last modified
* @param milliseconds Unix time to set
*/
}
- /**
- * In ownCloud 3.X.X and 4.X.X there is a bug that SabreDAV does not return
- * the time that the file was created. There is a chance that this will
- * be fixed in future versions. Use this method to check if this version of
- * ownCloud has this fix.
- * @return True, if ownCloud the ownCloud version is supporting creation time
- */
- private boolean ocVersionSupportsTimeCreated(){
- /*if(mAccount != null){
- AccountManager accManager = (AccountManager) getActivity()
- .getSystemService(Context.ACCOUNT_SERVICE);
- OwnCloudVersion ocVersion = new OwnCloudVersion(accManager
- .getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION));
- if(ocVersion.compareTo(new OwnCloudVersion(0x030000)) < 0) {
- return true;
- }
- }*/
- return false;
- }
-
-
public void listenForTransferProgress() {
if (mProgressListener != null) {
if (mContainerActivity.getFileDownloaderBinder() != null) {
mLastPercent = percent;
}
- };
+ }
}