am c4ba7e39: Merge change 22772 into eclair
Merge commit 'c4ba7e39f1588604c0ae1e117e35b8413619abac' into eclair-plus-aosp * commit 'c4ba7e39f1588604c0ae1e117e35b8413619abac': New List and Tab assets.
@@ -101,8 +101,8 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
throw new RuntimeException(
|
||||
"Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabs'");
|
||||
}
|
||||
|
||||
// KeyListener to attach to all tabs. Detects non-navigation keys
|
||||
|
||||
// KeyListener to attach to all tabs. Detects non-navigation keys
|
||||
// and relays them to the tab content.
|
||||
mTabKeyListener = new OnKeyListener() {
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
@@ -114,14 +114,14 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
case KeyEvent.KEYCODE_DPAD_DOWN:
|
||||
case KeyEvent.KEYCODE_ENTER:
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
mTabContent.requestFocus(View.FOCUS_FORWARD);
|
||||
return mTabContent.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
mTabWidget.setTabSelectionListener(new TabWidget.OnTabSelectionChanged() {
|
||||
public void onTabSelectionChanged(int tabIndex, boolean clicked) {
|
||||
setCurrentTab(tabIndex);
|
||||
@@ -134,7 +134,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
mTabContent = (FrameLayout) findViewById(com.android.internal.R.id.tabcontent);
|
||||
if (mTabContent == null) {
|
||||
throw new RuntimeException(
|
||||
"Your TabHost must have a FrameLayout whose id attribute is "
|
||||
"Your TabHost must have a FrameLayout whose id attribute is "
|
||||
+ "'android.R.id.tabcontent'");
|
||||
}
|
||||
}
|
||||
@@ -284,7 +284,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
playSoundEffect(SoundEffectConstants.NAVIGATION_UP);
|
||||
return true;
|
||||
}
|
||||
return handled;
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
// Call the tab widget's focusCurrentTab(), instead of just
|
||||
// selecting the tab.
|
||||
mTabWidget.focusCurrentTab(mCurrentTab);
|
||||
|
||||
|
||||
// tab content
|
||||
mCurrentView = spec.mContentStrategy.getContentView();
|
||||
|
||||
@@ -368,7 +368,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
public interface TabContentFactory {
|
||||
/**
|
||||
* Callback to make the tab contents
|
||||
*
|
||||
*
|
||||
* @param tag
|
||||
* Which tab was selected.
|
||||
* @return The view to display the contents of the selected tab.
|
||||
@@ -502,6 +502,8 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
View tabIndicator = inflater.inflate(R.layout.tab_indicator,
|
||||
mTabWidget, // tab widget is the parent
|
||||
false); // no inflate params
|
||||
// TODO: Move this to xml when bug 2068024 is resolved.
|
||||
tabIndicator.getBackground().setDither(true);
|
||||
|
||||
final TextView tv = (TextView) tabIndicator.findViewById(R.id.title);
|
||||
tv.setText(mLabel);
|
||||
@@ -529,6 +531,8 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
View tabIndicator = inflater.inflate(R.layout.tab_indicator,
|
||||
mTabWidget, // tab widget is the parent
|
||||
false); // no inflate params
|
||||
// TODO: Move this to xml when bug 2068024 is resolved.
|
||||
tabIndicator.getBackground().setDither(true);
|
||||
|
||||
final TextView tv = (TextView) tabIndicator.findViewById(R.id.title);
|
||||
tv.setText(mLabel);
|
||||
@@ -638,7 +642,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
|
||||
}
|
||||
}
|
||||
mLaunchedView = wd;
|
||||
|
||||
|
||||
// XXX Set FOCUS_AFTER_DESCENDANTS on embedded activities for now so they can get
|
||||
// focus if none of their children have it. They need focus to be able to
|
||||
// display menu items.
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.view.View.OnFocusChangeListener;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Displays a list of tab labels representing each page in the parent's tab
|
||||
* collection. The container object for this widget is
|
||||
* {@link android.widget.TabHost TabHost}. When the user selects a tab, this
|
||||
@@ -64,21 +64,36 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
super(context, attrs);
|
||||
initTabWidget();
|
||||
|
||||
TypedArray a =
|
||||
TypedArray a =
|
||||
context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TabWidget,
|
||||
defStyle, 0);
|
||||
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
mStripMoved = true;
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getChildDrawingOrder(int childCount, int i) {
|
||||
// Always draw the selected tab last, so that drop shadows are drawn
|
||||
// in the correct z-order.
|
||||
if (i == childCount - 1) {
|
||||
return mSelectedTab;
|
||||
} else if (i >= mSelectedTab) {
|
||||
return i + 1;
|
||||
} else {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
private void initTabWidget() {
|
||||
setOrientation(LinearLayout.HORIZONTAL);
|
||||
mGroupFlags |= FLAG_USE_CHILD_DRAWING_ORDER;
|
||||
|
||||
mBottomLeftStrip = mContext.getResources().getDrawable(
|
||||
com.android.internal.R.drawable.tab_bottom_left);
|
||||
mBottomRightStrip = mContext.getResources().getDrawable(
|
||||
@@ -156,7 +171,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
}
|
||||
super.childDrawableStateChanged(child);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
@@ -169,17 +184,17 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
}
|
||||
|
||||
View selectedChild = getChildTabViewAt(mSelectedTab);
|
||||
|
||||
|
||||
mBottomLeftStrip.setState(selectedChild.getDrawableState());
|
||||
mBottomRightStrip.setState(selectedChild.getDrawableState());
|
||||
|
||||
|
||||
if (mStripMoved) {
|
||||
Rect selBounds = new Rect(); // Bounds of the selected tab indicator
|
||||
selBounds.left = selectedChild.getLeft();
|
||||
selBounds.right = selectedChild.getRight();
|
||||
final int myHeight = getHeight();
|
||||
mBottomLeftStrip.setBounds(
|
||||
Math.min(0, selBounds.left
|
||||
Math.min(0, selBounds.left
|
||||
- mBottomLeftStrip.getIntrinsicWidth()),
|
||||
myHeight - mBottomLeftStrip.getIntrinsicHeight(),
|
||||
selBounds.left,
|
||||
@@ -187,12 +202,12 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
mBottomRightStrip.setBounds(
|
||||
selBounds.right,
|
||||
myHeight - mBottomRightStrip.getIntrinsicHeight(),
|
||||
Math.max(getWidth(),
|
||||
Math.max(getWidth(),
|
||||
selBounds.right + mBottomRightStrip.getIntrinsicWidth()),
|
||||
myHeight);
|
||||
mStripMoved = false;
|
||||
}
|
||||
|
||||
|
||||
mBottomLeftStrip.draw(canvas);
|
||||
mBottomRightStrip.draw(canvas);
|
||||
}
|
||||
@@ -202,26 +217,26 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
* This method is used to bring a tab to the front of the Widget,
|
||||
* and is used to post to the rest of the UI that a different tab
|
||||
* has been brought to the foreground.
|
||||
*
|
||||
* Note, this is separate from the traditional "focus" that is
|
||||
* employed from the view logic.
|
||||
*
|
||||
* For instance, if we have a list in a tabbed view, a user may be
|
||||
* navigating up and down the list, moving the UI focus (orange
|
||||
* highlighting) through the list items. The cursor movement does
|
||||
* not effect the "selected" tab though, because what is being
|
||||
* scrolled through is all on the same tab. The selected tab only
|
||||
* changes when we navigate between tabs (moving from the list view
|
||||
*
|
||||
* Note, this is separate from the traditional "focus" that is
|
||||
* employed from the view logic.
|
||||
*
|
||||
* For instance, if we have a list in a tabbed view, a user may be
|
||||
* navigating up and down the list, moving the UI focus (orange
|
||||
* highlighting) through the list items. The cursor movement does
|
||||
* not effect the "selected" tab though, because what is being
|
||||
* scrolled through is all on the same tab. The selected tab only
|
||||
* changes when we navigate between tabs (moving from the list view
|
||||
* to the next tabbed view, in this example).
|
||||
*
|
||||
*
|
||||
* To move both the focus AND the selected tab at once, please use
|
||||
* {@link #setCurrentTab}. Normally, the view logic takes care of
|
||||
* adjusting the focus, so unless you're circumventing the UI,
|
||||
* {@link #setCurrentTab}. Normally, the view logic takes care of
|
||||
* adjusting the focus, so unless you're circumventing the UI,
|
||||
* you'll probably just focus your interest here.
|
||||
*
|
||||
*
|
||||
* @param index The tab that you want to indicate as the selected
|
||||
* tab (tab brought to the front of the widget)
|
||||
*
|
||||
*
|
||||
* @see #focusCurrentTab
|
||||
*/
|
||||
public void setCurrentTab(int index) {
|
||||
@@ -234,19 +249,19 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
getChildTabViewAt(mSelectedTab).setSelected(true);
|
||||
mStripMoved = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current tab and focuses the UI on it.
|
||||
* This method makes sure that the focused tab matches the selected
|
||||
* tab, normally at {@link #setCurrentTab}. Normally this would not
|
||||
* be an issue if we go through the UI, since the UI is responsible
|
||||
* for calling TabWidget.onFocusChanged(), but in the case where we
|
||||
* are selecting the tab programmatically, we'll need to make sure
|
||||
* This method makes sure that the focused tab matches the selected
|
||||
* tab, normally at {@link #setCurrentTab}. Normally this would not
|
||||
* be an issue if we go through the UI, since the UI is responsible
|
||||
* for calling TabWidget.onFocusChanged(), but in the case where we
|
||||
* are selecting the tab programmatically, we'll need to make sure
|
||||
* focus keeps up.
|
||||
*
|
||||
* @param index The tab that you want focused (highlighted in orange)
|
||||
*
|
||||
* @param index The tab that you want focused (highlighted in orange)
|
||||
* and selected (tab brought to the front of the widget)
|
||||
*
|
||||
*
|
||||
* @see #setCurrentTab
|
||||
*/
|
||||
public void focusCurrentTab(int index) {
|
||||
@@ -254,18 +269,18 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
|
||||
// set the tab
|
||||
setCurrentTab(index);
|
||||
|
||||
|
||||
// change the focus if applicable.
|
||||
if (oldTab != index) {
|
||||
getChildTabViewAt(index).requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
super.setEnabled(enabled);
|
||||
int count = getTabCount();
|
||||
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
View child = getChildTabViewAt(i);
|
||||
child.setEnabled(enabled);
|
||||
@@ -318,7 +333,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
getChildTabViewAt(mSelectedTab).requestFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (hasFocus) {
|
||||
int i = 0;
|
||||
int numTabs = getTabCount();
|
||||
@@ -354,7 +369,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
|
||||
/**
|
||||
* Informs the TabHost which tab was selected. It also indicates
|
||||
* if the tab was clicked/pressed or just focused into.
|
||||
*
|
||||
*
|
||||
* @param tabIndex index of the tab that was selected
|
||||
* @param clicked whether the selection changed due to a touch/click
|
||||
* or due to focus entering the tab through navigation. Pass true
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:color="#323232"/>
|
||||
<item android:color="#FFF"/> <!-- not selected -->
|
||||
<item android:state_selected="true" android:color="#ffffff"/>
|
||||
<item android:color="#808080"/> <!-- not selected -->
|
||||
</selector>
|
||||
|
||||
|
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 161 B |
20
core/res/res/drawable/dark_header_dither.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/dark_header"
|
||||
android:dither="true"
|
||||
/>
|
||||
|
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 119 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 121 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 119 B |
BIN
core/res/res/drawable/divider_vertical_bright_opaque.9.png
Normal file
|
After Width: | Height: | Size: 120 B |
BIN
core/res/res/drawable/divider_vertical_dark.9.png
Normal file
|
After Width: | Height: | Size: 121 B |
BIN
core/res/res/drawable/divider_vertical_dark_opaque.9.png
Normal file
|
After Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 162 B |
20
core/res/res/drawable/light_header_dither.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2009 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/light_header"
|
||||
android:dither="true"
|
||||
/>
|
||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 657 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 300 B |
@@ -18,6 +18,8 @@
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="64dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="-4px"
|
||||
android:layout_marginRight="-4px"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:drawable/tab_indicator">
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
-->
|
||||
<resources>
|
||||
<drawable name="screen_background_light">#fff9f9f9</drawable>
|
||||
<drawable name="screen_background_dark">#ff1a1a1a</drawable>
|
||||
<drawable name="screen_background_dark">#ff202020</drawable>
|
||||
<drawable name="status_bar_closed_default_background">#ff000000</drawable>
|
||||
<drawable name="status_bar_opened_default_background">#ff000000</drawable>
|
||||
<drawable name="search_bar_default_color">#ff000000</drawable>
|
||||
@@ -28,7 +28,7 @@
|
||||
<color name="white">#ffffffff</color>
|
||||
<color name="black">#ff000000</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="background_dark">#ff1a1a1a</color>
|
||||
<color name="background_dark">#ff202020</color>
|
||||
<color name="bright_foreground_dark">#ffffffff</color>
|
||||
<color name="bright_foreground_dark_disabled">#80ffffff</color>
|
||||
<color name="bright_foreground_dark_inverse">#ff000000</color>
|
||||
|
||||
@@ -339,7 +339,7 @@
|
||||
</style>
|
||||
|
||||
<style name="Widget.TextView.ListSeparator">
|
||||
<item name="android:background">@android:drawable/dark_header</item>
|
||||
<item name="android:background">@android:drawable/dark_header_dither</item>
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">25dip</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
@@ -351,7 +351,7 @@
|
||||
|
||||
<style name="Widget.TextView.ListSeparator.White">
|
||||
<item name="android:textColor">?textColorPrimaryInverse</item>
|
||||
<item name="android:background">@android:drawable/light_header</item>
|
||||
<item name="android:background">@android:drawable/light_header_dither</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.EditText">
|
||||
|
||||