Adding background protection for tab labels in AllApps/Customize and modified padding to match mockups.
Change-Id: I7f3b37d892fdf5a702a66d68e1bbdf333068d7ec
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index 0e32461..4feb998 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -16,7 +16,7 @@
package com.android.launcher2;
-import com.android.launcher.R;
+import java.util.ArrayList;
import android.animation.Animator;
import android.animation.ObjectAnimator;
@@ -25,11 +25,14 @@
import android.content.res.Resources;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TabHost;
+import android.widget.TabWidget;
+import android.widget.TextView;
-import java.util.ArrayList;
+import com.android.launcher.R;
/**
* Implements a tabbed version of AllApps2D.
@@ -43,10 +46,12 @@
private AllAppsPagedView mAllApps;
private Context mContext;
+ private final LayoutInflater mInflater;
public AllAppsTabbed(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
+ mInflater = LayoutInflater.from(context);
}
@Override
@@ -68,11 +73,15 @@
}
};
- String label = mContext.getString(R.string.all_apps_tab_all);
- addTab(newTabSpec(TAG_ALL).setIndicator(label).setContent(contentFactory));
+ TextView tabView;
+ TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs);
+ tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
+ tabView.setText(mContext.getString(R.string.all_apps_tab_all));
+ addTab(newTabSpec(TAG_ALL).setIndicator(tabView).setContent(contentFactory));
- label = mContext.getString(R.string.all_apps_tab_downloaded);
- addTab(newTabSpec(TAG_DOWNLOADED).setIndicator(label).setContent(contentFactory));
+ tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
+ tabView.setText(mContext.getString(R.string.all_apps_tab_downloaded));
+ addTab(newTabSpec(TAG_DOWNLOADED).setIndicator(tabView).setContent(contentFactory));
setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 1a486d7..033ccc3 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -99,6 +99,7 @@
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TabHost;
+import android.widget.TabWidget;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.TabHost.OnTabChangeListener;
@@ -306,18 +307,27 @@
}
};
- String widgetsLabel = getString(R.string.widgets_tab_label);
+
+ TextView tabView;
+ TabWidget tabWidget = (TabWidget)
+ mHomeCustomizationDrawer.findViewById(com.android.internal.R.id.tabs);
+
+ tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
+ tabView.setText(getString(R.string.widgets_tab_label));
mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(WIDGETS_TAG)
- .setIndicator(widgetsLabel).setContent(contentFactory));
- String applicationsLabel = getString(R.string.applications_tab_label);
+ .setIndicator(tabView).setContent(contentFactory));
+ tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
+ tabView.setText(getString(R.string.applications_tab_label));
mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(APPLICATIONS_TAG)
- .setIndicator(applicationsLabel).setContent(contentFactory));
- String wallpapersLabel = getString(R.string.wallpapers_tab_label);
+ .setIndicator(tabView).setContent(contentFactory));
+ tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
+ tabView.setText(getString(R.string.wallpapers_tab_label));
mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(WALLPAPERS_TAG)
- .setIndicator(wallpapersLabel).setContent(contentFactory));
- String shortcutsLabel = getString(R.string.shortcuts_tab_label);
+ .setIndicator(tabView).setContent(contentFactory));
+ tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
+ tabView.setText(getString(R.string.shortcuts_tab_label));
mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(SHORTCUTS_TAG)
- .setIndicator(shortcutsLabel).setContent(contentFactory));
+ .setIndicator(tabView).setContent(contentFactory));
mHomeCustomizationDrawer.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
// animate the changing of the tab content by fading pages in and out