Java 类android.support.v7.widget.ToolbarWidgetWrapper 实例源码

项目:boohee_v5.6    文件:ToolbarActionBar.java   
public ToolbarActionBar(Toolbar toolbar, CharSequence title, Callback callback) {
    this.mDecorToolbar = new ToolbarWidgetWrapper(toolbar, false);
    this.mWindowCallback = new ToolbarCallbackWrapper(callback);
    this.mDecorToolbar.setWindowCallback(this.mWindowCallback);
    toolbar.setOnMenuItemClickListener(this.mMenuClicker);
    this.mDecorToolbar.setWindowTitle(title);
}
项目:MusicX-music-player    文件:ATEUtil.java   
@Nullable
public static Toolbar getSupportActionBarView(@Nullable ActionBar ab) {
    if (ab == null) return null;
    try {
        Field field = ab.getClass().getDeclaredField("mDecorToolbar");
        field.setAccessible(true);
        ToolbarWidgetWrapper wrapper = (ToolbarWidgetWrapper) field.get(ab);
        field = ToolbarWidgetWrapper.class.getDeclaredField("mToolbar");
        field.setAccessible(true);
        return (Toolbar) field.get(wrapper);
    } catch (Throwable t) {
        Log.d("ATEUtil", "Unable to get Toolbar from " + ab.getClass().getName());
        return null;
    }
}
项目:app-theme-engine-master    文件:Util.java   
@Nullable
public static Toolbar getSupportActionBarView(@Nullable ActionBar ab) {
    if (ab == null || !(ab instanceof WindowDecorActionBar)) return null;
    try {
        WindowDecorActionBar decorAb = (WindowDecorActionBar) ab;
        Field field = WindowDecorActionBar.class.getDeclaredField("mDecorToolbar");
        field.setAccessible(true);
        ToolbarWidgetWrapper wrapper = (ToolbarWidgetWrapper) field.get(decorAb);
        field = ToolbarWidgetWrapper.class.getDeclaredField("mToolbar");
        field.setAccessible(true);
        return (Toolbar) field.get(wrapper);
    } catch (Throwable t) {
        throw new RuntimeException("Failed to retrieve Toolbar from AppCompat support ActionBar: " + t.getMessage(), t);
    }
}
项目:app-theme-engine    文件:ATEUtil.java   
@Nullable
public static Toolbar getSupportActionBarView(@Nullable ActionBar ab) {
    if (ab == null) return null;
    try {
        Field field = ab.getClass().getDeclaredField("mDecorToolbar");
        field.setAccessible(true);
        ToolbarWidgetWrapper wrapper = (ToolbarWidgetWrapper) field.get(ab);
        field = ToolbarWidgetWrapper.class.getDeclaredField("mToolbar");
        field.setAccessible(true);
        return (Toolbar) field.get(wrapper);
    } catch (Throwable t) {
        Log.d("ATEUtil", "Unable to get Toolbar from " + ab.getClass().getName());
        return null;
    }
}
项目:Superuser-UI    文件:ToolbarContentTintHelper.java   
@Nullable
public static Toolbar getSupportActionBarView(@Nullable ActionBar ab) {
    if (ab == null || !(ab instanceof WindowDecorActionBar)) return null;
    try {
        WindowDecorActionBar decorAb = (WindowDecorActionBar) ab;
        Field field = WindowDecorActionBar.class.getDeclaredField("mDecorToolbar");
        field.setAccessible(true);
        ToolbarWidgetWrapper wrapper = (ToolbarWidgetWrapper) field.get(decorAb);
        field = ToolbarWidgetWrapper.class.getDeclaredField("mToolbar");
        field.setAccessible(true);
        return (Toolbar) field.get(wrapper);
    } catch (Throwable t) {
        throw new RuntimeException("Failed to retrieve Toolbar from AppCompat support ActionBar: " + t.getMessage(), t);
    }
}