diff --git a/mobile/android/base/tabs/TabsLayoutItemView.java b/mobile/android/base/tabs/TabsLayoutItemView.java index 715d46347cf8..6cd13dc82678 100644 --- a/mobile/android/base/tabs/TabsLayoutItemView.java +++ b/mobile/android/base/tabs/TabsLayoutItemView.java @@ -5,8 +5,10 @@ package org.mozilla.gecko.tabs; import org.mozilla.gecko.R; +import org.mozilla.gecko.Tab; import org.mozilla.gecko.widget.TabThumbnailWrapper; +import android.graphics.drawable.Drawable; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; @@ -28,4 +30,23 @@ public class TabsLayoutItemView { close = (ImageButton) view.findViewById(R.id.close); thumbnailWrapper = (TabThumbnailWrapper) view.findViewById(R.id.wrapper); } -} \ No newline at end of file + + protected void assignValues(Tab tab) { + if (tab == null) + return; + + id = tab.getId(); + + Drawable thumbnailImage = tab.getThumbnail(); + if (thumbnailImage != null) { + thumbnail.setImageDrawable(thumbnailImage); + } else { + thumbnail.setImageResource(R.drawable.tab_thumbnail_default); + } + if (thumbnailWrapper != null) { + thumbnailWrapper.setRecording(tab.isRecording()); + } + title.setText(tab.getDisplayTitle()); + close.setTag(this); + } +} diff --git a/mobile/android/base/tabs/TabsListLayout.java b/mobile/android/base/tabs/TabsListLayout.java index 4fe33791a590..2dfce428893b 100644 --- a/mobile/android/base/tabs/TabsListLayout.java +++ b/mobile/android/base/tabs/TabsListLayout.java @@ -9,22 +9,21 @@ import java.util.ArrayList; import java.util.List; import org.mozilla.gecko.AboutPages; +import org.mozilla.gecko.animation.PropertyAnimator.Property; +import org.mozilla.gecko.animation.PropertyAnimator; +import org.mozilla.gecko.animation.ViewHelper; import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoEvent; import org.mozilla.gecko.R; import org.mozilla.gecko.Tab; -import org.mozilla.gecko.Tabs; import org.mozilla.gecko.tabs.TabsPanel.TabsLayout; -import org.mozilla.gecko.animation.PropertyAnimator; -import org.mozilla.gecko.animation.PropertyAnimator.Property; -import org.mozilla.gecko.animation.ViewHelper; +import org.mozilla.gecko.Tabs; import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.gecko.widget.TwoWayView; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect; -import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -150,7 +149,7 @@ class TabsListLayout extends TwoWayView return; TabsLayoutItemView item = (TabsLayoutItemView) view.getTag(); - assignValues(item, tab); + item.assignValues(tab); break; } } @@ -269,31 +268,12 @@ class TabsListLayout extends TwoWayView } Tab tab = mTabs.get(position); - assignValues(item, tab); + item.assignValues(tab); return convertView; } } - private void assignValues(TabsLayoutItemView item, Tab tab) { - if (item == null || tab == null) - return; - - item.id = tab.getId(); - - Drawable thumbnailImage = tab.getThumbnail(); - if (thumbnailImage != null) { - item.thumbnail.setImageDrawable(thumbnailImage); - } else { - item.thumbnail.setImageResource(R.drawable.tab_thumbnail_default); - } - if (item.thumbnailWrapper != null) { - item.thumbnailWrapper.setRecording(tab.isRecording()); - } - item.title.setText(tab.getDisplayTitle()); - item.close.setTag(item); - } - private void resetTransforms(View view) { ViewHelper.setAlpha(view, 1);