Added exception logging
[pub/Android/ownCloud.git] / src / com / owncloud / android / datamodel / OCFile.java
index 70a5154..70df2b2 100644 (file)
@@ -26,11 +26,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 
 import java.io.File;
 
-import com.owncloud.android.MainApp;
-
 import third_parties.daveKoeller.AlphanumComparator;
-import android.content.Intent;
-import android.net.Uri;
 public class OCFile implements Parcelable, Comparable<OCFile> {
 
     public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
@@ -299,17 +295,6 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
                 mRemotePath += PATH_SEPARATOR;
             }
             Log_OC.d(TAG, "OCFile name changed to " + mRemotePath);
-            
-            // Notify MediaScanner about removed file
-            Intent intent1 = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
-            intent1.setData(Uri.fromFile(new File(this.getStoragePath())));
-            MainApp.getAppContext().sendBroadcast(intent1);
-            
-            // Notify MediaScanner about new file
-            Intent intent2 = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
-            String folder = new File(this.getStoragePath()).getParent();
-            intent2.setData(Uri.fromFile(new File(folder+ PATH_SEPARATOR+name)));
-            MainApp.getAppContext().sendBroadcast(intent2);
         }
     }
 
@@ -462,7 +447,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     @Override
     public int describeContents() {
-        return ((Object) this).hashCode();
+        return super.hashCode();
     }
 
     @Override
@@ -551,6 +536,13 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
                 getMimeTypeFromName().startsWith("image/"));
     }
 
+    /**
+     * @return 'True' if the file is simple text (e.g. not application-dependent, like .doc or .docx)
+     */
+    public boolean isText() {
+        return ((mMimeType != null && mMimeType.startsWith("text/")) || getMimeTypeFromName().startsWith("text/"));
+    }
+
     public String getMimeTypeFromName() {
         String extension = "";
         int pos = mRemotePath.lastIndexOf('.');
@@ -576,5 +568,4 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     public void setRemoteId(String remoteId) {
         this.mRemoteId = remoteId;
     }
-
 }