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
// }
// 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) {
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
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 {
+ fileSizeSeparatorV.setVisibility(View.GONE);
fileSizeV.setVisibility(View.GONE);
lastModV.setVisibility(View.GONE);
checkBoxV.setVisibility(View.GONE);
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.math.BigDecimal;\r
import java.net.IDN;\r
import java.text.DateFormat;\r
import java.util.Arrays;\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 HashMap<String, String> mimeType2HUmanReadable;\r
static {\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
result /= 1024.;\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