Allow attaching arbitrary filetypes on K.

b/10819450.

Change-Id: I3be5358b9b55c8ff80aba8443e30e75585b9aa61
diff --git a/res/layout-sw600dp/compose.xml b/res/layout-sw600dp/compose.xml
index 5fa19b9..0a111b3 100644
--- a/res/layout-sw600dp/compose.xml
+++ b/res/layout-sw600dp/compose.xml
@@ -118,7 +118,7 @@
                     android:clickable="true"
                     android:focusable="true">
                     <ImageView
-                        android:text="@string/add_file_attachment"
+                        android:text="@string/add_photo_attachment"
                         android:src="@drawable/ic_attach_image_holo_light"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
diff --git a/res/menu-sw600dp/compose_menu.xml b/res/menu-sw600dp/compose_menu.xml
index 5377bce..00e38bd 100644
--- a/res/menu-sw600dp/compose_menu.xml
+++ b/res/menu-sw600dp/compose_menu.xml
@@ -27,6 +27,11 @@
         android:title="@string/save_draft"
         android:alphabeticShortcut="@string/trigger_save_char" />
 
+    <item android:id="@+id/add_file_attachment"
+        android:icon="@drawable/ic_attachment_holo_light"
+        android:title="@string/add_file_attachment"
+        android:showAsAction="never" />
+
     <item android:id="@+id/add_photo_attachment"
         android:icon="@drawable/ic_attachment_holo_light"
         android:title="@string/add_photo_attachment"
diff --git a/res/menu/compose_menu.xml b/res/menu/compose_menu.xml
index ce1ba18..6b564f5 100644
--- a/res/menu/compose_menu.xml
+++ b/res/menu/compose_menu.xml
@@ -22,6 +22,11 @@
         android:icon="@drawable/send"
         android:title="@string/send"/>
 
+    <item android:id="@+id/add_file_attachment"
+        android:icon="@drawable/ic_attachment_holo_light"
+        android:title="@string/add_file_attachment"
+        android:showAsAction="never" />
+
     <item android:id="@+id/add_photo_attachment"
         android:icon="@drawable/ic_attachment_holo_light"
         android:title="@string/add_photo_attachment"
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index ea5c738..c1dd6b1 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -226,6 +226,7 @@
     private static final int INIT_DRAFT_USING_REFERENCE_MESSAGE = 2;
     private static final String EXTRA_SELECTED_ACCOUNT = "selectedAccount";
     private static final String TAG_WAIT = "wait-fragment";
+    private static final String MIME_TYPE_ALL = "*/*";
     private static final String MIME_TYPE_PHOTO = "image/*";
     private static final String MIME_TYPE_VIDEO = "video/*";
 
@@ -1121,10 +1122,6 @@
         if (mPhotoAttachmentsButton != null) {
             mPhotoAttachmentsButton.setOnClickListener(this);
         }
-        mVideoAttachmentsButton = findViewById(R.id.add_video_attachment);
-        if (mVideoAttachmentsButton != null) {
-            mVideoAttachmentsButton.setOnClickListener(this);
-        }
         mTo = (RecipientEditTextView) findViewById(R.id.to);
         mTo.setTokenizer(new Rfc822Tokenizer());
         mCc = (RecipientEditTextView) findViewById(R.id.cc);
@@ -1953,8 +1950,6 @@
             showCcBccViews();
         } else if (id == R.id.add_photo_attachment) {
             doAttach(MIME_TYPE_PHOTO);
-        } else if (id == R.id.add_video_attachment) {
-            doAttach(MIME_TYPE_VIDEO);
         }
     }
 
@@ -2003,6 +1998,10 @@
             sendFeedbackItem.setVisible(mAccount != null
                     && mAccount.supportsCapability(AccountCapabilities.SEND_FEEDBACK));
         }
+
+        // Only show attach file on K. Sigh.
+        menu.findItem(R.id.add_file_attachment).setVisible(Utils.isRunningKitkatOrLater());
+
         return true;
     }
 
@@ -2031,7 +2030,9 @@
         Analytics.getInstance().sendMenuItemEvent(Analytics.EVENT_CATEGORY_MENU_ITEM, id, null, 0);
 
         boolean handled = true;
-        if (id == R.id.add_photo_attachment) {
+        if (id == R.id.add_file_attachment) {
+            doAttach(MIME_TYPE_ALL);
+        } else if (id == R.id.add_photo_attachment) {
             doAttach(MIME_TYPE_PHOTO);
         } else if (id == R.id.add_video_attachment) {
             doAttach(MIME_TYPE_VIDEO);