Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e6bfca3 authored by sam cheung's avatar sam cheung Committed by Josh Guilfoyle
Browse files

fix white gap issue between Carousel Tab widget and Tab content

parent abc0c152
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -156861,6 +156861,17 @@
 visibility="public"
>
</method>
<method name="dispatchKeyUpEvent"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="protected"
>
</method>
<method name="getCurrentTab"
 return="int"
 abstract="false"
@@ -157166,6 +157177,17 @@
<parameter name="indicatorFactory" type="android.widget.TabHost.IndicatorStrategy">
</parameter>
</method>
<method name="setIndicator"
 return="android.widget.TabHost.TabSpec"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
</class>
<class name="TabWidget"
 extends="android.widget.LinearLayout"
+28 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.view.LayoutInflater;
import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.Window;
import com.android.internal.R;
@@ -176,7 +177,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
            // leaving touch mode.. if nothing has focus, let's give it to
            // the indicator of the current tab
            if (!mCurrentView.hasFocus() || mCurrentView.isFocused()) {
                mTabWidget.getChildAt(mCurrentTab).requestFocus();
                dispatchKeyUpEvent();
            }
        }
    }
@@ -195,8 +196,10 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
            throw new IllegalArgumentException("you must specify a way to create the tab content");
        }
        View tabIndicator = tabSpec.mIndicatorStrategy.createIndicatorView();
        if (tabIndicator != null) {
        	tabIndicator.setOnKeyListener(mTabKeyListener);
        	mTabWidget.addView(tabIndicator);
        }
        mTabSpecs.add(tabSpec);

        if (mCurrentTab == -1) {
@@ -272,13 +275,17 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
                && (mCurrentView.isRootNamespace())
                && (mCurrentView.hasFocus())
                && (mCurrentView.findFocus().focusSearch(View.FOCUS_UP) == null)) {
            mTabWidget.getChildAt(mCurrentTab).requestFocus();
            dispatchKeyUpEvent();
            playSoundEffect(SoundEffectConstants.NAVIGATION_UP);
            return true;
        }
        return handled;        
    }

	protected void dispatchKeyUpEvent() {
		mTabWidget.getChildAt(mCurrentTab).requestFocus();
	}


    @Override
    public void dispatchWindowFocusChanged(boolean hasFocus) {
@@ -414,6 +421,12 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
        	return this;
        }
        
        public TabSpec setIndicator() {
        	mIndicatorStrategy = new ViewStubIndicatorStrategy();
        	//mIndicatorStrategy = new LabelIndicatorStrategy("");
        	return this;
        }

        /**
         * Specify the id of the view that should be used as the content
         * of the tab.
@@ -479,6 +492,17 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
        void tabClosed();
    }

    private class ViewStubIndicatorStrategy implements IndicatorStrategy {

		public View createIndicatorView() {
			View view = new ViewStub(getContext());
		
			return view;
		}
    	
    	
    }
    
    /**
     * How to create a tab indicator that just has a label.
     */
+10 −1
Original line number Diff line number Diff line
package com.tmobile.widget;


import com.tmobile.widget.CarouselTabWidget.CarouselTabWidgetOnItemSelectedListener;

import android.app.LocalActivityManager;
@@ -135,6 +136,8 @@ public class Carousel extends TabHost implements OnGestureListener {
		}
	}
	
   
    
	 public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
		   
			float x1 = e1.getX();
@@ -205,4 +208,10 @@ public class Carousel extends TabHost implements OnGestureListener {
		public void setTabWidget(CarouselTabWidget tabWidget) {
			mTabWidget = tabWidget;
		}
		
		protected void dispatchKeyUpEvent() {
			mTabWidget.getFilmstrip().requestFocus();
		}
		

}
+2 −1
Original line number Diff line number Diff line
@@ -48,7 +48,8 @@ public class CarouselTabContentLayout extends FrameLayout {
		
		LayoutParams layoutParams = generateDefaultLayoutParams();
		
		setPadding(0, 62, 0, 0);
		// The height of filmstrip is 50, hence set the y padding to 50
		setPadding(0, 50, 0, 0);
		super.addView(mCarouselLayout, -1, layoutParams);
	}