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

Commit 80df829e authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 5079507 - ICS (phone) : ActionBar tabs don't correctly resize...

Merge "Fix bug 5079507 - ICS (phone) : ActionBar tabs don't correctly resize if activity handles orientation change"
parents f49b9963 45c0b195
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1403,16 +1403,18 @@ public class Activity extends ContextThemeWrapper
    public void onConfigurationChanged(Configuration newConfig) {
        mCalled = true;

        if (mActionBar != null) {
            mActionBar.onConfigurationChanged(newConfig);
        }

        mFragments.dispatchConfigurationChanged(newConfig);

        if (mWindow != null) {
            // Pass the configuration changed event to the window
            mWindow.onConfigurationChanged(newConfig);
        }

        if (mActionBar != null) {
            // Do this last; the action bar will need to access
            // view changes from above.
            mActionBar.onConfigurationChanged(newConfig);
        }
    }
    
    /**
+1 −2
Original line number Diff line number Diff line
@@ -192,8 +192,7 @@ public class ActionBarImpl extends ActionBar {
        mContentHeight = mActionView.getContentHeight();

        if (mTabScrollView != null) {
            mTabScrollView.getLayoutParams().height = mContentHeight;
            mTabScrollView.requestLayout();
            mTabScrollView.setContentHeight(mContentHeight);
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ public class ActionBarContainer extends FrameLayout {
        mTabContainer = tabView;
        if (tabView != null) {
            addView(tabView);
            tabView.getLayoutParams().width = LayoutParams.MATCH_PARENT;
        }
    }

+16 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
@@ -172,7 +173,8 @@ public class ActionBarView extends AbsActionBarView {
        // Background is always provided by the container.
        setBackgroundResource(0);

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionBar);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionBar,
                com.android.internal.R.attr.actionBarStyle, 0);

        ApplicationInfo appInfo = context.getApplicationInfo();
        PackageManager pm = context.getPackageManager();
@@ -249,6 +251,18 @@ public class ActionBarView extends AbsActionBarView {
        mHomeLayout.setFocusable(true);
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        // Action bar can change size on configuration changes.
        // Reread the desired height from the theme-specified style.
        TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.ActionBar,
                com.android.internal.R.attr.actionBarStyle, 0);
        setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0));
        a.recycle();
    }

    @Override
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
@@ -318,6 +332,7 @@ public class ActionBarView extends AbsActionBarView {
        mIncludeTabs = tabs != null;
        if (mIncludeTabs && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
            addView(mTabScrollView);
            mTabScrollView.getLayoutParams().width = LayoutParams.WRAP_CONTENT;
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -87,6 +87,11 @@ public class ScrollingTabContainerView extends HorizontalScrollView {
        }
    }

    public void setContentHeight(int contentHeight) {
        mTabLayout.getLayoutParams().height = contentHeight;
        requestLayout();
    }

    public void animateToVisibility(int visibility) {
        if (mVisibilityAnim != null) {
            mVisibilityAnim.cancel();