From cb85ff0229e445985204199b0fd690cf08947db8 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 19 Jun 2013 14:27:06 +0200 Subject: [PATCH] Improved looks through differnt font family usage and margins. --- ...avigation.xml => actionbar_navigation.xml} | 6 +- core/res/layout/actionbar_serverstatus.xml | 13 +- core/res/layout/fragment_details_header.xml | 130 ++++++++++-------- core/res/layout/list_item_filter.xml | 1 - core/res/layout/list_item_simple.xml | 4 +- core/res/layout/list_item_torrent.xml | 8 +- core/res/layout/list_item_torrentfile.xml | 33 ++--- core/res/values-land/dimens.xml | 14 -- core/res/values-v16/styles.xml | 30 ++++ core/res/values/dimens.xml | 10 +- core/res/values/strings.xml | 3 +- .../transdroid/core/gui/DetailsActivity.java | 2 +- .../core/gui/lists/TorrentDetailsView.java | 6 +- .../core/gui/navigation/NavigationHelper.java | 15 ++ .../navigation/NavigationSelectionView.java | 2 +- 15 files changed, 159 insertions(+), 118 deletions(-) rename core/res/layout/{list_item_navigation.xml => actionbar_navigation.xml} (77%) create mode 100644 core/res/values-v16/styles.xml diff --git a/core/res/layout/list_item_navigation.xml b/core/res/layout/actionbar_navigation.xml similarity index 77% rename from core/res/layout/list_item_navigation.xml rename to core/res/layout/actionbar_navigation.xml index 71e0580c..203d103f 100644 --- a/core/res/layout/list_item_navigation.xml +++ b/core/res/layout/actionbar_navigation.xml @@ -11,7 +11,8 @@ android:layout_height="wrap_content" android:textColor="?attr/text_actionbar" android:textIsSelectable="false" - android:textSize="@dimen/ui_navigation_filter" /> + android:textSize="@dimen/ui_navigation_filter" + android:fontFamily="sans-serif-condensed" /> + android:textSize="@dimen/ui_navigation_server" + android:fontFamily="sans-serif-light" /> \ No newline at end of file diff --git a/core/res/layout/actionbar_serverstatus.xml b/core/res/layout/actionbar_serverstatus.xml index 1a8d4baa..11874b86 100644 --- a/core/res/layout/actionbar_serverstatus.xml +++ b/core/res/layout/actionbar_serverstatus.xml @@ -3,18 +3,16 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" - android:layout_marginRight="@dimen/margin_default" - android:layout_marginTop="@dimen/ui_serverstatus_margin" + android:paddingRight="@dimen/margin_default" + android:paddingTop="@dimen/ui_serverstatus_margin" android:background="?attr/selectable_background_transdroid" - android:clickable="true" - android:focusable="true" > + android:clickable="true" > @@ -37,7 +34,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/upcount_text" - android:fontFamily="sans-serif-light" android:paddingTop="@dimen/ui_serverstatus_signmargin" android:text="↓" android:textColor="?attr/text_bright" @@ -50,7 +46,6 @@ android:layout_width="@dimen/ui_serverstatus_width" android:layout_height="wrap_content" android:layout_toLeftOf="@id/downcount_sign" - android:fontFamily="sans-serif-light" android:gravity="end" android:textColor="?attr/text_bright" android:textSize="@dimen/ui_serverstatus_bignumber" /> @@ -63,7 +58,6 @@ android:layout_alignParentRight="true" android:layout_below="@id/upcount_text" android:layout_marginTop="-4dip" - android:fontFamily="sans-serif-light" android:gravity="end" android:textColor="?attr/text_bright" android:textSize="@dimen/ui_serverstatus_smallnumber" /> @@ -76,7 +70,6 @@ android:layout_alignRight="@id/downcount_sign" android:layout_below="@id/downcount_text" android:layout_marginTop="-4dip" - android:fontFamily="sans-serif-light" android:gravity="end" android:textColor="?attr/text_bright" android:textSize="@dimen/ui_serverstatus_smallnumber" /> diff --git a/core/res/layout/fragment_details_header.xml b/core/res/layout/fragment_details_header.xml index d546eb57..907b71d5 100644 --- a/core/res/layout/fragment_details_header.xml +++ b/core/res/layout/fragment_details_header.xml @@ -2,154 +2,168 @@ + android:layout_marginBottom="@dimen/margin_default" + android:layout_marginTop="@dimen/margin_default" > - + - + - + android:background="@color/green" + android:textSize="@dimen/text_enlargednumbers" /> + - + android:textColor="?attr/text_bright" + android:textIsSelectable="false" + android:textSize="@dimen/text_hugenumbers" /> + - + - + android:layout_toRightOf="@id/separator" + android:textIsSelectable="false" + android:textSize="@dimen/text_small" /> + - + android:textColor="?attr/text_bright" + android:textIsSelectable="false" + android:textSize="@dimen/text_enlargednumbers" /> + - + android:layout_toRightOf="@id/separator" + android:textIsSelectable="false" + android:textSize="@dimen/text_small" /> + - + - + android:textColor="?attr/text_bright" + android:textIsSelectable="false" + android:textSize="@dimen/text_hugenumbers" /> + - + android:layout_toLeftOf="@id/separator" + android:textIsSelectable="false" + android:textSize="@dimen/text_small" /> + - + android:textColor="?attr/text_bright" + android:textIsSelectable="false" + android:textSize="@dimen/text_enlargednumbers" /> + - - + + - + android:orientation="vertical" + android:paddingBottom="@dimen/margin_half" + android:paddingLeft="@dimen/margin_default" + android:paddingRight="@dimen/margin_default" + android:paddingTop="@dimen/margin_half" > + + + + \ No newline at end of file diff --git a/core/res/layout/list_item_filter.xml b/core/res/layout/list_item_filter.xml index 02c9b77d..fa62800e 100644 --- a/core/res/layout/list_item_filter.xml +++ b/core/res/layout/list_item_filter.xml @@ -11,7 +11,6 @@ android:id="@+id/item_text" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="17sp" android:textIsSelectable="false" /> \ No newline at end of file diff --git a/core/res/layout/list_item_simple.xml b/core/res/layout/list_item_simple.xml index 1135bdfa..030e8a7d 100644 --- a/core/res/layout/list_item_simple.xml +++ b/core/res/layout/list_item_simple.xml @@ -2,10 +2,10 @@ + android:paddingTop="4dip" > - + android:paddingRight="@dimen/margin_default" > - - + android:paddingTop="@dimen/margin_half" > + - + android:textSize="@dimen/text_enlarged" /> + + android:textSize="@dimen/text_small" /> - - + android:textSize="@dimen/text_small" /> + + \ No newline at end of file diff --git a/core/res/values-land/dimens.xml b/core/res/values-land/dimens.xml index c8a1d911..28365483 100644 --- a/core/res/values-land/dimens.xml +++ b/core/res/values-land/dimens.xml @@ -1,22 +1,8 @@ - - 16dp - 8dp - 16dp - - - 12sp - 15sp - 15sp - 22sp - 33sp - 12sp - 15sp 12sp - 110dp 1dp 2dp 19sp diff --git a/core/res/values-v16/styles.xml b/core/res/values-v16/styles.xml new file mode 100644 index 00000000..6570d483 --- /dev/null +++ b/core/res/values-v16/styles.xml @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/res/values/dimens.xml b/core/res/values/dimens.xml index 46d7ea75..c98149c1 100644 --- a/core/res/values/dimens.xml +++ b/core/res/values/dimens.xml @@ -8,15 +8,15 @@ 12sp 15sp - 15sp - 22sp - 33sp - 12sp + 17sp + 24sp + 35sp + 14sp 17sp 14sp - 110dp + 105dp 2dp 3dp 21sp diff --git a/core/res/values/strings.xml b/core/res/values/strings.xml index 870ba5ca..fdeba9a5 100644 --- a/core/res/values/strings.xml +++ b/core/res/values/strings.xml @@ -70,11 +70,12 @@ SINCE %1$s ~ %1$s ETA %1$s + OF %1$s UNKNOWN ETA RATIO %1$s %1$s OF %2$s PEERS ↑ %1$s - ↓ %1$s + %1$s ↓ Downloading Seeding Paused diff --git a/core/src/org/transdroid/core/gui/DetailsActivity.java b/core/src/org/transdroid/core/gui/DetailsActivity.java index 0186ac60..029e8611 100644 --- a/core/src/org/transdroid/core/gui/DetailsActivity.java +++ b/core/src/org/transdroid/core/gui/DetailsActivity.java @@ -98,7 +98,7 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent // Simple action bar with up, torrent name as title and refresh button getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setTitle(torrent.getName()); + getSupportActionBar().setTitle(NavigationHelper.buildCondensedFontString(torrent.getName())); // Connect to the last used server ServerSetting lastUsed = applicationSettings.getLastUsedServer(); diff --git a/core/src/org/transdroid/core/gui/lists/TorrentDetailsView.java b/core/src/org/transdroid/core/gui/lists/TorrentDetailsView.java index 61ce87d0..8323f31d 100644 --- a/core/src/org/transdroid/core/gui/lists/TorrentDetailsView.java +++ b/core/src/org/transdroid/core/gui/lists/TorrentDetailsView.java @@ -24,6 +24,8 @@ public class TorrentDetailsView extends RelativeLayout { @ViewById protected TextView labelText, dateaddedText, uploadedText, uploadedunitText, ratioText, upspeedText, seedersText, downloadedunitText, downloadedText, totalsizeText, downspeedText, leechersText, statusText; + @ViewById + protected TorrentStatusLayout statusLayout; public TorrentDetailsView(Context context) { super(context); @@ -64,6 +66,7 @@ public class TorrentDetailsView extends RelativeLayout { dateaddedText.setVisibility(View.INVISIBLE); } + statusLayout.setStatus(torrent.getStatusCode()); statusText.setText(getResources().getString(R.string.status_status, local.getProgressStatusEta(getResources()))); ratioText.setText(getResources().getString(R.string.status_ratio, local.getRatioString())); // TODO: Implement separate numbers of seeders and leechers @@ -75,7 +78,8 @@ public class TorrentDetailsView extends RelativeLayout { // TODO: Add field that displays availability // Sizes and speeds texts - totalsizeText.setText(FileSizeConverter.getSize(torrent.getTotalSize())); + totalsizeText.setText(getResources().getString(R.string.status_ofsize, + FileSizeConverter.getSize(torrent.getTotalSize()))); downloadedText.setText(FileSizeConverter.getSize(torrent.getDownloadedEver(), false)); downloadedunitText.setText(FileSizeConverter.getSizeUnit(torrent.getDownloadedEver()).toString()); uploadedText.setText(FileSizeConverter.getSize(torrent.getUploadedEver(), false)); diff --git a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java index 813e5f9c..9c813e61 100644 --- a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java +++ b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java @@ -8,6 +8,9 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.TypefaceSpan; import de.keyboardsurfer.android.widget.crouton.Crouton; import de.keyboardsurfer.android.widget.crouton.Style; @@ -78,4 +81,16 @@ public class NavigationHelper { return !context.getPackageName().equals("org.transdroid.lite"); } + /** + * Converts a string into a {@link Spannable} that displays the string in the Roboto Condensed font + * @param string A plain text {@link String} + * @return A {@link Spannable} that can be applied to supporting views (such as the action bar title) so that the + * input string will be displayed using the Roboto Condensed font (if the OS has this) + */ + public static SpannableString buildCondensedFontString(String string) { + SpannableString s = new SpannableString(string); + s.setSpan(new TypefaceSpan("sans-serif-condensed"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + return s; + } + } diff --git a/core/src/org/transdroid/core/gui/navigation/NavigationSelectionView.java b/core/src/org/transdroid/core/gui/navigation/NavigationSelectionView.java index 4e71c965..e3cdd720 100644 --- a/core/src/org/transdroid/core/gui/navigation/NavigationSelectionView.java +++ b/core/src/org/transdroid/core/gui/navigation/NavigationSelectionView.java @@ -11,7 +11,7 @@ import android.widget.TextView; * View that displays the user-selected server and display filter inside the action bar list navigation spinner * @author Eric Kok */ -@EViewGroup(resName="list_item_navigation") +@EViewGroup(resName="actionbar_navigation") public class NavigationSelectionView extends LinearLayout { @ViewById