From bc418f17751091e6a1192f1fc35e459a73bbd193 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Mon, 24 Aug 2015 10:12:06 -0600 Subject: [PATCH] Bug 1190301 - Use compound drawables instead of ImageButton views for tab audio indicator. r=mhaigh --HG-- extra : commitid : gRtKCFje0R extra : rebase_source : 8a94567769beda2ac2af6c819f30c482445ae2d7 --- .../layout-large-v11/tab_strip_item_view.xml | 12 +----------- .../base/resources/layout/tabs_layout_item_view.xml | 12 ++---------- mobile/android/base/tabs/TabStripItemView.java | 10 ++++++---- mobile/android/base/tabs/TabsLayoutItemView.java | 10 +++++++--- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/mobile/android/base/resources/layout-large-v11/tab_strip_item_view.xml b/mobile/android/base/resources/layout-large-v11/tab_strip_item_view.xml index 449f8c3e579c..2f56b7702f5e 100644 --- a/mobile/android/base/resources/layout-large-v11/tab_strip_item_view.xml +++ b/mobile/android/base/resources/layout-large-v11/tab_strip_item_view.xml @@ -20,6 +20,7 @@ android:layout_height="match_parent" android:layout_weight="1.0" android:layout_marginRight="-5dp" + android:drawablePadding="6dp" android:gravity="center_vertical" android:textSize="14sp" android:ellipsize="end" @@ -28,17 +29,6 @@ gecko:fadeWidth="30dip" android:duplicateParentState="true"/> - - - - + android:paddingRight="5dp" + android:drawablePadding="6dp"/> diff --git a/mobile/android/base/tabs/TabStripItemView.java b/mobile/android/base/tabs/TabStripItemView.java index 0508f4446e51..226a4874d04f 100644 --- a/mobile/android/base/tabs/TabStripItemView.java +++ b/mobile/android/base/tabs/TabStripItemView.java @@ -49,7 +49,6 @@ public class TabStripItemView extends ThemedLinearLayout private final ImageView faviconView; private final ThemedTextView titleView; private final ThemedImageButton closeView; - private final ThemedImageButton audioPlayingView; private final ResizablePathDrawable backgroundDrawable; private final Region tabRegion; @@ -106,8 +105,6 @@ public class TabStripItemView extends ThemedLinearLayout tabs.closeTab(tabs.getTab(id), true); } }); - - audioPlayingView = (ThemedImageButton) findViewById(R.id.audio_playing); } @Override @@ -199,7 +196,6 @@ public class TabStripItemView extends ThemedLinearLayout updateTitle(tab); updateFavicon(tab.getFavicon()); setPrivateMode(tab.isPrivate()); - audioPlayingView.setVisibility(tab.isAudioPlaying() ? View.VISIBLE : View.GONE); } private void updateTitle(Tab tab) { @@ -213,6 +209,12 @@ public class TabStripItemView extends ThemedLinearLayout titleView.setText(tab.getDisplayTitle()); } + // TODO: Set content description to indicate audio is playing. + if (tab.isAudioPlaying()) { + titleView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tab_audio_playing, 0, 0, 0); + } else { + titleView.setCompoundDrawables(null, null, null, null); + } } private void updateFavicon(final Bitmap favicon) { diff --git a/mobile/android/base/tabs/TabsLayoutItemView.java b/mobile/android/base/tabs/TabsLayoutItemView.java index 808cf36be2d0..ca51f6ea7963 100644 --- a/mobile/android/base/tabs/TabsLayoutItemView.java +++ b/mobile/android/base/tabs/TabsLayoutItemView.java @@ -38,7 +38,6 @@ public class TabsLayoutItemView extends LinearLayout private TextView mTitle; private TabsPanelThumbnailView mThumbnail; private ImageView mCloseButton; - private ImageView mAudioPlayingButton; private TabThumbnailWrapper mThumbnailWrapper; public TabsLayoutItemView(Context context, AttributeSet attrs) { @@ -99,7 +98,6 @@ public class TabsLayoutItemView extends LinearLayout mTitle = (TextView) findViewById(R.id.title); mThumbnail = (TabsPanelThumbnailView) findViewById(R.id.thumbnail); mCloseButton = (ImageView) findViewById(R.id.close); - mAudioPlayingButton = (ImageView) findViewById(R.id.audio_playing); mThumbnailWrapper = (TabThumbnailWrapper) findViewById(R.id.wrapper); growCloseButtonHitArea(); @@ -145,7 +143,13 @@ public class TabsLayoutItemView extends LinearLayout } mTitle.setText(tab.getDisplayTitle()); mCloseButton.setTag(this); - mAudioPlayingButton.setVisibility(tab.isAudioPlaying() ? View.VISIBLE : View.GONE); + + // TODO: Set content description to indicate audio is playing. + if (tab.isAudioPlaying()) { + mTitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tab_audio_playing, 0, 0, 0); + } else { + mTitle.setCompoundDrawables(null, null, null, null); + } } public int getTabId() {