android:orientation="horizontal" >
<!-- 'OK' / 'CANCEL' BUTTONS CHANGE THEIR ORDER FROM ANDROID 4.0 ; THANKS, GOOGLE -->
- <Button
+ <android.support.v7.widget.AppCompatButton
android:id="@+id/cancel"
+ android:theme="@style/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/common_cancel" />
- <Button
+ <android.support.v7.widget.AppCompatButton
android:id="@+id/ok"
+ android:theme="@style/Button.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dp"
- android:paddingTop="16dp"
- android:paddingBottom="16dp"
+ android:paddingTop="@dimen/standard_padding"
+ android:paddingBottom="@dimen/standard_padding"
android:background="@color/owncloud_blue_accent">
<ImageView
android:id="@+id/itemIcon"
android:layout_width="24sp"
android:layout_height="24sp"
- android:layout_marginLeft="16sp"
+ android:layout_marginLeft="@dimen/standard_padding"
android:layout_marginBottom="3dp"
android:layout_gravity="bottom"
android:src="@drawable/ic_account_circle"
android:text="@string/app_name"
android:textColor="#FFF"
android:paddingLeft="22dp"
- android:paddingRight="16dp"
+ android:paddingRight="@dimen/standard_padding"
android:textSize="24sp"
android:ellipsize="end"
android:singleLine="true"
android:layout_alignParentLeft="true"
android:orientation="horizontal"
android:background="@color/background_color"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="16dp"
+ android:layout_marginTop="@dimen/standard_margin"
+ android:layout_marginBottom="@dimen/standard_margin"
android:minHeight="?android:attr/listPreferredItemHeight">
<ImageView
android:id="@+id/itemIcon"
android:layout_width="24sp"
android:layout_height="24sp"
- android:layout_marginLeft="16sp"
+ android:layout_marginLeft="@dimen/standard_margin"
android:layout_gravity="center_vertical"
/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="22dp"
- android:paddingRight="16dp"
+ android:paddingRight="@dimen/standard_margin"
android:textColor="@color/drawerMenuTextColor"
android:text="@string/app_name"
android:textStyle="normal"
android:layout_width="fill_parent"
android:layout_height="56dp"
android:gravity="center_vertical"
- android:paddingLeft="16dp"
- android:paddingRight="16dp"
- android:textColor="#000"
+ android:paddingLeft="@dimen/standard_padding"
+ android:paddingRight="@dimen/standard_padding"
+ android:textColor="@color/black"
android:textSize="18dp" />
\ No newline at end of file
android:id="@+id/fdFileHeaderContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- android:layout_marginTop="4dp" >
+ android:layout_marginLeft="@dimen/standard_margin"
+ android:layout_marginRight="@dimen/standard_margin"
+ android:layout_marginTop="@dimen/standard_margin">
<ImageView
android:id="@+id/fdIcon"
android:id="@+id/fdDetailsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
+ android:layout_marginLeft="@dimen/standard_margin"
+ android:layout_marginRight="@dimen/standard_margin"
+ android:layout_marginTop="@dimen/standard_margin"
android:layout_below="@id/fdFileHeaderContainer" >
<RelativeLayout
android:id="@+id/fdTypeLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="24dp"
android:text="@string/filedetails_type"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
- android:layout_marginLeft="12dp"
+ android:layout_marginLeft="@dimen/standard_margin"
android:layout_toRightOf="@+id/fdLabelContainer" >
<TextView
android:id="@+id/fdType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="24dp"
android:text="@string/placeholder_filetype"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:layout_height="wrap_content"
android:layout_below="@+id/fdDetailsContainer"
android:gravity="center_horizontal"
- android:layout_margin="16dp"
+ android:layout_margin="@dimen/standard_margin"
>
- <CheckBox
+ <android.support.v7.widget.AppCompatCheckBox
android:id="@+id/fdFavorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
- android:text="@string/favorite" />
+ android:text="@string/favorite"
+ android:checked="false" />
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="16dp"
+ android:layout_margin="@dimen/standard_margin"
android:layout_gravity="center"
android:contentDescription="@string/preview_image_description"
android:src="@drawable/logo" />
<android.support.v7.widget.AppCompatButton
android:id="@+id/folder_picker_btn_cancel"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
<android.support.v7.widget.AppCompatButton
android:id="@+id/folder_picker_btn_choose"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
<android.support.v7.widget.AppCompatButton
android:id="@+id/ok"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
<android.support.v7.widget.AppCompatButton
android:id="@+id/cancel"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
<TextView
android:id="@+id/footerText"
android:layout_width="match_parent"
- android:layout_height="56dp"
+ android:layout_height="wrap_content"
+ android:padding="@dimen/standard_padding"
android:layout_gravity="center"
android:gravity="center"
android:textColor="@color/setup_text_hint"
android:layout_width="match_parent"\r
android:background="@drawable/list_selector"\r
android:orientation="vertical"\r
- android:layout_height="56dp">\r
+ android:layout_height="72dp">\r
\r
<LinearLayout\r
android:layout_width="match_parent"\r
android:orientation="horizontal">\r
\r
<FrameLayout\r
- android:layout_width="56dp"\r
- android:layout_height="56dp"\r
+ android:layout_width="60dp"\r
+ android:layout_height="72dp"\r
+ android:paddingLeft="@dimen/standard_padding"\r
+ android:paddingBottom="@dimen/standard_padding"\r
+ android:paddingTop="@dimen/standard_padding"\r
+ android:paddingRight="4dp"\r
android:focusable="false"\r
android:focusableInTouchMode="false">\r
\r
android:id="@+id/localFileIndicator"\r
android:layout_width="@dimen/file_icon_size"\r
android:layout_height="@dimen/file_icon_size"\r
- android:layout_gravity="center_vertical"\r
- android:layout_marginLeft="22dp"\r
+ android:layout_gravity="top|right"\r
+ android:layout_marginLeft="21dp"\r
android:src="@drawable/local_file_indicator" />\r
\r
<ImageView\r
android:id="@+id/thumbnail"\r
android:layout_width="@dimen/file_icon_size"\r
android:layout_height="@dimen/file_icon_size"\r
- android:layout_gravity="center_vertical"\r
- android:layout_marginLeft="9dp"\r
+ android:layout_gravity="left|center_vertical"\r
android:src="@drawable/ic_menu_archive" />\r
\r
<ImageView\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
android:layout_gravity="bottom|right"\r
- android:layout_marginBottom="10dp"\r
android:layout_marginRight="2dp"\r
android:src="@drawable/ic_favorite" />\r
</FrameLayout>\r
android:layout_width="0dp"\r
android:layout_height="match_parent"\r
android:layout_weight="1"\r
- android:gravity="center_vertical"\r
+ android:gravity="top"\r
+ android:paddingTop="@dimen/standard_padding"\r
android:orientation="vertical" >\r
\r
<TextView\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
android:layout_gravity="center_vertical"\r
- android:layout_marginLeft="4dp"\r
+ android:layout_marginLeft="0dp"\r
android:layout_marginRight="4dp"\r
android:ellipsize="middle"\r
android:singleLine="true"\r
android:text="TextView"\r
android:textColor="#303030"\r
- android:textSize="16dip" />\r
+ android:textSize="@dimen/two_line_primary_text_size" />\r
\r
<LinearLayout\r
android:layout_width="match_parent"\r
android:layout_height="wrap_content"\r
- android:layout_marginLeft="4dp"\r
+ android:layout_marginLeft="0dp"\r
android:layout_marginRight="4dp"\r
- android:weightSum="1">\r
+ android:orientation="horizontal">\r
\r
<TextView\r
android:id="@+id/last_mod"\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
android:text="TextView"\r
- android:layout_weight=".5"\r
android:textColor="@color/list_item_lastmod_and_filesize_text"\r
- android:textSize="12dip"/>\r
+ android:textSize="@dimen/two_line_secondary_text_size"/>\r
+\r
+ <TextView\r
+ android:id="@+id/file_separator"\r
+ android:layout_width="wrap_content"\r
+ android:layout_height="wrap_content"\r
+ android:gravity="right"\r
+ android:text=", "\r
+ android:textColor="@color/list_item_lastmod_and_filesize_text"\r
+ android:textSize="@dimen/two_line_secondary_text_size"/>\r
\r
<TextView\r
android:id="@+id/file_size"\r
android:gravity="right"\r
android:text="TextView"\r
android:textColor="@color/list_item_lastmod_and_filesize_text"\r
- android:layout_weight=".5"\r
- android:textSize="12dip"/>\r
+ android:textSize="@dimen/two_line_secondary_text_size"/>\r
\r
</LinearLayout>\r
\r
android:layout_height="wrap_content"\r
android:layout_gravity="center_vertical"\r
android:layout_marginLeft="4dp"\r
- android:layout_marginRight="4dp"\r
+ android:layout_marginRight="@dimen/standard_margin"\r
android:gravity=""\r
- android:src="@android:drawable/checkbox_off_background" />\r
+ android:src="@drawable/ic_checkbox_blank_outline" />\r
</LinearLayout>\r
\r
<View\r
android:clickable="true"
android:orientation="vertical"
android:background="#fff"
- android:paddingLeft="16dp"
+ android:paddingLeft="@dimen/standard_padding"
tools:context=".MainActivity" >
<TextView
android:layout_height="wrap_content"
android:drawablePadding="5dp"
android:gravity="center_vertical"
- android:paddingLeft="16dp"
+ android:paddingLeft="@dimen/standard_padding"
android:textSize="16dp" >
</TextView>
android:layout_height="56dp"
android:layout_marginLeft="8dp"
android:gravity="left"
- android:paddingLeft="16dp"
+ android:paddingLeft="@dimen/standard_padding"
android:paddingTop="8dp"
android:textSize="16dp"
android:groupIndicator="@android:color/transparent"
android:id="@+id/loadingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal" >
+ android:orientation="horizontal"
+ android:padding="@dimen/standard_padding">
<ProgressBar
android:id="@+id/loadingBar"
+ style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- android:layout_marginBottom="10dp"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="5dp"
- android:layout_marginTop="10dp" />
+ android:indeterminate="true"
+ android:indeterminateOnly="false"/>
<TextView
android:id="@+id/loadingText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- android:layout_marginRight="20dp"
+ android:layout_marginLeft="@dimen/standard_margin"
android:text="TextView" />
</LinearLayout>
android:textStyle="bold"
android:textSize="22dp"
android:textColor="#000000"
- android:layout_marginTop="5dp"
- android:layout_marginBottom="5dp" />
+ android:layout_marginBottom="@dimen/standard_margin" />
</LinearLayout>
\ No newline at end of file
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:padding="10dp"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
android:weightSum="1" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_marginBottom="15dp"
- android:layout_weight="1" >
+ android:layout_marginBottom="@dimen/standard_margin"
+ android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical" >
+ android:orientation="vertical"
+ android:paddingLeft="@dimen/standard_padding"
+ android:paddingRight="@dimen/standard_padding">
<TextView
android:id="@+id/logTV"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:text="@string/empty" />
+ android:text="@string/empty"
+ android:typeface="monospace"/>
</LinearLayout>
</ScrollView>
android:id="@+id/historyButtonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal" >
+ android:orientation="horizontal"
+ android:layout_marginBottom="@dimen/standard_margin"
+ android:layout_marginLeft="@dimen/standard_margin"
+ android:layout_marginRight="@dimen/standard_margin">
- <android.support.v7.widget.AppCompatButton
+ <Button
android:id="@+id/deleteLogHistoryButton"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
<android.support.v7.widget.AppCompatButton
android:id="@+id/sendLogHistoryButton"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button.Primary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:oc="http://schemas.android.com/apk/res/com.owncloud.android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
- android:padding="20dp" >
+ android:padding="@dimen/standard_padding" >
<TextView
android:text="@string/pass_code_enter_pass_code"
android:textColor="@android:color/black"
android:gravity="center_horizontal"
+ android:textSize="16sp"
/>
<TextView
android:text="@string/pass_code_configure_your_pass_code_explanation"
android:textAppearance="@android:style/TextAppearance.Small"
android:gravity="center_horizontal"
+ android:textSize="14sp"
/>
<LinearLayout
<android.support.v7.widget.AppCompatButton
android:id="@+id/cancel"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/common_cancel" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
- android:padding="16dp"
+ android:padding="@dimen/standard_padding"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
- android:paddingBottom="16dp"
+ android:paddingBottom="@dimen/standard_padding"
android:text="@string/ssl_validator_header"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
- android:paddingTop="16dp"
+ android:paddingTop="@dimen/standard_padding"
android:text="@string/ssl_validator_question"
android:textAppearance="?android:attr/textAppearanceMedium"
>
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
- android:padding="16dp">
+ android:padding="@dimen/standard_padding">
<TextView
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ssl_validator_header"
- android:paddingBottom="16dp"
+ android:paddingBottom="@dimen/standard_padding"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/black"
/>
android:id="@+id/question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingTop="16dp"
+ android:paddingTop="@dimen/standard_padding"
android:text="@string/ssl_validator_question"
android:textAppearance="?android:attr/textAppearanceMedium"
>
\r
<android.support.v7.widget.AppCompatButton\r
android:id="@+id/upload_files_btn_cancel"\r
- style="@style/ownCloud.Button"\r
+ android:theme="@style/Button"\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
android:layout_weight="1"\r
\r
<android.support.v7.widget.AppCompatButton\r
android:id="@+id/upload_files_btn_upload"\r
- style="@style/ownCloud.Button"\r
+ android:theme="@style/Button.Primary"\r
android:layout_width="wrap_content"\r
android:layout_height="wrap_content"\r
android:layout_weight="1"\r
android:orientation="horizontal" >
<android.support.v7.widget.AppCompatButton
+ android:theme="@style/Button"
android:id="@+id/uploader_cancel"
style="@style/ownCloud.Button"
android:layout_width="fill_parent"
<android.support.v7.widget.AppCompatButton
android:id="@+id/uploader_choose_folder"
- style="@style/ownCloud.Button"
+ android:theme="@style/Button.Primary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_width="fill_parent"
android:background="#fefefe"
android:orientation="horizontal"
- android:layout_height="56dp" >
+ android:layout_height="72dp"
+ android:padding="@dimen/standard_padding">
<ImageView
- android:layout_width="20dp"
- android:layout_height="20dp"
+ android:layout_width="@dimen/file_icon_size"
+ android:layout_height="@dimen/file_icon_size"
android:layout_gravity="center_vertical|center"
- android:layout_margin="4dp"
android:src="@drawable/ic_menu_archive"
- android:id="@+id/thumbnail" />
+ android:id="@+id/thumbnail"
+ android:layout_marginRight="@dimen/standard_padding"/>
<TextView
android:text="TextView"
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
-
- <style name="Theme.ownCloud.ButtonStyle" parent="@android:style/Widget.Holo.Light.Button">
- <item name="android:background">@android:drawable/btn_default</item>
- <item name="android:textColor">@color/button_text_color</item>
- </style>
<!-- Notifications -->
<style name="Theme.ownCloud.NotificationText.Title"
<style name="Theme.ownCloud" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
<item name="actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
- <item name="android:buttonStyle">@style/Theme.ownCloud.ButtonStyle</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/color_accent</item>
<item name="android:alertDialogTheme">@style/Theme.ownCloud.Dialog</item>
<item name="alertDialogTheme">@style/ownCloud.AlertDialog</item>
- <item name="colorButtonNormal">@color/background_color</item>
- <item name="colorControlActivated">@color/primary_dark</item>
- <item name="colorControlHighlight">@color/color_accent</item>
</style>
<!-- seperate action bar style for activities without an action bar -->
<style name="Theme.ownCloud.noActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
- <item name="android:buttonStyle">@style/Theme.ownCloud.ButtonStyle</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorAccent">@color/color_accent</item>
<item name="android:alertDialogTheme">@style/Theme.ownCloud.Dialog</item>
<item name="alertDialogTheme">@style/ownCloud.AlertDialog</item>
- <item name="colorButtonNormal">@color/background_color</item>
- <item name="colorControlActivated">@color/primary_dark</item>
- <item name="colorControlHighlight">@color/color_accent</item>
</style>
<style name="Theme.ownCloud.noActionBar.Login" parent="Theme.ownCloud.noActionBar">
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
-
- <!-- Buttons -->
- <style name="Theme.ownCloud.ButtonStyle" parent="@android:style/Widget.Button">
- <item name="android:background">@android:drawable/btn_default</item>
- <item name="android:textColor">@color/button_text_color</item>
- </style>
-
+
<!-- DropDown -->
<style name="Theme.ownCloud.DropDownStyle"
parent="style/Widget.AppCompat.Spinner.DropDown.ActionBar">
});\r
\r
mOkButton = findViewById(R.id.buttonOK);\r
+ mOkButton.setOnClickListener(new View.OnClickListener() {\r
+\r
+ @Override\r
+ public void onClick(View v) {\r
+ onOkClick();\r
+ }\r
+ });\r
+\r
+ mCenteredRefreshButton = findViewById(R.id.centeredRefreshButton);\r
+ mCenteredRefreshButton.setOnClickListener(new View.OnClickListener() {\r
+\r
+ @Override\r
+ public void onClick(View v) {\r
+ checkOcServer();\r
+ }\r
+ });\r
+\r
\r
/// initialize block to be moved to single Fragment to check server and get info about it \r
initServerPreFragment(savedInstanceState);\r
\r
mHostUrlInput.removeTextChangedListener(mHostUrlInputWatcher);\r
mHostUrlInput.setOnFocusChangeListener(null);\r
- \r
+\r
super.onPause();\r
}\r
\r
Intent getServerInfoIntent = new Intent();\r
getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);\r
getServerInfoIntent.putExtra(\r
- OperationsService.EXTRA_SERVER_URL,\r
- normalizeUrlSuffix(uri)\r
+ OperationsService.EXTRA_SERVER_URL,\r
+ normalizeUrlSuffix(uri)\r
);\r
if (mOperationsServiceBinder != null) {\r
mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);\r
}\r
\r
/**\r
- * Called when the refresh button in the input field for ownCloud host is clicked.\r
- * \r
- * Performs a new check on the URL in the input field.\r
- * \r
- * @param view Refresh 'button'\r
- */\r
- public void onRefreshClick(View view) {\r
- checkOcServer();\r
- }\r
-\r
-\r
- /**\r
* Called when the eye icon in the password field is clicked.\r
* \r
* Toggles the visibility of the password in the field. \r
public static Bitmap mDefaultImg =
BitmapFactory.decodeResource(
- MainApp.getAppContext().getResources(),
- DisplayUtils.getFileTypeIconId("image/png", "default.png")
+ MainApp.getAppContext().getResources(),
+ R.drawable.file_image
);
// }
// Display username in drawer
- Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
- if (account != null) {
- TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username);
- int lastAtPos = account.name.lastIndexOf("@");
- username.setText(account.name.substring(0, lastAtPos));
- }
+ setUsernameInDrawer(navigationDrawerLayout, AccountUtils.getCurrentOwnCloudAccount(getApplicationContext()));
// load slide menu items
mDrawerTitles = getResources().getStringArray(R.array.drawer_items);
}
/**
+ * sets the given account name in the drawer in case the drawer is available. The account name
+ * is shortened beginning from the @-sign in the username.
+ *
+ * @param navigationDrawerLayout the drawer layout to be used
+ * @param account the account to be set in the drawer
+ */
+ protected void setUsernameInDrawer(RelativeLayout navigationDrawerLayout, Account account) {
+ if (navigationDrawerLayout != null && getAccount() != null) {
+ TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username);
+ int lastAtPos = account.name.lastIndexOf("@");
+ username.setText(account.name.substring(0, lastAtPos));
+ }
+ }
+
+ /**
* Updates title bar and home buttons (state and icon).
*
* Assumes that navigation drawer is NOT visible.
setFile(file);
if (mAccountWasSet) {
- RelativeLayout navigationDrawerLayout = (RelativeLayout) findViewById(R.id.left_drawer);
- if (navigationDrawerLayout != null && getAccount() != null) {
- TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username);
- int lastAtPos = getAccount().name.lastIndexOf("@");
- username.setText(getAccount().name.substring(0, lastAtPos));
- }
+ setUsernameInDrawer((RelativeLayout) findViewById(R.id.left_drawer), getAccount());
}
if (!stateWasRecovered) {
import com.owncloud.android.ui.activity.ComponentsGetter;\r
import com.owncloud.android.utils.DisplayUtils;\r
import com.owncloud.android.utils.FileStorageUtils;\r
+import com.owncloud.android.utils.MimetypeIconUtil;\r
\r
\r
/**\r
switch (viewType){\r
case LIST_ITEM:\r
TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);\r
+ TextView fileSizeSeparatorV = (TextView) view.findViewById(R.id.file_separator);\r
TextView lastModV = (TextView) view.findViewById(R.id.last_mod);\r
ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);\r
\r
\r
checkBoxV.setVisibility(View.GONE);\r
\r
+ fileSizeSeparatorV.setVisibility(View.VISIBLE);\r
fileSizeV.setVisibility(View.VISIBLE);\r
fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));\r
\r
} else {\r
if (parentList.isItemChecked(position)) {\r
checkBoxV.setImageResource(\r
- android.R.drawable.checkbox_on_background);\r
+ R.drawable.ic_checkbox_marked);\r
} else {\r
checkBoxV.setImageResource(\r
- android.R.drawable.checkbox_off_background);\r
+ R.drawable.ic_checkbox_blank_outline);\r
}\r
checkBoxV.setVisibility(View.VISIBLE);\r
}\r
}\r
\r
} else { //Folder\r
+ fileSizeSeparatorV.setVisibility(View.INVISIBLE);\r
fileSizeV.setVisibility(View.INVISIBLE);\r
}\r
\r
\r
\r
} else {\r
- fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(),\r
+ fileIcon.setImageResource(MimetypeIconUtil.getFileTypeIconId(file.getMimetype(),\r
file.getFileName()));\r
}\r
\r
} else {\r
// Folder\r
-\r
- if (checkIfFileIsSharedWithMe(file)) {\r
- fileIcon.setImageResource(R.drawable.shared_with_me_folder);\r
- } else if (file.isShareByLink()) {\r
- // If folder is sharedByLink, icon folder must be changed to\r
- // folder-public one\r
- fileIcon.setImageResource(R.drawable.folder_public);\r
- } else {\r
- fileIcon.setImageResource(\r
- DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName())\r
- );\r
- }\r
+ fileIcon.setImageResource(\r
+ MimetypeIconUtil.getFolderTypeIconId(\r
+ checkIfFileIsSharedWithMe(file), file.isShareByLink()));\r
}\r
}\r
\r
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.utils.BitmapUtils;
import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.MimetypeIconUtil;
/**
* This Adapter populates a ListView with all files and directories contained
fileIcon.setTag(file.hashCode());
TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);
+ TextView fileSizeSeparatorV = (TextView) view.findViewById(R.id.file_separator);
TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
if (!file.isDirectory()) {
+ fileSizeSeparatorV.setVisibility(View.VISIBLE);
fileSizeV.setVisibility(View.VISIBLE);
fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.length()));
checkBoxV.setVisibility(View.GONE);
} else {
if (parentList.isItemChecked(position)) {
- checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
+ checkBoxV.setImageResource(R.drawable.ic_checkbox_marked);
} else {
- checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
+ checkBoxV.setImageResource(R.drawable.ic_checkbox_blank_outline);
}
checkBoxV.setVisibility(View.VISIBLE);
}
}
}
} else {
- fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(null, file.getName()));
+ fileIcon.setImageResource(MimetypeIconUtil.getFileTypeIconId(null, file.getName()));
}
} else {
+ fileSizeSeparatorV.setVisibility(View.GONE);
fileSizeV.setVisibility(View.GONE);
lastModV.setVisibility(View.GONE);
checkBoxV.setVisibility(View.GONE);
import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.MimetypeIconUtil;
import java.lang.ref.WeakReference;
}
ImageView iv = (ImageView) getView().findViewById(R.id.fdIcon);
if (iv != null) {
- iv.setImageResource(DisplayUtils.getFileTypeIconId(mimetype, filename));
+ iv.setImageResource(MimetypeIconUtil.getFileTypeIconId(mimetype, filename));
}
}
ImageView checkBoxV = (ImageView) v.findViewById(R.id.custom_checkbox);
if (checkBoxV != null) {
if (((ListView)getListView()).isItemChecked(position)) {
- checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
+ checkBoxV.setImageResource(R.drawable.ic_checkbox_marked);
} else {
- checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
+ checkBoxV.setImageResource(R.drawable.ic_checkbox_blank_outline);
}
}
// notify the change to the container Activity
\r
package com.owncloud.android.utils;\r
\r
-import java.net.IDN;\r
-import java.text.DateFormat;\r
-import java.util.Arrays;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-import java.util.Vector;\r
-\r
import android.annotation.TargetApi;\r
import android.app.Activity;\r
import android.content.Context;\r
-import android.graphics.Color;\r
import android.graphics.Point;\r
import android.graphics.PorterDuff;\r
import android.os.Build;\r
import android.text.format.DateUtils;\r
import android.view.Display;\r
-import android.webkit.MimeTypeMap;\r
import android.widget.ProgressBar;\r
import android.widget.SeekBar;\r
\r
import com.owncloud.android.R;\r
import com.owncloud.android.datamodel.OCFile;\r
\r
+import java.math.BigDecimal;\r
+import java.net.IDN;\r
+import java.text.DateFormat;\r
+import java.util.Calendar;\r
+import java.util.Date;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
/**\r
* A helper class for some string operations.\r
*/\r
public class DisplayUtils {\r
\r
private static final String OWNCLOUD_APP_NAME = "ownCloud";\r
-\r
- //private static String TAG = DisplayUtils.class.getSimpleName(); \r
\r
private static final String[] sizeSuffixes = { "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };\r
+ private static final int[] sizeScales = { 0, 0, 0, 1, 1, 2, 2, 2, 2 };\r
+\r
+ private static Map<String, String> mimeType2HumanReadable;\r
\r
- private static HashMap<String, String> mimeType2HUmanReadable;\r
static {\r
- mimeType2HUmanReadable = new HashMap<String, String>();\r
+ mimeType2HumanReadable = new HashMap<String, String>();\r
// images\r
- mimeType2HUmanReadable.put("image/jpeg", "JPEG image");\r
- mimeType2HUmanReadable.put("image/jpg", "JPEG image");\r
- mimeType2HUmanReadable.put("image/png", "PNG image");\r
- mimeType2HUmanReadable.put("image/bmp", "Bitmap image");\r
- mimeType2HUmanReadable.put("image/gif", "GIF image");\r
- mimeType2HUmanReadable.put("image/svg+xml", "JPEG image");\r
- mimeType2HUmanReadable.put("image/tiff", "TIFF image");\r
+ mimeType2HumanReadable.put("image/jpeg", "JPEG image");\r
+ mimeType2HumanReadable.put("image/jpg", "JPEG image");\r
+ mimeType2HumanReadable.put("image/png", "PNG image");\r
+ mimeType2HumanReadable.put("image/bmp", "Bitmap image");\r
+ mimeType2HumanReadable.put("image/gif", "GIF image");\r
+ mimeType2HumanReadable.put("image/svg+xml", "JPEG image");\r
+ mimeType2HumanReadable.put("image/tiff", "TIFF image");\r
// music\r
- mimeType2HUmanReadable.put("audio/mpeg", "MP3 music file");\r
- mimeType2HUmanReadable.put("application/ogg", "OGG music file");\r
-\r
+ mimeType2HumanReadable.put("audio/mpeg", "MP3 music file");\r
+ mimeType2HumanReadable.put("application/ogg", "OGG music file");\r
}\r
\r
- private static final String TYPE_APPLICATION = "application";\r
- private static final String TYPE_AUDIO = "audio";\r
- private static final String TYPE_IMAGE = "image";\r
- private static final String TYPE_TXT = "text";\r
- private static final String TYPE_VIDEO = "video";\r
- \r
- private static final String SUBTYPE_PDF = "pdf";\r
- private static final String SUBTYPE_XML = "xml";\r
- private static final String[] SUBTYPES_DOCUMENT = { \r
- "msword",\r
- "vnd.openxmlformats-officedocument.wordprocessingml.document",\r
- "vnd.oasis.opendocument.text",\r
- "rtf",\r
- "javascript"\r
- };\r
- private static Set<String> SUBTYPES_DOCUMENT_SET = new HashSet<String>(Arrays.asList(SUBTYPES_DOCUMENT));\r
- private static final String[] SUBTYPES_SPREADSHEET = {\r
- "msexcel",\r
- "vnd.ms-excel",\r
- "vnd.openxmlformats-officedocument.spreadsheetml.sheet",\r
- "vnd.oasis.opendocument.spreadsheet"\r
- };\r
- private static Set<String> SUBTYPES_SPREADSHEET_SET = new HashSet<String>(Arrays.asList(SUBTYPES_SPREADSHEET));\r
- private static final String[] SUBTYPES_PRESENTATION = { \r
- "mspowerpoint",\r
- "vnd.ms-powerpoint",\r
- "vnd.openxmlformats-officedocument.presentationml.presentation",\r
- "vnd.oasis.opendocument.presentation"\r
- };\r
- private static Set<String> SUBTYPES_PRESENTATION_SET = new HashSet<String>(Arrays.asList(SUBTYPES_PRESENTATION));\r
- private static final String[] SUBTYPES_COMPRESSED = {"x-tar", "x-gzip", "zip"};\r
- private static final Set<String> SUBTYPES_COMPRESSED_SET = new HashSet<String>(Arrays.asList(SUBTYPES_COMPRESSED));\r
- private static final String SUBTYPE_OCTET_STREAM = "octet-stream";\r
- private static final String EXTENSION_RAR = "rar";\r
- private static final String EXTENSION_RTF = "rtf";\r
- private static final String EXTENSION_3GP = "3gp";\r
- private static final String EXTENSION_PY = "py";\r
- private static final String EXTENSION_JS = "js";\r
- \r
/**\r
* Converts the file size in bytes to human readable output.\r
- * \r
+ * <ul>\r
+ * <li>appends a size suffix, e.g. B, KB, MB etc.</li>\r
+ * <li>rounds the size based on the suffix to 0,1 or 2 decimals</li>\r
+ * </ul>\r
+ *\r
* @param bytes Input file size\r
* @return Like something readable like "12 MB"\r
*/\r
public static String bytesToHumanReadable(long bytes) {\r
double result = bytes;\r
- int attachedsuff = 0;\r
- while (result > 1024 && attachedsuff < sizeSuffixes.length) {\r
+ int attachedSuff = 0;\r
+ while (result > 1024 && attachedSuff < sizeSuffixes.length) {\r
result /= 1024.;\r
- attachedsuff++;\r
+ attachedSuff++;\r
}\r
- result = ((int) (result * 100)) / 100.;\r
- return result + " " + sizeSuffixes[attachedsuff];\r
+\r
+ return new BigDecimal(result).setScale(\r
+ sizeScales[attachedSuff], BigDecimal.ROUND_HALF_UP) + " " + sizeSuffixes[attachedSuff];\r
}\r
\r
/**\r
* @return A human friendly version of the MIME type\r
*/\r
public static String convertMIMEtoPrettyPrint(String mimetype) {\r
- if (mimeType2HUmanReadable.containsKey(mimetype)) {\r
- return mimeType2HUmanReadable.get(mimetype);\r
+ if (mimeType2HumanReadable.containsKey(mimetype)) {\r
+ return mimeType2HumanReadable.get(mimetype);\r
}\r
if (mimetype.split("/").length >= 2)\r
return mimetype.split("/")[1].toUpperCase() + " file";\r
return "Unknown type";\r
}\r
- \r
- \r
- /**\r
- * Returns the resource identifier of an image to use as icon associated to a known MIME type.\r
- * \r
- * @param mimetype MIME type string; if NULL, the method tries to guess it from the extension in filename\r
- * @param filename Name, with extension.\r
- * @return Identifier of an image resource.\r
- */\r
- public static int getFileTypeIconId(String mimetype, String filename) {\r
-\r
- if (mimetype == null) {\r
- String fileExtension = getExtension(filename);\r
- mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);\r
- if (mimetype == null) {\r
- mimetype = TYPE_APPLICATION + "/" + SUBTYPE_OCTET_STREAM;\r
- }\r
- } \r
- \r
- if ("DIR".equals(mimetype)) {\r
- return R.drawable.ic_menu_archive;\r
-\r
- } else {\r
- String [] parts = mimetype.split("/");\r
- String type = parts[0];\r
- String subtype = (parts.length > 1) ? parts[1] : "";\r
- \r
- if(TYPE_TXT.equals(type)) {\r
- return R.drawable.file_doc;\r
- \r
- } else if(TYPE_IMAGE.equals(type)) {\r
- return R.drawable.file_image;\r
- \r
- } else if(TYPE_VIDEO.equals(type)) {\r
- return R.drawable.file_movie;\r
- \r
- } else if(TYPE_AUDIO.equals(type)) { \r
- return R.drawable.file_sound;\r
- \r
- } else if(TYPE_APPLICATION.equals(type)) {\r
- \r
- if (SUBTYPE_PDF.equals(subtype)) {\r
- return R.drawable.file_pdf;\r
- \r
- } else if (SUBTYPE_XML.equals(subtype)) {\r
- return R.drawable.file_doc;\r
-\r
- } else if (SUBTYPES_DOCUMENT_SET.contains(subtype)) {\r
- return R.drawable.file_doc;\r
-\r
- } else if (SUBTYPES_SPREADSHEET_SET.contains(subtype)) {\r
- return R.drawable.file_xls;\r
-\r
- } else if (SUBTYPES_PRESENTATION_SET.contains(subtype)) {\r
- return R.drawable.file_ppt;\r
-\r
- } else if (SUBTYPES_COMPRESSED_SET.contains(subtype)) {\r
- return R.drawable.file_zip;\r
-\r
- } else if (SUBTYPE_OCTET_STREAM.equals(subtype) ) {\r
- if (getExtension(filename).equalsIgnoreCase(EXTENSION_RAR)) {\r
- return R.drawable.file_zip;\r
- \r
- } else if (getExtension(filename).equalsIgnoreCase(EXTENSION_RTF)) {\r
- return R.drawable.file_doc;\r
- \r
- } else if (getExtension(filename).equalsIgnoreCase(EXTENSION_3GP)) {\r
- return R.drawable.file_movie;\r
- \r
- } else if ( getExtension(filename).equalsIgnoreCase(EXTENSION_PY) ||\r
- getExtension(filename).equalsIgnoreCase(EXTENSION_JS)) {\r
- return R.drawable.file_doc;\r
- } \r
- } \r
- }\r
- }\r
-\r
- // default icon\r
- return R.drawable.file;\r
- }\r
\r
- \r
- private static String getExtension(String filename) {\r
- String extension = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();\r
- return extension;\r
- }\r
- \r
/**\r
* Converts Unix time to human readable format\r
* @param milliseconds that have passed since 01/01/1970\r
return df.format(date);\r
}\r
\r
- \r
public static int getSeasonalIconId() {\r
if (Calendar.getInstance().get(Calendar.DAY_OF_YEAR) >= 354 &&\r
MainApp.getAppContext().getString(R.string.app_name).equals(OWNCLOUD_APP_NAME)) {\r
--- /dev/null
+package com.owncloud.android.utils;
+
+import android.webkit.MimeTypeMap;
+
+import com.owncloud.android.R;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>Helper class for detecting the right icon for a file or folder,
+ * based on its mime type and file extension.</p>
+ *
+ * This class maintains all the necessary mappings fot these detections.<br/>
+ * In order to add further mappings, there are up to three look up maps that need further values:
+ * <ol>
+ * <li>
+ * {@link MimetypeIconUtil#FILE_EXTENSION_TO_MIMETYPE_MAPPING}<br/>
+ * to add a new file extension to mime type mapping
+ * </li>
+ * <li>
+ * {@link MimetypeIconUtil#MIMETYPE_TO_ICON_MAPPING}<br/>
+ * to add a new mapping of a mime type to an icon mapping
+ * </li>
+ * <li>
+ * {@link MimetypeIconUtil#MAINMIMETYPE_TO_ICON_MAPPING}<br/>
+ * to add a new mapping for the main part of a mime type.
+ * This is a list of fallback mappings in case there is no mapping for the complete mime type
+ * </li>
+ * </ol>
+ */
+public class MimetypeIconUtil {
+ /** Mapping: icon for mime type */
+ private static final Map<String, Integer> MIMETYPE_TO_ICON_MAPPING = new HashMap<String, Integer>();
+ /** Mapping: icon for main mime type (first part of a mime type declaration). */
+ private static final Map<String, Integer> MAINMIMETYPE_TO_ICON_MAPPING = new HashMap<String, Integer>();
+ /** Mapping: mime type for file extension. */
+ private static final Map<String, List<String>> FILE_EXTENSION_TO_MIMETYPE_MAPPING =
+ new HashMap<String, List<String>>();
+
+ static {
+ populateFileExtensionMimeTypeMapping();
+ populateMimeTypeIconMapping();
+ populateMainMimeTypeMapping();
+ }
+
+ /**
+ * Returns the resource identifier of an image to use as icon associated to a known MIME type.
+ *
+ * @param mimetype MIME type string; if NULL, the method tries to guess it from the extension in filename
+ * @param filename Name, with extension.
+ * @return Identifier of an image resource.
+ */
+ public static int getFileTypeIconId(String mimetype, String filename) {
+ List<String> possibleMimeTypes;
+ if (mimetype == null) {
+ possibleMimeTypes = determineMimeTypesByFilename(filename);
+ } else {
+ possibleMimeTypes = Collections.singletonList(mimetype);
+ }
+
+ return determineIconIdByMimeTypeList(possibleMimeTypes);
+ }
+
+ /**
+ * Returns the resource identifier of an image to use as icon associated to a type of folder.
+ *
+ * @param isSharedWithUser flag if the folder is shared with the user
+ * @param isShareByLink flag if the folder is shared by link
+ * @return Identifier of an image resource.
+ */
+ public static int getFolderTypeIconId(boolean isSharedWithUser, boolean isShareByLink) {
+ if (isSharedWithUser) {
+ return R.drawable.shared_with_me_folder;
+ } else if (isShareByLink) {
+ return R.drawable.folder_public;
+ }
+
+ return R.drawable.ic_menu_archive;
+ }
+
+ /**
+ * determines the icon based on the mime type.
+ *
+ * @param mimetypes the mimetypes
+ * @return the icon id, R.drawable.file if the mime type could not be matched at all or was {@code null}
+ */
+ private static int determineIconIdByMimeTypeList(List<String> mimetypes) {
+ // no mime type leads to file
+ if (mimetypes == null || mimetypes.size() < 1) {
+ return R.drawable.file;
+ } else {
+
+ // search for full mime type mapping
+ for (String mimetype : mimetypes) {
+ Integer iconId = MIMETYPE_TO_ICON_MAPPING.get(mimetype);
+
+ if (iconId != null) {
+ return iconId;
+ }
+ }
+
+ // fallback to main mime type part mapping
+ for (String mimetype : mimetypes) {
+ String mainMimetypePart = mimetype.split("/")[0];
+
+ Integer iconId = MAINMIMETYPE_TO_ICON_MAPPING.get(mainMimetypePart);
+ if (iconId != null) {
+ return iconId;
+ }
+ }
+ }
+
+ // no match found at all, falling back to file
+ return R.drawable.file;
+ }
+
+ /**
+ * determines the list of possible mime types for the given file, based on its extension.
+ *
+ * @param filename the file name
+ * @return list of possible mime types (ordered), empty list in case no mime types found
+ */
+ private static List<String> determineMimeTypesByFilename(String filename) {
+ String fileExtension = getExtension(filename);
+
+ // try detecting the mimetype based on the web app logic equivalent
+ List<String> mimeTypeList = FILE_EXTENSION_TO_MIMETYPE_MAPPING.get(fileExtension);
+ if (mimeTypeList != null && mimeTypeList.size() > 0) {
+ return mimeTypeList;
+ } else {
+ // try detecting the mime type via android itself
+ String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
+ if (mimeType != null) {
+ return Collections.singletonList(mimeType);
+ } else {
+ return new ArrayList<String>();
+ }
+ }
+ }
+
+ /**
+ * provides the file extension of a given filename.
+ *
+ * @param filename the filename
+ * @return the file extension
+ */
+ private static String getExtension(String filename) {
+ String extension = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();
+ return extension;
+ }
+
+ /**
+ * populates the mapping list: full mime type --> icon.
+ */
+ private static void populateMimeTypeIconMapping() {
+ MIMETYPE_TO_ICON_MAPPING.put("application/coreldraw", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/epub+zip", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/font-sfnt", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/font-woff", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/illustrator", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/javascript", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("application/json", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("application/msaccess", R.drawable.file);
+ MIMETYPE_TO_ICON_MAPPING.put("application/msexcel", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/mspowerpoint", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/msword", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/octet-stream", R.drawable.file);
+ MIMETYPE_TO_ICON_MAPPING.put("application/postscript", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/pdf", R.drawable.file_pdf);
+ MIMETYPE_TO_ICON_MAPPING.put("application/rss+xml", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("application/rtf", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.android.package-archive", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-excel", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-excel.addin.macroEnabled.12", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-excel.sheet.binary.macroEnabled.12", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-excel.sheet.macroEnabled.12", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-excel.template.macroEnabled.12", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-fontobject", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-powerpoint", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-powerpoint.addin.macroEnabled.12", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-powerpoint.presentation.macroEnabled.12", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-powerpoint.slideshow.macroEnabled.12", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-powerpoint.template.macroEnabled.12", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-word.document.macroEnabled.12", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-word.template.macroEnabled.12", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.presentation", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.presentation-template", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.spreadsheet", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.spreadsheet-template", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.text", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.text-master", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.text-template", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.text-web", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.openxmlformats-officedocument.presentationml.presentation", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.openxmlformats-officedocument.presentationml.slideshow", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.openxmlformats-officedocument.presentationml.template", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.openxmlformats-officedocument.spreadsheetml.template", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.openxmlformats-officedocument.wordprocessingml.document", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/vnd.openxmlformats-officedocument.wordprocessingml.template", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-7z-compressed", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-bin", R.drawable.file_application);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-cbr", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-compressed", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-dcraw", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-deb", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-font", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-gimp", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-gzip", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-ms-dos-executable", R.drawable.file_application);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-msi", R.drawable.file_application);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-iwork-numbers-sffnumbers", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-iwork-keynote-sffkey", R.drawable.file_ppt);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-iwork-pages-sffpages", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-perl", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-photoshop", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-php", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-rar-compressed", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-shockwave-flash", R.drawable.file_application);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-tar", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("application/x-tex", R.drawable.file_doc);
+ MIMETYPE_TO_ICON_MAPPING.put("application/xml", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("application/yaml", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("application/zip", R.drawable.file_zip);
+ MIMETYPE_TO_ICON_MAPPING.put("database", R.drawable.file);
+ MIMETYPE_TO_ICON_MAPPING.put("httpd/unix-directory", R.drawable.ic_menu_archive);
+ MIMETYPE_TO_ICON_MAPPING.put("image/svg+xml", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("image/vector", R.drawable.file_image);
+ MIMETYPE_TO_ICON_MAPPING.put("text/calendar", R.drawable.file_calendar);
+ MIMETYPE_TO_ICON_MAPPING.put("text/css", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("text/csv", R.drawable.file_xls);
+ MIMETYPE_TO_ICON_MAPPING.put("text/html", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("text/vcard", R.drawable.file_vcard);
+ MIMETYPE_TO_ICON_MAPPING.put("text/x-c", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("text/x-c++src", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("text/x-h", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("text/x-python", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("text/x-shellscript", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("web", R.drawable.file_code);
+ MIMETYPE_TO_ICON_MAPPING.put("DIR", R.drawable.ic_menu_archive);
+ }
+
+ /**
+ * populates the mapping list: main mime type --> icon.
+ */
+ private static void populateMainMimeTypeMapping() {
+ MAINMIMETYPE_TO_ICON_MAPPING.put("audio", R.drawable.file_sound);
+ MAINMIMETYPE_TO_ICON_MAPPING.put("database", R.drawable.file);
+ MAINMIMETYPE_TO_ICON_MAPPING.put("httpd", R.drawable.file_zip);
+ MAINMIMETYPE_TO_ICON_MAPPING.put("image", R.drawable.file_image);
+ MAINMIMETYPE_TO_ICON_MAPPING.put("text", R.drawable.file_doc);
+ MAINMIMETYPE_TO_ICON_MAPPING.put("video", R.drawable.file_movie);
+ MAINMIMETYPE_TO_ICON_MAPPING.put("web", R.drawable.file_code);
+ }
+
+ /**
+ * populates the mapping list: file extension --> mime type.
+ */
+ private static void populateFileExtensionMimeTypeMapping() {
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("3gp", Collections.singletonList("video/3gpp"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("7z", Collections.singletonList("application/x-7z-compressed"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("accdb", Collections.singletonList("application/msaccess"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ai", Collections.singletonList("application/illustrator"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("apk", Collections.singletonList("application/vnd.android.package-archive"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("arw", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("avi", Collections.singletonList("video/x-msvideo"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("bash", Collections.singletonList("text/x-shellscript"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("blend", Collections.singletonList("application/x-blender"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("bin", Collections.singletonList("application/x-bin"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("bmp", Collections.singletonList("image/bmp"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("bpg", Collections.singletonList("image/bpg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cb7", Collections.singletonList("application/x-cbr"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cba", Collections.singletonList("application/x-cbr"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cbr", Collections.singletonList("application/x-cbr"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cbt", Collections.singletonList("application/x-cbr"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cbtc", Collections.singletonList("application/x-cbr"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cbz", Collections.singletonList("application/x-cbr"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cc", Collections.singletonList("text/x-c"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cdr", Collections.singletonList("application/coreldraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cnf", Collections.singletonList("text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("conf", Collections.singletonList("text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cpp", Collections.singletonList("text/x-c++src"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cr2", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("css", Collections.singletonList("text/css"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("csv", Collections.singletonList("text/csv"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("cvbdl", Collections.singletonList("application/x-cbr"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("c", Collections.singletonList("text/x-c"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("c++", Collections.singletonList("text/x-c++src"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("dcr", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("deb", Collections.singletonList("application/x-deb"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("dng", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("doc", Collections.singletonList("application/msword"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("docm", Collections.singletonList("application/vnd.ms-word.document.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("docx", Collections.singletonList("application/vnd.openxmlformats-officedocument.wordprocessingml.document"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("dot", Collections.singletonList("application/msword"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("dotx", Collections.singletonList("application/vnd.openxmlformats-officedocument.wordprocessingml.template"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("dv", Collections.singletonList("video/dv"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("eot", Collections.singletonList("application/vnd.ms-fontobject"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("epub", Collections.singletonList("application/epub+zip"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("eps", Collections.singletonList("application/postscript"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("erf", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("exe", Collections.singletonList("application/x-ms-dos-executable"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("flac", Collections.singletonList("audio/flac"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("flv", Collections.singletonList("video/x-flv"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("gif", Collections.singletonList("image/gif"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("gz", Collections.singletonList("application/x-gzip"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("gzip", Collections.singletonList("application/x-gzip"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("h", Collections.singletonList("text/x-h"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("hh", Collections.singletonList("text/x-h"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("html", Arrays.asList("text/html", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("htm", Arrays.asList("text/html", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ical", Collections.singletonList("text/calendar"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ics", Collections.singletonList("text/calendar"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("iiq", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("impress", Collections.singletonList("text/impress"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("jpeg", Collections.singletonList("image/jpeg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("jpg", Collections.singletonList("image/jpeg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("jps", Collections.singletonList("image/jpeg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("js", Arrays.asList("application/javascript", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("json", Arrays.asList("application/json", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("k25", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("kdc", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("key", Collections.singletonList("application/x-iwork-keynote-sffkey"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("keynote", Collections.singletonList("application/x-iwork-keynote-sffkey"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("kra", Collections.singletonList("application/x-krita"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("m2t", Collections.singletonList("video/mp2t"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("m4v", Collections.singletonList("video/mp4"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("markdown", Collections.singletonList("text/markdown"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mdown", Collections.singletonList("text/markdown"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("md", Collections.singletonList("text/markdown"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mdb", Collections.singletonList("application/msaccess"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mdwn", Collections.singletonList("text/markdown"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mkd", Collections.singletonList("text/markdown"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mef", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mkv", Collections.singletonList("video/x-matroska"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mobi", Collections.singletonList("application/x-mobipocket-ebook"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mov", Collections.singletonList("video/quicktime"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mp3", Collections.singletonList("audio/mpeg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mp4", Collections.singletonList("video/mp4"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mpeg", Collections.singletonList("video/mpeg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mpg", Collections.singletonList("video/mpeg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mpo", Collections.singletonList("image/jpeg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("msi", Collections.singletonList("application/x-msi"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mts", Collections.singletonList("video/MP2T"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("mt2s", Collections.singletonList("video/MP2T"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("nef", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("numbers", Collections.singletonList("application/x-iwork-numbers-sffnumbers"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("odf", Collections.singletonList("application/vnd.oasis.opendocument.formula"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("odg", Collections.singletonList("application/vnd.oasis.opendocument.graphics"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("odp", Collections.singletonList("application/vnd.oasis.opendocument.presentation"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ods", Collections.singletonList("application/vnd.oasis.opendocument.spreadsheet"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("odt", Collections.singletonList("application/vnd.oasis.opendocument.text"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("oga", Collections.singletonList("audio/ogg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ogg", Collections.singletonList("audio/ogg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ogv", Collections.singletonList("video/ogg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("opus", Collections.singletonList("audio/ogg"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("orf", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("otf", Collections.singletonList("application/font-sfnt"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pages", Collections.singletonList("application/x-iwork-pages-sffpages"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pdf", Collections.singletonList("application/pdf"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pfb", Collections.singletonList("application/x-font"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pef", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("php", Collections.singletonList("application/x-php"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pl", Collections.singletonList("application/x-perl"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("png", Collections.singletonList("image/png"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pot", Collections.singletonList("application/vnd.ms-powerpoint"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("potm", Collections.singletonList("application/vnd.ms-powerpoint.template.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("potx", Collections.singletonList("application/vnd.openxmlformats-officedocument.presentationml.template"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ppa", Collections.singletonList("application/vnd.ms-powerpoint"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ppam", Collections.singletonList("application/vnd.ms-powerpoint.addin.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pps", Collections.singletonList("application/vnd.ms-powerpoint"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ppsm", Collections.singletonList("application/vnd.ms-powerpoint.slideshow.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ppsx", Collections.singletonList("application/vnd.openxmlformats-officedocument.presentationml.slideshow"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ppt", Collections.singletonList("application/vnd.ms-powerpoint"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pptm", Collections.singletonList("application/vnd.ms-powerpoint.presentation.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("pptx", Collections.singletonList("application/vnd.openxmlformats-officedocument.presentationml.presentation"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ps", Collections.singletonList("application/postscript"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("psd", Collections.singletonList("application/x-photoshop"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("py", Collections.singletonList("text/x-python"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("raf", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("rar", Collections.singletonList("application/x-rar-compressed"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("reveal", Collections.singletonList("text/reveal"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("rtf", Collections.singletonList("application/rtf"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("rw2", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("sgf", Collections.singletonList("application/sgf"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("sh-lib", Collections.singletonList("text/x-shellscript"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("sh", Collections.singletonList("text/x-shellscript"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("srf", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("sr2", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("svg", Arrays.asList("image/svg+xml", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("swf", Arrays.asList("application/x-shockwave-flash", "application/octet-stream"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("tar", Collections.singletonList("application/x-tar"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("gz", Collections.singletonList("application/x-compressed"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("tex", Collections.singletonList("application/x-tex"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("tgz", Collections.singletonList("application/x-compressed"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("tiff", Collections.singletonList("image/tiff"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("tif", Collections.singletonList("image/tiff"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("ttf", Collections.singletonList("application/font-sfnt"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("txt", Collections.singletonList("text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("vcard", Collections.singletonList("text/vcard"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("vcf", Collections.singletonList("text/vcard"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("vob", Collections.singletonList("video/dvd"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("wav", Collections.singletonList("audio/wav"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("webm", Collections.singletonList("video/webm"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("woff", Collections.singletonList("application/font-woff"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("wmv", Collections.singletonList("video/x-ms-wmv"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xcf", Collections.singletonList("application/x-gimp"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xla", Collections.singletonList("application/vnd.ms-excel"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xlam", Collections.singletonList("application/vnd.ms-excel.addin.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xls", Collections.singletonList("application/vnd.ms-excel"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xlsb", Collections.singletonList("application/vnd.ms-excel.sheet.binary.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xlsm", Collections.singletonList("application/vnd.ms-excel.sheet.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xlsx", Collections.singletonList("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xlt", Collections.singletonList("application/vnd.ms-excel"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xltm", Collections.singletonList("application/vnd.ms-excel.template.macroEnabled.12"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xltx", Collections.singletonList("application/vnd.openxmlformats-officedocument.spreadsheetml.template"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xml", Arrays.asList("application/xml", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("xrf", Collections.singletonList("image/x-dcraw"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("yaml", Arrays.asList("application/yaml", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("yml", Arrays.asList("application/yaml", "text/plain"));
+ FILE_EXTENSION_TO_MIMETYPE_MAPPING.put("zip", Collections.singletonList("application/zip"));
+ }
+}