Esempio n. 1
0
 /**
  * Updates the MIME type in view
  *
  * @param mimetype to set
  */
 private void setFiletype(String mimetype) {
   TextView tv = (TextView) getView().findViewById(R.id.fdType);
   if (tv != null) {
     String printableMimetype = DisplayUtils.convertMIMEtoPrettyPrint(mimetype);
     ;
     tv.setText(printableMimetype);
   }
   ImageView iv = (ImageView) getView().findViewById(R.id.fdIcon);
   if (iv != null) {
     iv.setImageResource(DisplayUtils.getResourceId(mimetype));
   }
 }
Esempio n. 2
0
 /**
  * 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);
   }
 }
Esempio n. 3
0
  /** Updates the view with all relevant details about that file. */
  public void updateFileDetails() {

    if (mFile != null && mAccount != null && mLayout == R.layout.file_details_fragment) {

      // set file details
      setFilename(mFile.getFileName());
      setFiletype(DisplayUtils.convertMIMEtoPrettyPrint(mFile.getMimetype()));
      setFilesize(mFile.getFileLength());
      if (ocVersionSupportsTimeCreated()) {
        setTimeCreated(mFile.getCreationTimestamp());
      }

      setTimeModified(mFile.getModificationTimestamp());

      CheckBox cb = (CheckBox) getView().findViewById(R.id.fdKeepInSync);
      cb.setChecked(mFile.keepInSync());

      // configure UI for depending upon local state of the file
      // if (FileDownloader.isDownloading(mAccount, mFile.getRemotePath()) ||
      // FileUploader.isUploading(mAccount, mFile.getRemotePath())) {
      FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
      FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
      if ((downloaderBinder != null && downloaderBinder.isDownloading(mAccount, mFile))
          || (uploaderBinder != null && uploaderBinder.isUploading(mAccount, mFile))) {
        setButtonsForTransferring();

      } else if (mFile.isDown()) {
        // Update preview
        if (mFile.getMimetype().startsWith("image/")) {
          BitmapLoader bl = new BitmapLoader();
          bl.execute(new String[] {mFile.getStoragePath()});
        }

        setButtonsForDown();

      } else {
        setButtonsForRemote();
      }
    }
  }
Esempio n. 4
0
 /**
  * Updates the time that the file was last modified
  *
  * @param milliseconds Unix time to set
  */
 private void setTimeModified(long milliseconds) {
   TextView tv = (TextView) getView().findViewById(R.id.fdModified);
   if (tv != null) {
     tv.setText(DisplayUtils.unixTimeToHumanReadable(milliseconds));
   }
 }
Esempio n. 5
0
 /**
  * Updates the file size in view
  *
  * @param filesize in bytes to set
  */
 private void setFilesize(long filesize) {
   TextView tv = (TextView) getView().findViewById(R.id.fdSize);
   if (tv != null) tv.setText(DisplayUtils.bytesToHumanReadable(filesize));
 }