From 3fa5a516005fdad2bd73ac71908d513f6b2a35ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 15 Jun 2015 01:38:52 +0200 Subject: [PATCH] No need for TabInfo struct in TabsAdapter --- .../fdroid/fdroid/installer/TabsAdapter.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/installer/TabsAdapter.java b/F-Droid/src/org/fdroid/fdroid/installer/TabsAdapter.java index 8e211f8c5..e3c2badbc 100644 --- a/F-Droid/src/org/fdroid/fdroid/installer/TabsAdapter.java +++ b/F-Droid/src/org/fdroid/fdroid/installer/TabsAdapter.java @@ -27,6 +27,7 @@ import android.widget.TabHost; import android.widget.TabWidget; import java.util.ArrayList; +import java.util.List; /** * This is a helper class that implements the management of tabs and all @@ -44,20 +45,10 @@ public class TabsAdapter extends PagerAdapter private final Context mContext; private final TabHost mTabHost; private final ViewPager mViewPager; - private final ArrayList mTabs = new ArrayList<>(); + private final List mTabs = new ArrayList<>(); private final Rect mTempRect = new Rect(); private TabHost.OnTabChangeListener mOnTabChangeListener; - static final class TabInfo { - private final String tag; - private final View view; - - TabInfo(String _tag, View _view) { - tag = _tag; - view = _view; - } - } - static class DummyTabFactory implements TabHost.TabContentFactory { private final Context mContext; @@ -87,8 +78,7 @@ public class TabsAdapter extends PagerAdapter tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); - TabInfo info = new TabInfo(tag, view); - mTabs.add(info); + mTabs.add(view); mTabHost.addTab(tabSpec); notifyDataSetChanged(); } @@ -100,7 +90,7 @@ public class TabsAdapter extends PagerAdapter @Override public Object instantiateItem(ViewGroup container, int position) { - View view = mTabs.get(position).view; + View view = mTabs.get(position); container.addView(view); return view; } @@ -151,7 +141,7 @@ public class TabsAdapter extends PagerAdapter widget.requestRectangleOnScreen(mTempRect, false); // Make sure the scrollbars are visible for a moment after selection - final View contentView = mTabs.get(position).view; + final View contentView = mTabs.get(position); if (contentView instanceof CaffeinatedScrollView) { ((CaffeinatedScrollView) contentView).awakenScrollBars(); }