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

Commit 44c1473c authored by Gilles Debunne's avatar Gilles Debunne
Browse files

New Holo style for Tabs.

Holo theme with new assets and style for TabWidgets.

Legacy Themes still use GB style.

Assets added in a previous bluk update were removed.

Change-Id: Ia4a612678561fa5047bbd2a72488086c0f3d61a1
parent 48c9daac
Loading
Loading
Loading
Loading
+24 −5
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import com.android.internal.R;
import android.app.LocalActivityManager;
import android.app.LocalActivityManager;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Build;
import android.util.AttributeSet;
import android.util.AttributeSet;
@@ -63,6 +64,8 @@ public class TabHost extends FrameLayout implements ViewTreeObserver.OnTouchMode
    private OnTabChangeListener mOnTabChangeListener;
    private OnTabChangeListener mOnTabChangeListener;
    private OnKeyListener mTabKeyListener;
    private OnKeyListener mTabKeyListener;


    private int mTabLayoutId;

    public TabHost(Context context) {
    public TabHost(Context context) {
        super(context);
        super(context);
        initTabHost();
        initTabHost();
@@ -70,6 +73,18 @@ public class TabHost extends FrameLayout implements ViewTreeObserver.OnTouchMode


    public TabHost(Context context, AttributeSet attrs) {
    public TabHost(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);

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

        mTabLayoutId = a.getResourceId(R.styleable.TabWidget_tabLayout, 0);
        if (mTabLayoutId == 0) {
            throw new IllegalArgumentException("Invalid TabWidget tabLayout id");
        }

        a.recycle();

        initTabHost();
        initTabHost();
    }
    }


@@ -214,6 +229,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
        if (tabSpec.mIndicatorStrategy instanceof ViewIndicatorStrategy) {
        if (tabSpec.mIndicatorStrategy instanceof ViewIndicatorStrategy) {
            mTabWidget.setStripEnabled(false);
            mTabWidget.setStripEnabled(false);
        }
        }

        mTabWidget.addView(tabIndicator);
        mTabWidget.addView(tabIndicator);
        mTabSpecs.add(tabSpec);
        mTabSpecs.add(tabSpec);


@@ -513,7 +529,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
            final Context context = getContext();
            final Context context = getContext();
            LayoutInflater inflater =
            LayoutInflater inflater =
                    (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View tabIndicator = inflater.inflate(R.layout.tab_indicator,
            View tabIndicator = inflater.inflate(mTabLayoutId,
                    mTabWidget, // tab widget is the parent
                    mTabWidget, // tab widget is the parent
                    false); // no inflate params
                    false); // no inflate params


@@ -547,7 +563,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
            final Context context = getContext();
            final Context context = getContext();
            LayoutInflater inflater =
            LayoutInflater inflater =
                    (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View tabIndicator = inflater.inflate(R.layout.tab_indicator,
            View tabIndicator = inflater.inflate(mTabLayoutId,
                    mTabWidget, // tab widget is the parent
                    mTabWidget, // tab widget is the parent
                    false); // no inflate params
                    false); // no inflate params


@@ -555,7 +571,10 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
            tv.setText(mLabel);
            tv.setText(mLabel);


            final ImageView iconView = (ImageView) tabIndicator.findViewById(R.id.icon);
            final ImageView iconView = (ImageView) tabIndicator.findViewById(R.id.icon);
            if (mIcon != null) {
                iconView.setImageDrawable(mIcon);
                iconView.setImageDrawable(mIcon);
                iconView.setVisibility(VISIBLE);
            }


            if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) {
            if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) {
                // Donut apps get old color scheme
                // Donut apps get old color scheme
+3 −11
Original line number Original line Diff line number Diff line
@@ -121,6 +121,8 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
        final Context context = mContext;
        final Context context = mContext;
        final Resources resources = context.getResources();
        final Resources resources = context.getResources();


        // Tests the target Sdk version, as set in the Manifest. Could not be set using styles.xml
        // in a values-v? directory which targets the current platform Sdk version instead.
        if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) {
        if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) {
            // Donut apps get old color scheme
            // Donut apps get old color scheme
            if (mLeftStrip == null) {
            if (mLeftStrip == null) {
@@ -131,16 +133,6 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
                mRightStrip = resources.getDrawable(
                mRightStrip = resources.getDrawable(
                        com.android.internal.R.drawable.tab_bottom_right_v4);
                        com.android.internal.R.drawable.tab_bottom_right_v4);
            }
            }
        } else {
            // Use modern color scheme for Eclair and beyond
            if (mLeftStrip == null) {
                mLeftStrip = resources.getDrawable(
                        com.android.internal.R.drawable.tab_bottom_left);
            }
            if (mRightStrip == null) {
                mRightStrip = resources.getDrawable(
                        com.android.internal.R.drawable.tab_bottom_right);
            }
        }
        }


        // Deal with focus, as we don't want the focus to go by default
        // Deal with focus, as we don't want the focus to go by default
+1 −0
Original line number Original line Diff line number Diff line
@@ -7142,6 +7142,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    case Gravity.RIGHT:
                    case Gravity.RIGHT:
                        return 0.0f;
                        return 0.0f;
                    case Gravity.CENTER_HORIZONTAL:
                    case Gravity.CENTER_HORIZONTAL:
                    case Gravity.FILL_HORIZONTAL:
                        return (mLayout.getLineWidth(0) - ((mRight - mLeft) -
                        return (mLayout.getLineWidth(0) - ((mRight - mLeft) -
                                getCompoundPaddingLeft() - getCompoundPaddingRight())) /
                                getCompoundPaddingLeft() - getCompoundPaddingRight())) /
                                getHorizontalFadingEdgeLength();
                                getHorizontalFadingEdgeLength();
−597 B
Loading image diff...
−728 B
Loading image diff...
Loading