summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AppsCustomizeTabHost.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-06-15 19:51:24 -0700
committerWinson Chung <winsonc@google.com>2011-06-24 10:49:03 -0700
commitfd3385fe9e0f034b04f99d5d59a58d74fe040da4 (patch)
tree6ea22637ec38883c8cef8318d4a6e312f32b8656 /src/com/android/launcher2/AppsCustomizeTabHost.java
parent4e076545e4ccdbd3c045a3fa33869a2b7519a0cc (diff)
downloadandroid_packages_apps_Trebuchet-fd3385fe9e0f034b04f99d5d59a58d74fe040da4.tar.gz
android_packages_apps_Trebuchet-fd3385fe9e0f034b04f99d5d59a58d74fe040da4.tar.bz2
android_packages_apps_Trebuchet-fd3385fe9e0f034b04f99d5d59a58d74fe040da4.zip
Using GridLayout in AppsCustomize widgets tab.
- Starting to implement new widgets design - Hiding outlines in phone ui while dragging - Making the tab bar show only when we have items as well Change-Id: Ic027f9ba83fc0982f2f92a90412f050a8e248f9c
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizeTabHost.java')
-rw-r--r--src/com/android/launcher2/AppsCustomizeTabHost.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 87c154b47..587a3eb5f 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -39,9 +39,11 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
private static final String APPS_TAB_TAG = "APPS";
private static final String WIDGETS_TAB_TAG = "WIDGETS";
+ private static final int sTabBarFadeInDuration = 150;
private final LayoutInflater mLayoutInflater;
private ViewGroup mTabs;
+ private ViewGroup mTabsContainer;
private AppsCustomizePagedView mAppsCustomizePane;
public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
@@ -67,10 +69,12 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
// Setup the tab host
setup();
+ final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
final TabWidget tabs = (TabWidget) findViewById(com.android.internal.R.id.tabs);
final AppsCustomizePagedView appsCustomizePane = (AppsCustomizePagedView)
findViewById(R.id.apps_customize_pane_content);
mTabs = tabs;
+ mTabsContainer = tabsContainer;
mAppsCustomizePane = appsCustomizePane;
if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();
@@ -98,6 +102,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
lastTab.setOnKeyListener(keyListener);
View shopButton = findViewById(R.id.market_button);
shopButton.setOnKeyListener(keyListener);
+
+ // Hide the tab bar until we measure
+ mTabsContainer.setAlpha(0f);
}
@Override
@@ -107,9 +114,15 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
// Set the width of the tab list to the content width
if (remeasureTabWidth) {
- mTabs.getLayoutParams().width = mAppsCustomizePane.getPageContentWidth();
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ int contentWidth = mAppsCustomizePane.getPageContentWidth();
+ if (contentWidth > 0) {
+ // Set the width and show the tab bar (if we have a loading graphic, we can switch
+ // it off here)
+ mTabs.getLayoutParams().width = contentWidth;
+ mTabsContainer.animate().alpha(1f).setDuration(sTabBarFadeInDuration);
+ }
}
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override