jenkins-bot has submitted this change and it was merged. Change subject: Move article title/subtitle beneath the lead image ......................................................................
Move article title/subtitle beneath the lead image N.B. The parallax scrolling behavior no longer works well or makes sense with this change, so I'll remove it in a follow-up patch. Bug: T135294 Change-Id: I7c435fb86f0bd245a53670128472603ec4fcba1a --- M app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java M app/src/main/res/layout/activity_main.xml M app/src/main/res/layout/view_article_header.xml M app/src/main/res/values/attrs.xml M app/src/main/res/values/colors.xml M app/src/main/res/values/dimens.xml M app/src/main/res/values/styles_dark.xml M app/src/main/res/values/styles_light.xml 8 files changed, 43 insertions(+), 47 deletions(-) Approvals: Dbrant: Looks good to me, approved jenkins-bot: Verified diff --git a/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java b/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java index b6c7e26..01c6f25 100644 --- a/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java +++ b/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java @@ -6,7 +6,6 @@ import android.graphics.Color; import android.graphics.PointF; import android.graphics.Typeface; -import android.graphics.drawable.Drawable; import android.os.Build; import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; @@ -21,10 +20,8 @@ import android.text.TextUtils; import android.text.style.AbsoluteSizeSpan; import android.util.AttributeSet; -import android.view.Gravity; import android.view.View; import android.view.ViewGroup; -import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; @@ -37,11 +34,11 @@ import org.wikipedia.richtext.AudioUrlSpan; import org.wikipedia.richtext.RichTextUtil; import org.wikipedia.util.DimenUtil; -import org.wikipedia.util.GradientUtil; import org.wikipedia.util.StringUtil; import org.wikipedia.views.AppTextView; import org.wikipedia.views.FaceAndColorDetectImageView; import org.wikipedia.views.ObservableWebView; +import org.wikipedia.views.StatusBarBlankView; import org.wikipedia.views.ViewUtil; import butterknife.BindView; @@ -50,11 +47,12 @@ import static org.wikipedia.util.ResourceUtil.getThemedAttributeId; import static org.wikipedia.util.DimenUtil.leadImageHeightForDevice; -public class ArticleHeaderView extends FrameLayout implements ObservableWebView.OnScrollChangeListener { +public class ArticleHeaderView extends LinearLayout implements ObservableWebView.OnScrollChangeListener { @BindView(R.id.view_article_header_image) ArticleHeaderImageView image; - @BindView(R.id.view_article_header_text) - AppTextView text; + @BindView(R.id.view_article_header_text) AppTextView text; @BindView(R.id.view_article_header_menu_bar) ArticleMenuBarView menuBar; + @BindView(R.id.view_article_header_container) LinearLayout container; + @BindView(R.id.view_article_header_status_bar_placeholder) StatusBarBlankView statusBarPlaceholder; @NonNull private CharSequence title = ""; @NonNull private CharSequence subtitle = ""; @@ -89,26 +87,25 @@ public void showText() { setVisibility(View.VISIBLE); + setTopOffset(); updateText(); setTextColor(getColor(getThemedAttributeId(getContext(), - R.attr.lead_disabled_text_color))); + R.attr.lead_text_color))); setTextHeightUnconstrained(); - clearTextDropShadow(); - clearTextGradient(); } public void showTextImage() { setVisibility(View.VISIBLE); + unsetTopOffset(); updateText(); - setTextColor(getColor(R.color.lead_text_color)); + setTextColor(getColor(getThemedAttributeId(getContext(), + R.attr.lead_text_color))); setImageHeight(leadImageHeightForDevice()); setTextHeightConstrained(); - setTextDropShadow(); - setTextGradient(); } // TODO: remove. @@ -280,24 +277,6 @@ new ParagraphSpan(paragraphScalar)); } - private void setTextDropShadow() { - text.setShadowLayer(2, 1, 1, getColor(R.color.lead_text_shadow)); - } - - private void clearTextDropShadow() { - text.setShadowLayer(0, 0, 0, Color.TRANSPARENT); - } - - private void clearTextGradient() { - text.setBackgroundColor(Color.TRANSPARENT); - } - - private void setTextGradient() { - Drawable gradient = GradientUtil.getCubicGradient(getColor(R.color.lead_gradient_start), - Gravity.BOTTOM); - ViewUtil.setBackgroundDrawable(text, gradient); - } - private void setImageHeight(int height) { DimenUtil.setViewHeight(image, height); } @@ -341,4 +320,22 @@ private int getDimensionPixelSize(@DimenRes int id) { return getResources().getDimensionPixelSize(id); } + + private void setTopOffset() { + setTopOffset(true); + } + + private void unsetTopOffset() { + setTopOffset(false); + } + + private void setTopOffset(boolean noImage) { + statusBarPlaceholder.setVisibility(noImage ? View.VISIBLE : View.GONE); + int offset = noImage ? getDimensionPixelOffset(R.dimen.lead_no_image_top_offset_dp) : 0; + setPadding(0, offset, 0, 0); + } + + private int getDimensionPixelOffset(@DimenRes int id) { + return getContext().getResources().getDimensionPixelOffset(id); + } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 63d0cc8..d64390f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -85,10 +85,6 @@ android:singleLine="true" android:ellipsize="end" android:background="?attr/selectableItemBackgroundBorderless" - android:shadowColor="@color/lead_text_shadow" - android:shadowDx="1" - android:shadowDy="1" - android:shadowRadius="2" android:layout_gravity="center_vertical" android:drawableStart="@drawable/ic_search" tools:ignore="RtlCompat" diff --git a/app/src/main/res/layout/view_article_header.xml b/app/src/main/res/layout/view_article_header.xml index bfc2282..69a35c7 100644 --- a/app/src/main/res/layout/view_article_header.xml +++ b/app/src/main/res/layout/view_article_header.xml @@ -2,27 +2,29 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> - <org.wikipedia.page.leadimages.ArticleHeaderImageView - android:id="@+id/view_article_header_image" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - <LinearLayout + android:id="@+id/view_article_header_container" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="64dp" android:gravity="bottom" android:orientation="vertical"> <org.wikipedia.views.StatusBarBlankView + android:id="@+id/view_article_header_status_bar_placeholder" android:layout_width="match_parent" android:layout_height="wrap_content" /> + + <org.wikipedia.page.leadimages.ArticleHeaderImageView + android:id="@+id/view_article_header_image" + android:layout_width="match_parent" + android:layout_height="match_parent" /> <org.wikipedia.views.AppTextView style="@style/RtlAwareTextView" android:id="@+id/view_article_header_text" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingTop="12dp" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingBottom="16dp" android:paddingLeft="@dimen/activity_horizontal_margin" diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index a73bcab..5aa2db7 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -12,7 +12,7 @@ <attr name="abusefilter_background_color" format="reference"/> <attr name="lead_image_drawable" format="reference"/> <!-- TODO: rename? --> - <attr name="lead_disabled_text_color" format="reference"/> + <attr name="lead_text_color" format="reference"/> <attr name="list_separator_color" format="reference"/> <attr name="list_separator_drawable" format="reference"/> <attr name="syntax_highlight_template_color" format="reference"/> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 427ef1c..3d41dba 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -84,8 +84,8 @@ <color name="list_item_selected">#20808080</color> <color name="lead_text_color">#f0f0f0</color> <color name="lead_text_shadow">#80000000</color> - <color name="lead_disabled_text_light">#000</color> - <color name="lead_disabled_text_dark">#fff</color> + <color name="lead_text_light">#000</color> + <color name="lead_text_dark">#fff</color> <color name="gallery_background">#303030</color> <color name="gallery_license_text">#aaa</color> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 90a9006..a1c1158 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -28,7 +28,7 @@ <!-- Default width of the lead image to be downloaded --> <dimen name="leadImageWidth">640dp</dimen> - <item type="dimen" format="float" name="articleHeaderViewScreenHeightRatio">0.571</item> + <item type="dimen" format="float" name="articleHeaderViewScreenHeightRatio">0.4</item> <!-- Default font size of the page title --> <dimen name="titleTextSize">28sp</dimen> <!-- Default font size of the Wikidata description for the page --> @@ -76,6 +76,7 @@ <item name="lead_title_leading_scalar" format="float" type="dimen">1.05</item> <item name="lead_subtitle_leading_scalar" format="float" type="dimen">1.35</item> <item name="lead_subtitle_paragraph_scalar" format="float" type="dimen">1.15</item> + <dimen name="lead_no_image_top_offset_dp">56dp</dimen> <dimen name="audio_url_span_loading_spinner_border_thickness">2dp</dimen> <dimen name="audio_url_span_loading_spinner_radius">8dp</dimen> diff --git a/app/src/main/res/values/styles_dark.xml b/app/src/main/res/values/styles_dark.xml index 9ff2fca..f9dc1d4 100644 --- a/app/src/main/res/values/styles_dark.xml +++ b/app/src/main/res/values/styles_dark.xml @@ -37,7 +37,7 @@ <item name="link_color">@color/link_dark</item> <item name="abusefilter_background_color">@color/abusefilter_background_dark</item> <item name="lead_image_drawable">@drawable/lead_default_dark</item> - <item name="lead_disabled_text_color">@color/lead_disabled_text_dark</item> + <item name="lead_text_color">@color/lead_text_dark</item> <item name="list_separator_color">@color/list_separator_dark</item> <item name="list_separator_drawable">@drawable/divider_dark</item> <item name="syntax_highlight_template_color">@color/syntax_highlight_template_dark</item> diff --git a/app/src/main/res/values/styles_light.xml b/app/src/main/res/values/styles_light.xml index 1086d43..00c9600 100644 --- a/app/src/main/res/values/styles_light.xml +++ b/app/src/main/res/values/styles_light.xml @@ -38,7 +38,7 @@ <item name="abusefilter_background_color">@color/abusefilter_background_light</item> <!-- TODO: rename? --> <item name="lead_image_drawable">@drawable/lead_default</item> - <item name="lead_disabled_text_color">@color/lead_disabled_text_light</item> + <item name="lead_text_color">@color/lead_text_light</item> <item name="list_separator_color">@color/list_separator_light</item> <item name="list_separator_drawable">@drawable/divider_light</item> <item name="syntax_highlight_template_color">@color/syntax_highlight_template_light</item> -- To view, visit https://gerrit.wikimedia.org/r/304815 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7c435fb86f0bd245a53670128472603ec4fcba1a Gerrit-PatchSet: 2 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Mholloway <mhollo...@wikimedia.org> Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org> Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org> Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits