本文整理汇总了Java中android.support.v4.view.ActionProvider类的典型用法代码示例。如果您正苦于以下问题:Java ActionProvider类的具体用法?Java ActionProvider怎么用?Java ActionProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionProvider类属于android.support.v4.view包,在下文中一共展示了ActionProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSupportActionProvider
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public SupportMenuItem setSupportActionProvider(ActionProvider actionProvider) {
if (this.mActionProvider != null) {
this.mActionProvider.reset();
}
this.mActionView = null;
this.mActionProvider = actionProvider;
this.mMenu.onItemsChanged(true);
if (this.mActionProvider != null) {
this.mActionProvider.setVisibilityListener(new VisibilityListener() {
public void onActionProviderVisibilityChanged(boolean isVisible) {
MenuItemImpl.this.mMenu.onItemVisibleChanged(MenuItemImpl.this);
}
});
}
return this;
}
示例2: setSupportActionProvider
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
@Override
public SupportMenuItem setSupportActionProvider(ActionProvider actionProvider) {
if (mActionProvider == actionProvider) {
return this;
}
mActionView = null;
if (mActionProvider != null) {
mActionProvider.setVisibilityListener(null);
}
mActionProvider = actionProvider;
mMenu.onItemsChanged(true); // Measurement can be changed
if (actionProvider != null) {
actionProvider.setVisibilityListener(new ActionProvider.VisibilityListener() {
@Override
public void onActionProviderVisibilityChanged(boolean isVisible) {
mMenu.onItemVisibleChanged(MenuItemImpl.this);
}
});
}
return this;
}
示例3: readItem
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public void readItem(AttributeSet attrs) {
TypedArray a = SupportMenuInflater.this.mContext.obtainStyledAttributes(attrs, R.styleable.MenuItem);
this.itemId = a.getResourceId(R.styleable.MenuItem_android_id, 0);
this.itemCategoryOrder = (SupportMenu.CATEGORY_MASK & a.getInt(R.styleable.MenuItem_android_menuCategory, this.groupCategory)) | (65535 & a.getInt(R.styleable.MenuItem_android_orderInCategory, this.groupOrder));
this.itemTitle = a.getText(R.styleable.MenuItem_android_title);
this.itemTitleCondensed = a.getText(R.styleable.MenuItem_android_titleCondensed);
this.itemIconResId = a.getResourceId(R.styleable.MenuItem_android_icon, 0);
this.itemAlphabeticShortcut = getShortcut(a.getString(R.styleable.MenuItem_android_alphabeticShortcut));
this.itemNumericShortcut = getShortcut(a.getString(R.styleable.MenuItem_android_numericShortcut));
if (a.hasValue(R.styleable.MenuItem_android_checkable)) {
int i;
if (a.getBoolean(R.styleable.MenuItem_android_checkable, false)) {
i = 1;
} else {
i = 0;
}
this.itemCheckable = i;
} else {
this.itemCheckable = this.groupCheckable;
}
this.itemChecked = a.getBoolean(R.styleable.MenuItem_android_checked, false);
this.itemVisible = a.getBoolean(R.styleable.MenuItem_android_visible, this.groupVisible);
this.itemEnabled = a.getBoolean(R.styleable.MenuItem_android_enabled, this.groupEnabled);
this.itemShowAsAction = a.getInt(R.styleable.MenuItem_showAsAction, -1);
this.itemListenerMethodName = a.getString(R.styleable.MenuItem_android_onClick);
this.itemActionViewLayout = a.getResourceId(R.styleable.MenuItem_actionLayout, 0);
this.itemActionViewClassName = a.getString(R.styleable.MenuItem_actionViewClass);
this.itemActionProviderClassName = a.getString(R.styleable.MenuItem_actionProviderClass);
boolean hasActionProvider = this.itemActionProviderClassName != null;
if (hasActionProvider && this.itemActionViewLayout == 0 && this.itemActionViewClassName == null) {
this.itemActionProvider = (ActionProvider) newInstance(this.itemActionProviderClassName, SupportMenuInflater.ACTION_PROVIDER_CONSTRUCTOR_SIGNATURE, SupportMenuInflater.this.mActionProviderConstructorArguments);
} else {
if (hasActionProvider) {
Log.w(SupportMenuInflater.LOG_TAG, "Ignoring attribute 'actionProviderClass'. Action view already specified.");
}
this.itemActionProvider = null;
}
a.recycle();
this.itemAdded = false;
}
示例4: getActionProvider
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public android.view.ActionProvider getActionProvider() {
ActionProvider provider = ((SupportMenuItem) this.mWrappedObject).getSupportActionProvider();
if (provider instanceof ActionProviderWrapper) {
return ((ActionProviderWrapper) provider).mInner;
}
return null;
}
示例5: setVisibilityListener
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public void setVisibilityListener(ActionProvider.VisibilityListener listener) {
VisibilityListener visibilityListener;
this.mListener = listener;
android.view.ActionProvider actionProvider = this.mInner;
if (listener == null) {
visibilityListener = null;
}
actionProvider.setVisibilityListener(visibilityListener);
}
示例6: onActionClick
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
@Override
public void onActionClick(ActionProvider actionProvider) {
if (mIsEditTextShow) {
mIsEditTextShow = false;
closeEditTextAnimation();
} else {
mIsEditTextShow = true;
openEditTextAnimation();
mLayoutTitle.setVisibility(View.VISIBLE);
}
}
示例7: getActionProvider
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public ActionProvider getActionProvider()
{
if (this.mActionProvider == null) {
this.mActionProvider = new ActionProvider(getContext())
{
public final View onCreateActionView()
{
return PlaySearchToolbar.this.mActionView;
}
};
}
return this.mActionProvider;
}
示例8: setSupportActionProvider
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public SupportMenuItem setSupportActionProvider(ActionProvider actionprovider)
{
if (mActionProvider != null)
{
mActionProvider.reset();
}
mActionView = null;
mActionProvider = actionprovider;
mMenu.onItemsChanged(true);
if (mActionProvider != null)
{
mActionProvider.setVisibilityListener(new android.support.v4.view.ActionProvider.VisibilityListener() {
final MenuItemImpl this$0;
public void onActionProviderVisibilityChanged(boolean flag)
{
mMenu.onItemVisibleChanged(MenuItemImpl.this);
}
{
this$0 = MenuItemImpl.this;
super();
}
});
}
return this;
}
示例9: setActionProvider
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
@Override
public MenuItem setActionProvider(android.view.ActionProvider provider) {
mWrappedObject.setActionProvider(provider);
if (provider != null && mEmulateProviderVisibilityOverride) {
checkActionProviderOverrideVisibility();
}
return this;
}
示例10: checkActionProviderOverrideVisibility
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
/**
* @return true if the ActionProvider has overriden the visibility
*/
final boolean checkActionProviderOverrideVisibility() {
if (mLastRequestVisible) {
ActionProvider provider = getSupportActionProvider();
if (provider != null && provider.overridesItemVisibility() && !provider.isVisible()) {
wrappedSetVisible(false);
return true;
}
}
return false;
}
示例11: ActionProviderWrapper
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public ActionProviderWrapper(ActionProvider inner) {
super(inner.getContext());
mInner = inner;
if (mEmulateProviderVisibilityOverride) {
mInner.setVisibilityListener(new ActionProvider.VisibilityListener() {
@Override
public void onActionProviderVisibilityChanged(boolean isVisible) {
if (mInner.overridesItemVisibility() && mLastRequestVisible) {
wrappedSetVisible(isVisible);
}
}
});
}
}
示例12: performItemAction
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public boolean performItemAction(MenuItem item, int flags) {
MenuItemImpl itemImpl = (MenuItemImpl) item;
if (itemImpl == null || !itemImpl.isEnabled()) {
return false;
}
boolean invoked = itemImpl.invoke();
final ActionProvider provider = itemImpl.getSupportActionProvider();
final boolean providerHasSubMenu = provider != null && provider.hasSubMenu();
if (itemImpl.hasCollapsibleActionView()) {
invoked |= itemImpl.expandActionView();
if (invoked) {
close(true);
}
} else if (itemImpl.hasSubMenu() || providerHasSubMenu) {
close(false);
if (!itemImpl.hasSubMenu()) {
itemImpl.setSubMenu(new SubMenuBuilder(getContext(), this, itemImpl));
}
final SubMenuBuilder subMenu = (SubMenuBuilder) itemImpl.getSubMenu();
if (providerHasSubMenu) {
provider.onPrepareSubMenu(subMenu);
}
invoked |= dispatchSubMenuSelected(subMenu);
if (!invoked) {
close(true);
}
} else {
if ((flags & FLAG_PERFORM_NO_CLOSE) == 0) {
close(true);
}
}
return invoked;
}
示例13: ActionProviderWrapper
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public ActionProviderWrapper(Context context, android.view.ActionProvider inner) {
super(context);
this.mInner = inner;
}
示例14: setActionProvider
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
public MenuItem setActionProvider(android.view.ActionProvider provider) {
((SupportMenuItem) this.mWrappedObject).setSupportActionProvider(provider != null ? createActionProviderWrapper(provider) : null);
return this;
}
示例15: createActionProviderWrapper
import android.support.v4.view.ActionProvider; //导入依赖的package包/类
ActionProviderWrapper createActionProviderWrapper(android.view.ActionProvider provider) {
return new ActionProviderWrapper(this.mContext, provider);
}