Java Code Examples for android.view.Window#FEATURE_ACTION_BAR

The following examples show how to use android.view.Window#FEATURE_ACTION_BAR . 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: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 6 votes vote down vote up
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
Example 2
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
Example 3
Source File: BaseActivity.java    From Android-Application-ZJB with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
        if ("MenuBuilder".equals(menu.getClass().getSimpleName())) {
            try {
                Method method = menu.getClass().getDeclaredMethod("setOptionalIconsVisible",
                        Boolean.TYPE);
                method.setAccessible(true);
                method.invoke(menu, true);
            } catch (Exception e) {
                // ignore
            }
        }
    }

    return super.onMenuOpened(featureId, menu);
}
 
Example 4
Source File: BaseActivity.java    From weixin with Apache License 2.0 6 votes vote down vote up
/**
 * overflow被展开的时候调用<br>
 * onMenuOpened()方法用于让隐藏在overflow当中的Action按钮的图标显示出来
 * 
 * @param featureId
 * @param menu
 * @return
 */
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
	//通过返回反射的方法将MenuBuilder的setOptionalIconsVisible变量设置为true
	if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
		if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
			try {
				Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
				m.setAccessible(true);
				m.invoke(menu, true);
			} catch (Exception e) {
			}
		}
	}
	return super.onMenuOpened(featureId, menu);
}
 
Example 5
Source File: ActionBarSherlockCompat.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
Example 6
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 6 votes vote down vote up
@Override
public boolean requestFeature(int featureId) {
    if (DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
Example 7
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 5 votes vote down vote up
@Override
public void dispatchPanelClosed(int featureId, android.view.Menu menu){
    if (DEBUG) Log.d(TAG, "[dispatchPanelClosed] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(false);
        }
    }
}
 
Example 8
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public void dispatchPanelClosed(int featureId, android.view.Menu menu){
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPanelClosed] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(false);
        }
    }
}
 
Example 9
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public boolean dispatchMenuOpened(int featureId, android.view.Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchMenuOpened] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(true);
        }
        return true;
    }

    return false;
}
 
Example 10
Source File: ActionBarSherlockCompat.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
@Override
public void dispatchPanelClosed(int featureId, android.view.Menu menu){
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPanelClosed] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(false);
        }
    }
}
 
Example 11
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void dispatchPanelClosed(int featureId, android.view.Menu menu){
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPanelClosed] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(false);
        }
    }
}
 
Example 12
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public boolean dispatchMenuOpened(int featureId, android.view.Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchMenuOpened] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(true);
        }
        return true;
    }

    return false;
}
 
Example 13
Source File: Dialog.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * @see Activity#onMenuOpened(int, Menu)
 */
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR) {
        mActionBar.dispatchMenuVisibilityChanged(true);
    }
    return true;
}
 
Example 14
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 5 votes vote down vote up
@Override
public boolean dispatchMenuOpened(int featureId, android.view.Menu menu) {
    if (DEBUG) Log.d(TAG, "[dispatchMenuOpened] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(true);
        }
        return true;
    }

    return false;
}
 
Example 15
Source File: ActionBarUtils.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
/**
     * 利用反射让隐藏在Overflow中的MenuItem显示Icon图标
     *
     * @param featureId
     * @param menu      onMenuOpened方法中调用
     */
public static void setOverflowIconVisible(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
        if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
            try {
                Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
                m.setAccessible(true);
                m.invoke(menu, true);
            } catch (Exception e) {
            }
        }
    }
}
 
Example 16
Source File: HomeActivity.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
/**
 * 显示overflower菜单图标
 */
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
        if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
            try {
                Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
                m.setAccessible(true);
                m.invoke(menu, true);
            } catch (Exception e) {
            }
        }
    }
    return super.onMenuOpened(featureId, menu);
}
 
Example 17
Source File: MusicActivity.java    From LLApp with Apache License 2.0 5 votes vote down vote up
/**
 * 这个方法用来解决超出的menuItem不显示图标的问题,这个方法在AppCompatActivity中不被调用
 * @param featureId
 * @param menu
 * @return
 */
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {
        if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
            try {
                Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
                m.setAccessible(true);
                m.invoke(menu, true);
            } catch (Exception e) {
            }
        }
    }
    return super.onMenuOpened(featureId, menu);
}
 
Example 18
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void dispatchPanelClosed(int featureId, android.view.Menu menu){
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPanelClosed] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(false);
        }
    }
}
 
Example 19
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean dispatchMenuOpened(int featureId, android.view.Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchMenuOpened] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_ACTION_BAR || featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (aActionBar != null) {
            aActionBar.dispatchMenuVisibilityChanged(true);
        }
        return true;
    }

    return false;
}
 
Example 20
Source File: Dialog.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * @see Activity#onPanelClosed(int, Menu)
 */
@Override
public void onPanelClosed(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR) {
        mActionBar.dispatchMenuVisibilityChanged(false);
    }
}