Merge "Fix bug 5174755 - Adjust action bar overflow limits for ifRoom items"
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.internal.view.menu;
|
|||||||
import com.android.internal.view.menu.ActionMenuView.ActionMenuChildView;
|
import com.android.internal.view.menu.ActionMenuView.ActionMenuChildView;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
@@ -109,6 +110,16 @@ public class ActionMenuPresenter extends BaseMenuPresenter {
|
|||||||
mScrapActionButtonView = null;
|
mScrapActionButtonView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
if (!mMaxItemsSet) {
|
||||||
|
mMaxItems = mContext.getResources().getInteger(
|
||||||
|
com.android.internal.R.integer.max_action_buttons);
|
||||||
|
if (mMenu != null) {
|
||||||
|
mMenu.onItemsChanged(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setWidthLimit(int width, boolean strict) {
|
public void setWidthLimit(int width, boolean strict) {
|
||||||
mWidthLimit = width;
|
mWidthLimit = width;
|
||||||
mStrictWidthLimit = strict;
|
mStrictWidthLimit = strict;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.animation.Animator.AnimatorListener;
|
|||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -92,6 +93,14 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
|
|||||||
a.recycle();
|
a.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
if (mActionMenuPresenter != null) {
|
||||||
|
mActionMenuPresenter.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setHeight(int height) {
|
public void setHeight(int height) {
|
||||||
mContentHeight = height;
|
mContentHeight = height;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,6 +259,9 @@ public class ActionBarView extends AbsActionBarView {
|
|||||||
com.android.internal.R.attr.actionBarStyle, 0);
|
com.android.internal.R.attr.actionBarStyle, 0);
|
||||||
setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0));
|
setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0));
|
||||||
a.recycle();
|
a.recycle();
|
||||||
|
if (mActionMenuPresenter != null) {
|
||||||
|
mActionMenuPresenter.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,5 +20,5 @@
|
|||||||
<!-- The maximum number of action buttons that should be permitted within
|
<!-- The maximum number of action buttons that should be permitted within
|
||||||
an action bar/action mode. This will be used to determine how many
|
an action bar/action mode. This will be used to determine how many
|
||||||
showAsAction="ifRoom" items can fit. "always" items can override this. -->
|
showAsAction="ifRoom" items can fit. "always" items can override this. -->
|
||||||
<integer name="max_action_buttons">2</integer>
|
<integer name="max_action_buttons">3</integer>
|
||||||
</resources>
|
</resources>
|
||||||
24
core/res/res/values-w500dp/dimens.xml
Normal file
24
core/res/res/values-w500dp/dimens.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
** Copyright 2011, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<!-- The maximum number of action buttons that should be permitted within
|
||||||
|
an action bar/action mode. This will be used to determine how many
|
||||||
|
showAsAction="ifRoom" items can fit. "always" items can override this. -->
|
||||||
|
<integer name="max_action_buttons">4</integer>
|
||||||
|
</resources>
|
||||||
24
core/res/res/values-w600dp/dimens.xml
Normal file
24
core/res/res/values-w600dp/dimens.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
** Copyright 2011, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<!-- The maximum number of action buttons that should be permitted within
|
||||||
|
an action bar/action mode. This will be used to determine how many
|
||||||
|
showAsAction="ifRoom" items can fit. "always" items can override this. -->
|
||||||
|
<integer name="max_action_buttons">5</integer>
|
||||||
|
</resources>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<!-- The maximum number of action buttons that should be permitted within
|
<!-- The maximum number of action buttons that should be permitted within
|
||||||
an action bar/action mode. This will be used to determine how many
|
an action bar/action mode. This will be used to determine how many
|
||||||
showAsAction="ifRoom" items can fit. "always" items can override this. -->
|
showAsAction="ifRoom" items can fit. "always" items can override this. -->
|
||||||
<integer name="max_action_buttons">3</integer>
|
<integer name="max_action_buttons">2</integer>
|
||||||
<dimen name="toast_y_offset">64dip</dimen>
|
<dimen name="toast_y_offset">64dip</dimen>
|
||||||
<!-- Height of the status bar -->
|
<!-- Height of the status bar -->
|
||||||
<dimen name="status_bar_height">25dip</dimen>
|
<dimen name="status_bar_height">25dip</dimen>
|
||||||
|
|||||||
Reference in New Issue
Block a user