Loading api/current.xml +0 −13 Original line number Diff line number Diff line Loading @@ -156964,19 +156964,6 @@ <parameter name="isInTouchMode" type="boolean"> </parameter> </method> <method name="removeViewFromLayout" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="protected" > <parameter name="aView" type="android.view.View"> </parameter> </method> <method name="setCurrentTab" return="void" abstract="false" core/java/android/widget/TabHost.java +1 −7 Original line number Diff line number Diff line Loading @@ -333,6 +333,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); // give the current tab content view a shot mCurrentView.requestFocus(); } } //mTabContent.requestFocus(View.FOCUS_FORWARD); Loading Loading @@ -701,17 +702,10 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); if (mLaunchedView != null) { if (mCloseView) { mLaunchedView.setVisibility(View.GONE); } else { removeViewFromLayout(mLaunchedView); } } } } // Implemented by Carousel (a child class of TabHost) protected void removeViewFromLayout(View aView) { } } core/java/com/tmobile/widget/Carousel.java +23 −7 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.tmobile.widget; import com.tmobile.widget.CarouselTabWidget.CarouselTabWidgetOnItemSelectedListener; import android.app.Activity; import android.app.LocalActivityManager; import android.content.Context; import android.content.Intent; Loading Loading @@ -62,6 +63,25 @@ public class Carousel extends TabHost implements OnGestureListener { return windowDecor; } public View getView(int position) { String name = mTabWidget.getFilmstrip().getFilmstripItem(position) .getName(); Activity activity = mLocalActivityManager.getActivity(name); if (activity != null) { Window window = activity.getWindow(); View windowDecor = (window != null) ? window.getDecorView() : null; return windowDecor; } return getView(position, null, null); } } public class CarouselOnItemSelectedListener extends Loading Loading @@ -132,7 +152,6 @@ public class Carousel extends TabHost implements OnGestureListener { } if (mCarouselTabContentLayout != null) { mCarouselTabContentLayout.setTabHost(this); mCarouselTabContentLayout.setAdapter(new CarouselViewAdapter()); } } Loading Loading @@ -167,7 +186,7 @@ public class Carousel extends TabHost implements OnGestureListener { return false; } mCarouselTabContentLayout.setSelection(newSelectedPosition, true, true); mCarouselTabContentLayout.setSelection(newSelectedPosition, true); mTabWidget.setFilmstripSelection(newSelectedPosition); return true; Loading Loading @@ -211,6 +230,7 @@ public class Carousel extends TabHost implements OnGestureListener { } protected void dispatchKeyUpEvent() { mTabWidget.getFilmstrip().requestFocus(); } Loading @@ -222,8 +242,4 @@ public class Carousel extends TabHost implements OnGestureListener { mCarouselTabContentLayout.setSelection(index, false); } // Call carousel tab layout to remove view protected void removeViewFromLayout(View aView) { mCarouselTabContentLayout.removeViewFromLayout(aView); } } core/java/com/tmobile/widget/CarouselLayout.java +29 −23 Original line number Diff line number Diff line package com.tmobile.widget; import com.tmobile.widget.Carousel.CarouselViewAdapter; import android.content.Context; import android.util.AttributeSet; import android.view.View; Loading @@ -8,7 +10,6 @@ import android.view.ViewParent; import android.widget.AbsoluteLayout; import android.widget.Adapter; import android.widget.Scroller; import android.widget.TabHost; public class CarouselLayout extends AbsoluteLayout { Loading @@ -22,6 +23,7 @@ public class CarouselLayout extends AbsoluteLayout { } public void scrollBy(int distance, int duration) { if (distance == 0) return; removeCallbacks(this); Loading Loading @@ -67,9 +69,8 @@ public class CarouselLayout extends AbsoluteLayout { private int mOldSelectedPosition = INVALID_POSITION; private int mSelectedPosition = INVALID_POSITION; private Adapter mAdapter; private CarouselViewAdapter mAdapter; private int mScrollDuration = 0; private TabHost mTabHost; private ScrollerRunnable mScrollerRunnable = new ScrollerRunnable(); Loading Loading @@ -102,7 +103,7 @@ public class CarouselLayout extends AbsoluteLayout { invalidate(); } public void setAdapter(Adapter adapter) { public void setAdapter(CarouselViewAdapter adapter) { if (null != mAdapter) { //mAdapter.unregisterDataSetObserver(mDataSetObserver); resetLayout(); Loading Loading @@ -130,28 +131,38 @@ public class CarouselLayout extends AbsoluteLayout { private void removeOldSelectedView() { if (INVALID_POSITION == mOldSelectedPosition) return; mOldSelectedPosition = INVALID_POSITION; } View theOldSelectedView = mAdapter.getView(mOldSelectedPosition); removeView(theOldSelectedView); public void removeViewFromLayout(View aView) { removeView(aView); mOldSelectedPosition = INVALID_POSITION; } private void snapToCurrentSelection() { mScrollerRunnable.stop(); removeOldSelectedView(); if (INVALID_POSITION != mSelectedPosition) { View theSelectedView = mAdapter.getView(mSelectedPosition); theSelectedView.setLayoutParams(new AbsoluteLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0, 0)); requestLayout(); theSelectedView.setFocusable(true); theSelectedView.setFocusableInTouchMode(true); ((ViewGroup) theSelectedView).setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); // Do not request focus in order to keep the focus in Gallery when it has the focus //theSelectedView.requestFocus(); } public void setSelection(int position) { setSelection(position, false, false); } public void setTabHost(TabHost aTabHost) { mTabHost = aTabHost; public void setSelection(int position) { setSelection(position, false); } public void setSelection(int position, boolean animate, boolean startActivity) { public void setSelection(int position, boolean animate) { if (position == mSelectedPosition) return; snapToCurrentSelection(); Loading @@ -160,16 +171,10 @@ public class CarouselLayout extends AbsoluteLayout { if (INVALID_POSITION != mSelectedPosition) { int xView = 0; View theSelectedView = null; if (startActivity) { theSelectedView = mAdapter.getView(mSelectedPosition, null, this); } else { theSelectedView = mTabHost.getCurrentView(); } View theSelectedView = mAdapter.getView(mSelectedPosition); if (animate && (INVALID_POSITION != mOldSelectedPosition)) { xView = (mSelectedPosition > mOldSelectedPosition) ? getWidth() : -getWidth(); mScrollerRunnable.scrollBy(-xView, mScrollDuration); } else { Loading Loading @@ -199,6 +204,7 @@ public class CarouselLayout extends AbsoluteLayout { } private void handleScroll(int inChangeInX) { if (getChildCount() == 0) return; for (int i = getChildCount() - 1; i >= 0; i--) { Loading core/java/com/tmobile/widget/CarouselTabContentLayout.java +11 −28 Original line number Diff line number Diff line package com.tmobile.widget; import com.android.internal.R; import com.tmobile.widget.Carousel.CarouselViewAdapter; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.View; import android.widget.Adapter; import android.widget.FrameLayout; import android.widget.TabHost; import com.android.internal.R; public class CarouselTabContentLayout extends FrameLayout { private CarouselLayout mCarouselLayout; private int mScrollDuration = SCROLL_DURATION_DEFAULT; private static final int SCROLL_DURATION_DEFAULT = 400; Loading @@ -32,13 +29,10 @@ public class CarouselTabContentLayout extends FrameLayout { int defStyle) { super(context, attrs, defStyle); setFocusable(false); setFocusableInTouchMode(false); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Gallery, defStyle, 0); mScrollDuration = a.getInt(R.styleable.Gallery_animationDuration, SCROLL_DURATION_DEFAULT); a.recycle(); Loading @@ -55,17 +49,13 @@ public class CarouselTabContentLayout extends FrameLayout { } public void setSelection(int position, boolean animate) { mCarouselLayout.setSelection(position, animate, false); mCarouselLayout.setSelection(position, animate); } public void setAdapter(Adapter adapter) { public void setAdapter(CarouselViewAdapter adapter) { mCarouselLayout.setAdapter(adapter); } public void setTabHost(TabHost aTabHost) { mCarouselLayout.setTabHost(aTabHost); } @Override public void addView(View child, int width, int height) { // Do nothing Loading Loading @@ -119,12 +109,13 @@ public class CarouselTabContentLayout extends FrameLayout { } @Override public void removeViews(int start, int count) { public void removeViewsInLayout(int start, int count) { // Do nothing } @Override public void removeViewsInLayout(int start, int count) { public void removeViews(int start, int count) { // Do nothing } Loading @@ -133,15 +124,7 @@ public class CarouselTabContentLayout extends FrameLayout { } public void setSelection(int position) { mCarouselLayout.setSelection(position, true, false); } public void setSelection(int position, boolean animate, boolean startActivity) { mCarouselLayout.setSelection(position, animate, startActivity); } protected void removeViewFromLayout(View aView) { mCarouselLayout.removeViewFromLayout(aView); mCarouselLayout.setSelection(position, true); } } Loading
api/current.xml +0 −13 Original line number Diff line number Diff line Loading @@ -156964,19 +156964,6 @@ <parameter name="isInTouchMode" type="boolean"> </parameter> </method> <method name="removeViewFromLayout" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="protected" > <parameter name="aView" type="android.view.View"> </parameter> </method> <method name="setCurrentTab" return="void" abstract="false"
core/java/android/widget/TabHost.java +1 −7 Original line number Diff line number Diff line Loading @@ -333,6 +333,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); // give the current tab content view a shot mCurrentView.requestFocus(); } } //mTabContent.requestFocus(View.FOCUS_FORWARD); Loading Loading @@ -701,17 +702,10 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); if (mLaunchedView != null) { if (mCloseView) { mLaunchedView.setVisibility(View.GONE); } else { removeViewFromLayout(mLaunchedView); } } } } // Implemented by Carousel (a child class of TabHost) protected void removeViewFromLayout(View aView) { } }
core/java/com/tmobile/widget/Carousel.java +23 −7 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.tmobile.widget; import com.tmobile.widget.CarouselTabWidget.CarouselTabWidgetOnItemSelectedListener; import android.app.Activity; import android.app.LocalActivityManager; import android.content.Context; import android.content.Intent; Loading Loading @@ -62,6 +63,25 @@ public class Carousel extends TabHost implements OnGestureListener { return windowDecor; } public View getView(int position) { String name = mTabWidget.getFilmstrip().getFilmstripItem(position) .getName(); Activity activity = mLocalActivityManager.getActivity(name); if (activity != null) { Window window = activity.getWindow(); View windowDecor = (window != null) ? window.getDecorView() : null; return windowDecor; } return getView(position, null, null); } } public class CarouselOnItemSelectedListener extends Loading Loading @@ -132,7 +152,6 @@ public class Carousel extends TabHost implements OnGestureListener { } if (mCarouselTabContentLayout != null) { mCarouselTabContentLayout.setTabHost(this); mCarouselTabContentLayout.setAdapter(new CarouselViewAdapter()); } } Loading Loading @@ -167,7 +186,7 @@ public class Carousel extends TabHost implements OnGestureListener { return false; } mCarouselTabContentLayout.setSelection(newSelectedPosition, true, true); mCarouselTabContentLayout.setSelection(newSelectedPosition, true); mTabWidget.setFilmstripSelection(newSelectedPosition); return true; Loading Loading @@ -211,6 +230,7 @@ public class Carousel extends TabHost implements OnGestureListener { } protected void dispatchKeyUpEvent() { mTabWidget.getFilmstrip().requestFocus(); } Loading @@ -222,8 +242,4 @@ public class Carousel extends TabHost implements OnGestureListener { mCarouselTabContentLayout.setSelection(index, false); } // Call carousel tab layout to remove view protected void removeViewFromLayout(View aView) { mCarouselTabContentLayout.removeViewFromLayout(aView); } }
core/java/com/tmobile/widget/CarouselLayout.java +29 −23 Original line number Diff line number Diff line package com.tmobile.widget; import com.tmobile.widget.Carousel.CarouselViewAdapter; import android.content.Context; import android.util.AttributeSet; import android.view.View; Loading @@ -8,7 +10,6 @@ import android.view.ViewParent; import android.widget.AbsoluteLayout; import android.widget.Adapter; import android.widget.Scroller; import android.widget.TabHost; public class CarouselLayout extends AbsoluteLayout { Loading @@ -22,6 +23,7 @@ public class CarouselLayout extends AbsoluteLayout { } public void scrollBy(int distance, int duration) { if (distance == 0) return; removeCallbacks(this); Loading Loading @@ -67,9 +69,8 @@ public class CarouselLayout extends AbsoluteLayout { private int mOldSelectedPosition = INVALID_POSITION; private int mSelectedPosition = INVALID_POSITION; private Adapter mAdapter; private CarouselViewAdapter mAdapter; private int mScrollDuration = 0; private TabHost mTabHost; private ScrollerRunnable mScrollerRunnable = new ScrollerRunnable(); Loading Loading @@ -102,7 +103,7 @@ public class CarouselLayout extends AbsoluteLayout { invalidate(); } public void setAdapter(Adapter adapter) { public void setAdapter(CarouselViewAdapter adapter) { if (null != mAdapter) { //mAdapter.unregisterDataSetObserver(mDataSetObserver); resetLayout(); Loading Loading @@ -130,28 +131,38 @@ public class CarouselLayout extends AbsoluteLayout { private void removeOldSelectedView() { if (INVALID_POSITION == mOldSelectedPosition) return; mOldSelectedPosition = INVALID_POSITION; } View theOldSelectedView = mAdapter.getView(mOldSelectedPosition); removeView(theOldSelectedView); public void removeViewFromLayout(View aView) { removeView(aView); mOldSelectedPosition = INVALID_POSITION; } private void snapToCurrentSelection() { mScrollerRunnable.stop(); removeOldSelectedView(); if (INVALID_POSITION != mSelectedPosition) { View theSelectedView = mAdapter.getView(mSelectedPosition); theSelectedView.setLayoutParams(new AbsoluteLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0, 0)); requestLayout(); theSelectedView.setFocusable(true); theSelectedView.setFocusableInTouchMode(true); ((ViewGroup) theSelectedView).setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); // Do not request focus in order to keep the focus in Gallery when it has the focus //theSelectedView.requestFocus(); } public void setSelection(int position) { setSelection(position, false, false); } public void setTabHost(TabHost aTabHost) { mTabHost = aTabHost; public void setSelection(int position) { setSelection(position, false); } public void setSelection(int position, boolean animate, boolean startActivity) { public void setSelection(int position, boolean animate) { if (position == mSelectedPosition) return; snapToCurrentSelection(); Loading @@ -160,16 +171,10 @@ public class CarouselLayout extends AbsoluteLayout { if (INVALID_POSITION != mSelectedPosition) { int xView = 0; View theSelectedView = null; if (startActivity) { theSelectedView = mAdapter.getView(mSelectedPosition, null, this); } else { theSelectedView = mTabHost.getCurrentView(); } View theSelectedView = mAdapter.getView(mSelectedPosition); if (animate && (INVALID_POSITION != mOldSelectedPosition)) { xView = (mSelectedPosition > mOldSelectedPosition) ? getWidth() : -getWidth(); mScrollerRunnable.scrollBy(-xView, mScrollDuration); } else { Loading Loading @@ -199,6 +204,7 @@ public class CarouselLayout extends AbsoluteLayout { } private void handleScroll(int inChangeInX) { if (getChildCount() == 0) return; for (int i = getChildCount() - 1; i >= 0; i--) { Loading
core/java/com/tmobile/widget/CarouselTabContentLayout.java +11 −28 Original line number Diff line number Diff line package com.tmobile.widget; import com.android.internal.R; import com.tmobile.widget.Carousel.CarouselViewAdapter; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.View; import android.widget.Adapter; import android.widget.FrameLayout; import android.widget.TabHost; import com.android.internal.R; public class CarouselTabContentLayout extends FrameLayout { private CarouselLayout mCarouselLayout; private int mScrollDuration = SCROLL_DURATION_DEFAULT; private static final int SCROLL_DURATION_DEFAULT = 400; Loading @@ -32,13 +29,10 @@ public class CarouselTabContentLayout extends FrameLayout { int defStyle) { super(context, attrs, defStyle); setFocusable(false); setFocusableInTouchMode(false); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Gallery, defStyle, 0); mScrollDuration = a.getInt(R.styleable.Gallery_animationDuration, SCROLL_DURATION_DEFAULT); a.recycle(); Loading @@ -55,17 +49,13 @@ public class CarouselTabContentLayout extends FrameLayout { } public void setSelection(int position, boolean animate) { mCarouselLayout.setSelection(position, animate, false); mCarouselLayout.setSelection(position, animate); } public void setAdapter(Adapter adapter) { public void setAdapter(CarouselViewAdapter adapter) { mCarouselLayout.setAdapter(adapter); } public void setTabHost(TabHost aTabHost) { mCarouselLayout.setTabHost(aTabHost); } @Override public void addView(View child, int width, int height) { // Do nothing Loading Loading @@ -119,12 +109,13 @@ public class CarouselTabContentLayout extends FrameLayout { } @Override public void removeViews(int start, int count) { public void removeViewsInLayout(int start, int count) { // Do nothing } @Override public void removeViewsInLayout(int start, int count) { public void removeViews(int start, int count) { // Do nothing } Loading @@ -133,15 +124,7 @@ public class CarouselTabContentLayout extends FrameLayout { } public void setSelection(int position) { mCarouselLayout.setSelection(position, true, false); } public void setSelection(int position, boolean animate, boolean startActivity) { mCarouselLayout.setSelection(position, animate, startActivity); } protected void removeViewFromLayout(View aView) { mCarouselLayout.removeViewFromLayout(aView); mCarouselLayout.setSelection(position, true); } }