use of com.actionbarsherlock.view.MenuItem in project mobile-android by photo.
the class CommonRefreshableFragmentWithImageWorker method reinitMenu.
protected void reinitMenu(Menu menu) {
try {
MenuItem refreshItem = menu.findItem(R.id.menu_refresh);
refreshItem.setVisible(isRefreshMenuVisible());
} catch (Exception ex) {
GuiUtils.noAlertError(TAG, ex);
try {
TrackerUtils.trackErrorEvent("#409 situation", CommonUtils.format("isAdded: %1$b; isDetached: %2$b; " + "isHidden: %3$b; isRemoving: %4$b; " + "isVisible: %1$b", isAdded(), isDetached(), isHidden(), isRemoving(), isVisible()));
} catch (Exception ex2) {
GuiUtils.noAlertError(TAG, ex2);
TrackerUtils.trackErrorEvent("#409 situation", "additinal details error");
}
}
}
use of com.actionbarsherlock.view.MenuItem in project little-bear-dictionary by daimajia.
the class PopupMenuHelper method onSubMenuSelected.
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
if (subMenu.hasVisibleItems()) {
PopupMenuHelper subPopup = new PopupMenuHelper(mContext, subMenu, mAnchorView);
subPopup.setCallback(mPresenterCallback);
boolean preserveIconSpacing = false;
final int count = subMenu.size();
for (int i = 0; i < count; i++) {
MenuItem childItem = subMenu.getItem(i);
if (childItem.isVisible() && childItem.getIcon() != null) {
preserveIconSpacing = true;
break;
}
}
subPopup.setForceShowIcon(preserveIconSpacing);
if (subPopup.tryShow()) {
if (mPresenterCallback != null) {
mPresenterCallback.onOpenSubMenu(subMenu);
}
return true;
}
}
return false;
}
use of com.actionbarsherlock.view.MenuItem in project little-bear-dictionary by daimajia.
the class ActionBarView method onRestoreInstanceState.
@Override
public void onRestoreInstanceState(Parcelable p) {
SavedState state = (SavedState) p;
super.onRestoreInstanceState(state.getSuperState());
if (state.expandedMenuItemId != 0 && mExpandedMenuPresenter != null && mOptionsMenu != null) {
final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
if (item != null) {
item.expandActionView();
}
}
if (state.isOverflowOpen) {
postShowOverflowMenu();
}
}
use of com.actionbarsherlock.view.MenuItem in project little-bear-dictionary by daimajia.
the class MenuPopupHelper method onSubMenuSelected.
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
if (subMenu.hasVisibleItems()) {
MenuPopupHelper subPopup = new MenuPopupHelper(mContext, subMenu, mAnchorView, false);
subPopup.setCallback(mPresenterCallback);
boolean preserveIconSpacing = false;
final int count = subMenu.size();
for (int i = 0; i < count; i++) {
MenuItem childItem = subMenu.getItem(i);
if (childItem.isVisible() && childItem.getIcon() != null) {
preserveIconSpacing = true;
break;
}
}
subPopup.setForceShowIcon(preserveIconSpacing);
if (subPopup.tryShow()) {
if (mPresenterCallback != null) {
mPresenterCallback.onOpenSubMenu(subMenu);
}
return true;
}
}
return false;
}
use of com.actionbarsherlock.view.MenuItem in project little-bear-dictionary by daimajia.
the class MenuBuilder method restoreActionViewStates.
public void restoreActionViewStates(Bundle states) {
if (states == null) {
return;
}
SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(getActionViewStatesKey());
final int itemCount = size();
for (int i = 0; i < itemCount; i++) {
final MenuItem item = getItem(i);
final View v = item.getActionView();
if (v != null && v.getId() != View.NO_ID) {
v.restoreHierarchyState(viewStates);
}
if (item.hasSubMenu()) {
final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
subMenu.restoreActionViewStates(states);
}
}
final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
if (expandedId > 0) {
MenuItem itemToExpand = findItem(expandedId);
if (itemToExpand != null) {
itemToExpand.expandActionView();
}
}
}
Aggregations