diff --git a/ICONS.txt b/ICONS.txt new file mode 100644 index 0000000000..3dffdb83c1 --- /dev/null +++ b/ICONS.txt @@ -0,0 +1,99 @@ +Standard Google Material Design icons +Copyright (c) 2014, Google (http://www.google.com/design/) +uses the license at https://github.com/google/material-design-icons/blob/master/LICENSE + +Twitter icon graphic +Copyright (c) 2014, Austin Andrews (http://materialdesignicons.com/), +with Reserved Font Name Material Design Icons. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/drawable_resources/ic_twitter.svg b/drawable_resources/ic_twitter.svg new file mode 100644 index 0000000000..7c22e2523d --- /dev/null +++ b/drawable_resources/ic_twitter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/drawable_resources/ic_web.svg b/drawable_resources/ic_web.svg new file mode 100644 index 0000000000..2c65f3259e --- /dev/null +++ b/drawable_resources/ic_web.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java index 8b41b390eb..513770bd4c 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java @@ -130,12 +130,18 @@ public class UserInfoActivity extends FileActivity { @BindView(R.id.website_address) public TextView mWebsiteTextView; + @BindView(R.id.website_icon) + public ImageView mWebsiteIcon; + @BindView(R.id.twitter_container) public View mTwitterContainer; @BindView(R.id.twitter_handle) public TextView mTwitterHandleTextView; + @BindView(R.id.twitter_icon) + public ImageView mTwitterIcon; + @BindView(R.id.empty_list_progress) public ProgressBar multiListProgressBar; @@ -252,16 +258,18 @@ public class UserInfoActivity extends FileActivity { populateUserInfoElement(mEmailContainer, mEmailAddressTextView, userInfo.getEmail(), mEmailIcon, tint); populateUserInfoElement(mAddressContainer, mAddressTextView, userInfo.getAddress(), mAddressIcon, tint); - populateUserInfoElement(mWebsiteContainer, mWebsiteTextView, userInfo.getWebpage()); - populateUserInfoElement(mTwitterContainer, mTwitterHandleTextView, userInfo.getTwitter()); - } - } - - private void populateUserInfoElement(View container, TextView textView, String text) { - if (!TextUtils.isEmpty(text)) { - textView.setText(text); - } else { - container.setVisibility(View.GONE); + populateUserInfoElement( + mWebsiteContainer, + mWebsiteTextView, + DisplayUtils.beautifyURL(userInfo.getWebpage()), + mWebsiteIcon, + tint); + populateUserInfoElement( + mTwitterContainer, + mTwitterHandleTextView, + DisplayUtils.beautifyTwitterHandle(userInfo.getTwitter()), + mTwitterIcon, + tint); } } @@ -275,7 +283,6 @@ public class UserInfoActivity extends FileActivity { } } - private void changeAccountPassword(Account account) { Intent updateAccountCredentials = new Intent(UserInfoActivity.this, AuthenticatorActivity.class); updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account); diff --git a/src/main/java/com/owncloud/android/utils/DisplayUtils.java b/src/main/java/com/owncloud/android/utils/DisplayUtils.java index e82cb4b7b0..961d723154 100644 --- a/src/main/java/com/owncloud/android/utils/DisplayUtils.java +++ b/src/main/java/com/owncloud/android/utils/DisplayUtils.java @@ -78,6 +78,10 @@ public class DisplayUtils { private static final int RELATIVE_THRESHOLD_CRITICAL = 95; private static final String MIME_TYPE_UNKNOWN = "Unknown type"; + private static final String HTTP_PROTOCOLL = "http://"; + private static final String HTTPS_PROTOCOLL = "https://"; + private static final String TWITTER_HANDLE_PREFIX = "@"; + private static Map mimeType2HumanReadable; static { @@ -150,6 +154,50 @@ public class DisplayUtils { DateFormat df = DateFormat.getDateTimeInstance(); return df.format(date); } + + /** + * beautifies a given URL by removing any http/https protocol prefix. + * + * @param url to be beautified url + * @return beautified url + */ + public static String beautifyURL(String url) { + if (url == null) { + return ""; + } + + if (url.length() >= 7) { + if (url.substring(0,7).equalsIgnoreCase(HTTP_PROTOCOLL)) { + return url.substring(HTTP_PROTOCOLL.length()); + } + } + + if (url.length() >= 8) { + if (url.substring(0,8).equalsIgnoreCase(HTTPS_PROTOCOLL)) { + return url.substring(HTTPS_PROTOCOLL.length()); + } + } + + return url; + } + + /** + * beautifies a given twitter handle by prefixing it with an @ in case it is missing. + * + * @param handle to be beautified twitter handle + * @return beautified twitter handle + */ + public static String beautifyTwitterHandle(String handle) { + if (handle == null) { + return ""; + } + + if (handle.startsWith(TWITTER_HANDLE_PREFIX)) { + return handle; + } else { + return TWITTER_HANDLE_PREFIX + handle; + } + } /** * Converts an internationalized domain name (IDN) in an URL to and from ASCII/Unicode. diff --git a/src/main/res/drawable-hdpi/ic_twitter.png b/src/main/res/drawable-hdpi/ic_twitter.png new file mode 100644 index 0000000000..7fdcf2fba9 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_twitter.png differ diff --git a/src/main/res/drawable-hdpi/ic_web.png b/src/main/res/drawable-hdpi/ic_web.png new file mode 100644 index 0000000000..d86b798077 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_web.png differ diff --git a/src/main/res/drawable-mdpi/ic_twitter.png b/src/main/res/drawable-mdpi/ic_twitter.png new file mode 100644 index 0000000000..bb99f6ebfb Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_twitter.png differ diff --git a/src/main/res/drawable-mdpi/ic_web.png b/src/main/res/drawable-mdpi/ic_web.png new file mode 100644 index 0000000000..881c3855d8 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_web.png differ diff --git a/src/main/res/drawable-xhdpi/ic_twitter.png b/src/main/res/drawable-xhdpi/ic_twitter.png new file mode 100644 index 0000000000..3c35dc24ce Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_twitter.png differ diff --git a/src/main/res/drawable-xhdpi/ic_web.png b/src/main/res/drawable-xhdpi/ic_web.png new file mode 100644 index 0000000000..628bc2c012 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_web.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_twitter.png b/src/main/res/drawable-xxhdpi/ic_twitter.png new file mode 100644 index 0000000000..a0eb86985c Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_twitter.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_web.png b/src/main/res/drawable-xxhdpi/ic_web.png new file mode 100644 index 0000000000..bd139a7578 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_web.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_twitter.png b/src/main/res/drawable-xxxhdpi/ic_twitter.png new file mode 100644 index 0000000000..76fbfba4ed Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_twitter.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_web.png b/src/main/res/drawable-xxxhdpi/ic_web.png new file mode 100644 index 0000000000..f37365234a Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_web.png differ diff --git a/src/main/res/layout/user_info_layout.xml b/src/main/res/layout/user_info_layout.xml index 8080b4fbc0..76c15f9430 100644 --- a/src/main/res/layout/user_info_layout.xml +++ b/src/main/res/layout/user_info_layout.xml @@ -174,17 +174,27 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:layout_height="wrap_content"> + + @@ -192,31 +202,43 @@ android:id="@+id/website_address" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginRight="@dimen/standard_margin" + android:layout_marginBottom="@dimen/standard_margin" + android:layout_below="@+id/website_headline" + android:layout_toEndOf="@id/website_icon" + android:layout_toRightOf="@id/website_icon" android:maxLines="3" - android:text="@string/user_info_twitter" + android:text="@string/user_info_website" android:textColor="?android:attr/textColorSecondary"/> - + - + android:layout_height="wrap_content"> + + @@ -225,12 +247,15 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="@dimen/standard_margin" - android:layout_marginLeft="@dimen/standard_margin" - android:maxLines="1" + android:layout_marginBottom="@dimen/standard_margin" + android:layout_below="@+id/twitter_headline" + android:layout_toEndOf="@id/twitter_icon" + android:layout_toRightOf="@id/twitter_icon" + android:maxLines="3" android:text="@string/placeholder_filename" android:textColor="?android:attr/textColorSecondary"/> - + diff --git a/src/main/res/layout/user_info_list_item.xml b/src/main/res/layout/user_info_list_item.xml deleted file mode 100644 index d33a2a4315..0000000000 --- a/src/main/res/layout/user_info_list_item.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - \ No newline at end of file