Java Code Examples for com.actionbarsherlock.view.MenuItem#getActionView()
The following examples show how to use
com.actionbarsherlock.view.MenuItem#getActionView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MenuBuilder.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
public void saveActionViewStates(Bundle outStates) { SparseArray<Parcelable> viewStates = null; 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) { if (viewStates == null) { viewStates = new SparseArray<Parcelable>(); } v.saveHierarchyState(viewStates); if (item.isActionViewExpanded()) { outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId()); } } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.saveActionViewStates(outStates); } } if (viewStates != null) { outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates); } }
Example 2
Source File: MenuBuilder.java From android-apps with MIT License | 6 votes |
public void saveActionViewStates(Bundle outStates) { SparseArray<Parcelable> viewStates = null; 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) { if (viewStates == null) { viewStates = new SparseArray<Parcelable>(); } v.saveHierarchyState(viewStates); if (item.isActionViewExpanded()) { outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId()); } } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.saveActionViewStates(outStates); } } if (viewStates != null) { outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates); } }
Example 3
Source File: MenuBuilder.java From zen4android with MIT License | 6 votes |
public void saveActionViewStates(Bundle outStates) { SparseArray<Parcelable> viewStates = null; 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) { if (viewStates == null) { viewStates = new SparseArray<Parcelable>(); } v.saveHierarchyState(viewStates); if (item.isActionViewExpanded()) { outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId()); } } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.saveActionViewStates(outStates); } } if (viewStates != null) { outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates); } }
Example 4
Source File: MenuBuilder.java From zhangshangwuda with Apache License 2.0 | 6 votes |
public void saveActionViewStates(Bundle outStates) { SparseArray<Parcelable> viewStates = null; 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) { if (viewStates == null) { viewStates = new SparseArray<Parcelable>(); } v.saveHierarchyState(viewStates); if (item.isActionViewExpanded()) { outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId()); } } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.saveActionViewStates(outStates); } } if (viewStates != null) { outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates); } }
Example 5
Source File: MenuBuilder.java From Libraries-for-Android-Developers with MIT License | 6 votes |
public void saveActionViewStates(Bundle outStates) { SparseArray<Parcelable> viewStates = null; 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) { if (viewStates == null) { viewStates = new SparseArray<Parcelable>(); } v.saveHierarchyState(viewStates); if (item.isActionViewExpanded()) { outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId()); } } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.saveActionViewStates(outStates); } } if (viewStates != null) { outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates); } }
Example 6
Source File: MenuBuilder.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
public void restoreActionViewStates(Bundle states) { if (states == null) { return; } SparseArray<Parcelable> viewStates = states.getSparseParcelableArray( getActionViewStatesKey()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) { //Fixes Issue #652 with sdk <= 2.3.6 return; } 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(); } } }
Example 7
Source File: MenuBuilder.java From android-apps with MIT License | 5 votes |
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(); } } }
Example 8
Source File: MenuBuilder.java From zen4android with MIT License | 5 votes |
public void restoreActionViewStates(Bundle states) { if (states == null) { return; } SparseArray<Parcelable> viewStates = states.getSparseParcelableArray( getActionViewStatesKey()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) { //Fixes Issue #652 with sdk <= 2.3.6 return; } 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(); } } }
Example 9
Source File: MenuBuilder.java From zhangshangwuda with Apache License 2.0 | 5 votes |
public void restoreActionViewStates(Bundle states) { if (states == null) { return; } SparseArray<Parcelable> viewStates = states.getSparseParcelableArray( getActionViewStatesKey()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) { //Fixes Issue #652 with sdk <= 2.3.6 return; } 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(); } } }
Example 10
Source File: MenuBuilder.java From Libraries-for-Android-Developers with MIT License | 5 votes |
public void restoreActionViewStates(Bundle states) { if (states == null) { return; } SparseArray<Parcelable> viewStates = states.getSparseParcelableArray( getActionViewStatesKey()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) { //Fixes Issue #652 with sdk <= 2.3.6 return; } 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(); } } }
Example 11
Source File: StyledActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.save, menu); MenuItem item = menu.findItem(R.id.save_button); mSaveButton = (RefreshActionItem) item.getActionView(); mSaveButton.setMenuItem(item); mSaveButton.setMax(100); mSaveButton.setRefreshActionListener(this); String[] items = generateRandomItemList(); setListAdapter(new ArrayAdapter<String>(getApplicationContext(), R.layout.simple_list_item, android.R.id.text1, items)); return true; }
Example 12
Source File: BasicUsageActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.refresh, menu); MenuItem item = menu.findItem(R.id.refresh_button); mRefreshActionItem = (RefreshActionItem) item.getActionView(); mRefreshActionItem.setMenuItem(item); mRefreshActionItem.setMax(100); mRefreshActionItem.setRefreshActionListener(this); loadData(); return true; }
Example 13
Source File: IndeterminateProgressActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.refresh, menu); MenuItem item = menu.findItem(R.id.refresh_button); mRefreshActionItem = (RefreshActionItem)item.getActionView(); mRefreshActionItem.setMenuItem(item); mRefreshActionItem.setProgressIndicatorType(ProgressIndicatorType.INDETERMINATE); mRefreshActionItem.setRefreshActionListener(this); loadData(); return true; }
Example 14
Source File: BadgeActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.refresh, menu); MenuItem item = menu.findItem(R.id.refresh_button); mRefreshActionItem = (RefreshActionItem) item.getActionView(); mRefreshActionItem.setMenuItem(item); mRefreshActionItem.setMax(100); mRefreshActionItem.setRefreshActionListener(this); loadData(); return true; }