jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/333954 )
Change subject: Rename ArticleHeaderView to PageHeaderView ...................................................................... Rename ArticleHeaderView to PageHeaderView Since all pages are not articles, ArticleHeaderView becomes a misnomer. Hence, this task has renamed the ArticleHeaderView with PageHeaderView. Bug: T155920 Change-Id: I3d307164eddea99292070fe7bc8b951628a8df3f --- R app/src/androidTest/java/org/wikipedia/page/leadimages/PageHeaderViewTest.java M app/src/main/java/org/wikipedia/page/PageFragment.java M app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java R app/src/main/java/org/wikipedia/page/leadimages/PageHeaderImageView.java R app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java M app/src/main/res/layout/fragment_page.xml R app/src/main/res/layout/view_page_header.xml R app/src/main/res/layout/view_page_header_image.xml R app/src/main/res/menu/menu_page_header_edit.xml 9 files changed, 72 insertions(+), 71 deletions(-) Approvals: jenkins-bot: Verified Mholloway: Looks good to me, approved diff --git a/app/src/androidTest/java/org/wikipedia/page/leadimages/ArticleHeaderViewTest.java b/app/src/androidTest/java/org/wikipedia/page/leadimages/PageHeaderViewTest.java similarity index 98% rename from app/src/androidTest/java/org/wikipedia/page/leadimages/ArticleHeaderViewTest.java rename to app/src/androidTest/java/org/wikipedia/page/leadimages/PageHeaderViewTest.java index 8b689c2..e0dfc04 100644 --- a/app/src/androidTest/java/org/wikipedia/page/leadimages/ArticleHeaderViewTest.java +++ b/app/src/androidTest/java/org/wikipedia/page/leadimages/PageHeaderViewTest.java @@ -13,7 +13,7 @@ import org.junit.experimental.theories.Theory; import org.junit.experimental.theories.suppliers.TestedOn; import org.wikipedia.Constants; -import org.wikipedia.page.leadimages.ArticleHeaderView.Callback; +import org.wikipedia.page.leadimages.PageHeaderView.Callback; import org.wikipedia.test.theories.TestedOnBool; import org.wikipedia.test.view.FontScale; import org.wikipedia.test.view.LayoutDirection; @@ -38,8 +38,8 @@ import static org.mockito.Mockito.verify; import static org.wikipedia.test.TestUtil.runOnMainSync; -@SmallTest public class ArticleHeaderViewTest extends ViewTest { - private ArticleHeaderView subject; +@SmallTest public class PageHeaderViewTest extends ViewTest { + private PageHeaderView subject; @Theory public void testLayout(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp, // @TestedOn(ints = {HEIGHT_DP_L, WIDTH_DP_S}) int heightDp, @@ -312,7 +312,7 @@ setUp(widthDp, layoutDirection, fontScale, theme); Uri imageUri = frescoUri(image.id()); - subject = new ArticleHeaderView(ctx()); + subject = new PageHeaderView(ctx()); subject.loadImage(imageUri == null ? null : imageUri.toString()); setTitle(str(title)); setSubtitle(str(subtitle)); diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java b/app/src/main/java/org/wikipedia/page/PageFragment.java index 4247789..9d1b795 100755 --- a/app/src/main/java/org/wikipedia/page/PageFragment.java +++ b/app/src/main/java/org/wikipedia/page/PageFragment.java @@ -55,8 +55,8 @@ import org.wikipedia.onboarding.PrefsOnboardingStateMachine; import org.wikipedia.page.action.PageActionTab; import org.wikipedia.page.action.PageActionToolbarHideHandler; -import org.wikipedia.page.leadimages.ArticleHeaderView; import org.wikipedia.page.leadimages.LeadImagesHandler; +import org.wikipedia.page.leadimages.PageHeaderView; import org.wikipedia.page.snippet.CompatActionMode; import org.wikipedia.page.snippet.ShareHandler; import org.wikipedia.page.tabs.Tab; @@ -355,8 +355,8 @@ tocHandler = new ToCHandler(this, tocDrawer, bridge); // TODO: initialize View references in onCreateView(). - ArticleHeaderView articleHeaderView = findById(getView(), R.id.page_header_view); - leadImagesHandler = new LeadImagesHandler(this, bridge, webView, articleHeaderView); + PageHeaderView pageHeaderView = findById(getView(), R.id.page_header_view); + leadImagesHandler = new LeadImagesHandler(this, bridge, webView, pageHeaderView); toolbarHideHandler = getSearchBarHideHandler(); toolbarHideHandler.setScrollView(webView); diff --git a/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java b/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java index 8ae69bf..fa837c7 100755 --- a/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java +++ b/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java @@ -58,7 +58,7 @@ @NonNull private final CommunicationBridge bridge; @NonNull private final ObservableWebView webView; - @NonNull private final ArticleHeaderView articleHeaderView; + @NonNull private final PageHeaderView pageHeaderView; private View image; private int displayHeightDp; @@ -66,13 +66,13 @@ public LeadImagesHandler(@NonNull final PageFragment parentFragment, @NonNull CommunicationBridge bridge, @NonNull ObservableWebView webView, - @NonNull ArticleHeaderView articleHeaderView) { - this.articleHeaderView = articleHeaderView; + @NonNull PageHeaderView pageHeaderView) { + this.pageHeaderView = pageHeaderView; this.parentFragment = parentFragment; this.bridge = bridge; this.webView = webView; - image = articleHeaderView.getImage(); + image = pageHeaderView.getImage(); initDisplayDimensions(); @@ -89,11 +89,11 @@ * The only way to "show" the lead image view is by calling the beginLayout function. */ public void hide() { - articleHeaderView.hide(); + pageHeaderView.hide(); } @Nullable public Bitmap getLeadImageBitmap() { - return isLeadImageEnabled() ? articleHeaderView.copyBitmap() : null; + return isLeadImageEnabled() ? pageHeaderView.copyBitmap() : null; } public boolean isLeadImageEnabled() { @@ -103,7 +103,7 @@ } public void setAnimationPaused(boolean paused) { - articleHeaderView.setAnimationPaused(paused); + pageHeaderView.setAnimationPaused(paused); } /** @@ -139,13 +139,13 @@ // set the page title text, and honor any HTML formatting in the title loadLeadImage(); - articleHeaderView.setTitle(StringUtil.fromHtml(getPage().getDisplayTitle())); - articleHeaderView.setSubtitle(StringUtils.capitalize(getTitle().getDescription())); - articleHeaderView.setLocale(getPage().getTitle().getWikiSite().languageCode()); - articleHeaderView.setPronunciation(getPage().getTitlePronunciationUrl()); + pageHeaderView.setTitle(StringUtil.fromHtml(getPage().getDisplayTitle())); + pageHeaderView.setSubtitle(StringUtils.capitalize(getTitle().getDescription())); + pageHeaderView.setLocale(getPage().getTitle().getWikiSite().languageCode()); + pageHeaderView.setPronunciation(getPage().getTitlePronunciationUrl()); // TODO: remove pre-beta condition when ready. - articleHeaderView.setAllowDescriptionEdit(ReleaseUtil.isPreBetaRelease() + pageHeaderView.setAllowDescriptionEdit(ReleaseUtil.isPreBetaRelease() && DescriptionEditClient.isEditAllowed(getPage())); layoutViews(listener, sequence); @@ -164,12 +164,12 @@ } if (isMainPage()) { - articleHeaderView.hide(); + pageHeaderView.hide(); } else { if (!isLeadImageEnabled()) { - articleHeaderView.showText(); + pageHeaderView.showText(); } else { - articleHeaderView.showTextImage(); + pageHeaderView.showTextImage(); } } @@ -182,7 +182,7 @@ if (isMainPage()) { padding = Math.round(getContentTopOffsetPx(getActivity()) / DimenUtil.getDensityScalar()); } else { - padding = Math.round(articleHeaderView.getHeight() / DimenUtil.getDensityScalar()); + padding = Math.round(pageHeaderView.getHeight() / DimenUtil.getDensityScalar()); } setWebViewPaddingTop(padding); @@ -216,9 +216,9 @@ private void loadLeadImage(@Nullable String url) { if (!isMainPage() && !TextUtils.isEmpty(url) && isLeadImageEnabled()) { String fullUrl = getTitle().getWikiSite().scheme() + ":" + url; - articleHeaderView.loadImage(fullUrl); + pageHeaderView.loadImage(fullUrl); } else { - articleHeaderView.loadImage(null); + pageHeaderView.loadImage(null); } } @@ -237,8 +237,8 @@ } private void initArticleHeaderView() { - articleHeaderView.setOnImageLoadListener(new ImageLoadListener()); - articleHeaderView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { + pageHeaderView.setOnImageLoadListener(new ImageLoadListener()); + pageHeaderView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override @SuppressWarnings("checkstyle:parameternumber") public void onLayoutChange(View v, int left, int top, int right, int bottom, @@ -246,7 +246,7 @@ updatePadding(); } }); - articleHeaderView.setCallback(new ArticleHeaderView.Callback() { + pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onDescriptionClicked() { verifyLoggedInForDescriptionEdit(); @@ -293,7 +293,7 @@ } private void initWebView() { - webView.addOnScrollChangeListener(articleHeaderView); + webView.addOnScrollChangeListener(pageHeaderView); webView.addOnClickListener(new ObservableWebView.OnClickListener() { @Override @@ -341,12 +341,12 @@ private class ImageLoadListener implements FaceAndColorDetectImageView.OnImageLoadListener { @Override public void onImageLoaded(final int bmpHeight, @Nullable final PointF faceLocation, @ColorInt final int mainColor) { - articleHeaderView.post(new Runnable() { + pageHeaderView.post(new Runnable() { @Override public void run() { if (isFragmentAdded()) { if (faceLocation != null) { - articleHeaderView.setImageFocus(faceLocation); + pageHeaderView.setImageFocus(faceLocation); } startKenBurnsAnimation(); } diff --git a/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderImageView.java b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderImageView.java similarity index 79% rename from app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderImageView.java rename to app/src/main/java/org/wikipedia/page/leadimages/PageHeaderImageView.java index a35c096..4ec2722 100644 --- a/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderImageView.java +++ b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderImageView.java @@ -24,27 +24,27 @@ import static org.wikipedia.util.GradientUtil.getCubicGradient; -public class ArticleHeaderImageView extends FrameLayout { - @BindView(R.id.view_article_header_image_image) FaceAndColorDetectImageView image; - @BindView(R.id.view_article_header_image_gradient) View gradientView; +public class PageHeaderImageView extends FrameLayout { + @BindView(R.id.view_page_header_image_image) FaceAndColorDetectImageView image; + @BindView(R.id.view_page_header_image_gradient) View gradientView; - public ArticleHeaderImageView(Context context) { + public PageHeaderImageView(Context context) { super(context); init(); } - public ArticleHeaderImageView(Context context, AttributeSet attrs) { + public PageHeaderImageView(Context context, AttributeSet attrs) { super(context, attrs); init(); } - public ArticleHeaderImageView(Context context, AttributeSet attrs, int defStyleAttr) { + public PageHeaderImageView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public ArticleHeaderImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + public PageHeaderImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } @@ -86,7 +86,7 @@ // Clip the Ken Burns zoom animation applied to the image. setClipChildren(true); - inflate(getContext(), R.layout.view_article_header_image, this); + inflate(getContext(), R.layout.view_page_header_image, this); ButterKnife.bind(this); @ColorInt int color = ContextCompat.getColor(getContext(), R.color.new_lead_gradient_start); diff --git a/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java similarity index 90% rename from app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java rename to app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java index adfdbfb..1e5a76c 100644 --- a/app/src/main/java/org/wikipedia/page/leadimages/ArticleHeaderView.java +++ b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java @@ -58,15 +58,16 @@ import static org.wikipedia.util.L10nUtil.isLangRTL; import static org.wikipedia.util.ResourceUtil.getThemedAttributeId; -public class ArticleHeaderView extends FrameLayout implements ObservableWebView.OnScrollChangeListener { - @BindView(R.id.view_article_header_image) ArticleHeaderImageView image; - @BindView(R.id.view_article_header_image_gradient) View gradient; - @BindView(R.id.view_article_title_text) AppTextView titleText; - @BindView(R.id.view_article_subtitle_text) AppTextView subtitleText; - @BindView(R.id.view_article_header_divider) View divider; - @BindView(R.id.view_article_header_container) LinearLayout container; - @BindView(R.id.view_article_header_status_bar_placeholder) StatusBarBlankView statusBarPlaceholder; - @BindView(R.id.view_article_header_edit_pencil) View editPencil; +public class PageHeaderView extends FrameLayout implements ObservableWebView.OnScrollChangeListener { + @BindView(R.id.view_page_header_image) + PageHeaderImageView image; + @BindView(R.id.view_page_header_image_gradient) View gradient; + @BindView(R.id.view_page_title_text) AppTextView titleText; + @BindView(R.id.view_page_subtitle_text) AppTextView subtitleText; + @BindView(R.id.view_page_header_divider) View divider; + @BindView(R.id.view_page_header_container) LinearLayout container; + @BindView(R.id.view_page_header_status_bar_placeholder) StatusBarBlankView statusBarPlaceholder; + @BindView(R.id.view_page_header_edit_pencil) View editPencil; @Nullable private Callback callback; @VisibleForTesting @NonNull CharSequence title = ""; @@ -83,23 +84,23 @@ void onEditLeadSection(); } - public ArticleHeaderView(Context context) { + public PageHeaderView(Context context) { super(context); init(); } - public ArticleHeaderView(Context context, AttributeSet attrs) { + public PageHeaderView(Context context, AttributeSet attrs) { super(context, attrs); init(); } - public ArticleHeaderView(Context context, AttributeSet attrs, int defStyleAttr) { + public PageHeaderView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public ArticleHeaderView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + public PageHeaderView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } @@ -219,10 +220,10 @@ updateScroll(scrollY); } - @OnClick(R.id.view_article_header_edit_pencil) void onEditClick() { + @OnClick(R.id.view_page_header_edit_pencil) void onEditClick() { if (allowDescriptionEdit) { PopupMenu menu = new PopupMenu(editPencil.getContext(), editPencil); - menu.getMenuInflater().inflate(R.menu.menu_article_header_edit, menu.getMenu()); + menu.getMenuInflater().inflate(R.menu.menu_page_header_edit, menu.getMenu()); menu.setOnMenuItemClickListener(new EditMenuClickListener()); menu.show(); } else { @@ -323,7 +324,7 @@ } private void init() { - inflate(getContext(), R.layout.view_article_header, this); + inflate(getContext(), R.layout.view_page_header, this); ButterKnife.bind(this); FeedbackUtil.setToolbarButtonLongPressToast(editPencil); hide(); @@ -389,12 +390,12 @@ @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { - case R.id.menu_article_header_edit_description: + case R.id.menu_page_header_edit_description: if (callback != null) { callback.onEditDescription(); } return true; - case R.id.menu_article_header_edit_lead_section: + case R.id.menu_page_header_edit_lead_section: if (callback != null) { callback.onEditLeadSection(); } diff --git a/app/src/main/res/layout/fragment_page.xml b/app/src/main/res/layout/fragment_page.xml index 94b37dd..a8cb879 100644 --- a/app/src/main/res/layout/fragment_page.xml +++ b/app/src/main/res/layout/fragment_page.xml @@ -28,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - <org.wikipedia.page.leadimages.ArticleHeaderView + <org.wikipedia.page.leadimages.PageHeaderView android:id="@+id/page_header_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/app/src/main/res/layout/view_article_header.xml b/app/src/main/res/layout/view_page_header.xml similarity index 86% rename from app/src/main/res/layout/view_article_header.xml rename to app/src/main/res/layout/view_page_header.xml index a1eb2a5..f6d2933 100644 --- a/app/src/main/res/layout/view_article_header.xml +++ b/app/src/main/res/layout/view_page_header.xml @@ -4,24 +4,24 @@ xmlns:tools="http://schemas.android.com/tools"> <LinearLayout - android:id="@+id/view_article_header_container" + android:id="@+id/view_page_header_container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <org.wikipedia.views.StatusBarBlankView - android:id="@+id/view_article_header_status_bar_placeholder" + android:id="@+id/view_page_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" + <org.wikipedia.page.leadimages.PageHeaderImageView + android:id="@+id/view_page_header_image" android:layout_width="match_parent" android:layout_height="match_parent" /> <org.wikipedia.views.AppTextView style="@style/RtlAwareTextView" - android:id="@+id/view_article_title_text" + android:id="@+id/view_page_title_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="12dp" @@ -36,7 +36,7 @@ <org.wikipedia.views.AppTextView style="@style/RtlAwareTextView" - android:id="@+id/view_article_subtitle_text" + android:id="@+id/view_page_subtitle_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="@dimen/activity_horizontal_margin" @@ -54,7 +54,7 @@ tools:text="Subtitle" /> <View - android:id="@+id/view_article_header_divider" + android:id="@+id/view_page_header_divider" android:layout_width="53.5dp" android:layout_height="1dp" android:layout_marginTop="20dp" @@ -64,7 +64,7 @@ </LinearLayout> <ImageView - android:id="@+id/view_article_header_edit_pencil" + android:id="@+id/view_page_header_edit_pencil" android:layout_width="28dp" android:layout_height="28dp" android:layout_marginLeft="@dimen/activity_horizontal_margin" diff --git a/app/src/main/res/layout/view_article_header_image.xml b/app/src/main/res/layout/view_page_header_image.xml similarity index 81% rename from app/src/main/res/layout/view_article_header_image.xml rename to app/src/main/res/layout/view_page_header_image.xml index ddbca70..b2eabe3 100644 --- a/app/src/main/res/layout/view_article_header_image.xml +++ b/app/src/main/res/layout/view_page_header_image.xml @@ -4,7 +4,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> <ImageView - android:id="@+id/view_article_header_image_placeholder" + android:id="@+id/view_page_header_image_placeholder" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" @@ -12,14 +12,14 @@ android:contentDescription="@null" /> <org.wikipedia.views.FaceAndColorDetectImageView - android:id="@+id/view_article_header_image_image" + android:id="@+id/view_page_header_image_image" android:layout_width="match_parent" android:layout_height="match_parent" app:actualImageScaleType="focusCrop" android:contentDescription="@null" /> <View - android:id="@+id/view_article_header_image_gradient" + android:id="@+id/view_page_header_image_gradient" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="bottom"/> diff --git a/app/src/main/res/menu/menu_article_header_edit.xml b/app/src/main/res/menu/menu_page_header_edit.xml similarity index 65% rename from app/src/main/res/menu/menu_article_header_edit.xml rename to app/src/main/res/menu/menu_page_header_edit.xml index 6dc1be0..48ba226 100644 --- a/app/src/main/res/menu/menu_article_header_edit.xml +++ b/app/src/main/res/menu/menu_page_header_edit.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/menu_article_header_edit_description" + <item android:id="@+id/menu_page_header_edit_description" android:title="@string/article_header_edit_description" /> - <item android:id="@+id/menu_article_header_edit_lead_section" + <item android:id="@+id/menu_page_header_edit_lead_section" android:title="@string/article_header_edit_lead_section" /> </menu> \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/333954 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3d307164eddea99292070fe7bc8b951628a8df3f Gerrit-PatchSet: 2 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Sandaru <sandar...@gmail.com> 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